From 1377d05b7c36720408ad078b8f4174f34dfdb467 Mon Sep 17 00:00:00 2001 From: Bibhas Date: Tue, 20 Aug 2019 10:37:07 +0530 Subject: [PATCH] Blackened all code (#95) * blackend all code * sorted imports * isort changes * reverted isort changes * renamedcElementTree * updated library install command * updated dependencies * reverted dependency changes * added back application in website.py * added back nosetest config * restored shell.py * removed shell.py * renamed file_obj --- .gitignore | 1 + .pre-commit-config.yaml | 46 +++ imgee/__init__.py | 19 +- imgee/_version.py | 7 +- imgee/forms.py | 28 +- imgee/models/__init__.py | 9 +- imgee/models/profile.py | 14 +- imgee/models/stored_file.py | 53 ++-- imgee/models/thumbnail.py | 4 +- imgee/models/user.py | 7 +- imgee/static/img/imgee.svg | 2 +- imgee/static/js/dropzone-amd-module.js | 16 +- imgee/static/js/edit_in_place.js | 1 - imgee/static/js/jquery.ba-postmessage.min.js | 4 +- imgee/static/js/jquery.history.js | 2 +- imgee/static/js/jquery.jeditable.min.js | 2 +- imgee/static/js/list-grid.js | 8 +- .../static/sass/layout/modules/_dropzone.sass | 153 +++++----- .../sass/layout/modules/_editable-text.sass | 2 +- imgee/static/sass/layout/modules/_form.sass | 2 +- .../static/sass/layout/modules/_gallery.sass | 10 +- imgee/static/sass/layout/modules/_label.sass | 2 +- .../static/sass/layout/modules/_modules.sass | 2 +- imgee/static/sass/layout/modules/_popup.sass | 6 +- .../static/sass/layout/modules/_profile.sass | 2 +- .../sass/layout/modules/_show-label.sass | 2 +- .../static/sass/layout/modules/_sidebar.sass | 3 +- .../sass/layout/modules/_view-image.sass | 184 ++++++------ imgee/storage.py | 98 +++++-- imgee/tasks.py | 16 +- imgee/templates/delete.html.jinja2 | 1 - imgee/templates/delete_label.html.jinja2 | 1 - imgee/templates/edit_title_form.html.jinja2 | 2 +- imgee/templates/layout.html.jinja2 | 1 - imgee/templates/purge_cache.html.jinja2 | 1 - imgee/utils.py | 264 ++++++++++++++---- imgee/views/__init__.py | 8 +- imgee/views/files.py | 112 ++++++-- imgee/views/index.py | 76 ++++- imgee/views/labels.py | 60 ++-- imgee/views/login.py | 16 +- install_libraries.sh | 2 +- instance/settings-sample.py | 4 +- instance/settings.py | 4 +- manage.py | 7 +- migrations/README | 2 +- migrations/env.py | 43 +-- migrations/script.py.mako | 1 + .../1036f2d710dc_storedfile_orig_extn.py | 4 +- .../200442fae8bd_remove_size_in_tn.py | 4 +- ...dff4c223_change_tn_size_to_width_height.py | 23 +- .../versions/2c7e25599132_add_mimetype.py | 35 ++- migrations/versions/2d5db2a698f6_init.py | 128 +++++---- .../347ba3ac054f_update_image_attrs.py | 23 +- .../4b2844325813_related_names_for_th.py | 22 +- .../555bc8d5cbd7_add_height_width_and.py | 12 +- .../5a1014061968_storedfile_no_previe.py | 5 +- pyproject.toml | 23 ++ runserver.py | 3 + sample_app/static/jquery.min.js | 2 +- sample_app/webapp.py | 18 +- setup.cfg | 33 +++ shell.py | 9 - tests/fixtures.py | 20 +- tests/test_labels.py | 9 +- tests/test_registry.py | 7 +- tests/test_upload.py | 50 ++-- website.py | 6 +- 68 files changed, 1163 insertions(+), 583 deletions(-) create mode 100644 .pre-commit-config.yaml mode change 100755 => 100644 migrations/README mode change 100755 => 100644 migrations/env.py mode change 100755 => 100644 migrations/script.py.mako create mode 100644 pyproject.toml delete mode 100755 shell.py diff --git a/.gitignore b/.gitignore index 242511fc..32c84c02 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,4 @@ imgee/static/test_uploads *.bak instance/production.env.sh imgee/static/gen +.pytest_cache diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..d529ae15 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,46 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +repos: + - repo: https://github.com/lucasmbrown/mirrors-autoflake + rev: v1.3 + hooks: + - id: autoflake + args: ['--in-place', '--remove-all-unused-imports', '--ignore-init-module-imports', '--remove-unused-variable'] + - repo: https://github.com/pre-commit/mirrors-isort + rev: v4.3.21 + hooks: + - id: isort + additional_dependencies: + - toml + - repo: https://github.com/ambv/black + rev: master + hooks: + - id: black + language_version: python3.6 + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v2.2.3 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-added-large-files + - id: check-byte-order-marker + - id: check-case-conflict + - id: check-executables-have-shebangs + - id: check-json + - id: check-merge-conflict + - id: check-xml + - id: fix-encoding-pragma + - id: flake8 + additional_dependencies: + - toml + - flake8-assertive + - flake8-blind-except + - flake8-builtins + - flake8-coding + - flake8-comprehensions + - flake8-isort + - flake8-logging-format + - flake8-mutable + - flake8-print + - pep8-naming diff --git a/imgee/__init__.py b/imgee/__init__.py index bde30d7a..69fe8fa4 100644 --- a/imgee/__init__.py +++ b/imgee/__init__.py @@ -4,14 +4,16 @@ import os.path +from flask import Flask, redirect, url_for +from flask_migrate import Migrate from werkzeug.utils import secure_filename -from flask import Flask, redirect, url_for from flask_lastuser import Lastuser from flask_lastuser.sqlalchemy import UserManager -from baseframe import baseframe, assets, Version -from flask_migrate import Migrate + +from baseframe import Version, assets, baseframe import coaster.app + from ._version import __version__ version = Version(__version__) @@ -20,9 +22,9 @@ assets['imgee.css'][version] = 'css/app.css' -from . import models, views -from .models import db -from .tasks import TaskRegistry +from . import models, views # NOQA # isort:skip +from .models import db # NOQA # isort:skip +from .tasks import TaskRegistry # NOQA # isort:skip registry = TaskRegistry() @@ -39,7 +41,10 @@ def error403(error): return redirect(url_for('login')) + if app.config.get('MEDIA_DOMAIN', '').lower().startswith(('http://', 'https://')): app.config['MEDIA_DOMAIN'] = app.config['MEDIA_DOMAIN'].split(':', 1)[1] -app.upload_folder = os.path.join(app.static_folder, secure_filename(app.config.get('UPLOADED_FILES_DIR'))) +app.upload_folder = os.path.join( + app.static_folder, secure_filename(app.config.get('UPLOADED_FILES_DIR')) +) diff --git a/imgee/_version.py b/imgee/_version.py index 0b08e46b..c6a2d347 100644 --- a/imgee/_version.py +++ b/imgee/_version.py @@ -1,4 +1,9 @@ __all__ = ['__version__', '__version_info__'] __version__ = '0.2.0' -__version_info__ = tuple([int(num) if num.isdigit() else num for num in __version__.replace('-', '.', 1).split('.')]) +__version_info__ = tuple( + [ + int(num) if num.isdigit() else num + for num in __version__.replace('-', '.', 1).split('.') + ] +) diff --git a/imgee/forms.py b/imgee/forms.py index 5ba69c03..553cd850 100644 --- a/imgee/forms.py +++ b/imgee/forms.py @@ -1,22 +1,25 @@ # -*- coding: utf-8 -*- -from coaster.utils import make_name -from baseframe.forms import Form -from wtforms.validators import Required, ValidationError, Length -from wtforms import (FileField, TextField, HiddenField, SelectField) +from wtforms import FileField, HiddenField, SelectField, TextField +from wtforms.validators import Length, Required, ValidationError +from baseframe.forms import Form +from coaster.utils import make_name from imgee import app + from .models import Label from .utils import is_file_allowed def valid_file(form, field): if not is_file_allowed(field.data.stream, field.data.mimetype, field.data.filename): - raise ValidationError("Sorry, unknown image format. Please try uploading another file.") + raise ValidationError( + "Sorry, unknown image format. Please try uploading another file." + ) class UploadImageForm(Form): - file = FileField("File", validators=[Required(), valid_file]) + upload_file = FileField("File", validators=[Required(), valid_file]) class DeleteImageForm(Form): @@ -41,15 +44,22 @@ def label_doesnt_exist(form, field): profile_id = form.profile_id.data label_name = make_name(field.data) if label_name in reserved_words(): - raise ValidationError('"%s" is reserved and cannot be used as a label. Please try another name.' % label_name) + raise ValidationError( + '"%s" is reserved and cannot be used as a label. Please try another name.' + % label_name + ) exists = Label.query.filter_by(profile_id=profile_id, name=label_name).first() if exists: - raise ValidationError('Label "%s" already exists. Please try another name.' % field.data) + raise ValidationError( + 'Label "%s" already exists. Please try another name.' % field.data + ) class CreateLabelForm(Form): - label = TextField('Label', validators=[Required(), Length(max=250), label_doesnt_exist]) + label = TextField( + 'Label', validators=[Required(), Length(max=250), label_doesnt_exist] + ) profile_id = HiddenField('profile_id') diff --git a/imgee/models/__init__.py b/imgee/models/__init__.py index 18c5dfa6..aeff7f71 100644 --- a/imgee/models/__init__.py +++ b/imgee/models/__init__.py @@ -1,11 +1,12 @@ # -*- coding: utf-8 -*- from flask_sqlalchemy import SQLAlchemy + from imgee import app db = SQLAlchemy(app) -from imgee.models.user import * -from imgee.models.stored_file import * -from imgee.models.thumbnail import * -from imgee.models.profile import * +from imgee.models.user import * # NOQA # isort:skip +from imgee.models.stored_file import * # NOQA # isort:skip +from imgee.models.thumbnail import * # NOQA # isort:skip +from imgee.models.profile import * # NOQA # isort:skip diff --git a/imgee/models/profile.py b/imgee/models/profile.py index ccafeaf6..9193d105 100644 --- a/imgee/models/profile.py +++ b/imgee/models/profile.py @@ -1,5 +1,8 @@ -from coaster.sqlalchemy import BaseNameMixin +# -*- coding: utf-8 -*- from flask_lastuser.sqlalchemy import ProfileMixin + +from coaster.sqlalchemy import BaseNameMixin + from . import db @@ -7,9 +10,12 @@ class Profile(ProfileMixin, BaseNameMixin, db.Model): __tablename__ = 'profile' userid = db.Column(db.Unicode(22), nullable=False, unique=True) - stored_files = db.relationship('StoredFile', - backref=db.backref('profile'), lazy='dynamic', - cascade='all, delete-orphan') + stored_files = db.relationship( + 'StoredFile', + backref=db.backref('profile'), + lazy='dynamic', + cascade='all, delete-orphan', + ) def permissions(self, user, inherited=None): perms = super(Profile, self).permissions(user, inherited) diff --git a/imgee/models/stored_file.py b/imgee/models/stored_file.py index 345e3d23..65a1ce35 100644 --- a/imgee/models/stored_file.py +++ b/imgee/models/stored_file.py @@ -2,14 +2,17 @@ from flask import url_for from coaster.sqlalchemy import BaseNameMixin, BaseScopedNameMixin + from .. import app +from ..utils import guess_extension, newid from . import db -from ..utils import newid, guess_extension - -image_labels = db.Table('image_labels', +image_labels = db.Table( + 'image_labels', db.Column('label_id', db.Integer, db.ForeignKey('label.id'), nullable=False), - db.Column('stored_file_id', db.Integer, db.ForeignKey('stored_file.id'), nullable=False), + db.Column( + 'stored_file_id', db.Integer, db.ForeignKey('stored_file.id'), nullable=False + ), ) @@ -18,9 +21,12 @@ class Label(BaseScopedNameMixin, db.Model): Labels are used to categorize images for easy discovery. An image may have zero or more labels. """ + __tablename__ = 'label' profile_id = db.Column(None, db.ForeignKey('profile.id'), nullable=False) - profile = db.relationship('Profile', backref=db.backref('labels', cascade='all, delete-orphan')) + profile = db.relationship( + 'Profile', backref=db.backref('labels', cascade='all, delete-orphan') + ) parent = db.synonym('profile') def __repr__(self): @@ -34,6 +40,7 @@ class StoredFile(BaseNameMixin, db.Model): copy is stored locally for thumbnail generation. Files are always served from S3. """ + __tablename__ = 'stored_file' profile_id = db.Column(None, db.ForeignKey('profile.id'), nullable=False) size = db.Column(db.BigInteger, default=0) # in bytes @@ -42,10 +49,14 @@ class StoredFile(BaseNameMixin, db.Model): mimetype = db.Column(db.Unicode(32), nullable=False) orig_extn = db.Column(db.Unicode(15), nullable=True) no_previews = db.Column(db.Boolean, default=False, nullable=False) - thumbnails = db.relationship('Thumbnail', backref='stored_file', - cascade='all, delete-orphan') - labels = db.relationship('Label', secondary='image_labels', - backref=db.backref('stored_files', lazy='dynamic')) + thumbnails = db.relationship( + 'Thumbnail', backref='stored_file', cascade='all, delete-orphan' + ) + labels = db.relationship( + 'Label', + secondary='image_labels', + backref=db.backref('stored_files', lazy='dynamic'), + ) def __init__(self, **kwargs): super(StoredFile, self).__init__(**kwargs) @@ -64,21 +75,19 @@ def filename(self): return self.name + self.extn def dict_data(self): - return dict( - title=self.title, - uploaded=self.created_at.isoformat() + 'Z', - filesize=app.jinja_env.filters['filesizeformat'](self.size), - imgsize=u'%s×%s px' % (self.width, self.height), - url=url_for('view_image', profile=self.profile.name, image=self.name), - thumb_url=url_for('get_image', image=self.name, size=app.config.get('THUMBNAIL_SIZE')) - ) + return { + 'title': self.title, + 'uploaded': self.created_at.isoformat() + 'Z', + 'filesize': app.jinja_env.filters['filesizeformat'](self.size), + 'imgsize': u'%s×%s px' % (self.width, self.height), + 'url': url_for('view_image', profile=self.profile.name, image=self.name), + 'thumb_url': url_for( + 'get_image', image=self.name, size=app.config.get('THUMBNAIL_SIZE') + ), + } def add_labels(self, labels): - status = { - '+': [], - '-': [], - '': [] - } + status = {'+': [], '-': [], '': []} new_labels = set(labels) old_labels = set(self.labels) diff --git a/imgee/models/thumbnail.py b/imgee/models/thumbnail.py index 6bb51a53..4147c545 100644 --- a/imgee/models/thumbnail.py +++ b/imgee/models/thumbnail.py @@ -1,8 +1,9 @@ # -*- coding: utf-8 -*- from coaster.sqlalchemy import BaseMixin -from . import db + from ..utils import newid +from . import db class Thumbnail(BaseMixin, db.Model): @@ -12,6 +13,7 @@ class Thumbnail(BaseMixin, db.Model): image types. Unrecognized types are always served as the original file. """ + __tablename__ = 'thumbnail' name = db.Column(db.Unicode(64), nullable=False, unique=True, index=True) diff --git a/imgee/models/user.py b/imgee/models/user.py index 4896bef1..43f8b456 100644 --- a/imgee/models/user.py +++ b/imgee/models/user.py @@ -1,8 +1,10 @@ # -*- coding: utf-8 -*- from flask import url_for -from flask_lastuser.sqlalchemy import UserBase from werkzeug.utils import cached_property + +from flask_lastuser.sqlalchemy import UserBase + from . import db from .profile import Profile @@ -17,7 +19,8 @@ def profile(self): @cached_property def profiles(self): return [self.profile] + Profile.query.filter( - Profile.userid.in_(self.organizations_owned_ids())).order_by(Profile.title).all() + Profile.userid.in_(self.organizations_owned_ids()) + ).order_by(Profile.title).all() @cached_property def profile_url(self): diff --git a/imgee/static/img/imgee.svg b/imgee/static/img/imgee.svg index 9201aa26..767dafab 100644 --- a/imgee/static/img/imgee.svg +++ b/imgee/static/img/imgee.svg @@ -142,4 +142,4 @@ d="m 303.19728,143.45299 -103.59175,0 c -4.82596,0 -7.97647,-3.38802 -7.97647,-7.49852 l 0,-79.762686 c 0,-4.944658 3.03322,-8.691781 7.97647,-8.691781 l 67.63379,0 0,11.82119 -63.79759,0 0,72.416457 96.57828,0 0,-32.52297 11.86764,-0.007 0,36.74693 c -0.001,4.1105 -3.98609,7.49852 -8.69037,7.49852 l 0,0 z m -87.88785,-22.85476 33.27339,-31.961417 14.95554,13.997017 16.07159,-21.139296 7.88628,15.081473 0.0567,24.022223 -72.2412,0 0,0 z m 16.47069,-32.194637 c -4.54259,0 -8.2268,-3.684163 -8.2268,-8.229647 0,-4.542625 3.68421,-8.226787 8.2268,-8.226787 4.54551,0 8.22961,3.684162 8.22961,8.226787 0,4.545484 -3.6841,8.229647 -8.22961,8.229647 z m 80.15183,-34.211809 0,33.525051 -11.91194,0 0,-33.525051 -22.06856,0 27.40629,-29.407726 27.40631,29.407726 -20.83333,0 2.9e-4,0 z" inkscape:connector-curvature="0" style="fill:#f0a40c;fill-opacity:1" - sodipodi:nodetypes="csssscccccccccccccccccccccsssccccccccccc" /> \ No newline at end of file + sodipodi:nodetypes="csssscccccccccccccccccccccsssccccccccccc" /> diff --git a/imgee/static/js/dropzone-amd-module.js b/imgee/static/js/dropzone-amd-module.js index 4d28b08c..97beb9a2 100644 --- a/imgee/static/js/dropzone-amd-module.js +++ b/imgee/static/js/dropzone-amd-module.js @@ -162,19 +162,19 @@ Emitter.prototype.hasListeners = function(event){ /* # # More info at [www.dropzonejs.com](http://www.dropzonejs.com) -# -# Copyright (c) 2012, Matias Meno -# +# +# Copyright (c) 2012, Matias Meno +# # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: -# +# # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. -# +# # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -202,9 +202,9 @@ Emitter.prototype.hasListeners = function(event){ /* This is a list of all available events you can register on a dropzone object. - + You can register an event handler like this: - + dropzone.on("dragEnter", function() { }); */ @@ -1184,4 +1184,4 @@ Emitter.prototype.hasListeners = function(event){ }).call(this); return module.exports; -})); \ No newline at end of file +})); diff --git a/imgee/static/js/edit_in_place.js b/imgee/static/js/edit_in_place.js index c53b8daf..66760419 100644 --- a/imgee/static/js/edit_in_place.js +++ b/imgee/static/js/edit_in_place.js @@ -46,4 +46,3 @@ $(".editable_label").each(function (){ } }); }); - diff --git a/imgee/static/js/jquery.ba-postmessage.min.js b/imgee/static/js/jquery.ba-postmessage.min.js index 5fe80a25..cc23e3c1 100644 --- a/imgee/static/js/jquery.ba-postmessage.min.js +++ b/imgee/static/js/jquery.ba-postmessage.min.js @@ -1,9 +1,9 @@ /* * jQuery postMessage - v0.5 - 9/11/2009 * http://benalman.com/projects/jquery-postmessage-plugin/ - * + * * Copyright (c) 2009 "Cowboy" Ben Alman * Dual licensed under the MIT and GPL licenses. * http://benalman.com/about/license/ */ -(function($){var g,d,j=1,a,b=this,f=!1,h="postMessage",e="addEventListener",c,i=b[h]&&!$.browser.opera;$[h]=function(k,l,m){if(!l){return}k=typeof k==="string"?k:$.param(k);m=m||parent;if(i){m[h](k,l.replace(/([^:]+:\/\/[^\/]+).*/,"$1"))}else{if(l){m.location=l.replace(/#.*$/,"")+"#"+(+new Date)+(j++)+"&"+k}}};$.receiveMessage=c=function(l,m,k){if(i){if(l){a&&c();a=function(n){if((typeof m==="string"&&n.origin!==m)||($.isFunction(m)&&m(n.origin)===f)){return f}l(n)}}if(b[e]){b[l?e:"removeEventListener"]("message",a,f)}else{b[l?"attachEvent":"detachEvent"]("onmessage",a)}}else{g&&clearInterval(g);g=null;if(l){k=typeof m==="number"?m:typeof k==="number"?k:100;g=setInterval(function(){var o=document.location.hash,n=/^#?\d+&/;if(o!==d&&n.test(o)){d=o;l({data:o.replace(n,"")})}},k)}}}})(jQuery); \ No newline at end of file +(function($){var g,d,j=1,a,b=this,f=!1,h="postMessage",e="addEventListener",c,i=b[h]&&!$.browser.opera;$[h]=function(k,l,m){if(!l){return}k=typeof k==="string"?k:$.param(k);m=m||parent;if(i){m[h](k,l.replace(/([^:]+:\/\/[^\/]+).*/,"$1"))}else{if(l){m.location=l.replace(/#.*$/,"")+"#"+(+new Date)+(j++)+"&"+k}}};$.receiveMessage=c=function(l,m,k){if(i){if(l){a&&c();a=function(n){if((typeof m==="string"&&n.origin!==m)||($.isFunction(m)&&m(n.origin)===f)){return f}l(n)}}if(b[e]){b[l?e:"removeEventListener"]("message",a,f)}else{b[l?"attachEvent":"detachEvent"]("onmessage",a)}}else{g&&clearInterval(g);g=null;if(l){k=typeof m==="number"?m:typeof k==="number"?k:100;g=setInterval(function(){var o=document.location.hash,n=/^#?\d+&/;if(o!==d&&n.test(o)){d=o;l({data:o.replace(n,"")})}},k)}}}})(jQuery); diff --git a/imgee/static/js/jquery.history.js b/imgee/static/js/jquery.history.js index 8d4edcd2..cc52fdb2 100644 --- a/imgee/static/js/jquery.history.js +++ b/imgee/static/js/jquery.history.js @@ -1 +1 @@ -window.JSON||(window.JSON={}),function(){function f(a){return a<10?"0"+a:a}function quote(a){return escapable.lastIndex=0,escapable.test(a)?'"'+a.replace(escapable,function(a){var b=meta[a];return typeof b=="string"?b:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function str(a,b){var c,d,e,f,g=gap,h,i=b[a];i&&typeof i=="object"&&typeof i.toJSON=="function"&&(i=i.toJSON(a)),typeof rep=="function"&&(i=rep.call(b,a,i));switch(typeof i){case"string":return quote(i);case"number":return isFinite(i)?String(i):"null";case"boolean":case"null":return String(i);case"object":if(!i)return"null";gap+=indent,h=[];if(Object.prototype.toString.apply(i)==="[object Array]"){f=i.length;for(c=0;c")&&c[0]);return a>4?a:!1}();return a},m.isInternetExplorer=function(){var a=m.isInternetExplorer.cached=typeof m.isInternetExplorer.cached!="undefined"?m.isInternetExplorer.cached:Boolean(m.getInternetExplorerMajorVersion());return a},m.emulated={pushState:!Boolean(a.history&&a.history.pushState&&a.history.replaceState&&!/ Mobile\/([1-7][a-z]|(8([abcde]|f(1[0-8]))))/i.test(e.userAgent)&&!/AppleWebKit\/5([0-2]|3[0-2])/i.test(e.userAgent)),hashChange:Boolean(!("onhashchange"in a||"onhashchange"in d)||m.isInternetExplorer()&&m.getInternetExplorerMajorVersion()<8)},m.enabled=!m.emulated.pushState,m.bugs={setHash:Boolean(!m.emulated.pushState&&e.vendor==="Apple Computer, Inc."&&/AppleWebKit\/5([0-2]|3[0-3])/.test(e.userAgent)),safariPoll:Boolean(!m.emulated.pushState&&e.vendor==="Apple Computer, Inc."&&/AppleWebKit\/5([0-2]|3[0-3])/.test(e.userAgent)),ieDoubleCheck:Boolean(m.isInternetExplorer()&&m.getInternetExplorerMajorVersion()<8),hashEscape:Boolean(m.isInternetExplorer()&&m.getInternetExplorerMajorVersion()<7)},m.isEmptyObject=function(a){for(var b in a)return!1;return!0},m.cloneObject=function(a){var b,c;return a?(b=k.stringify(a),c=k.parse(b)):c={},c},m.getRootUrl=function(){var a=d.location.protocol+"//"+(d.location.hostname||d.location.host);if(d.location.port||!1)a+=":"+d.location.port;return a+="/",a},m.getBaseHref=function(){var a=d.getElementsByTagName("base"),b=null,c="";return a.length===1&&(b=a[0],c=b.href.replace(/[^\/]+$/,"")),c=c.replace(/\/+$/,""),c&&(c+="/"),c},m.getBaseUrl=function(){var a=m.getBaseHref()||m.getBasePageUrl()||m.getRootUrl();return a},m.getPageUrl=function(){var a=m.getState(!1,!1),b=(a||{}).url||d.location.href,c;return c=b.replace(/\/+$/,"").replace(/[^\/]+$/,function(a,b,c){return/\./.test(a)?a:a+"/"}),c},m.getBasePageUrl=function(){var a=d.location.href.replace(/[#\?].*/,"").replace(/[^\/]+$/,function(a,b,c){return/[^\/]$/.test(a)?"":a}).replace(/\/+$/,"")+"/";return a},m.getFullUrl=function(a,b){var c=a,d=a.substring(0,1);return b=typeof b=="undefined"?!0:b,/[a-z]+\:\/\//.test(a)||(d==="/"?c=m.getRootUrl()+a.replace(/^\/+/,""):d==="#"?c=m.getPageUrl().replace(/#.*/,"")+a:d==="?"?c=m.getPageUrl().replace(/[\?#].*/,"")+a:b?c=m.getBaseUrl()+a.replace(/^(\.\/)+/,""):c=m.getBasePageUrl()+a.replace(/^(\.\/)+/,"")),c.replace(/\#$/,"")},m.getShortUrl=function(a){var b=a,c=m.getBaseUrl(),d=m.getRootUrl();return m.emulated.pushState&&(b=b.replace(c,"")),b=b.replace(d,"/"),m.isTraditionalAnchor(b)&&(b="./"+b),b=b.replace(/^(\.\/)+/g,"./").replace(/\#$/,""),b},m.store={},m.idToState=m.idToState||{},m.stateToId=m.stateToId||{},m.urlToId=m.urlToId||{},m.storedStates=m.storedStates||[],m.savedStates=m.savedStates||[],m.normalizeStore=function(){m.store.idToState=m.store.idToState||{},m.store.urlToId=m.store.urlToId||{},m.store.stateToId=m.store.stateToId||{}},m.getState=function(a,b){typeof a=="undefined"&&(a=!0),typeof b=="undefined"&&(b=!0);var c=m.getLastSavedState();return!c&&b&&(c=m.createStateObject()),a&&(c=m.cloneObject(c),c.url=c.cleanUrl||c.url),c},m.getIdByState=function(a){var b=m.extractId(a.url),c;if(!b){c=m.getStateString(a);if(typeof m.stateToId[c]!="undefined")b=m.stateToId[c];else if(typeof m.store.stateToId[c]!="undefined")b=m.store.stateToId[c];else{for(;;){b=(new Date).getTime()+String(Math.random()).replace(/\D/g,"");if(typeof m.idToState[b]=="undefined"&&typeof m.store.idToState[b]=="undefined")break}m.stateToId[c]=b,m.idToState[b]=a}}return b},m.normalizeState=function(a){var b,c;if(!a||typeof a!="object")a={};if(typeof a.normalized!="undefined")return a;if(!a.data||typeof a.data!="object")a.data={};b={},b.normalized=!0,b.title=a.title||"",b.url=m.getFullUrl(m.unescapeString(a.url||d.location.href)),b.hash=m.getShortUrl(b.url),b.data=m.cloneObject(a.data),b.id=m.getIdByState(b),b.cleanUrl=b.url.replace(/\??\&_suid.*/,""),b.url=b.cleanUrl,c=!m.isEmptyObject(b.data);if(b.title||c)b.hash=m.getShortUrl(b.url).replace(/\??\&_suid.*/,""),/\?/.test(b.hash)||(b.hash+="?"),b.hash+="&_suid="+b.id;return b.hashedUrl=m.getFullUrl(b.hash),(m.emulated.pushState||m.bugs.safariPoll)&&m.hasUrlDuplicate(b)&&(b.url=b.hashedUrl),b},m.createStateObject=function(a,b,c){var d={data:a,title:b,url:c};return d=m.normalizeState(d),d},m.getStateById=function(a){a=String(a);var c=m.idToState[a]||m.store.idToState[a]||b;return c},m.getStateString=function(a){var b,c,d;return b=m.normalizeState(a),c={data:b.data,title:a.title,url:a.url},d=k.stringify(c),d},m.getStateId=function(a){var b,c;return b=m.normalizeState(a),c=b.id,c},m.getHashByState=function(a){var b,c;return b=m.normalizeState(a),c=b.hash,c},m.extractId=function(a){var b,c,d;return c=/(.*)\&_suid=([0-9]+)$/.exec(a),d=c?c[1]||a:a,b=c?String(c[2]||""):"",b||!1},m.isTraditionalAnchor=function(a){var b=!/[\/\?\.]/.test(a);return b},m.extractState=function(a,b){var c=null,d,e;return b=b||!1,d=m.extractId(a),d&&(c=m.getStateById(d)),c||(e=m.getFullUrl(a),d=m.getIdByUrl(e)||!1,d&&(c=m.getStateById(d)),!c&&b&&!m.isTraditionalAnchor(a)&&(c=m.createStateObject(null,null,e))),c},m.getIdByUrl=function(a){var c=m.urlToId[a]||m.store.urlToId[a]||b;return c},m.getLastSavedState=function(){return m.savedStates[m.savedStates.length-1]||b},m.getLastStoredState=function(){return m.storedStates[m.storedStates.length-1]||b},m.hasUrlDuplicate=function(a){var b=!1,c;return c=m.extractState(a.url),b=c&&c.id!==a.id,b},m.storeState=function(a){return m.urlToId[a.url]=a.id,m.storedStates.push(m.cloneObject(a)),a},m.isLastSavedState=function(a){var b=!1,c,d,e;return m.savedStates.length&&(c=a.id,d=m.getLastSavedState(),e=d.id,b=c===e),b},m.saveState=function(a){return m.isLastSavedState(a)?!1:(m.savedStates.push(m.cloneObject(a)),!0)},m.getStateByIndex=function(a){var b=null;return typeof a=="undefined"?b=m.savedStates[m.savedStates.length-1]:a<0?b=m.savedStates[m.savedStates.length+a]:b=m.savedStates[a],b},m.getHash=function(){var a=m.unescapeHash(d.location.hash);return a},m.unescapeString=function(b){var c=b,d;for(;;){d=a.unescape(c);if(d===c)break;c=d}return c},m.unescapeHash=function(a){var b=m.normalizeHash(a);return b=m.unescapeString(b),b},m.normalizeHash=function(a){var b=a.replace(/[^#]*#/,"").replace(/#.*/,"");return b},m.setHash=function(a,b){var c,e,f;return b!==!1&&m.busy()?(m.pushQueue({scope:m,callback:m.setHash,args:arguments,queue:b}),!1):(c=m.escapeHash(a),m.busy(!0),e=m.extractState(a,!0),e&&!m.emulated.pushState?m.pushState(e.data,e.title,e.url,!1):d.location.hash!==c&&(m.bugs.setHash?(f=m.getPageUrl(),m.pushState(null,null,f+"#"+c,!1)):d.location.hash=c),m)},m.escapeHash=function(b){var c=m.normalizeHash(b);return c=a.escape(c),m.bugs.hashEscape||(c=c.replace(/\%21/g,"!").replace(/\%26/g,"&").replace(/\%3D/g,"=").replace(/\%3F/g,"?")),c},m.getHashByUrl=function(a){var b=String(a).replace(/([^#]*)#?([^#]*)#?(.*)/,"$2");return b=m.unescapeHash(b),b},m.setTitle=function(a){var b=a.title,c;b||(c=m.getStateByIndex(0),c&&c.url===a.url&&(b=c.title||m.options.initialTitle));try{d.getElementsByTagName("title")[0].innerHTML=b.replace("<","<").replace(">",">").replace(" & "," & ")}catch(e){}return d.title=b,m},m.queues=[],m.busy=function(a){typeof a!="undefined"?m.busy.flag=a:typeof m.busy.flag=="undefined"&&(m.busy.flag=!1);if(!m.busy.flag){h(m.busy.timeout);var b=function(){var a,c,d;if(m.busy.flag)return;for(a=m.queues.length-1;a>=0;--a){c=m.queues[a];if(c.length===0)continue;d=c.shift(),m.fireQueueItem(d),m.busy.timeout=g(b,m.options.busyDelay)}};m.busy.timeout=g(b,m.options.busyDelay)}return m.busy.flag},m.busy.flag=!1,m.fireQueueItem=function(a){return a.callback.apply(a.scope||m,a.args||[])},m.pushQueue=function(a){return m.queues[a.queue||0]=m.queues[a.queue||0]||[],m.queues[a.queue||0].push(a),m},m.queue=function(a,b){return typeof a=="function"&&(a={callback:a}),typeof b!="undefined"&&(a.queue=b),m.busy()?m.pushQueue(a):m.fireQueueItem(a),m},m.clearQueue=function(){return m.busy.flag=!1,m.queues=[],m},m.stateChanged=!1,m.doubleChecker=!1,m.doubleCheckComplete=function(){return m.stateChanged=!0,m.doubleCheckClear(),m},m.doubleCheckClear=function(){return m.doubleChecker&&(h(m.doubleChecker),m.doubleChecker=!1),m},m.doubleCheck=function(a){return m.stateChanged=!1,m.doubleCheckClear(),m.bugs.ieDoubleCheck&&(m.doubleChecker=g(function(){return m.doubleCheckClear(),m.stateChanged||a(),!0},m.options.doubleCheckInterval)),m},m.safariStatePoll=function(){var b=m.extractState(d.location.href),c;if(!m.isLastSavedState(b))c=b;else return;return c||(c=m.createStateObject()),m.Adapter.trigger(a,"popstate"),m},m.back=function(a){return a!==!1&&m.busy()?(m.pushQueue({scope:m,callback:m.back,args:arguments,queue:a}),!1):(m.busy(!0),m.doubleCheck(function(){m.back(!1)}),n.go(-1),!0)},m.forward=function(a){return a!==!1&&m.busy()?(m.pushQueue({scope:m,callback:m.forward,args:arguments,queue:a}),!1):(m.busy(!0),m.doubleCheck(function(){m.forward(!1)}),n.go(1),!0)},m.go=function(a,b){var c;if(a>0)for(c=1;c<=a;++c)m.forward(b);else{if(!(a<0))throw new Error("History.go: History.go requires a positive or negative integer passed.");for(c=-1;c>=a;--c)m.back(b)}return m};if(m.emulated.pushState){var o=function(){};m.pushState=m.pushState||o,m.replaceState=m.replaceState||o}else m.onPopState=function(b,c){var e=!1,f=!1,g,h;return m.doubleCheckComplete(),g=m.getHash(),g?(h=m.extractState(g||d.location.href,!0),h?m.replaceState(h.data,h.title,h.url,!1):(m.Adapter.trigger(a,"anchorchange"),m.busy(!1)),m.expectedStateId=!1,!1):(e=m.Adapter.extractEventData("state",b,c)||!1,e?f=m.getStateById(e):m.expectedStateId?f=m.getStateById(m.expectedStateId):f=m.extractState(d.location.href),f||(f=m.createStateObject(null,null,d.location.href)),m.expectedStateId=!1,m.isLastSavedState(f)?(m.busy(!1),!1):(m.storeState(f),m.saveState(f),m.setTitle(f),m.Adapter.trigger(a,"statechange"),m.busy(!1),!0))},m.Adapter.bind(a,"popstate",m.onPopState),m.pushState=function(b,c,d,e){if(m.getHashByUrl(d)&&m.emulated.pushState)throw new Error("History.js does not support states with fragement-identifiers (hashes/anchors).");if(e!==!1&&m.busy())return m.pushQueue({scope:m,callback:m.pushState,args:arguments,queue:e}),!1;m.busy(!0);var f=m.createStateObject(b,c,d);return m.isLastSavedState(f)?m.busy(!1):(m.storeState(f),m.expectedStateId=f.id,n.pushState(f.id,f.title,f.url),m.Adapter.trigger(a,"popstate")),!0},m.replaceState=function(b,c,d,e){if(m.getHashByUrl(d)&&m.emulated.pushState)throw new Error("History.js does not support states with fragement-identifiers (hashes/anchors).");if(e!==!1&&m.busy())return m.pushQueue({scope:m,callback:m.replaceState,args:arguments,queue:e}),!1;m.busy(!0);var f=m.createStateObject(b,c,d);return m.isLastSavedState(f)?m.busy(!1):(m.storeState(f),m.expectedStateId=f.id,n.replaceState(f.id,f.title,f.url),m.Adapter.trigger(a,"popstate")),!0};if(f){try{m.store=k.parse(f.getItem("History.store"))||{}}catch(p){m.store={}}m.normalizeStore()}else m.store={},m.normalizeStore();m.Adapter.bind(a,"beforeunload",m.clearAllIntervals),m.Adapter.bind(a,"unload",m.clearAllIntervals),m.saveState(m.storeState(m.extractState(d.location.href,!0))),f&&(m.onUnload=function(){var a,b;try{a=k.parse(f.getItem("History.store"))||{}}catch(c){a={}}a.idToState=a.idToState||{},a.urlToId=a.urlToId||{},a.stateToId=a.stateToId||{};for(b in m.idToState){if(!m.idToState.hasOwnProperty(b))continue;a.idToState[b]=m.idToState[b]}for(b in m.urlToId){if(!m.urlToId.hasOwnProperty(b))continue;a.urlToId[b]=m.urlToId[b]}for(b in m.stateToId){if(!m.stateToId.hasOwnProperty(b))continue;a.stateToId[b]=m.stateToId[b]}m.store=a,m.normalizeStore(),f.setItem("History.store",k.stringify(a))},m.intervalList.push(i(m.onUnload,m.options.storeInterval)),m.Adapter.bind(a,"beforeunload",m.onUnload),m.Adapter.bind(a,"unload",m.onUnload));if(!m.emulated.pushState){m.bugs.safariPoll&&m.intervalList.push(i(m.safariStatePoll,m.options.safariPollInterval));if(e.vendor==="Apple Computer, Inc."||(e.appCodeName||"")==="Mozilla")m.Adapter.bind(a,"hashchange",function(){m.Adapter.trigger(a,"popstate")}),m.getHash()&&m.Adapter.onDomLoad(function(){m.Adapter.trigger(a,"hashchange")})}},m.init()}(window) \ No newline at end of file +window.JSON||(window.JSON={}),function(){function f(a){return a<10?"0"+a:a}function quote(a){return escapable.lastIndex=0,escapable.test(a)?'"'+a.replace(escapable,function(a){var b=meta[a];return typeof b=="string"?b:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function str(a,b){var c,d,e,f,g=gap,h,i=b[a];i&&typeof i=="object"&&typeof i.toJSON=="function"&&(i=i.toJSON(a)),typeof rep=="function"&&(i=rep.call(b,a,i));switch(typeof i){case"string":return quote(i);case"number":return isFinite(i)?String(i):"null";case"boolean":case"null":return String(i);case"object":if(!i)return"null";gap+=indent,h=[];if(Object.prototype.toString.apply(i)==="[object Array]"){f=i.length;for(c=0;c")&&c[0]);return a>4?a:!1}();return a},m.isInternetExplorer=function(){var a=m.isInternetExplorer.cached=typeof m.isInternetExplorer.cached!="undefined"?m.isInternetExplorer.cached:Boolean(m.getInternetExplorerMajorVersion());return a},m.emulated={pushState:!Boolean(a.history&&a.history.pushState&&a.history.replaceState&&!/ Mobile\/([1-7][a-z]|(8([abcde]|f(1[0-8]))))/i.test(e.userAgent)&&!/AppleWebKit\/5([0-2]|3[0-2])/i.test(e.userAgent)),hashChange:Boolean(!("onhashchange"in a||"onhashchange"in d)||m.isInternetExplorer()&&m.getInternetExplorerMajorVersion()<8)},m.enabled=!m.emulated.pushState,m.bugs={setHash:Boolean(!m.emulated.pushState&&e.vendor==="Apple Computer, Inc."&&/AppleWebKit\/5([0-2]|3[0-3])/.test(e.userAgent)),safariPoll:Boolean(!m.emulated.pushState&&e.vendor==="Apple Computer, Inc."&&/AppleWebKit\/5([0-2]|3[0-3])/.test(e.userAgent)),ieDoubleCheck:Boolean(m.isInternetExplorer()&&m.getInternetExplorerMajorVersion()<8),hashEscape:Boolean(m.isInternetExplorer()&&m.getInternetExplorerMajorVersion()<7)},m.isEmptyObject=function(a){for(var b in a)return!1;return!0},m.cloneObject=function(a){var b,c;return a?(b=k.stringify(a),c=k.parse(b)):c={},c},m.getRootUrl=function(){var a=d.location.protocol+"//"+(d.location.hostname||d.location.host);if(d.location.port||!1)a+=":"+d.location.port;return a+="/",a},m.getBaseHref=function(){var a=d.getElementsByTagName("base"),b=null,c="";return a.length===1&&(b=a[0],c=b.href.replace(/[^\/]+$/,"")),c=c.replace(/\/+$/,""),c&&(c+="/"),c},m.getBaseUrl=function(){var a=m.getBaseHref()||m.getBasePageUrl()||m.getRootUrl();return a},m.getPageUrl=function(){var a=m.getState(!1,!1),b=(a||{}).url||d.location.href,c;return c=b.replace(/\/+$/,"").replace(/[^\/]+$/,function(a,b,c){return/\./.test(a)?a:a+"/"}),c},m.getBasePageUrl=function(){var a=d.location.href.replace(/[#\?].*/,"").replace(/[^\/]+$/,function(a,b,c){return/[^\/]$/.test(a)?"":a}).replace(/\/+$/,"")+"/";return a},m.getFullUrl=function(a,b){var c=a,d=a.substring(0,1);return b=typeof b=="undefined"?!0:b,/[a-z]+\:\/\//.test(a)||(d==="/"?c=m.getRootUrl()+a.replace(/^\/+/,""):d==="#"?c=m.getPageUrl().replace(/#.*/,"")+a:d==="?"?c=m.getPageUrl().replace(/[\?#].*/,"")+a:b?c=m.getBaseUrl()+a.replace(/^(\.\/)+/,""):c=m.getBasePageUrl()+a.replace(/^(\.\/)+/,"")),c.replace(/\#$/,"")},m.getShortUrl=function(a){var b=a,c=m.getBaseUrl(),d=m.getRootUrl();return m.emulated.pushState&&(b=b.replace(c,"")),b=b.replace(d,"/"),m.isTraditionalAnchor(b)&&(b="./"+b),b=b.replace(/^(\.\/)+/g,"./").replace(/\#$/,""),b},m.store={},m.idToState=m.idToState||{},m.stateToId=m.stateToId||{},m.urlToId=m.urlToId||{},m.storedStates=m.storedStates||[],m.savedStates=m.savedStates||[],m.normalizeStore=function(){m.store.idToState=m.store.idToState||{},m.store.urlToId=m.store.urlToId||{},m.store.stateToId=m.store.stateToId||{}},m.getState=function(a,b){typeof a=="undefined"&&(a=!0),typeof b=="undefined"&&(b=!0);var c=m.getLastSavedState();return!c&&b&&(c=m.createStateObject()),a&&(c=m.cloneObject(c),c.url=c.cleanUrl||c.url),c},m.getIdByState=function(a){var b=m.extractId(a.url),c;if(!b){c=m.getStateString(a);if(typeof m.stateToId[c]!="undefined")b=m.stateToId[c];else if(typeof m.store.stateToId[c]!="undefined")b=m.store.stateToId[c];else{for(;;){b=(new Date).getTime()+String(Math.random()).replace(/\D/g,"");if(typeof m.idToState[b]=="undefined"&&typeof m.store.idToState[b]=="undefined")break}m.stateToId[c]=b,m.idToState[b]=a}}return b},m.normalizeState=function(a){var b,c;if(!a||typeof a!="object")a={};if(typeof a.normalized!="undefined")return a;if(!a.data||typeof a.data!="object")a.data={};b={},b.normalized=!0,b.title=a.title||"",b.url=m.getFullUrl(m.unescapeString(a.url||d.location.href)),b.hash=m.getShortUrl(b.url),b.data=m.cloneObject(a.data),b.id=m.getIdByState(b),b.cleanUrl=b.url.replace(/\??\&_suid.*/,""),b.url=b.cleanUrl,c=!m.isEmptyObject(b.data);if(b.title||c)b.hash=m.getShortUrl(b.url).replace(/\??\&_suid.*/,""),/\?/.test(b.hash)||(b.hash+="?"),b.hash+="&_suid="+b.id;return b.hashedUrl=m.getFullUrl(b.hash),(m.emulated.pushState||m.bugs.safariPoll)&&m.hasUrlDuplicate(b)&&(b.url=b.hashedUrl),b},m.createStateObject=function(a,b,c){var d={data:a,title:b,url:c};return d=m.normalizeState(d),d},m.getStateById=function(a){a=String(a);var c=m.idToState[a]||m.store.idToState[a]||b;return c},m.getStateString=function(a){var b,c,d;return b=m.normalizeState(a),c={data:b.data,title:a.title,url:a.url},d=k.stringify(c),d},m.getStateId=function(a){var b,c;return b=m.normalizeState(a),c=b.id,c},m.getHashByState=function(a){var b,c;return b=m.normalizeState(a),c=b.hash,c},m.extractId=function(a){var b,c,d;return c=/(.*)\&_suid=([0-9]+)$/.exec(a),d=c?c[1]||a:a,b=c?String(c[2]||""):"",b||!1},m.isTraditionalAnchor=function(a){var b=!/[\/\?\.]/.test(a);return b},m.extractState=function(a,b){var c=null,d,e;return b=b||!1,d=m.extractId(a),d&&(c=m.getStateById(d)),c||(e=m.getFullUrl(a),d=m.getIdByUrl(e)||!1,d&&(c=m.getStateById(d)),!c&&b&&!m.isTraditionalAnchor(a)&&(c=m.createStateObject(null,null,e))),c},m.getIdByUrl=function(a){var c=m.urlToId[a]||m.store.urlToId[a]||b;return c},m.getLastSavedState=function(){return m.savedStates[m.savedStates.length-1]||b},m.getLastStoredState=function(){return m.storedStates[m.storedStates.length-1]||b},m.hasUrlDuplicate=function(a){var b=!1,c;return c=m.extractState(a.url),b=c&&c.id!==a.id,b},m.storeState=function(a){return m.urlToId[a.url]=a.id,m.storedStates.push(m.cloneObject(a)),a},m.isLastSavedState=function(a){var b=!1,c,d,e;return m.savedStates.length&&(c=a.id,d=m.getLastSavedState(),e=d.id,b=c===e),b},m.saveState=function(a){return m.isLastSavedState(a)?!1:(m.savedStates.push(m.cloneObject(a)),!0)},m.getStateByIndex=function(a){var b=null;return typeof a=="undefined"?b=m.savedStates[m.savedStates.length-1]:a<0?b=m.savedStates[m.savedStates.length+a]:b=m.savedStates[a],b},m.getHash=function(){var a=m.unescapeHash(d.location.hash);return a},m.unescapeString=function(b){var c=b,d;for(;;){d=a.unescape(c);if(d===c)break;c=d}return c},m.unescapeHash=function(a){var b=m.normalizeHash(a);return b=m.unescapeString(b),b},m.normalizeHash=function(a){var b=a.replace(/[^#]*#/,"").replace(/#.*/,"");return b},m.setHash=function(a,b){var c,e,f;return b!==!1&&m.busy()?(m.pushQueue({scope:m,callback:m.setHash,args:arguments,queue:b}),!1):(c=m.escapeHash(a),m.busy(!0),e=m.extractState(a,!0),e&&!m.emulated.pushState?m.pushState(e.data,e.title,e.url,!1):d.location.hash!==c&&(m.bugs.setHash?(f=m.getPageUrl(),m.pushState(null,null,f+"#"+c,!1)):d.location.hash=c),m)},m.escapeHash=function(b){var c=m.normalizeHash(b);return c=a.escape(c),m.bugs.hashEscape||(c=c.replace(/\%21/g,"!").replace(/\%26/g,"&").replace(/\%3D/g,"=").replace(/\%3F/g,"?")),c},m.getHashByUrl=function(a){var b=String(a).replace(/([^#]*)#?([^#]*)#?(.*)/,"$2");return b=m.unescapeHash(b),b},m.setTitle=function(a){var b=a.title,c;b||(c=m.getStateByIndex(0),c&&c.url===a.url&&(b=c.title||m.options.initialTitle));try{d.getElementsByTagName("title")[0].innerHTML=b.replace("<","<").replace(">",">").replace(" & "," & ")}catch(e){}return d.title=b,m},m.queues=[],m.busy=function(a){typeof a!="undefined"?m.busy.flag=a:typeof m.busy.flag=="undefined"&&(m.busy.flag=!1);if(!m.busy.flag){h(m.busy.timeout);var b=function(){var a,c,d;if(m.busy.flag)return;for(a=m.queues.length-1;a>=0;--a){c=m.queues[a];if(c.length===0)continue;d=c.shift(),m.fireQueueItem(d),m.busy.timeout=g(b,m.options.busyDelay)}};m.busy.timeout=g(b,m.options.busyDelay)}return m.busy.flag},m.busy.flag=!1,m.fireQueueItem=function(a){return a.callback.apply(a.scope||m,a.args||[])},m.pushQueue=function(a){return m.queues[a.queue||0]=m.queues[a.queue||0]||[],m.queues[a.queue||0].push(a),m},m.queue=function(a,b){return typeof a=="function"&&(a={callback:a}),typeof b!="undefined"&&(a.queue=b),m.busy()?m.pushQueue(a):m.fireQueueItem(a),m},m.clearQueue=function(){return m.busy.flag=!1,m.queues=[],m},m.stateChanged=!1,m.doubleChecker=!1,m.doubleCheckComplete=function(){return m.stateChanged=!0,m.doubleCheckClear(),m},m.doubleCheckClear=function(){return m.doubleChecker&&(h(m.doubleChecker),m.doubleChecker=!1),m},m.doubleCheck=function(a){return m.stateChanged=!1,m.doubleCheckClear(),m.bugs.ieDoubleCheck&&(m.doubleChecker=g(function(){return m.doubleCheckClear(),m.stateChanged||a(),!0},m.options.doubleCheckInterval)),m},m.safariStatePoll=function(){var b=m.extractState(d.location.href),c;if(!m.isLastSavedState(b))c=b;else return;return c||(c=m.createStateObject()),m.Adapter.trigger(a,"popstate"),m},m.back=function(a){return a!==!1&&m.busy()?(m.pushQueue({scope:m,callback:m.back,args:arguments,queue:a}),!1):(m.busy(!0),m.doubleCheck(function(){m.back(!1)}),n.go(-1),!0)},m.forward=function(a){return a!==!1&&m.busy()?(m.pushQueue({scope:m,callback:m.forward,args:arguments,queue:a}),!1):(m.busy(!0),m.doubleCheck(function(){m.forward(!1)}),n.go(1),!0)},m.go=function(a,b){var c;if(a>0)for(c=1;c<=a;++c)m.forward(b);else{if(!(a<0))throw new Error("History.go: History.go requires a positive or negative integer passed.");for(c=-1;c>=a;--c)m.back(b)}return m};if(m.emulated.pushState){var o=function(){};m.pushState=m.pushState||o,m.replaceState=m.replaceState||o}else m.onPopState=function(b,c){var e=!1,f=!1,g,h;return m.doubleCheckComplete(),g=m.getHash(),g?(h=m.extractState(g||d.location.href,!0),h?m.replaceState(h.data,h.title,h.url,!1):(m.Adapter.trigger(a,"anchorchange"),m.busy(!1)),m.expectedStateId=!1,!1):(e=m.Adapter.extractEventData("state",b,c)||!1,e?f=m.getStateById(e):m.expectedStateId?f=m.getStateById(m.expectedStateId):f=m.extractState(d.location.href),f||(f=m.createStateObject(null,null,d.location.href)),m.expectedStateId=!1,m.isLastSavedState(f)?(m.busy(!1),!1):(m.storeState(f),m.saveState(f),m.setTitle(f),m.Adapter.trigger(a,"statechange"),m.busy(!1),!0))},m.Adapter.bind(a,"popstate",m.onPopState),m.pushState=function(b,c,d,e){if(m.getHashByUrl(d)&&m.emulated.pushState)throw new Error("History.js does not support states with fragement-identifiers (hashes/anchors).");if(e!==!1&&m.busy())return m.pushQueue({scope:m,callback:m.pushState,args:arguments,queue:e}),!1;m.busy(!0);var f=m.createStateObject(b,c,d);return m.isLastSavedState(f)?m.busy(!1):(m.storeState(f),m.expectedStateId=f.id,n.pushState(f.id,f.title,f.url),m.Adapter.trigger(a,"popstate")),!0},m.replaceState=function(b,c,d,e){if(m.getHashByUrl(d)&&m.emulated.pushState)throw new Error("History.js does not support states with fragement-identifiers (hashes/anchors).");if(e!==!1&&m.busy())return m.pushQueue({scope:m,callback:m.replaceState,args:arguments,queue:e}),!1;m.busy(!0);var f=m.createStateObject(b,c,d);return m.isLastSavedState(f)?m.busy(!1):(m.storeState(f),m.expectedStateId=f.id,n.replaceState(f.id,f.title,f.url),m.Adapter.trigger(a,"popstate")),!0};if(f){try{m.store=k.parse(f.getItem("History.store"))||{}}catch(p){m.store={}}m.normalizeStore()}else m.store={},m.normalizeStore();m.Adapter.bind(a,"beforeunload",m.clearAllIntervals),m.Adapter.bind(a,"unload",m.clearAllIntervals),m.saveState(m.storeState(m.extractState(d.location.href,!0))),f&&(m.onUnload=function(){var a,b;try{a=k.parse(f.getItem("History.store"))||{}}catch(c){a={}}a.idToState=a.idToState||{},a.urlToId=a.urlToId||{},a.stateToId=a.stateToId||{};for(b in m.idToState){if(!m.idToState.hasOwnProperty(b))continue;a.idToState[b]=m.idToState[b]}for(b in m.urlToId){if(!m.urlToId.hasOwnProperty(b))continue;a.urlToId[b]=m.urlToId[b]}for(b in m.stateToId){if(!m.stateToId.hasOwnProperty(b))continue;a.stateToId[b]=m.stateToId[b]}m.store=a,m.normalizeStore(),f.setItem("History.store",k.stringify(a))},m.intervalList.push(i(m.onUnload,m.options.storeInterval)),m.Adapter.bind(a,"beforeunload",m.onUnload),m.Adapter.bind(a,"unload",m.onUnload));if(!m.emulated.pushState){m.bugs.safariPoll&&m.intervalList.push(i(m.safariStatePoll,m.options.safariPollInterval));if(e.vendor==="Apple Computer, Inc."||(e.appCodeName||"")==="Mozilla")m.Adapter.bind(a,"hashchange",function(){m.Adapter.trigger(a,"popstate")}),m.getHash()&&m.Adapter.onDomLoad(function(){m.Adapter.trigger(a,"hashchange")})}},m.init()}(window) diff --git a/imgee/static/js/jquery.jeditable.min.js b/imgee/static/js/jquery.jeditable.min.js index ef885f06..bfe6d94a 100644 --- a/imgee/static/js/jquery.jeditable.min.js +++ b/imgee/static/js/jquery.jeditable.min.js @@ -35,4 +35,4 @@ $(this).append(textarea);return(textarea);}},select:{element:function(settings,o for(var key in json){if(!json.hasOwnProperty(key)){continue;} if('selected'==key){continue;} var option=$('