summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gallery/.ropeproject/config.py96
-rw-r--r--gallery/.ropeproject/globalnames1
-rw-r--r--gallery/.ropeproject/history1
-rw-r--r--gallery/.ropeproject/objectdb1
-rw-r--r--gallery/gallery.py206
-rw-r--r--gallery/index.html107
-rw-r--r--gallery/js/main.js41
-rw-r--r--gallery/js/querystring.js13
-rw-r--r--gallery/js/title.js (renamed from gallery/js/titleScrambler.js)18
-rw-r--r--gallery/style.css51
10 files changed, 312 insertions, 223 deletions
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;}
-}
-</style>
-<link href="/im/gallery_style.css" type="text/css" rel="stylesheet" />
-<script type="text/javascript">
-$(function(){
- $("b").addClass("pulsate_and_grow");
- $(".sorting-options").click(function(){
-
- $(".sorting-options").click(function(){
- console.log("wazzup");
- if ($(this).hasClass("pulsate_opacity")){
- $(this).removeClass("pulsate_opacity");
- }
- $(this).addClass("pulsate_opacity");
-
- });
- });
-});
-
-</script>
-</head>
-<body>
-<div id="help">
- <b>key controls</b>
- <div id="keys">
- <br/>
- <div class="small"><i>when composer is launched...</i></div>
- <div>ESC toggle</div>
- <div>C clear</div>
- <div>R reverse</div>
- <br/>
- <div class="small"><i>in the gallery...</i></div>
- <div>BACKSPACE delete</div>
- <div>LEFT ARROW newer</div>
- <div>RIGHT ARROW older</div>
- </div>
-</div>
-<div id="actions">
- <b>sort</b>
- <div id="sorting-optionsContainer">
- <div class="sorting-options" id="date">date</div>
- <div class="sorting-options" id="username">username</div>
- <div class="sorting-options" id="height">height</div>
- <div class="sorting-options" id="width">width</div>
- <div class="sorting-options" id="gif">gif</div>
- <div class="sorting-options" id="shuffle">shuffle</div>
- <div class="sorting-options" id="lombada">lombada</div>
- </div>
-</div>
-<div id="tags">
- <b>tags</b>
- <div id="tag-optionsContainer">
-
-
- <div class="tag-clear"><i>remove tag</i></div>
- <div class="tag-options" id="transparent">transparent</div>
- <div class="tag-options" id="break">break</div>
- <div class="tag-options" id="gradient">gradient</div>
- <div class="tag-options" id="grid">grid</div>
- <div class="tag-options" id="pattern">pattern</div>
- <div class="tag-options" id="landscape">landscape</div>
- <div class="tag-options" id="shader">shader</div>
- <div class="tag-options" id="ascii">ascii</div>
- <div class="tag-options" id="Over">Over</div>
- <div class="tag-options" id="ATop">ATop</div>
- <div class="tag-options" id="Dst_Over">Dst_Over</div>
- <div class="tag-options" id="Dst_In">Dst_In</div>
- <div class="tag-options" id="Dst_Out">Dst_Out</div>
- <div class="tag-options" id="Multiply">Multiply</div>
- <div class="tag-options" id="Screen">Screen</div>
- <div class="tag-options" id="Divide">Divide</div>
- <div class="tag-options" id="Plus">Plus</div>
- <div class="tag-options" id="Difference">Difference</div>
- <div class="tag-options" id="Exclusion">Exclusion</div>
- <div class="tag-options" id="Lighten">Lighten</div>
- <div class="tag-options" id="Darken">Darken</div>
- <div class="tag-options" id="Overlay">Overlay</div>
- <div class="tag-options" id="Hard_Light">Hard_Light</div>
- <div class="tag-options" id="Soft_Light">Soft_Light</div>
- <div class="tag-options" id="Pegtop_Light">Pegtop_Light</div>
- <div class="tag-options" id="Linear_Light">Linear_Light</div>
- <div class="tag-options" id="Vivid_Light">Vivid_Light</div>
- <div class="tag-options" id="Pin_Light">Pin_Light</div>
- <div class="tag-options" id="Linear_Dodge">Linear_Dodge</div>
- <div class="tag-options" id="Linear_Burn">Linear_Burn</div>
- <div class="tag-options" id="Color_Dodge">Color_Dodge</div>
- <div class="tag-options" id="Color_Burn">Color_Burn</div>
-
- </div>
-</div>
-<div id="dump">
- <div id="rebus"></div>
- <input id="urlz" type="text" />
- <div id="d_clip_container" style="position:relative">
- <div id="d_clip_button">copy</div>
- </div>
- <button id="clear">clear</button>
-</div>
-<div id="images">
-"""
-
-
-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 "<div id='nextpage'>"
-print "<a href='/im/'>editor</a>"
-print "|"
-print "<a href='?%s'>&larr; newer</a>" % newer_QS;
-print "|"
-if params['random'] is not None and params['random'] == '1':
- print "<a href='?random=%d%s'>random</a>" % (random.randint(1,2**63), random_time_QS);
-else:
- print "<a href='?random=%d%s'>random</a>" % (1, random_time_QS);
-print "|"
-print "<a href='?%s'>older &rarr;</a>" % back_QS;
-print "</div>"
-print """
-else:
- print "Main.init()"
-print """
-</script>
-</html>
-"""
-
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 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
-<script type="text/javascript" src="/js/jquery.js"></script>
-<script type="text/javascript" src="/js/titleScrambler.js"></script>
+<script type="text/javascript" src="js/jquery.js"></script>
+<!--<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>-->
<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="pragma" content="no-cache" />
<link href="main.css" />
-<script type="text/javascript" src="js/main.js"> </script>
+<script type="text/javascript" src="js/querystring.js"></script>
+<script type="text/javascript" src="js/title.js"> </script>
<script type="text/javascript" src="js/jquery.isotope.min.js"></script>
<script type="text/javascript" src="js/gallery_isotope_config.js?v=3"></script>
<script type="text/javascript" src="/js/ZeroClipboard.js"></script>
<script type="text/javascript" src="http://asdf.us/js/pbembed.js"></script>
-<script type="text/javascript">
+<script type="text/javascript" src="js/main.js"> </script>
+
+<link href="style.css" type="text/css" rel="stylesheet" />
+</head>
<body>
<div id='nextpage'>
-<a href='/im/'>editor</a> | <a id="newer">&larr; newer</a> | <a href='?random=1'>random</a> | <a id="older">older &rarr;</a>
+ <a href='/im/'>editor</a> |
+ <a id="newer">&larr; newer</a> |
+ <a href='?random=1'>random</a> |
+ <a id="older">older &rarr;</a>
+</div>
+<div id="help">
+ <b>key controls</b>
+ <div id="keys">
+ <br/>
+ <div class="small"><i>when composer is launched...</i></div>
+ <div>ESC toggle</div>
+ <div>C clear</div>
+ <div>R reverse</div>
+ <br/>
+ <div class="small"><i>in the gallery...</i></div>
+ <div>BACKSPACE delete</div>
+ <div>LEFT ARROW newer</div>
+ <div>RIGHT ARROW older</div>
+ </div>
+</div>
+<div id="actions">
+ <b>sort</b>
+ <div id="sorting-optionsContainer">
+ <div class="sorting-options" id="date">date</div>
+ <div class="sorting-options" id="username">username</div>
+ <div class="sorting-options" id="height">height</div>
+ <div class="sorting-options" id="width">width</div>
+ <div class="sorting-options" id="gif">gif</div>
+ <div class="sorting-options" id="shuffle">shuffle</div>
+ <div class="sorting-options" id="lombada">lombada</div>
+ </div>
+</div>
+<div id="tags">
+ <b>tags</b>
+ <div id="tag-optionsContainer">
+ <div class="tag-clear"><i>remove tag</i></div>
+ <div class="tag-options" id="transparent">transparent</div>
+ <div class="tag-options" id="break">break</div>
+ <div class="tag-options" id="gradient">gradient</div>
+ <div class="tag-options" id="grid">grid</div>
+ <div class="tag-options" id="pattern">pattern</div>
+ <div class="tag-options" id="landscape">landscape</div>
+ <div class="tag-options" id="shader">shader</div>
+ <div class="tag-options" id="ascii">ascii</div>
+ <div class="tag-options" id="Over">Over</div>
+ <div class="tag-options" id="ATop">ATop</div>
+ <div class="tag-options" id="Dst_Over">Dst_Over</div>
+ <div class="tag-options" id="Dst_In">Dst_In</div>
+ <div class="tag-options" id="Dst_Out">Dst_Out</div>
+ <div class="tag-options" id="Multiply">Multiply</div>
+ <div class="tag-options" id="Screen">Screen</div>
+ <div class="tag-options" id="Divide">Divide</div>
+ <div class="tag-options" id="Plus">Plus</div>
+ <div class="tag-options" id="Difference">Difference</div>
+ <div class="tag-options" id="Exclusion">Exclusion</div>
+ <div class="tag-options" id="Lighten">Lighten</div>
+ <div class="tag-options" id="Darken">Darken</div>
+ <div class="tag-options" id="Overlay">Overlay</div>
+ <div class="tag-options" id="Hard_Light">Hard_Light</div>
+ <div class="tag-options" id="Soft_Light">Soft_Light</div>
+ <div class="tag-options" id="Pegtop_Light">Pegtop_Light</div>
+ <div class="tag-options" id="Linear_Light">Linear_Light</div>
+ <div class="tag-options" id="Vivid_Light">Vivid_Light</div>
+ <div class="tag-options" id="Pin_Light">Pin_Light</div>
+ <div class="tag-options" id="Linear_Dodge">Linear_Dodge</div>
+ <div class="tag-options" id="Linear_Burn">Linear_Burn</div>
+ <div class="tag-options" id="Color_Dodge">Color_Dodge</div>
+ <div class="tag-options" id="Color_Burn">Color_Burn</div>
+ </div>
</div>
-</body>
+<div id="dump">
+ <div id="rebus"></div>
+ <input id="urlz" type="text" />
+ <div id="d_clip_container" style="position:relative">
+ <div id="d_clip_button">copy</div>
+ </div>
+ <button id="clear">clear</button>
+</div>
+<div id="images">
+</div>
+
+<script>
+(function($){
+ //get params from the query string, and create
+ //the back and newer buttons
+ //taking into account name, tag and random
+ params = {
+ name
+ }
+})(jQuery);
+Main.init();
+
+</script>
+</html>
</html>
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/titleScrambler.js b/gallery/js/title.js
index 6948cbf..a9ac584 100644
--- a/gallery/js/titleScrambler.js
+++ b/gallery/js/title.js
@@ -1,3 +1,21 @@
+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("");
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;
+}
+