From 24e05a0b065b7d01417efeabb07523b3cc8c0bf0 Mon Sep 17 00:00:00 2001 From: pepperpepperpepper Date: Mon, 16 Nov 2015 16:35:11 -0800 Subject: gallery first draft --- gallery/.ropeproject/config.py | 96 ++++++++++++++++++ gallery/.ropeproject/globalnames | 1 + gallery/.ropeproject/history | 1 + gallery/.ropeproject/objectdb | 1 + gallery/gallery.py | 206 ++------------------------------------- gallery/index.html | 107 ++++++++++++++++++-- gallery/js/main.js | 41 ++++---- gallery/js/querystring.js | 13 +++ gallery/js/title.js | 74 ++++++++++++++ gallery/js/titleScrambler.js | 56 ----------- gallery/style.css | 51 ++++++++++ 11 files changed, 368 insertions(+), 279 deletions(-) create mode 100644 gallery/.ropeproject/config.py create mode 100644 gallery/.ropeproject/globalnames create mode 100644 gallery/.ropeproject/history create mode 100644 gallery/.ropeproject/objectdb create mode 100644 gallery/js/querystring.js create mode 100644 gallery/js/title.js delete mode 100644 gallery/js/titleScrambler.js create mode 100644 gallery/style.css diff --git a/gallery/.ropeproject/config.py b/gallery/.ropeproject/config.py new file mode 100644 index 0000000..3745e30 --- /dev/null +++ b/gallery/.ropeproject/config.py @@ -0,0 +1,96 @@ +# The default ``config.py`` + + +def set_prefs(prefs): + """This function is called before opening the project""" + + # Specify which files and folders to ignore in the project. + # Changes to ignored resources are not added to the history and + # VCSs. Also they are not returned in `Project.get_files()`. + # Note that ``?`` and ``*`` match all characters but slashes. + # '*.pyc': matches 'test.pyc' and 'pkg/test.pyc' + # 'mod*.pyc': matches 'test/mod1.pyc' but not 'mod/1.pyc' + # '.svn': matches 'pkg/.svn' and all of its children + # 'build/*.o': matches 'build/lib.o' but not 'build/sub/lib.o' + # 'build//*.o': matches 'build/lib.o' and 'build/sub/lib.o' + prefs['ignored_resources'] = [ + '*.pyc', '*~', '.ropeproject', '.hg', '.svn', '_svn', '.git', + '.tox', '.env', 'node_modules', 'bower_components'] + + # Specifies which files should be considered python files. It is + # useful when you have scripts inside your project. Only files + # ending with ``.py`` are considered to be python files by + # default. + #prefs['python_files'] = ['*.py'] + + # Custom source folders: By default rope searches the project + # for finding source folders (folders that should be searched + # for finding modules). You can add paths to that list. Note + # that rope guesses project source folders correctly most of the + # time; use this if you have any problems. + # The folders should be relative to project root and use '/' for + # separating folders regardless of the platform rope is running on. + # 'src/my_source_folder' for instance. + #prefs.add('source_folders', 'src') + + # You can extend python path for looking up modules + #prefs.add('python_path', '~/python/') + + # Should rope save object information or not. + prefs['save_objectdb'] = True + prefs['compress_objectdb'] = False + + # If `True`, rope analyzes each module when it is being saved. + prefs['automatic_soa'] = True + # The depth of calls to follow in static object analysis + prefs['soa_followed_calls'] = 0 + + # If `False` when running modules or unit tests "dynamic object + # analysis" is turned off. This makes them much faster. + prefs['perform_doa'] = True + + # Rope can check the validity of its object DB when running. + prefs['validate_objectdb'] = True + + # How many undos to hold? + prefs['max_history_items'] = 32 + + # Shows whether to save history across sessions. + prefs['save_history'] = True + prefs['compress_history'] = False + + # Set the number spaces used for indenting. According to + # :PEP:`8`, it is best to use 4 spaces. Since most of rope's + # unit-tests use 4 spaces it is more reliable, too. + prefs['indent_size'] = 4 + + # Builtin and c-extension modules that are allowed to be imported + # and inspected by rope. + prefs['extension_modules'] = [] + + # Add all standard c-extensions to extension_modules list. + prefs['import_dynload_stdmods'] = True + + # If `True` modules with syntax errors are considered to be empty. + # The default value is `False`; When `False` syntax errors raise + # `rope.base.exceptions.ModuleSyntaxError` exception. + prefs['ignore_syntax_errors'] = False + + # If `True`, rope ignores unresolvable imports. Otherwise, they + # appear in the importing namespace. + prefs['ignore_bad_imports'] = False + + # If `True`, rope will transform a comma list of imports into + # multiple separate import statements when organizing + # imports. + prefs['split_imports'] = False + + # If `True`, rope will sort imports alphabetically by module name + # instead of alphabetically by import statement, with from imports + # after normal imports. + prefs['sort_imports_alphabetically'] = False + + +def project_opened(project): + """This function is called after opening the project""" + # Do whatever you like here! diff --git a/gallery/.ropeproject/globalnames b/gallery/.ropeproject/globalnames new file mode 100644 index 0000000..29c40cd --- /dev/null +++ b/gallery/.ropeproject/globalnames @@ -0,0 +1 @@ +€}q. \ No newline at end of file diff --git a/gallery/.ropeproject/history b/gallery/.ropeproject/history new file mode 100644 index 0000000..fcd9c96 --- /dev/null +++ b/gallery/.ropeproject/history @@ -0,0 +1 @@ +€]q(]q]qe. \ No newline at end of file diff --git a/gallery/.ropeproject/objectdb b/gallery/.ropeproject/objectdb new file mode 100644 index 0000000..29c40cd --- /dev/null +++ b/gallery/.ropeproject/objectdb @@ -0,0 +1 @@ +€}q. \ No newline at end of file diff --git a/gallery/gallery.py b/gallery/gallery.py index 37af36c..ba3cb70 100644 --- a/gallery/gallery.py +++ b/gallery/gallery.py @@ -2,7 +2,6 @@ import os import cgi import re - import random import db @@ -55,202 +54,15 @@ class Gallery(object): return _TAG_TRANSLATE.get(tag, tag) def get_files (params): - sql = "SELECT * FROM im_cmd " - args = [] - where = [] - - if params['start'] is not None: - where.append("id < %s") - args.append(params['start']) - if params['name'] is not None: - where.append("name=%s") - args.append(params['name']) - if params['tag'] is not None: - where.append("tag=%s") - args.append(tagTranslate(params['tag'])) - if len(where): - sql += "WHERE " - sql += " AND ".join(where) - sql += " " - - if params['random'] is not None: - if params['random'] == '1': - sql += "ORDER BY RAND(" + str(random.randint(1,2**63)) + ") " - else: - sql += "ORDER BY RAND(" + params['random'] + ") " - else: - sql += "ORDER BY id DESC " - sql += "LIMIT %s" + """does a select * from im_cmd + with a where clause + the where clause needs to search by + name + id lt or gt + tag (using tag translate) + random (bool) - if params['limit'] is not None: - args.append( int(params['limit']) ) - else: - args.append( SQL_LIMIT ) - db.execute(sql, args) - rows = db.cursor.fetchall () - return rows + normally the results are ordered by id descending + """ params = get_params(PARAMLIST) - - -@-webkit-keyframes pulsate_and_grow { - 0% {-webkit-transform: scale(0.1, 0.1); opacity: 0.1;} - 50% {opacity: 1.0;} - 100% {-webkit-transform: scale(1.0, 1.0); opacity: 0.1;} -} -.tag-options:active, .tag-clear:active { - -webkit-animation: pulsate_opacity 0.5s ease-out; - -webkit-animation-iteration-count: 3; - opacity: 1.0; - -} -.sorting-options:active { - -webkit-animation: pulsate_opacity 0.5s ease-out; - -webkit-animation-iteration-count: 3; - opacity: 1.0; - -} -@-webkit-keyframes pulsate_opacity{ - 0% { opacity: 0.1;} - 50% {opacity: 1.0;} - 100% {opacity: 0.1;} -} - - - - - -
- key controls -
-
-
when composer is launched...
-
ESC toggle
-
C clear
-
R reverse
-
-
in the gallery...
-
BACKSPACE delete
-
LEFT ARROW newer
-
RIGHT ARROW older
-
-
-
- sort -
-
date
-
username
-
height
-
width
-
gif
-
shuffle
-
lombada
-
-
-
- tags -
- - -
remove tag
-
transparent
-
break
-
gradient
-
grid
-
pattern
-
landscape
-
shader
-
ascii
-
Over
-
ATop
-
Dst_Over
-
Dst_In
-
Dst_Out
-
Multiply
-
Screen
-
Divide
-
Plus
-
Difference
-
Exclusion
-
Lighten
-
Darken
-
Overlay
-
Hard_Light
-
Soft_Light
-
Pegtop_Light
-
Linear_Light
-
Vivid_Light
-
Pin_Light
-
Linear_Dodge
-
Linear_Burn
-
Color_Dodge
-
Color_Burn
- -
-
-
-
- -
-
copy
-
- -
-
-""" - - -previous_id = lowest_id + (SQL_LIMIT * 2) -back = ["start=%d" % lowest_id, "limit=%d" % SQL_LIMIT] -newer = ["start=%d" % previous_id, "limit=%d" % SQL_LIMIT] -random_time = "" -if params['name'] is not None: - back.append("name=%s" % params['name']) - newer.append("name=%s" % params['name']) - random_time = "name=%s" % params['name'] -if params['tag'] is not None: - back.append("tag=%s" % params['tag']) - newer.append("tag=%s" % params['tag']) - random_time = "tag=%s" % params['tag'] - -newer_QS = "&".join(newer) -back_QS = "&".join(back) -random_time_QS = ""; -if random_time: - random_time_QS = "&%s" % random_time; -print "
" -print "editor" -print "|" -print "← newer" % newer_QS; -print "|" -if params['random'] is not None and params['random'] == '1': - print "random" % (random.randint(1,2**63), random_time_QS); -else: - print "random" % (1, random_time_QS); -print "|" -print "older →" % back_QS; -print "
" -print """ -else: - print "Main.init()" -print """ - - -""" - diff --git a/gallery/index.html b/gallery/index.html index 255150f..38be9a4 100644 --- a/gallery/index.html +++ b/gallery/index.html @@ -1,23 +1,118 @@ - - + + - + + - + + + +
+ key controls +
+
+
when composer is launched...
+
ESC toggle
+
C clear
+
R reverse
+
+
in the gallery...
+
BACKSPACE delete
+
LEFT ARROW newer
+
RIGHT ARROW older
+
+
+
+ sort +
+
date
+
username
+
height
+
width
+
gif
+
shuffle
+
lombada
+
+
+
+ tags +
+
remove tag
+
transparent
+
break
+
gradient
+
grid
+
pattern
+
landscape
+
shader
+
ascii
+
Over
+
ATop
+
Dst_Over
+
Dst_In
+
Dst_Out
+
Multiply
+
Screen
+
Divide
+
Plus
+
Difference
+
Exclusion
+
Lighten
+
Darken
+
Overlay
+
Hard_Light
+
Soft_Light
+
Pegtop_Light
+
Linear_Light
+
Vivid_Light
+
Pin_Light
+
Linear_Dodge
+
Linear_Burn
+
Color_Dodge
+
Color_Burn
+
- +
+
+ +
+
copy
+
+ +
+
+
+ + + diff --git a/gallery/js/main.js b/gallery/js/main.js index 953e346..d97fab0 100644 --- a/gallery/js/main.js +++ b/gallery/js/main.js @@ -1,10 +1,23 @@ -var title_choices = [ +$(function(){ + $("b").addClass("pulsate_and_grow"); + $(".sorting-options").click(function(){ + + $(".sorting-options").click(function(){ + if ($(this).hasClass("pulsate_opacity")){ + $(this).removeClass("pulsate_opacity"); + } + $(this).addClass("pulsate_opacity"); + + }); + }); +}); + ZeroClipboard.setMoviePath( 'http://asdf.us/swf/ZeroClipboard10.swf' ); var clip = new ZeroClipboard.Client(); clip.glue( 'd_clip_button' ); -var Dump = - { + +var Dump = { pick: function () { Dump.pickUrl( $(this).attr("src") ) @@ -47,7 +60,8 @@ var Dump = { window.location.href = '?"""+back_QS+"""' } - } +} + function applyTag(tagname){ tag_regex = /&tag=[^&]*/; if (document.URL.match(tag_regex)){ @@ -123,22 +137,9 @@ var Main = Dump.clear() } } - 'Keep on pickin\' on..', - 'Pickolaus Pickleby by Charles Pickens!', - 'You pick potato and I pick potahto...', - 'Take your piq!', - 'Show em what you got', - 'I sure know how to pick \'em', - 'Jus pick somethin already!', - 'You can\'t pick your friends...', - 'Select your image my liege', - 'There\'s a time to choose...', - 'gimme a choice! gimme lil\' choice-a-that...', - 'You choose you lose', - 'novels by James CHOICE...', - 'Choose away, chooser-man...', -] -document.title = title_choices[Math.floor(Math.random() * title_choices.length)] + + + $(function(){ var imagedata = [ """ //needs a synchronous call here for (var i=0; i< (imagedata.length - 1); i++){ diff --git a/gallery/js/querystring.js b/gallery/js/querystring.js new file mode 100644 index 0000000..79c2a4d --- /dev/null +++ b/gallery/js/querystring.js @@ -0,0 +1,13 @@ +(function($) { + $.QueryString = (function(a) { + if (a == "") return {}; + var b = {}; + for (var i = 0; i < a.length; ++i) + { + var p=a[i].split('='); + if (p.length != 2) continue; + b[p[0]] = decodeURIComponent(p[1].replace(/\+/g, " ")); + } + return b; + })(window.location.search.substr(1).split('&')) +})(jQuery); diff --git a/gallery/js/title.js b/gallery/js/title.js new file mode 100644 index 0000000..a9ac584 --- /dev/null +++ b/gallery/js/title.js @@ -0,0 +1,74 @@ +var title_choices = [ + 'Keep on pickin\' on..', + 'Pickolaus Pickleby by Charles Pickens!', + 'You pick potato and I pick potahto...', + 'Take your piq!', + 'Show em what you got', + 'I sure know how to pick \'em', + 'Jus pick somethin already!', + 'You can\'t pick your friends...', + 'Select your image my liege', + 'There\'s a time to choose...', + 'gimme a choice! gimme lil\' choice-a-that...', + 'You choose you lose', + 'novels by James CHOICE...', + 'Choose away, chooser-man...' +] +document.title = title_choices[Math.floor(Math.random() * title_choices.length)] + +var titleSwitch = true; +var FillerChars = [ "(",")","|","1","4","\\", "9","_" ]; +var titleArray = document.title.split(""); +var titleArrayCopy = titleArray.slice(0); +var titleLength = titleArray.length + +function marqueeArray(arr){ + var first = arr[0] + arr.shift() +} + +function replaceArray(arr, char){ + arr[randomChoice(arr)] = char +} +var titleUpdateInterval = 300 +function randomChoice(arr){ + var rand = Math.random(); + rand *= arr.length; + rand = Math.floor(rand) + return rand; +} +var titleUpdate = setInterval(function(){ + if (titleSwitch === true){ + marqueeArray(titleArray); + document.title = titleArray.join("") + if (titleArray.length === 1){ + document.title = ""; + titleArray = titleArrayCopy.slice(0); + document.title = titleArray.join(""); + if (titleSwitch){ + titleSwitch = false; + }else{ + titleSwitch = true; + titleUpdateInterval = 100; + } + } + }else{ + + replaceArray(titleArray, FillerChars[randomChoice(FillerChars)]); + document.title = titleArray.join("") + if (titleArray[(titleArray.length-1)] in FillerChars){ + console.log("it's in there"); + titleArray = titleArrayCopy.slice(0); + document.title = titleArray.join(""); + if (titleSwitch){ + titleSwitch = false; + titleUpdateInterval = 300; + }else{ + titleSwitch = true; + } + + } + } + + }, titleUpdateInterval); + diff --git a/gallery/js/titleScrambler.js b/gallery/js/titleScrambler.js deleted file mode 100644 index 6948cbf..0000000 --- a/gallery/js/titleScrambler.js +++ /dev/null @@ -1,56 +0,0 @@ -var titleSwitch = true; -var FillerChars = [ "(",")","|","1","4","\\", "9","_" ]; -var titleArray = document.title.split(""); -var titleArrayCopy = titleArray.slice(0); -var titleLength = titleArray.length - -function marqueeArray(arr){ - var first = arr[0] - arr.shift() -} - -function replaceArray(arr, char){ - arr[randomChoice(arr)] = char -} -var titleUpdateInterval = 300 -function randomChoice(arr){ - var rand = Math.random(); - rand *= arr.length; - rand = Math.floor(rand) - return rand; -} -var titleUpdate = setInterval(function(){ - if (titleSwitch === true){ - marqueeArray(titleArray); - document.title = titleArray.join("") - if (titleArray.length === 1){ - document.title = ""; - titleArray = titleArrayCopy.slice(0); - document.title = titleArray.join(""); - if (titleSwitch){ - titleSwitch = false; - }else{ - titleSwitch = true; - titleUpdateInterval = 100; - } - } - }else{ - - replaceArray(titleArray, FillerChars[randomChoice(FillerChars)]); - document.title = titleArray.join("") - if (titleArray[(titleArray.length-1)] in FillerChars){ - console.log("it's in there"); - titleArray = titleArrayCopy.slice(0); - document.title = titleArray.join(""); - if (titleSwitch){ - titleSwitch = false; - titleUpdateInterval = 300; - }else{ - titleSwitch = true; - } - - } - } - - }, titleUpdateInterval); - diff --git a/gallery/style.css b/gallery/style.css new file mode 100644 index 0000000..2d78a0e --- /dev/null +++ b/gallery/style.css @@ -0,0 +1,51 @@ +/**** Isotope Filtering ****/ + +.isotope-item { + z-index: 2; +} + +.isotope-hidden.isotope-item { + pointer-events: none; + z-index: 1; +} + +/**** Isotope CSS3 transitions ****/ + +.isotope, +.isotope .isotope-item { + -webkit-transition-duration: 0.3s; + -moz-transition-duration: 0.3s; + -ms-transition-duration: 0.3s; + -o-transition-duration: 0.3s; + transition-duration: 0.3s; +} + + +.isotope { + -webkit-transition-property: height, width; + -moz-transition-property: height, width; + -ms-transition-property: height, width; + -o-transition-property: height, width; + transition-property: height, width; +} + +.isotope .isotope-item { + -webkit-transition-property: -webkit-transform, opacity; + -moz-transition-property: -moz-transform, opacity; + -ms-transition-property: -ms-transform, opacity; + -o-transition-property: -o-transform, opacity; + transition-property: transform, opacity; +} + +/**** disabling Isotope CSS3 transitions ****/ + +.isotope.no-transition, +.isotope.no-transition .isotope-item, +.isotope .isotope-item.no-transition { + -webkit-transition-duration: 0s; + -moz-transition-duration: 0s; + -ms-transition-duration: 0s; + -o-transition-duration: 0s; + transition-duration: 0s; +} + -- cgit v1.2.3-70-g09d2