From: Łukasz Rekucki Date: Mon, 19 Apr 2010 19:50:37 +0000 (+0200) Subject: Simpler deployment. X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/f938afb8ab4cb091d12e0ef0311eaea14b774798 Simpler deployment. --- diff --git a/README.md b/README.md new file mode 100644 index 00000000..47fad0c8 --- /dev/null +++ b/README.md @@ -0,0 +1,40 @@ +==================== +Platforma Redakcyjna +==================== + +Opis projektu +============= +Platforma to serwis służący do grupowej edycji książek na potrzeby serwisu WolneLektury.pl. + +Instalacja i użycie +=================== +#. Ściągnij i zainstaluj `pip `_ +#. Przejdź do katalogu serwisu w konsoli +#. Zainstaluj wymagane biblioteki komendą:: + + pip install -r requirements.txt + +#. Wypełnij bazę danych (Django poprosi o utworzenie pierwszego użytkownika):: + + ./project/manage.py syncdb + +#. Skopiuj zawartość pliku `project/localsettings.sample` do `project/localsettings.py` i zmień go zgodnie ze swoimi potrzebami. + +#. Uruchom serwer deweloperski:: + + ./project/manage.py runserver + +#. Zalecane jest serwowanie aplikacji przez `modwsgi `_ na serwerze `Apache2 `_ przy pomocy załączonego skryptu `dispatch.fcgi`. Inne strategie wdrożeniowe opisane są w `Dokumentacji Django `_. + +Wdrożenie +========= +#. Ściągnij i zainstaluj `fabric `_ +#. Przejdź do katalogu serwisu w konsoli +#. Aby wdrożyć serwis na serwer deweloperski wpisz komendę:: + + fab staging deploy + + Aby wdrożyć serwis na serwer produkcyjny wpisz:: + + fab production deploy + diff --git a/README.rst b/README.rst deleted file mode 100644 index 47fad0c8..00000000 --- a/README.rst +++ /dev/null @@ -1,40 +0,0 @@ -==================== -Platforma Redakcyjna -==================== - -Opis projektu -============= -Platforma to serwis służący do grupowej edycji książek na potrzeby serwisu WolneLektury.pl. - -Instalacja i użycie -=================== -#. Ściągnij i zainstaluj `pip `_ -#. Przejdź do katalogu serwisu w konsoli -#. Zainstaluj wymagane biblioteki komendą:: - - pip install -r requirements.txt - -#. Wypełnij bazę danych (Django poprosi o utworzenie pierwszego użytkownika):: - - ./project/manage.py syncdb - -#. Skopiuj zawartość pliku `project/localsettings.sample` do `project/localsettings.py` i zmień go zgodnie ze swoimi potrzebami. - -#. Uruchom serwer deweloperski:: - - ./project/manage.py runserver - -#. Zalecane jest serwowanie aplikacji przez `modwsgi `_ na serwerze `Apache2 `_ przy pomocy załączonego skryptu `dispatch.fcgi`. Inne strategie wdrożeniowe opisane są w `Dokumentacji Django `_. - -Wdrożenie -========= -#. Ściągnij i zainstaluj `fabric `_ -#. Przejdź do katalogu serwisu w konsoli -#. Aby wdrożyć serwis na serwer deweloperski wpisz komendę:: - - fab staging deploy - - Aby wdrożyć serwis na serwer produkcyjny wpisz:: - - fab production deploy - diff --git a/deployment.py b/deployment.py new file mode 100644 index 00000000..bdfbb43a --- /dev/null +++ b/deployment.py @@ -0,0 +1,65 @@ +#!/srv/internal/cas/pythonenv/bin/python +from __future__ import with_statement + +import shutil +import os +import sys + +from string import Template + +def render_template(source, dest, context={}): + print "Rendering template:", + with open(source, 'rb') as source_file: + t = Template(source_file.read()) + with open(dest, 'wb') as dest_file: + dest_file.write(t.safe_substitute(context)) + print "done." + +def restart_wsgi(): + print "Restarting wsgi application:", + os.system("touch %s" % WSGI_TARGET) + print "done." + +def update_application(): + print "Updating repository.", + os.system("cd %s; git pull" % PROJECT_ROOT) + print "Installing requirements" + os.system("pip install -r %s" % os.path.join(PROJECT_ROOT, 'requirements.txt')) + print "Installing local requirements" + os.system("pip install -r %s" % os.path.join(ROOT, 'etc', 'requirements.txt')) + print "done." + +ROOT = os.path.dirname(os.path.abspath(__file__)) + +PYTHON = os.path.join(ROOT, 'pythonenv', 'bin', 'python') +PYTHON_SITE = os.path.join(ROOT, 'pythonenv', 'lib', 'python2.6', 'site-packages') + +PROJECT_NAME = 'redakcja' +PROJECT_ROOT = os.path.join(ROOT, 'app') + +MEDIA_ROOT = os.path.join(ROOT, 'www', 'media') + +ADMIN_EMAIL = 'lrekucki@gmail.com' + +WSGI_TARGET = os.path.join(ROOT, 'www', 'wsgi', PROJECT_NAME + '.wsgi') +WSGI_DIR = os.path.dirname(WSGI_TARGET) + +WSGI_USER = PROJECT_NAME +WSGI_PROCESSES = 5 +WSGI_THREADS = 1 + +DOMAIN = 'redakcja.wolnelektury.pl' +DOMAIN_ALIASES = 'redakcja.nowoczesnapolska.org.pl' + +# +# Load local configuration +# +sys.path = [ os.path.join(ROOT, 'etc') ] + sys.path + +from local_deployment import * + +if __name__ == '__main__': + update_application() + render_template(os.path.join(PROJECT_ROOT, PROJECT_NAME + '.wsgi.template'), WSGI_TARGET, context=globals()) + render_template(os.path.join(PROJECT_ROOT, PROJECT_NAME + '.vhost.template'), os.path.join(ROOT, 'etc', PROJECT_NAME + '.vhost'), context=globals()) + restart_wsgi() diff --git a/fabfile.py b/fabfile.py deleted file mode 100644 index 399f1c2f..00000000 --- a/fabfile.py +++ /dev/null @@ -1,218 +0,0 @@ -from __future__ import with_statement # needed for python 2.5 -from fabric.api import * -from fabric.contrib import files - -import os -import time - -# ========== -# = Config = -# ========== -# Globals -env.project_name = 'platforma' -env.use_south = True -env.giturl = "git://github.com/fnp/redakcja.git" - - -# Servers -def staging(): - """Use staging server""" - env.hosts = ['stigma.nowoczesnapolska.org.pl:2222'] - env.user = 'platforma' - env.path = '/var/services/platforma' - env.python = '/usr/bin/python' - env.virtualenv = '/usr/bin/virtualenv' - env.pip = '/usr/bin/pip' - env.gitbranch = "staging" - common() - - -def production(): - """Use production server""" - env.hosts = ['szo.nowoczesnapolska.org.pl:2225'] - env.user = 'librarian' - env.gitbranch = 'master' - env.sandbox = '/srv/library-in-a-box/sandbox/' - env.virtualenv = os.path.join(env.sandbox, 'bin', 'virtualenv') - - env.pip = os.path.join(env.sandbox, 'python', 'bin', 'pip') - env.python = os.path.join(env.sandbox, 'python', 'bin', 'python') - common() - - -def common(): - env.path = os.path.join(env.sandbox, env.project_name) - env.target = os.path.join(env.path, 'bin', 'python') - - -# ========= -# = Tasks = -# ========= -def test(): - "Run the test suite and bail out if it fails" - require('hosts', 'path', provided_by=[staging, production]) - result = run('cd %(path)s/%(project_name)s; %(python)s manage.py test' % env) - - -def setup(): - """ - Setup a fresh virtualenv as well as a few useful directories, then run - a full deployment. virtualenv and pip should be already installed. - """ - require('hosts', 'sandbox', provided_by=[staging, production]) - - run("mkdir -p %(path)s; mkdir -p %(path)s/www/wsgi; mkdir -p %(path)s/www/media" % env) - - # make a git mirror - run("""cd %(path)s; -git clone %(giturl)s mirror; -cd %(path)s/mirror; -git pull""" % env, pty=True) - - run('%(virtualenv)s %(path)s' % env, pty=True) - run('cd %(path)s; rm -rf releases shared packages; mkdir -p releases; mkdir -p shared; mkdir -p packages;' % env, pty=True) - - # symlink static content - run("""cd %(path)s/www/media; -ln -sf %(path)s/releases/current/%(project_name)s/static static -ln -sf %(path)s/lib/python2.6/site-packages/django/contrib/admin/media admin-media -mkdir -p dynamic -""" % env) - - run('cd %(path)s/releases; ln -s . current; ln -s . previous' % env, pty=True) - - deploy() - - -def deploy(): - """ - Deploy the latest version of the site to the servers, - install any required third party modules, - install the virtual host and then restart the webserver - """ - require('hosts', 'sandbox', 'gitbranch', provided_by=[staging, production]) - - env.release = time.strftime('%Y-%m-%dT%H%M') - - prepare_package_from_git() - - upload_wsgi_script() -# upload_vhost_sample() - install_requirements() - hardlink_localsettings() - symlink_current_release() - migrate() - django_compress() - restart_webserver() - - -def deploy_version(version): - "Specify a specific version to be made live" - require('hosts', 'path', provided_by=[localhost, webserver]) - env.version = version - with cd(env.path): - run('rm releases/previous; mv releases/current releases/previous;', pty=True) - run('ln -s %(version)s releases/current' % env, pty=True) - - restart_webserver() - - -def rollback(): - """ - Limited rollback capability. Simple loads the previously current - version of the code. Rolling back again will swap between the two. - """ - require('hosts', provided_by=[staging, production]) - require('path') - with cd(env.path): - run('mv releases/current releases/_previous;', pty=True) - run('mv releases/previous releases/current;', pty=True) - run('mv releases/_previous releases/previous;', pty=True) - restart_webserver() - - -# ===================================================================== -# = Helpers. These are called by other functions rather than directly = -# ===================================================================== -def prepare_package_from_git(): - "Create an archive from the current Git master branch and upload it" - print '>>> upload tar from git' - - require('release', provided_by=[deploy]) - - run('mkdir -p %(path)s/releases/%(release)s' % env, pty=True) - run('mkdir -p %(path)s/packages' % env, pty=True) - run('cd %(path)s/mirror; git pull; git archive --format=tar %(gitbranch)s | gzip > %(path)s/packages/%(release)s.tar.gz' % env) - run('cd %(path)s/releases/%(release)s && tar zxf ../../packages/%(release)s.tar.gz' % env, pty=True) - - -#def upload_vhost_sample(): -# "Create and upload Apache virtual host configuration sample" -# print ">>> upload vhost sample" -# files.upload_template('%(project_name)s.vhost.template' % env, '%(path)s/%(project_name)s.vhost.sample' % env, context=env) - - -def upload_wsgi_script(): - "Create and upload a wsgi script sample" - print ">>> upload wsgi script sample" - files.upload_template('%(project_name)s/config/%(project_name)s.wsgi.template' % env, '%(path)s/www/wsgi/%(project_name)s.wsgi' % env, context=env) - run('chmod ug+x %(path)s/www/wsgi/%(project_name)s.wsgi' % env) - - -def install_requirements(): - "Install the required packages from the requirements file using pip" - - print '>>> Instaling global requirements' - require('release', provided_by=[deploy]) - run('cd %(path)s; %(path)s/bin/pip install -r %(path)s/releases/%(release)s/%(project_name)s/config/requirements.txt' % env, pty=True) - - print '>>> Instaling site requirements' - - with settings(warn_only=True): - run('cd %(path)s; %(path)s/bin/pip install -r %(sandbox)s/etc/%(project_name)s/requirements.txt' % env, pty=True) - - -def hardlink_localsettings(): - "Hardlink localsettings.py from root directory to release directory (if this file exists)" - print ">>> Hardlink localsettings" - require('release', 'path', provided_by=[deploy]) - require('sandbox', provided_by=[staging, production]) - - # hardlink localsettings - with settings(warn_only=True): - run('ln %(sandbox)s/etc/%(project_name)s/localsettings.py %(path)s/releases/%(release)s/%(project_name)s' % env) - - -def symlink_current_release(): - "Symlink our current release" - print '>>> symlink current release' - require('release', provided_by=[deploy]) - require('path', provided_by=[staging, production]) - with cd(env.path): - run('rm releases/previous; mv releases/current releases/previous') - run('ln -s %(release)s releases/current' % env) - - -def migrate(): - "Update the database" - print '>>> migrate' - require('project_name', provided_by=[staging, production]) - with cd('%(path)s/releases/current/%(project_name)s' % env): - run('%(target)s manage.py syncdb --noinput' % env, pty=True) - - if env.use_south: - run('%(target)s manage.py migrate' % env, pty=True) - - -def django_compress(): - "Update static files" - print '>>> migrate' - require('project_name', provided_by=[staging, production]) - with cd('%(path)s/releases/current/%(project_name)s' % env): - run('%(target)s manage.py synccompress --force' % env, pty=True) - - -def restart_webserver(): - "Restart the web server" - print '>>> restart webserver' - run('touch %(path)s/www/wsgi/%(project_name)s.wsgi' % env) diff --git a/localsettings.sample b/localsettings.sample new file mode 100644 index 00000000..c174cf92 --- /dev/null +++ b/localsettings.sample @@ -0,0 +1,18 @@ +# +# localsettings template for Platforma +# +# Duplicate this file as localsettings.py and change it to your liking. +# Settings defined in localsettings.py will override settings from +# settings.py file. localsettings.py should never be commited +# to a version control system. Please make changes to settings.py +# or localsettings.sample instead. +# + +# Path to repository with managed documents +REPOSITORY_PATH = '/home/user/repository' + +# Subdirectory of STATIC_ROOT containing images +IMAGE_DIR = 'images' + +CAS_SERVICE_URL = 'http://stigma.nowoczesnapolska.org.pl/cas/' + diff --git a/logging.cfg b/logging.cfg new file mode 100644 index 00000000..9bfa56c2 --- /dev/null +++ b/logging.cfg @@ -0,0 +1,29 @@ +[loggers] +keys=root,fnp + +[handlers] +keys=console + +[formatters] +keys=default + +[logger_root] +level=DEBUG +handlers=console + +[logger_fnp] +level=DEBUG +handlers=console +qualname=fnp +propagate=0 + +[formatter_default] +format=%(asctime)s %(name)s/%(levelname)s :: %(module)s.%(funcName)s:%(lineno)d :: %(message)s +datefmt= +class=logging.Formatter + +[handler_console] +class=StreamHandler +level=DEBUG +formatter=default +args=(sys.stderr, ) \ No newline at end of file diff --git a/logging.cfg.dev b/logging.cfg.dev new file mode 100644 index 00000000..9bfa56c2 --- /dev/null +++ b/logging.cfg.dev @@ -0,0 +1,29 @@ +[loggers] +keys=root,fnp + +[handlers] +keys=console + +[formatters] +keys=default + +[logger_root] +level=DEBUG +handlers=console + +[logger_fnp] +level=DEBUG +handlers=console +qualname=fnp +propagate=0 + +[formatter_default] +format=%(asctime)s %(name)s/%(levelname)s :: %(module)s.%(funcName)s:%(lineno)d :: %(message)s +datefmt= +class=logging.Formatter + +[handler_console] +class=StreamHandler +level=DEBUG +formatter=default +args=(sys.stderr, ) \ No newline at end of file diff --git a/platforma/__init__.py b/platforma/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/platforma/compress_settings.py b/platforma/compress_settings.py deleted file mode 100644 index fa416c41..00000000 --- a/platforma/compress_settings.py +++ /dev/null @@ -1,70 +0,0 @@ -# CSS and JS files to compress -COMPRESS_CSS = { - 'detail': { - 'source_filenames': ( - 'css/master.css', - 'css/gallery.css', - 'css/history.css', - 'css/summary.css', - 'css/html.css', - 'css/jquery.autocomplete.css', - 'css/dialogs.css', - ), - 'output_filename': 'compressed/detail_styles_?.css', - }, - 'listing': { - 'source_filenames': ( - 'css/filelist.css', - ), - 'output_filename': 'compressed/listing_styles_?.css', - } -} - -COMPRESS_JS = { - # everything except codemirror - 'detail': { - 'source_filenames': ( - # libraries - 'js/jquery-1.4.2.min.js', - 'js/jquery.autocomplete.js', - 'js/jquery.blockui.js', - 'js/jquery.elastic.js', - 'js/button_scripts.js', - 'js/slugify.js', - - # wiki scripts - 'js/wiki/wikiapi.js', - 'js/wiki/xslt.js', - - # base UI - 'js/wiki/base.js', - - # dialogs - 'js/wiki/dialog_save.js', - 'js/wiki/dialog_addtag.js', - - # views - 'js/wiki/view_history.js', - 'js/wiki/view_summary.js', - 'js/wiki/view_editor_source.js', - 'js/wiki/view_editor_wysiwyg.js', - 'js/wiki/view_gallery.js', - 'js/wiki/view_column_diff.js', - ), - 'output_filename': 'compressed/detail_scripts_?.js', - }, - 'listing': { - 'source_filenames': ( - 'js/jquery-1.4.2.min.js', - 'js/slugify.js', - ), - 'output_filename': 'compressed/listing_scripts_?.js', - } -} - -COMPRESS = True -COMPRESS_CSS_FILTERS = None -COMPRESS_JS_FILTERS = None -COMPRESS_AUTO = False -COMPRESS_VERSION = True -COMPRESS_VERSIONING = 'compress.versioning.hash.MD5Versioning' diff --git a/platforma/config/localsettings.sample b/platforma/config/localsettings.sample deleted file mode 100644 index c174cf92..00000000 --- a/platforma/config/localsettings.sample +++ /dev/null @@ -1,18 +0,0 @@ -# -# localsettings template for Platforma -# -# Duplicate this file as localsettings.py and change it to your liking. -# Settings defined in localsettings.py will override settings from -# settings.py file. localsettings.py should never be commited -# to a version control system. Please make changes to settings.py -# or localsettings.sample instead. -# - -# Path to repository with managed documents -REPOSITORY_PATH = '/home/user/repository' - -# Subdirectory of STATIC_ROOT containing images -IMAGE_DIR = 'images' - -CAS_SERVICE_URL = 'http://stigma.nowoczesnapolska.org.pl/cas/' - diff --git a/platforma/config/logging.cfg b/platforma/config/logging.cfg deleted file mode 100644 index 9bfa56c2..00000000 --- a/platforma/config/logging.cfg +++ /dev/null @@ -1,29 +0,0 @@ -[loggers] -keys=root,fnp - -[handlers] -keys=console - -[formatters] -keys=default - -[logger_root] -level=DEBUG -handlers=console - -[logger_fnp] -level=DEBUG -handlers=console -qualname=fnp -propagate=0 - -[formatter_default] -format=%(asctime)s %(name)s/%(levelname)s :: %(module)s.%(funcName)s:%(lineno)d :: %(message)s -datefmt= -class=logging.Formatter - -[handler_console] -class=StreamHandler -level=DEBUG -formatter=default -args=(sys.stderr, ) \ No newline at end of file diff --git a/platforma/config/logging.cfg.dev b/platforma/config/logging.cfg.dev deleted file mode 100644 index 9bfa56c2..00000000 --- a/platforma/config/logging.cfg.dev +++ /dev/null @@ -1,29 +0,0 @@ -[loggers] -keys=root,fnp - -[handlers] -keys=console - -[formatters] -keys=default - -[logger_root] -level=DEBUG -handlers=console - -[logger_fnp] -level=DEBUG -handlers=console -qualname=fnp -propagate=0 - -[formatter_default] -format=%(asctime)s %(name)s/%(levelname)s :: %(module)s.%(funcName)s:%(lineno)d :: %(message)s -datefmt= -class=logging.Formatter - -[handler_console] -class=StreamHandler -level=DEBUG -formatter=default -args=(sys.stderr, ) \ No newline at end of file diff --git a/platforma/config/platforma.vhost.template b/platforma/config/platforma.vhost.template deleted file mode 100644 index 7d445573..00000000 --- a/platforma/config/platforma.vhost.template +++ /dev/null @@ -1,38 +0,0 @@ - - ServerName %(project_name)s.example.com - ServerAdmin admin@example.com - - WSGIDaemonProcess %(project_name)s user=%(user)s group=%(user)s processes=2 threads=15 display-name=%%{GROUP} python-path=%(path)s/lib/python2.5/site-packages - WSGIProcessGroup %(project_name)s - - WSGIScriptAlias / %(path)s/%(project_name)s.wsgi - - Order allow,deny - allow from all - - - Alias /media %(path)s/media - - Options Indexes - Order allow,deny - Allow from all - - - Alias /admin-media %(path)s/admin-media - - Options Indexes - Order allow,deny - Allow from all - - - Alias /static %(path)s/releases/current/%(project_name)s/static - - Options Indexes - Order allow,deny - Allow from all - - - LogLevel warn - ErrorLog /var/log/apache2/error.log - CustomLog /var/log/apache2/access.log combined - diff --git a/platforma/config/platforma.wsgi.template b/platforma/config/platforma.wsgi.template deleted file mode 100644 index 6a1770c0..00000000 --- a/platforma/config/platforma.wsgi.template +++ /dev/null @@ -1,24 +0,0 @@ -#!%(python)s -import site -site.addsitedir('%(path)s/lib/python2.6/site-packages') - -import os -from os.path import abspath, dirname, join -import sys - -# Redirect sys.stdout to sys.stderr for bad libraries like geopy that use -# print statements for optional import exceptions. -sys.stdout = sys.stderr - -# Add apps and lib directories to PYTHONPATH -sys.path = [ - '%(path)s/releases/current', - '%(path)s/releases/current/apps', - '%(path)s/releases/current/lib', -] + sys.path - -# Run Django -os.environ['DJANGO_SETTINGS_MODULE'] = '%(project_name)s.settings' - -from django.core.handlers.wsgi import WSGIHandler -application = WSGIHandler() diff --git a/platforma/config/requirements.txt b/platforma/config/requirements.txt deleted file mode 100644 index d247c761..00000000 --- a/platforma/config/requirements.txt +++ /dev/null @@ -1,20 +0,0 @@ -## Python libraries -lxml>=2.2 -mercurial>=1.3.1 -PyYAML>=3.0 -PIL>=1.1 - -## Book conversion library -git+git://github.com/fnp/librarian.git@master#egg=librarian - -## Django -Django>=1.1.1,<1.2 -sorl-thumbnail>=3.2 -django-maintenancemode>=0.9 - -# migrations -south>=0.6 - -## Debugging utils, uncomment this if you want tests -# django-nose>=0.0.3 -# django-debug-toolbar>=0.8 \ No newline at end of file diff --git a/platforma/context_processors.py b/platforma/context_processors.py deleted file mode 100644 index 813d8f36..00000000 --- a/platforma/context_processors.py +++ /dev/null @@ -1,9 +0,0 @@ -# -*- coding: utf-8 - - -def settings(request): - from django.conf import settings - return { - 'MEDIA_URL': settings.MEDIA_URL, - 'STATIC_URL': settings.STATIC_URL, - } diff --git a/platforma/locale/pl/LC_MESSAGES/django.mo b/platforma/locale/pl/LC_MESSAGES/django.mo deleted file mode 100644 index a0cefb7b..00000000 Binary files a/platforma/locale/pl/LC_MESSAGES/django.mo and /dev/null differ diff --git a/platforma/locale/pl/LC_MESSAGES/django.po b/platforma/locale/pl/LC_MESSAGES/django.po deleted file mode 100644 index 52d7a6d2..00000000 --- a/platforma/locale/pl/LC_MESSAGES/django.po +++ /dev/null @@ -1,69 +0,0 @@ -# Polskie tłumaczenie dla platformy wolnych lektur. -# Copyright (C) 2009 -# This file is distributed under the same license as the 'platforma' package. -# lrekucki@gmail.com, 2009. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2009-10-16 10:52+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" - -#: templates/explorer/editor.html:53 -msgid "Refresh panel" -msgstr "Odśwież panel" - -#: templates/explorer/editor.html:67 -msgid "Print version" -msgstr "Wersja do druku" - -#: templates/explorer/editor.html:96 -msgid "Next page" -msgstr "Następna strona" - -#: templates/explorer/editor.html:100 -msgid "Zoom in" -msgstr "Powiększ" - -#: templates/explorer/editor.html:103 -msgid "Zoom out" -msgstr "Zmniejsz" - -#: templates/explorer/editor.html:106 -msgid "Reset zoom" -msgstr "Oryginalny rozmiar" - -#: templates/explorer/editor.html:155 -msgid "History" -msgstr "Historia" - -#: templates/explorer/editor.html:156 -msgid "Push" -msgstr "Zatwierdź" - -#: templates/explorer/editor.html:157 -msgid "Pull" -msgstr "Uaktualnij" - -#: templates/explorer/editor.html:158 -msgid "Save" -msgstr "Zapisz" - -#: templates/explorer/editor.html:159 -msgid "Quick save" -msgstr "Szybki zapis" - -#: templates/registration/head_login.html:5 -msgid "Log Out" -msgstr "Wyloguj" - -#: templates/registration/head_login.html:9 -msgid "Log In" -msgstr "Logowanie" diff --git a/platforma/manage.py b/platforma/manage.py deleted file mode 100755 index 1fc25dde..00000000 --- a/platforma/manage.py +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env python -from django.core.management import execute_manager -try: - import settings # Assumed to be in the same directory. -except ImportError: - import sys - sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__) - sys.exit(1) - -if __name__ == "__main__": - # Append lib and apps directories to PYTHONPATH - from os import path - import sys - - PROJECT_ROOT = path.realpath(path.dirname(__file__)) - sys.path += [PROJECT_ROOT + '/../apps', PROJECT_ROOT + '/../lib'] - - execute_manager(settings) diff --git a/platforma/settings.py b/platforma/settings.py deleted file mode 100644 index 1f9d5d00..00000000 --- a/platforma/settings.py +++ /dev/null @@ -1,182 +0,0 @@ -# -*- coding: utf-8 -*- -import os.path - -PROJECT_ROOT = os.path.realpath(os.path.dirname(__file__)) - -DEBUG = False -TEMPLATE_DEBUG = DEBUG - -MAINTENANCE_MODE = False - -ADMINS = ( - # (u'Marek Stępniowski', 'marek@stepniowski.com'), - (u'Łukasz Rekucki', 'lrekucki@gmail.com'), -) - -MANAGERS = ADMINS - -DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. -DATABASE_NAME = PROJECT_ROOT + '/dev.sqlite' # Or path to database file if using sqlite3. -DATABASE_USER = '' # Not used with sqlite3. -DATABASE_PASSWORD = '' # Not used with sqlite3. -DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3. -DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3. - -# Local time zone for this installation. Choices can be found here: -# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name -# although not all choices may be available on all operating systems. -# If running in a Windows environment this must be set to the same as your -# system time zone. -TIME_ZONE = 'Europe/Warsaw' - -# Language code for this installation. All choices can be found here: -# http://www.i18nguy.com/unicode/language-identifiers.html -LANGUAGE_CODE = 'pl' - -#import locale -#locale.setlocale(locale.LC_ALL, '') - -SITE_ID = 1 - -# If you set this to False, Django will make some optimizations so as not -# to load the internationalization machinery. -USE_I18N = True - -# Absolute path to the directory that holds media. -# Example: "/home/media/media.lawrence.com/" -MEDIA_ROOT = PROJECT_ROOT + '/media/' -STATIC_ROOT = PROJECT_ROOT + '/static/' - -# URL that handles the media served from MEDIA_ROOT. Make sure to use a -# trailing slash if there is a path component (optional in other cases). -# Examples: "http://media.lawrence.com", "http://example.com/media/" -MEDIA_URL = '/media/' -STATIC_URL = '/static/' - -# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a -# trailing slash. -# Examples: "http://foo.com/media/", "/media/". -ADMIN_MEDIA_PREFIX = '/admin-media/' - -# Make this unique, and don't share it with anybody. -SECRET_KEY = 'ife@x^_lak+x84=lxtr!-ur$5g$+s6xt85gbbm@e_fk6q3r8=+' -SESSION_COOKIE_NAME = "redakcja_sessionid" - -# List of callables that know how to import templates from various sources. -TEMPLATE_LOADERS = ( - 'django.template.loaders.filesystem.load_template_source', - 'django.template.loaders.app_directories.load_template_source', -# 'django.template.loaders.eggs.load_template_source', -) - -TEMPLATE_CONTEXT_PROCESSORS = ( - "django.core.context_processors.auth", - "django.core.context_processors.debug", - "django.core.context_processors.i18n", - "platforma.context_processors.settings", - "django.core.context_processors.request", -) - - -MIDDLEWARE_CLASSES = ( - 'django.middleware.common.CommonMiddleware', - 'django.contrib.sessions.middleware.SessionMiddleware', - - 'django.contrib.auth.middleware.AuthenticationMiddleware', - 'django_cas.middleware.CASMiddleware', - - 'django.middleware.doc.XViewMiddleware', - 'maintenancemode.middleware.MaintenanceModeMiddleware', - # 'debug_toolbar.middleware.DebugToolbarMiddleware' # -) - -AUTHENTICATION_BACKENDS = ( - 'django.contrib.auth.backends.ModelBackend', - 'django_cas.backends.CASBackend', -) - -ROOT_URLCONF = 'platforma.urls' - -TEMPLATE_DIRS = ( - PROJECT_ROOT + '/templates', -) - - -# -# Central Auth System -# -## Set this to where the CAS server lives -# CAS_SERVER_URL = "http://cas.fnp.pl/ -CAS_LOGOUT_COMPLETELY = True - -from compress_settings import * - -INSTALLED_APPS = ( - 'django.contrib.auth', - 'django.contrib.contenttypes', - 'django.contrib.sessions', - 'django.contrib.sites', - 'django.contrib.admin', - 'django.contrib.admindocs', - - 'django_cas', - 'compress', - 'south', - 'sorl.thumbnail', - 'filebrowser', - - 'wiki', - 'toolbar', -) - - -# -# Nose tests -# - -TEST_RUNNER = 'django_nose.run_tests' -TEST_MODULES = ('wiki', 'toolbar', 'vstorage') -NOSE_ARGS = ( - '--tests=' + ','.join(TEST_MODULES), - '--cover-package=' + ','.join(TEST_MODULES), - '-d', - '--with-coverage', - '--with-doctest', -) - - -FILEBROWSER_URL_FILEBROWSER_MEDIA = STATIC_URL + 'filebrowser/' -FILEBROWSER_DIRECTORY = 'images/' -FILEBROWSER_ADMIN_VERSIONS = [] -FILEBROWSER_VERSIONS_BASEDIR = 'thumbnails/' -FILEBROWSER_DEFAULT_ORDER = "path_relative" - -# REPOSITORY_PATH = '/Users/zuber/Projekty/platforma/files/books' -IMAGE_DIR = 'images' - - -WL_API_CONFIG = { - "URL": "http://localhost:7000/api/", - "AUTH_REALM": "WL API", - "AUTH_USER": "platforma", - "AUTH_PASSWD": "platforma", -} - -# Import localsettings file, which may override settings defined here -try: - from localsettings import * -except ImportError: - pass - -try: - LOGGING_CONFIG_FILE -except NameError: - LOGGING_CONFIG_FILE = os.path.join(PROJECT_ROOT, 'config', - ('logging.cfg' if not DEBUG else 'logging.cfg.dev')) -try: - import logging - import logging.config - - logging.config.fileConfig(LOGGING_CONFIG_FILE) -except ImportError, exc: - raise diff --git a/platforma/static/css/dialogs.css b/platforma/static/css/dialogs.css deleted file mode 100644 index 1c22868f..00000000 --- a/platforma/static/css/dialogs.css +++ /dev/null @@ -1,32 +0,0 @@ -.dialog { - display: none; - padding: 5px; - text-align: left; - cursor: auto; - background-color: #E1E1E1; /* #e0ffb8; */ -} - -.dialog .help_text { - font-size: 11px; - color: #2e3536; -} - -.dialog .action_area { - padding: 1em 0.5em 0.5em; - border-top: 1px solid black; - margin-top: 0.5em; -} - -.dialog p { - margin: 0.5em; -} - -*[data-ui-error-for] { - color: red; - font-weight: bold; -} - -#save_dialog textarea { - width: 90%; - margin: 0.2em 4%; -} \ No newline at end of file diff --git a/platforma/static/css/filelist.css b/platforma/static/css/filelist.css deleted file mode 100644 index a0b4995f..00000000 --- a/platforma/static/css/filelist.css +++ /dev/null @@ -1,67 +0,0 @@ -/* - Document : filelist - Created on : 2009-09-04, 20:44:44 - Author : lreqc - Description: - Dodatkowe style dla listy plików na stronie głównej. -*/ - -body { - background-color: #84BF2A; -} - -#content { - background: #EFEFEF; - border: 1px solid black; - padding: 0.5em 2em; - margin: 1em; - overflow: hidden; -} - -#content h1 img { - vertical-align: middle; -} - -#content h1 { - border-bottom: 2px solid black; - padding: 0.5em; - font-size: 2opt; - font-family: sans-serif; -} - -#file-list { - overflow: visible; - float: left; - max-width: 50%; - padding-right: 2%; - border-right: 1px dashed black; - -} - -#last-edited-list { - float: left; - max-width: 35%; - margin-left: 5%; -} - -#last-edited-list ul { - margin: 0px; -} - -#last-edited-list li { - margin-bottom: 1em; -} - -#last-edited-list .date { - font-size: 70%; - color: grey; -} - -a, a:visited, a:active { - color: blue; - text-decoration: none; -} - -a:hover { - text-decoration: underline; -} \ No newline at end of file diff --git a/platforma/static/css/gallery.css b/platforma/static/css/gallery.css deleted file mode 100644 index 379abcce..00000000 --- a/platforma/static/css/gallery.css +++ /dev/null @@ -1,60 +0,0 @@ -/* =========== */ -/* = Gallery = */ -/* =========== */ - -#side-gallery { - position: absolute; - /* overflow: hidden; */ - top: 0px; - right: 0px; - bottom: 0px; - width: 480px; - display: none; - background-color: #FFF; -} - -#side-gallery .error_message -{ - background-color: white; - color: black; - padding: 0.5em 1em; -} - -.change-gallery-panel { - width: 100%; - border-bottom: 1px solid #777; - background-color: #C1C1C1; - margin: 0; - padding: 2px; - z-index: 10; -} - -.gallery-image { - position: absolute; - top: 30px; - right: 0; - bottom: 0; - left: 0; - margin: 0; - border: none; - background-color: transparent; - overflow: hidden; -} - -.gallery-image img { - position: absolute; - -moz-drag: none; - user-select: none; - -webkit-user-select: none; - -khtml-user-select: none; - -moz-user-select: none; - cursor: pointer; - - background-color: white; - min-height: 100px; - min-width: 100px; -} - -.gallery-image img[src=''] { - background-color: red; -} diff --git a/platforma/static/css/history.css b/platforma/static/css/history.css deleted file mode 100644 index b3191165..00000000 --- a/platforma/static/css/history.css +++ /dev/null @@ -1,155 +0,0 @@ -#history-view { - overflow: auto; - position: absolute; - top: 30px; /* 0 for no toolbar, 30 for toolbar */ - bottom: 0px; - left: 0px; - right: 0px; - z-index: 1; -} - -/* - * File History - */ -#changes-list-container { - margin: 1em auto; - width: 70%; -} - -table#changes-list-container { - border-spacing: 0px 15px; -} - -#changes-list { - margin: 0.5em 0.2em; -} - -#changes-list td { - padding: 0.5em 1em; -} - -#changes-list .entry { - position: relative; - padding: 0.5em; - padding-left: 3em; - margin: 0.5em; -} - -#changes-list .entry:hover { - background-color: #f0f0f0; -} - -#changes-list .entry.selected { - background-color: #ffec63; -} - -#changes-list .tag { - display: inline-block; - visibility: hidden; - width: 60px; - margin: 0 0.5em 0 0; - font-size: 11px; - padding: 3px 2px; - text-align: center; - color: black; - background: #add8e6; - cursor: pointer; - vertical-align: middle; - -moz-border-radius: 10px; - -webkit-border-radius: 10px; - border-radius: 10px; -} - -#changes-list .entry:hover .tag { - visibility: visible; -} - -#changes-list .tag:hover { - background: #bde8f6; -} - -#changes-list *[data-version-tag] { - visibility: visible; - border: 1px solid black; - color: black; -} - -#changes-list *[data-stub-value = -'version'] { - font-weight: bold; -} - -#changes-list td[data-stub-value = -'version'] { - vertical-align: text-top; -} - -#changes-list *[data-stub-value = -'date'], #changes-list *[data-stub-value = 'author'] { - font-size: 11px; - color: gray; -} - -/* - * Graphical DIFF view - * - */ -#history-view .diff_table { - width: 90%; -} - -.editor.DiffPerspective { - overflow-y: scroll; -} - -.diff_table { - border-width: 1px; - border-style: solid; - border-color: black; - empty-cells: show; - border-spacing: 0px; -} - -.diff_table td { - border-width: 0px 1px 1px 0px; - border-style: dotted; - border-color: grey; - font-size: 10px; - line-height: 20px; - font-family: monospace; - padding: 0px; - white-space: pre-line; - /*word-wrap:break-word; - word-break:break-all; */ -} - -.diff_table th { - border-width: 0px 1px 1px 0px; - border-style: solid; - border-color: black; - background: #e5ffe5; -} - -/* .diff_table td.left, .diff_table td.right { - width: 50%; - }*/ -.diff_table tr.change { - background-color: #dcdcdc; -} - -.diff_mark { - display: inline-block; - padding: 2px; -} - -.diff_mark_removed { - background-color: #ff9c94; -} - -.diff_mark_added { - background-color: #90ee90; -} - -.diff_mark_changed { - background-color: yellow; -} \ No newline at end of file diff --git a/platforma/static/css/html.css b/platforma/static/css/html.css deleted file mode 100644 index bd710a8c..00000000 --- a/platforma/static/css/html.css +++ /dev/null @@ -1,569 +0,0 @@ -/* Style widoku HTML. Nie należy tu ustawiać position ani marginesów */ -.htmlview { - counter-reset: main; - font-size: 16px; - font-family: "Georgia", "Times New Roman", serif; - line-height: 1.5em; - padding: 3em; - padding-left: 45px; - overflow-y: scroll; - overflow-x: auto; -} - -.htmlview[data-tag-names-visible] { - padding-left: 90px; -} - -/* - .htmlview[data-tag-names-visible] *[x-editable]:not(*[x-common])::before { - display: block; - float: left; - clear: left; - content: attr(x-node); - font-weight: bold; - font-style: normal; - font-variant:normal; - font-size: 8px; - line-height: 8px; - margin-bottom: 4px; - - padding: 3px 4px; - vertical-align: super; - background-color:#add8e6; - margin-left: -80px; - width: 70px; - text-align: center; - - -webkit-border-radius: 4px; - } - */ -.htmlview *[x-node = 'RDF'] { - display: none; -} - -.htmlview * { - position: relative; -} - -.htmlview div { - max-width: 36em; -} - -.htmlview #toc { - display: none; -} - -.htmlview a { - color: blue; - text-decoration: none; -} - -.htmlview a:hover { - text-decoration: none; -} - -.htmlview h1 { - font-size: 3em; - margin: 1.5em 0; - text-align: center; - line-height: 1.5em; - font-weight: bold; -} - -.htmlview h2 { - font-size: 2em; - margin: 1.5em 0 0; - font-weight: bold; - line-height: 1.5em; -} - -.htmlview h3 { - font-size: 1.5em; - margin: 1.5em 0 0; - font-weight: normal; - line-height: 1.5em; -} - -.htmlview h4 { - font-size: 1em; - margin: 1.5em 0 0; - line-height: 1.5em; -} - -.htmlview p { - margin: 0; -} - -.htmlview #footnotes div { - margin: 1.5em 0 0 0; -} - -.htmlview #footnotes p { - margin-left: 2.5em; - font-size: 0.875em; -} - -.htmlview blockquote { - font-size: 0.875em; -} - -/* ============= */ -/* = Numbering = */ -/* ============= */ -.htmlview .anchor { - position: relative; - margin: 0em; - left: -2.2em; - color: #777; - font-size: 12px; - width: 2em; - text-align: center; - padding: 0.25em 0.7em; - line-height: 1.5em; -} - -.htmlview .anchor:hover, .htmlview .anchor:active { - color: #FFF; - background-color: #CCC; -} - -/* =================== */ -/* = Custom elements = */ -/* =================== */ -.htmlview .autor_utwor { - font-size: 0.5em; - display: block; - line-height: 1.5em; - margin-bottom: 0.25em; -} - -.htmlview .dzielo_nadrzedne { - /* */ -} - -.htmlview .podtytul { - /* */ -} - -.htmlview .didaskalia { - font-style: italic; - margin: 0.5em 0 0 1.5em; -} - -.htmlview .kwestia { - margin: 0.5em 0 0; -} - -.htmlview .strofa { - margin: 1.5em 0 0.5em auto; -} - -/* wersy */ -.htmlview .strofa .wers_wciety, .htmlview .strofa .wers_wciety[data-wlf-typ='1'] { - margin-left: 1em; -} - -.htmlview .strofa .wers_wciety[data-wlf-typ='2'], .htmlview .strofa .wers_cd { - margin-left: 2em; -} - -.htmlview .strofa .wers_wciety[data-wlf-typ='3'] { - margin-left: 3em; -} - -.htmlview .strofa .wers_wciety[data-wlf-typ='4'] { - margin-left: 4em; -} - -.htmlview .strofa .wers_wciety[data-wlf-typ='5'] { - margin-left: 5em; -} - -.htmlview .strofa .wers_wciety[data-wlf-typ='6'] { - margin-left: 6em; -} - -/* błędne wersy */ -.htmlview *: -not(.strofa) > *[x-verse]::after { - content: "Ten wers znajduje się poza strofą."; - display: inline; - background: red; - font-size: 8pt; - border: 1px solid black; - -moz-border-radius: 10px; - -webkit-border-radius: 10px; - padding: 1px 1em; - margin-left: 1em; - vertical-align: super; -} - -.htmlview .kwestia .strofa { - margin: 0; -} - -.htmlview .akap, .htmlview .akap_cd, .htmlview .akap_dialog { - text-align: justify; - margin: 1.5em 0 0; -} - -.htmlview .motto_container { - display: inline-block; - margin: 1.5em 0 0; - clear: right; -} - -.htmlview .motto { - text-align: justify; - font-style: italic; -} - -.htmlview p.motto_podpis { - position: relative; - right: -3em; - text-align: right; -} - -.htmlview div.fragment { - border-bottom: 0.1em solid #999; - padding-bottom: 1.5em; -} - -.htmlview div.nota p, .htmlview div.dedykacja p { - text-align: right; - font-style: italic; -} - -.htmlview br.sekcja_swiatlo { - height: 3em; - /* visibility: hidden; */ -} - -.htmlview hr.separator_linia { - margin: 1.5em 0; - border: none; - border-bottom: 0.1em solid #000; -} - -.htmlview p.sekcja_asterysk { - padding: 0; - margin: 1.5em 0; - text-align: center; -} - -.htmlview div.lista_osob ol { - list-style: none; - padding: 0 0 0 1.5em; -} - -.htmlview p.miejsce_czas { - font-style: italic; -} - -.htmlview .mat, .htmlview .slowo_obce, .htmlview .tytul_dziela, .htmlview .didaskalia { - font-style: italic; -} - -.htmlview .wyroznienie { - letter-spacing: 0.1em; -} - -.htmlview .osoba { - font-style: normal; - font-variant: small-caps; -} - -.htmlview .parse-warning { - display: block; - font-size: 10pt; - background: #C0C0C0; - margin: 1em; -} - -.parse-warning .message { - color: purple; - font-weight: bold; -} - -/* Uwaga/Extra */ -.htmlview .uwaga { - background-color: #96e0e4; - border: 1px solid black; - -moz-border-radius: 10px; - -webkit-border-radius: 10px; - display: block; - font-size: 10pt; - line-height: 12pt; - padding: 2px 1em; - float: right; - max-width: 20%; - max-height: 24pt; - margin-left: 0.5em; - overflow: hidden; - z-index: 500; -} - -div[x-node] > .uwaga { - float: none; - padding: 0.5em 1em; - margin: 1em; - max-width: 100%; - max-height: 100%; -} - -.htmlview .uwaga:hover { - max-height: 100%; -} - -.htmlview .annotation-inline-box .uwaga { - max-height: 100%; -} - -/* Motywy */ -/* ======================== */ -/* = Footnotes and themes = */ -/* ======================== */ -.htmlview .begin, .htmlview .end { - background: green; -} - -.htmlview .motyw { - /* position: absolute; */ - float: right; - left: auto; - clear: right; - width: 10em; - font-weight: normal; - font-size: 13px; - line-height: 18px; - font-variant: normal; - text-decoration: none; - background-color: #fff; - /* border: 1px solid gray; - - border-right: none; - */ - z-index: 1; - -moz-user-select: -moz-none; - -webkit-user-select: none; - user-select: none; - margin-right: -12em; - text-align: left; -} - -.htmlview .motyw[x-editable] { - border-left: 4px solid #DDD; - padding: 0.2em 0.2em 0.2em 0.5em; - margin-top: 0.2em; -} - -/* - * Przypisy - */ -/* Znaczniki w tekście */ -.htmlview .annotation:before { - content: "[" counter(main) "]"; - counter-increment: main; - vertical-align: super; - text-decoration: none; - font-size: 66%; -} - -.htmlview .annotation:hover { - background-color: #96e0e4; -} -*.htmlview *.annotation-inline-box { - position: static; -} - -/* - * Przypisy w tekście - */ -.htmlview .annotation-inline-box > span[x-annotation-box] { - display: none; - position: absolute; - width: 300px; - font-size: 10pt; - line-height: 12pt; - font-weight: normal; - font-style: normal; - background: #fffe93; - border-color: black; - border-width: 1px; - border-style: solid; - border-radius: 10px; - -moz-border-radius: 10px; - -webkit-border-radius: 10px; - padding: 3px 5px; - text-decoration: none; - z-index: 600; -} - -/* - * Przypisy na końcu utworu (aktualnie nieuzywane) - */ -.htmlview .annotations-block { - counter-reset: secondary; -} - -.htmlview .annotations-block .annotation-body { - position: relative; - padding-left: 2.5em; - padding-top: 0.2em; -} - -.htmlview .annotations-block .annotation-backref { - position: absolute; - top: 0.4em; - left: -0.4em; - width: 2.5em; - text-align: right; -} - -.htmlview .annotations-block .annotation-backref:before { - content: "[" counter(secondary) "]"; - counter-increment: secondary; -} - -/* - * EDITABLE ELEMENTS - */ -.htmlview *[x-editable] { - position: relative; - padding: 2px; - margin-left: 0; - border: 1px solid #FFF; -} - -/* focused editable element */ -.htmlview *[x-editable]:hover { - z-index: 900; -} - -.htmlview *[x-editable][x-open] { - visibility: hidden; -} - -.edit-button, .delete-button, .accept-button { - position: absolute; - top: -21px; - left: -1px; - width: 72px; - height: 21px; - display: block; - /* margin: 4px 0 2px 0;*/ - padding: 5px 5px 2px 5px; - border: none; - background-color: #FAFAFA; - /* z-index: 3000;*/ - /* color: #FFF; - z-index: 1500; - */ - border: 1px solid #DDD; - border-bottom: none; -} - -.delete-button { - left: 70px; -} - -.edit-button:hover, .edit-button:active, -.delete-button:hover, .delete-button:active, -.accept-button:hover, .accept-button:active { - /* color: #FFF;*/ - background-color: #999; - color: #FFF; -} - -/* - * VISIBILITY RULES - */ -.default-menu { - visibility: inherit; - opacity: 0.2; -} - -.default-menu:hover { - opacity: 1; - z-index: 5000; -} - -.htmlview *[x-annotation-box] > .default-menu { - opacity: 1; -} - -.htmlview *[x-editable][x-open] > .default-menu { - visibility: hidden; -} - -.htmlview *[x-editable][x-open] *[x-annotation-box] > .default-menu { - visibility: hidden; -} - -.htmlview *[x-editable] > .edit-menu { - visibility: hidden; -} - -.htmlview *[x-editable] *[x-annotation-box] > .edit-menu { - visibility: hidden; -} - -.htmlview *[x-editable][x-open] > .edit-menu { - visibility: visible; -} - -.htmlview *[x-editable][x-open] *[x-annotation-box] > .edit-menu { - visibility: visible; -} - -.html-editarea { - border: 0px; - background-color: gray; - padding: 1px; - z-index: 2000; - position: absolute; -} - -.html-editarea textarea { - position: absolute; - top: 0; - margin: 0px; - padding: 0px; - width: 100%; - height: 100%; - z-index: 0; - font-size: 10pt; - /* background-color: ivory;*/ -} - -.htmlview .out-of-flow-text { - display: block; - font-face: monospace; - border: 2px solid red !important; - white-space: pre-line; -} - -.htmlview .out-of-flow-text::before { - content: "Tekst w tej ramce nie jest otagowany!"; - background-color: #ff6c6c; - color: black; - font-size: 10pt; - line-height: 12pt; - border: 1px solid black; - -moz-border-radius: 10px; - -webkit-border-radius: 10px; - padding: 5px 1em; - margin: 0em; - margin-left: 1em; - text-align: justify; - display: inline; - float: right; - max-width: 25%; -} - -.unknown-tag { - background-color: yellow; - margin: -0.25em; - padding: 0.25em; - border: 1px solid orange; -} \ No newline at end of file diff --git a/platforma/static/css/html_print.css b/platforma/static/css/html_print.css deleted file mode 100644 index 38cb5968..00000000 --- a/platforma/static/css/html_print.css +++ /dev/null @@ -1,229 +0,0 @@ -/* Style widoku HTML. Nie należy tu ustawiać position ani marginesów */ -.htmlview { - font-size: 16px; - font: Georgia, "Times New Roman", serif; - line-height: 1.5em; - padding: 3em; -} - -.htmlview div { - max-width: 36em; -} - -.htmlview #toc { - display: none; -} - -.htmlview a { - color: blue; - text-decoration: none; -} - -.htmlview h1 { - font-size: 3em; - margin: 1.5em 0; - text-align: center; - line-height: 1.5em; - font-weight: bold; -} - -.htmlview h2 { - font-size: 2em; - margin: 1.5em 0 0; - font-weight: bold; - line-height: 1.5em; -} - -.htmlview h3 { - font-size: 1.5em; - margin: 1.5em 0 0; - font-weight: normal; - line-height: 1.5em; -} - -.htmlview h4 { - font-size: 1em; - margin: 1.5em 0 0; - line-height: 1.5em; -} - -.htmlview p { - margin: 0; -} - -/* ======================== */ -/* = Footnotes and themes = */ -/* ======================== */ -.htmlview .theme-begin { - border-left: 0.1em solid #DDDDDD; - color: #777; - padding: 0 0.5em; - width: 7.5em; - font-style: normal; - font-weight: normal; - font-size: 16px; - float: right; - margin-right: -9.5em; - clear: both; - left: 40em; - line-height: 1.5em; - text-align: left; -} - -.htmlview .annotation { - font-style: normal; - font-weight: normal; - font-size: 12px; -} - -.htmlview #footnotes .annotation { - display: block; - float: left; - width: 2.5em; - clear: both; -} - -.htmlview #footnotes div { - margin: 1.5em 0 0 0; -} - -.htmlview #footnotes p { - margin-left: 2.5em; - font-size: 0.875em; -} - -.htmlview blockquote { - font-size: 0.875em; -} - -/* ============= */ -/* = Numbering = */ -/* ============= */ -.htmlview p { - position: relative; -} - -.htmlview .anchor { - position: absolute; - margin: 0em; - left: -3em; - color: #777; - font-size: 12px; - width: 2em; - text-align: center; - padding: 0.25em 0.5em; - line-height: 1.5em; -} - -.htmlview .anchor:hover, .htmlview .anchor:active { - color: #FFF; - background-color: #CCC; -} - -/* =================== */ -/* = Custom elements = */ -/* =================== */ -.htmlview span.author { - font-size: 0.5em; - display: block; - line-height: 1.5em; - margin-bottom: 0.25em; -} - -.htmlview span.collection { - font-size: 0.375em; - display: block; - line-height: 1.5em; - margin-bottom: -0.25em; -} - -.htmlview span.subtitle { - font-size: 0.5em; - display: block; - line-height: 1.5em; - margin-top: -0.25em; -} - -.htmlview div.didaskalia { - font-style: italic; - margin: 0.5em 0 0 1.5em; -} - -.htmlview div.kwestia { - margin: 0.5em 0 0; -} - -.htmlview div.stanza { - margin: 1.5em 0 0; -} - -.htmlview div.kwestia div.stanza { - margin: 0; -} - -.htmlview p.paragraph { - text-align: justify; - margin: 1.5em 0 0; -} - -.htmlview p.motto { - text-align: justify; - font-style: italic; - margin: 1.5em 0 0; -} - -.htmlview p.motto_podpis { - font-size: 0.875em; - text-align: right; -} - -.htmlview div.fragment { - border-bottom: 0.1em solid #999; - padding-bottom: 1.5em; -} - -.htmlview div.note p, .htmlview div.dedication p, -.htmlview div.note p.paragraph, .htmlview div.dedication p.paragraph { - text-align: right; - font-style: italic; -} - -.htmlview hr.spacer { - height: 3em; - visibility: hidden; -} - -.htmlview hr.spacer-line { - margin: 1.5em 0; - border: none; - border-bottom: 0.1em solid #000; -} - -.htmlview p.spacer-asterisk { - padding: 0; - margin: 1.5em 0; - text-align: center; -} - -.htmlview div.person-list ol { - list-style: none; - padding: 0 0 0 1.5em; -} - -.htmlview p.place-and-time { - font-style: italic; -} - -.htmlview em.math, .htmlview em.foreign-word, -.htmlview em.book-title, .htmlview em.didaskalia { - font-style: italic; -} - -.htmlview em.author-emphasis { - letter-spacing: 0.1em; -} - -.htmlview em.person { - font-style: normal; - font-variant: small-caps; -} diff --git a/platforma/static/css/jquery.autocomplete.css b/platforma/static/css/jquery.autocomplete.css deleted file mode 100644 index 91b62283..00000000 --- a/platforma/static/css/jquery.autocomplete.css +++ /dev/null @@ -1,48 +0,0 @@ -.ac_results { - padding: 0px; - border: 1px solid black; - background-color: white; - overflow: hidden; - z-index: 99999; -} - -.ac_results ul { - width: 100%; - list-style-position: outside; - list-style: none; - padding: 0; - margin: 0; -} - -.ac_results li { - margin: 0px; - padding: 2px 5px; - cursor: default; - display: block; - /* - if width will be 100% horizontal scrollbar will apear - when scroll mode will be used - */ - /*width: 100%;*/ - font: menu; - font-size: 12px; - /* - it is very important, if line-height not setted or setted - in relative units scroll will be broken in firefox - */ - line-height: 16px; - overflow: hidden; -} - -.ac_loading { - background: white url('indicator.gif') right center no-repeat; -} - -.ac_odd { - background-color: #eee; -} - -.ac_over { - background-color: #0A246A; - color: white; -} diff --git a/platforma/static/css/master.css b/platforma/static/css/master.css deleted file mode 100644 index ae742667..00000000 --- a/platforma/static/css/master.css +++ /dev/null @@ -1,320 +0,0 @@ -a, a:visited, a:active { - color: blue; - text-decoration: none; -} - -a:hover { - text-decoration: underline; -} - - -body { - margin: 0; - overflow: hidden; - padding: 0; - min-width: 960px; - width: 100%; - height: 100%; -} - -.vsplitbar { - position: absolute; - top: 0px; - bottom: 0; - right: 0; - width: 26px; - background: #C1C1C1 url(../img/gallery.png) no-repeat scroll center center; - border-left: 2px solid #999; - border-right: 2px solid #999; - cursor: pointer; -} - -.vsplitbar:hover { - background-color: yellow; - border-color: orange; -} - -.editor { - position: absolute; - top: 0px; - bottom: 0; - left: 0; - right: 30px; - overflow: hidden; -} - -#editor.readonly .editor { - right: 0px; -} - -#html-view { - overflow: auto; - position: absolute; - top: 33px; - bottom: 0; - left: 0; - right: 0; - z-index: 1; -} - -#splitter { - position: fixed; - top: 31px; - left: 0px; - right: 0px; - bottom: 0px; - overflow: hidden; -} - - -#header { - position: fixed; - top: 0px; - right: 0px; - left: 0px; - height: 30px; - border-bottom: 1px solid #999; - - margin: 0; - padding: 0; - background-color: #C1C1C1; - background-image: -webkit-gradient(linear, left top, left bottom, from(#C1C1C1), color-stop(0.9, #A2A2A2)); - - /* Firefox 3.6 */ - background-image: -moz-linear-gradient(top left, #C1C1C1, #A2A2A2, 90%); - - font: 11px Helvetica, Verdana, sans-serif; - font-weight: bold; -} - -#header h1, #header h1 a { - margin: 0; - padding: 0; - font: 17px Helvetica, Verdana, sans-serif; - font-weight: bold; - float: left; - padding: 3px 6px 2px 6px; - color: #222; - line-height: 20px; -} - -#header h1 a { - text-decoration: none; - color: #222; -} - -#tabs { - overflow: hidden; - margin: 0; - padding: 0; - height: 31px; - border: 0px; - padding-left: 1em; -} - -#tabs li { - height: 18px; - margin-top: 6px; - margin-bottom: 0px; - - -webkit-user-select: none; - cursor: pointer; - display: block; - float: left; - - padding-left: 12px; - padding-right: 12px; - padding-top: 5px; - - font-weight: bold; - color: #222; - margin-left: 4px; - - background-color: #A2A2A2; - - -moz-box-shadow: 1px -1px 2px rgba(127, 127, 127, 0.25); - -webkit-box-shadow: 1px -1px 2px rgba(127, 127, 127, 0.25); - - border: 1px solid #999; - border-bottom-width: 0px; - -moz-border-radius: 4px 4px 0px 0px; - -webkit-border-radius: 4px; - -webkit-border-bottom-left-radius: 0px; - -webkit-border-bottom-right-radius: 0px; -} - -#tabs li.active { - background-color: #C1C1C1; -} - -#tools { - float: right; - clear: right; - overflow: hidden; - margin: 0; - padding: 0; - height: 30px; - margin-right: 5px; - line-height: 30px; - font-size: 10px; - vertical-align: middle; -} - - -/* - * Toolbars - */ - -.toolbar { - width: 100%; - border-bottom: 1px solid #777; - background-color: #C1C1C1; - margin: 0; - padding: 2px; - z-index: 100; - height: 28px; -} - -.toolbar button { - display: block; - float: left; - margin: 4px 0 2px 0; - padding: 2px 5px; - border: none; - background: none; -} - -.toolbar button img { - margin: 0; - padding: 0; - margin-bottom: -3px; -} - - -.toolbar select { - float: left; - margin: 1px 5px 1px 0; - background: none; - border: 1px solid #999; - padding: 1px; -} - -.toolbar input { - float: left; - font-size: 11px; - padding: 0; - margin: 4px 5px 0px 5px; - vertical-align:baseline; -} - -.toolbar-end { - clear: both; -} - -.toolbar button:hover, .toolbar button:active { - background: #777; - color: #FFF; - -webkit-border-radius: 10px; - -moz-border-radius: 10px; -} - -/* Remove extra padding in Firefox */ -button::-moz-focus-inner { - border: 0; - padding: 0; -} - -p { margin: 0;} - -#body-wrap { - height: 100%; - width: 100%; -} - -#content { - height: 100%; - width: 100%; -} - -#loading-overlay { - background-color: #FFF; - position: absolute; - z-index: 1000; - padding: 0; - top: 0; - left: 0; - width: 100%; - height: 100%; -} - -#loading-message { - position: absolute; - height: 20px; - width: 120px; - left: 50%; - margin-left: -60px; - top: 50%; - margin-top: -10px; -/* text-align: center;*/ -} - -#loading-message img { - float: left; - margin-right: 10px; - margin-top: -6px; -} - -/* - * CodeMirror - */ - -.CodeMirror-line-numbers { - padding: 0px; - padding-top: 5px; - text-align: right; - overflow: hidden; - width: 40px; - border-right: 1px solid black; - background-color: #e6e6fa; -} - -.CodeMirror-line-numbers div { - display: block; - font-family:"Lucida Console", monospace; - font-size: 13px; - line-height: 18px; - padding-right: 5px; -} - -img.tabclose { - padding-left: 8px; - width: 16px; - height: 16px; - vertical-align: middle; - vertical-align: text-bottom; -} - - -/* - * HTML Editor view - */ - -.htmlview { - z-index: 1; - overflow: hidden; -} - -.htmlview *[x-editable] { - background-color: white; - -} -.htmlview .active[x-editable] { - background-color: #FAFAFA; - border: 1px solid #DDD; -/* -webkit-transition: all 1s linear;*/ -} - -.blockOverlay { - background-color: black; - opacity: 0.4; -} diff --git a/platforma/static/css/summary.css b/platforma/static/css/summary.css deleted file mode 100644 index 8fac6e1b..00000000 --- a/platforma/static/css/summary.css +++ /dev/null @@ -1,31 +0,0 @@ -#summary-view-editor { - background: white; -} - -#summary-view { - padding: 1em; -} - -#summary-view .book-cover { - float: left; - margin: 1em; - margin-right: 2em; - - height: 300px; - width: 212px; - - - border: 1px dashed black; -} - -#summary-view p { - margin: 0.5em; -} - -#summary-view label { - font-weight: bold; -} - -#summary-view .book-cover { - -} diff --git a/platforma/static/css/xmlcolors_15032010.css b/platforma/static/css/xmlcolors_15032010.css deleted file mode 100644 index 099f94aa..00000000 --- a/platforma/static/css/xmlcolors_15032010.css +++ /dev/null @@ -1,61 +0,0 @@ -.editbox { - margin: .4em; - margin-top: 5px; - margin-left: 5px; - padding: 0; - font-family:"Lucida Console", monospace; - font-size: 13px; - line-height: 18px; - color: black; -} - -.editbox p { - margin: 0; -} - -.editbox span { - display: inline; - font-size: 13px; - line-height: 18px; -} - -span.xml-tagname { - color: #0e5f0e; -} - -span.xml-attribute { - color: #8b8b8b; -} - -span.xml-punctuation { - color: black; -} - -span.xml-attname { - color: #817aff; -} - -span.xml-comment { - color: #A70; -} - -span.xml-cdata { - color: #48A; -} - -span.xml-processing { - color: #999; -} - -span.xml-entity { - color: #A22; -} - -span.xml-error { - color: #F00; - font-weight: bolder; -} - -span.xml-text { - color: black; -} diff --git a/platforma/static/filebrowser/css/filebrowser.css b/platforma/static/filebrowser/css/filebrowser.css deleted file mode 100644 index c68126ea..00000000 --- a/platforma/static/filebrowser/css/filebrowser.css +++ /dev/null @@ -1,29 +0,0 @@ -.filebrowser table td { font-size: 10px; } -.filebrowser table a { font-size: 11px; } -.filebrowser thead th.sorted a { padding-right: 13px; } -.filebrowser td { padding: 9px 10px 7px 10px !important; } -.filebrowser td.fb_icon { padding: 6px 5px 5px 5px !important; } - -table a.fb_deletelink, table a.fb_renamelink, table a.fb_selectlink, table a.fb_showversionslink { - cursor: pointer; - display: block; padding: 0; margin: 0; - width: 23px; height: 17px; - background-color: transparent; - background-position: 0 center; - background-repeat: no-repeat; -} - -table .fb_deletelink:link, table .fb_deletelink:visited { - width: 15px; - background-image: url('../img/filebrowser_icon_delete.gif'); -} -table .fb_deletelink:hover, table .fb_deletelink:active { background-image: url('../img/filebrowser_icon_delete_hover.gif'); } -table .fb_renamelink:link, table .fb_renamelink:visited { - width: 14px; - background-image: url('../img/filebrowser_icon_rename.gif'); -} -table .fb_renamelink:hover, table .fb_renamelink:active { background-image: url('../img/filebrowser_icon_rename_hover.gif'); } -table .fb_selectlink:link, table .fb_selectlink:visited { background-image: url('../img/filebrowser_icon_select.gif'); } -table .fb_selectlink:hover, table .fb_selectlink:active { background-image: url('../img/filebrowser_icon_select_hover.gif'); } -table .fb_showversionslink:link, table .fb_showversionslink:visited { background-image: url('../img/filebrowser_icon_showversions.gif'); } -table .fb_showversionslink:hover, table .fb_showversionslink:active { background-image: url('../img/filebrowser_icon_showversions_hover.gif'); } diff --git a/platforma/static/filebrowser/img/filebrowser_icon_delete.gif b/platforma/static/filebrowser/img/filebrowser_icon_delete.gif deleted file mode 100644 index 221a6e1c..00000000 Binary files a/platforma/static/filebrowser/img/filebrowser_icon_delete.gif and /dev/null differ diff --git a/platforma/static/filebrowser/img/filebrowser_icon_delete_hover.gif b/platforma/static/filebrowser/img/filebrowser_icon_delete_hover.gif deleted file mode 100644 index 2a2142cd..00000000 Binary files a/platforma/static/filebrowser/img/filebrowser_icon_delete_hover.gif and /dev/null differ diff --git a/platforma/static/filebrowser/img/filebrowser_icon_imagegenerator.gif b/platforma/static/filebrowser/img/filebrowser_icon_imagegenerator.gif deleted file mode 100644 index 9b19a420..00000000 Binary files a/platforma/static/filebrowser/img/filebrowser_icon_imagegenerator.gif and /dev/null differ diff --git a/platforma/static/filebrowser/img/filebrowser_icon_imagegenerator_hover.gif b/platforma/static/filebrowser/img/filebrowser_icon_imagegenerator_hover.gif deleted file mode 100644 index aaa256f4..00000000 Binary files a/platforma/static/filebrowser/img/filebrowser_icon_imagegenerator_hover.gif and /dev/null differ diff --git a/platforma/static/filebrowser/img/filebrowser_icon_makethumb.gif b/platforma/static/filebrowser/img/filebrowser_icon_makethumb.gif deleted file mode 100644 index 837f6cc6..00000000 Binary files a/platforma/static/filebrowser/img/filebrowser_icon_makethumb.gif and /dev/null differ diff --git a/platforma/static/filebrowser/img/filebrowser_icon_makethumb_hover.gif b/platforma/static/filebrowser/img/filebrowser_icon_makethumb_hover.gif deleted file mode 100644 index d1d4d4a1..00000000 Binary files a/platforma/static/filebrowser/img/filebrowser_icon_makethumb_hover.gif and /dev/null differ diff --git a/platforma/static/filebrowser/img/filebrowser_icon_rename.gif b/platforma/static/filebrowser/img/filebrowser_icon_rename.gif deleted file mode 100644 index bc45fe4b..00000000 Binary files a/platforma/static/filebrowser/img/filebrowser_icon_rename.gif and /dev/null differ diff --git a/platforma/static/filebrowser/img/filebrowser_icon_rename_hover.gif b/platforma/static/filebrowser/img/filebrowser_icon_rename_hover.gif deleted file mode 100644 index be8ea08b..00000000 Binary files a/platforma/static/filebrowser/img/filebrowser_icon_rename_hover.gif and /dev/null differ diff --git a/platforma/static/filebrowser/img/filebrowser_icon_select.gif b/platforma/static/filebrowser/img/filebrowser_icon_select.gif deleted file mode 100644 index a8384279..00000000 Binary files a/platforma/static/filebrowser/img/filebrowser_icon_select.gif and /dev/null differ diff --git a/platforma/static/filebrowser/img/filebrowser_icon_select_disabled.gif b/platforma/static/filebrowser/img/filebrowser_icon_select_disabled.gif deleted file mode 100644 index 60ad2d53..00000000 Binary files a/platforma/static/filebrowser/img/filebrowser_icon_select_disabled.gif and /dev/null differ diff --git a/platforma/static/filebrowser/img/filebrowser_icon_select_hover.gif b/platforma/static/filebrowser/img/filebrowser_icon_select_hover.gif deleted file mode 100644 index 319558e9..00000000 Binary files a/platforma/static/filebrowser/img/filebrowser_icon_select_hover.gif and /dev/null differ diff --git a/platforma/static/filebrowser/img/filebrowser_icon_show.gif b/platforma/static/filebrowser/img/filebrowser_icon_show.gif deleted file mode 100644 index dded9824..00000000 Binary files a/platforma/static/filebrowser/img/filebrowser_icon_show.gif and /dev/null differ diff --git a/platforma/static/filebrowser/img/filebrowser_icon_show_hover.gif b/platforma/static/filebrowser/img/filebrowser_icon_show_hover.gif deleted file mode 100644 index fbd1f33e..00000000 Binary files a/platforma/static/filebrowser/img/filebrowser_icon_show_hover.gif and /dev/null differ diff --git a/platforma/static/filebrowser/img/filebrowser_icon_showversions.gif b/platforma/static/filebrowser/img/filebrowser_icon_showversions.gif deleted file mode 100644 index 71525d74..00000000 Binary files a/platforma/static/filebrowser/img/filebrowser_icon_showversions.gif and /dev/null differ diff --git a/platforma/static/filebrowser/img/filebrowser_icon_showversions_hover.gif b/platforma/static/filebrowser/img/filebrowser_icon_showversions_hover.gif deleted file mode 100644 index 1fbe2e49..00000000 Binary files a/platforma/static/filebrowser/img/filebrowser_icon_showversions_hover.gif and /dev/null differ diff --git a/platforma/static/filebrowser/img/filebrowser_object-tools_icon_imagegenerator.gif b/platforma/static/filebrowser/img/filebrowser_object-tools_icon_imagegenerator.gif deleted file mode 100644 index 9b19a420..00000000 Binary files a/platforma/static/filebrowser/img/filebrowser_object-tools_icon_imagegenerator.gif and /dev/null differ diff --git a/platforma/static/filebrowser/img/filebrowser_object-tools_icon_imagegenerator_hover.gif b/platforma/static/filebrowser/img/filebrowser_object-tools_icon_imagegenerator_hover.gif deleted file mode 100644 index aaa256f4..00000000 Binary files a/platforma/static/filebrowser/img/filebrowser_object-tools_icon_imagegenerator_hover.gif and /dev/null differ diff --git a/platforma/static/filebrowser/img/filebrowser_object-tools_icon_makedirectory.gif b/platforma/static/filebrowser/img/filebrowser_object-tools_icon_makedirectory.gif deleted file mode 100644 index bcd98d91..00000000 Binary files a/platforma/static/filebrowser/img/filebrowser_object-tools_icon_makedirectory.gif and /dev/null differ diff --git a/platforma/static/filebrowser/img/filebrowser_object-tools_icon_makedirectory_hover.gif b/platforma/static/filebrowser/img/filebrowser_object-tools_icon_makedirectory_hover.gif deleted file mode 100644 index f9938c77..00000000 Binary files a/platforma/static/filebrowser/img/filebrowser_object-tools_icon_makedirectory_hover.gif and /dev/null differ diff --git a/platforma/static/filebrowser/img/filebrowser_object-tools_icon_makethumb.gif b/platforma/static/filebrowser/img/filebrowser_object-tools_icon_makethumb.gif deleted file mode 100644 index a6863cb8..00000000 Binary files a/platforma/static/filebrowser/img/filebrowser_object-tools_icon_makethumb.gif and /dev/null differ diff --git a/platforma/static/filebrowser/img/filebrowser_object-tools_icon_makethumb_hover.gif b/platforma/static/filebrowser/img/filebrowser_object-tools_icon_makethumb_hover.gif deleted file mode 100644 index b9aba7cc..00000000 Binary files a/platforma/static/filebrowser/img/filebrowser_object-tools_icon_makethumb_hover.gif and /dev/null differ diff --git a/platforma/static/filebrowser/img/filebrowser_object-tools_icon_multipleupload.gif b/platforma/static/filebrowser/img/filebrowser_object-tools_icon_multipleupload.gif deleted file mode 100644 index 6de016be..00000000 Binary files a/platforma/static/filebrowser/img/filebrowser_object-tools_icon_multipleupload.gif and /dev/null differ diff --git a/platforma/static/filebrowser/img/filebrowser_object-tools_icon_multipleupload_hover.gif b/platforma/static/filebrowser/img/filebrowser_object-tools_icon_multipleupload_hover.gif deleted file mode 100644 index eaaf2542..00000000 Binary files a/platforma/static/filebrowser/img/filebrowser_object-tools_icon_multipleupload_hover.gif and /dev/null differ diff --git a/platforma/static/filebrowser/img/filebrowser_type_.gif b/platforma/static/filebrowser/img/filebrowser_type_.gif deleted file mode 100644 index 6a908e27..00000000 Binary files a/platforma/static/filebrowser/img/filebrowser_type_.gif and /dev/null differ diff --git a/platforma/static/filebrowser/img/filebrowser_type_code.gif b/platforma/static/filebrowser/img/filebrowser_type_code.gif deleted file mode 100644 index 96508394..00000000 Binary files a/platforma/static/filebrowser/img/filebrowser_type_code.gif and /dev/null differ diff --git a/platforma/static/filebrowser/img/filebrowser_type_document.gif b/platforma/static/filebrowser/img/filebrowser_type_document.gif deleted file mode 100644 index 65ebd99b..00000000 Binary files a/platforma/static/filebrowser/img/filebrowser_type_document.gif and /dev/null differ diff --git a/platforma/static/filebrowser/img/filebrowser_type_folder.gif b/platforma/static/filebrowser/img/filebrowser_type_folder.gif deleted file mode 100644 index 115e3fbd..00000000 Binary files a/platforma/static/filebrowser/img/filebrowser_type_folder.gif and /dev/null differ diff --git a/platforma/static/filebrowser/img/filebrowser_type_image.gif b/platforma/static/filebrowser/img/filebrowser_type_image.gif deleted file mode 100644 index 000b31c1..00000000 Binary files a/platforma/static/filebrowser/img/filebrowser_type_image.gif and /dev/null differ diff --git a/platforma/static/filebrowser/img/filebrowser_type_sound.gif b/platforma/static/filebrowser/img/filebrowser_type_sound.gif deleted file mode 100644 index 8a8970ab..00000000 Binary files a/platforma/static/filebrowser/img/filebrowser_type_sound.gif and /dev/null differ diff --git a/platforma/static/filebrowser/img/filebrowser_type_video.gif b/platforma/static/filebrowser/img/filebrowser_type_video.gif deleted file mode 100644 index f456d59b..00000000 Binary files a/platforma/static/filebrowser/img/filebrowser_type_video.gif and /dev/null differ diff --git a/platforma/static/filebrowser/img/tableheader_arrow_down.gif b/platforma/static/filebrowser/img/tableheader_arrow_down.gif deleted file mode 100644 index 5ae95a60..00000000 Binary files a/platforma/static/filebrowser/img/tableheader_arrow_down.gif and /dev/null differ diff --git a/platforma/static/filebrowser/img/tableheader_arrow_up.gif b/platforma/static/filebrowser/img/tableheader_arrow_up.gif deleted file mode 100644 index 85f1e126..00000000 Binary files a/platforma/static/filebrowser/img/tableheader_arrow_up.gif and /dev/null differ diff --git a/platforma/static/filebrowser/img/tableheader_arrows.gif b/platforma/static/filebrowser/img/tableheader_arrows.gif deleted file mode 100644 index 39b8780c..00000000 Binary files a/platforma/static/filebrowser/img/tableheader_arrows.gif and /dev/null differ diff --git a/platforma/static/filebrowser/js/AddFileBrowser.js b/platforma/static/filebrowser/js/AddFileBrowser.js deleted file mode 100644 index 888885f5..00000000 --- a/platforma/static/filebrowser/js/AddFileBrowser.js +++ /dev/null @@ -1,30 +0,0 @@ -var FileBrowser = { - // this is set automatically - admin_media_prefix: '', - // change this - thumb_prefix: 'thumb_', - no_thumb: 'filebrowser/img/no_thumb.gif', - - init: function() { - // Deduce admin_media_prefix by looking at the - - - - - - -
- -

Cancel All Uploads

- - diff --git a/platforma/static/filebrowser/uploadify/example/scripts/_notes/dwsync.xml b/platforma/static/filebrowser/uploadify/example/scripts/_notes/dwsync.xml deleted file mode 100644 index 13ca0434..00000000 --- a/platforma/static/filebrowser/uploadify/example/scripts/_notes/dwsync.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/platforma/static/filebrowser/uploadify/example/scripts/check.php b/platforma/static/filebrowser/uploadify/example/scripts/check.php deleted file mode 100644 index d7dc5717..00000000 --- a/platforma/static/filebrowser/uploadify/example/scripts/check.php +++ /dev/null @@ -1,35 +0,0 @@ - $value) { - if ($key != 'folder') { - if (file_exists($_SERVER['DOCUMENT_ROOT'] . $_POST['folder'] . '/' . $value)) { - $fileArray[$key] = $value; - } - } -} -echo json_encode($fileArray); -?> \ No newline at end of file diff --git a/platforma/static/filebrowser/uploadify/example/scripts/expressInstall.swf b/platforma/static/filebrowser/uploadify/example/scripts/expressInstall.swf deleted file mode 100644 index 0fbf8fca..00000000 Binary files a/platforma/static/filebrowser/uploadify/example/scripts/expressInstall.swf and /dev/null differ diff --git a/platforma/static/filebrowser/uploadify/example/scripts/jquery-1.3.2.min.js b/platforma/static/filebrowser/uploadify/example/scripts/jquery-1.3.2.min.js deleted file mode 100644 index b1ae21d8..00000000 --- a/platforma/static/filebrowser/uploadify/example/scripts/jquery-1.3.2.min.js +++ /dev/null @@ -1,19 +0,0 @@ -/* - * jQuery JavaScript Library v1.3.2 - * http://jquery.com/ - * - * Copyright (c) 2009 John Resig - * Dual licensed under the MIT and GPL licenses. - * http://docs.jquery.com/License - * - * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009) - * Revision: 6246 - */ -(function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("",""]||!O.indexOf("",""]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"","
"]||!O.indexOf("",""]||(!O.indexOf("",""]||!O.indexOf("",""]||!o.support.htmlSerialize&&[1,"div
","
"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}}); -/* - * Sizzle CSS Selector Engine - v0.9.3 - * Copyright 2009, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * More information: http://sizzlejs.com/ - */ -(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return UT[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="

";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="
";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("
").append(M.responseText.replace(//g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function(){G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='
';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})(); \ No newline at end of file diff --git a/platforma/static/filebrowser/uploadify/example/scripts/jquery.uploadify.v2.1.0.min.js b/platforma/static/filebrowser/uploadify/example/scripts/jquery.uploadify.v2.1.0.min.js deleted file mode 100644 index 43053119..00000000 --- a/platforma/static/filebrowser/uploadify/example/scripts/jquery.uploadify.v2.1.0.min.js +++ /dev/null @@ -1,26 +0,0 @@ -/* -Uploadify v2.1.0 -Release Date: August 24, 2009 - -Copyright (c) 2009 Ronnie Garcia, Travis Nickels - -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 -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -*/ - -if(jQuery){(function(a){a.extend(a.fn,{uploadify:function(b){a(this).each(function(){settings=a.extend({id:a(this).attr("id"),uploader:"uploadify.swf",script:"uploadify.php",expressInstall:null,folder:"",height:30,width:110,cancelImg:"cancel.png",wmode:"opaque",scriptAccess:"sameDomain",fileDataName:"Filedata",method:"POST",queueSizeLimit:999,simUploadLimit:1,queueID:false,displayData:"percentage",onInit:function(){},onSelect:function(){},onQueueFull:function(){},onCheck:function(){},onCancel:function(){},onError:function(){},onProgress:function(){},onComplete:function(){},onAllComplete:function(){}},b);var e=location.pathname;e=e.split("/");e.pop();e=e.join("/")+"/";var f={};f.uploadifyID=settings.id;f.pagepath=e;if(settings.buttonImg){f.buttonImg=escape(settings.buttonImg)}if(settings.buttonText){f.buttonText=escape(settings.buttonText)}if(settings.rollover){f.rollover=true}f.script=settings.script;f.folder=escape(settings.folder);if(settings.scriptData){var g="";for(var d in settings.scriptData){g+="&"+d+"="+settings.scriptData[d]}f.scriptData=escape(g.substr(1))}f.width=settings.width;f.height=settings.height;f.wmode=settings.wmode;f.method=settings.method;f.queueSizeLimit=settings.queueSizeLimit;f.simUploadLimit=settings.simUploadLimit;if(settings.hideButton){f.hideButton=true}if(settings.fileDesc){f.fileDesc=settings.fileDesc}if(settings.fileExt){f.fileExt=settings.fileExt}if(settings.multi){f.multi=true}if(settings.auto){f.auto=true}if(settings.sizeLimit){f.sizeLimit=settings.sizeLimit}if(settings.checkScript){f.checkScript=settings.checkScript}if(settings.fileDataName){f.fileDataName=settings.fileDataName}if(settings.queueID){f.queueID=settings.queueID}if(settings.onInit()!==false){a(this).css("display","none");a(this).after('
');swfobject.embedSWF(settings.uploader,settings.id+"Uploader",settings.width,settings.height,"9.0.24",settings.expressInstall,f,{quality:"high",wmode:settings.wmode,allowScriptAccess:settings.scriptAccess});if(settings.queueID==false){a("#"+a(this).attr("id")+"Uploader").after('
')}}if(typeof(settings.onOpen)=="function"){a(this).bind("uploadifyOpen",settings.onOpen)}a(this).bind("uploadifySelect",{action:settings.onSelect,queueID:settings.queueID},function(j,h,i){if(j.data.action(j,h,i)!==false){var k=Math.round(i.size/1024*100)*0.01;var l="KB";if(k>1000){k=Math.round(k*0.001*100)*0.01;l="MB"}var m=k.toString().split(".");if(m.length>1){k=m[0]+"."+m[1].substr(0,2)}else{k=m[0]}if(i.name.length>20){fileName=i.name.substr(0,20)+"..."}else{fileName=i.name}queue="#"+a(this).attr("id")+"Queue";if(j.data.queueID){queue="#"+j.data.queueID}a(queue).append('
'+fileName+" ("+k+l+')
')}});if(typeof(settings.onSelectOnce)=="function"){a(this).bind("uploadifySelectOnce",settings.onSelectOnce)}a(this).bind("uploadifyQueueFull",{action:settings.onQueueFull},function(h,i){if(h.data.action(h,i)!==false){alert("The queue is full. The max size is "+i+".")}});a(this).bind("uploadifyCheckExist",{action:settings.onCheck},function(m,l,k,j,o){var i=new Object();i=k;i.folder=e+j;if(o){for(var h in k){var n=h}}a.post(l,i,function(r){for(var p in r){if(m.data.action(m,l,k,j,o)!==false){var q=confirm("Do you want to replace the file "+r[p]+"?");if(!q){document.getElementById(a(m.target).attr("id")+"Uploader").cancelFileUpload(p,true,true)}}}if(o){document.getElementById(a(m.target).attr("id")+"Uploader").startFileUpload(n,true)}else{document.getElementById(a(m.target).attr("id")+"Uploader").startFileUpload(null,true)}},"json")});a(this).bind("uploadifyCancel",{action:settings.onCancel},function(l,h,k,m,j){if(l.data.action(l,h,k,m,j)!==false){var i=(j==true)?0:250;a("#"+a(this).attr("id")+h).fadeOut(i,function(){a(this).remove()})}});if(typeof(settings.onClearQueue)=="function"){a(this).bind("uploadifyClearQueue",settings.onClearQueue)}var c=[];a(this).bind("uploadifyError",{action:settings.onError},function(l,h,k,j){if(l.data.action(l,h,k,j)!==false){var i=new Array(h,k,j);c.push(i);a("#"+a(this).attr("id")+h+" .percentage").text(" - "+j.type+" Error");a("#"+a(this).attr("id")+h).addClass("uploadifyError")}});a(this).bind("uploadifyProgress",{action:settings.onProgress,toDisplay:settings.displayData},function(j,h,i,k){if(j.data.action(j,h,i,k)!==false){a("#"+a(this).attr("id")+h+"ProgressBar").css("width",k.percentage+"%");if(j.data.toDisplay=="percentage"){displayData=" - "+k.percentage+"%"}if(j.data.toDisplay=="speed"){displayData=" - "+k.speed+"KB/s"}if(j.data.toDisplay==null){displayData=" "}a("#"+a(this).attr("id")+h+" .percentage").text(displayData)}});a(this).bind("uploadifyComplete",{action:settings.onComplete},function(k,h,j,i,l){if(k.data.action(k,h,j,unescape(i),l)!==false){a("#"+a(this).attr("id")+h+" .percentage").text(" - Completed");a("#"+a(this).attr("id")+h).fadeOut(250,function(){a(this).remove()})}});if(typeof(settings.onAllComplete)=="function"){a(this).bind("uploadifyAllComplete",{action:settings.onAllComplete},function(h,i){if(h.data.action(h,i)!==false){c=[]}})}})},uploadifySettings:function(f,j,c){var g=false;a(this).each(function(){if(f=="scriptData"&&j!=null){if(c){var i=j}else{var i=a.extend(settings.scriptData,j)}var l="";for(var k in i){l+="&"+k+"="+escape(i[k])}j=l.substr(1)}g=document.getElementById(a(this).attr("id")+"Uploader").updateSettings(f,j)});if(j==null){if(f=="scriptData"){var b=unescape(g).split("&");var e=new Object();for(var d=0;d - is released under the MIT License -*/ -var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y0){for(var af=0;af0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad'}}aa.outerHTML='"+af+"";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab \ No newline at end of file diff --git a/platforma/static/filebrowser/uploadify/example/scripts/uploadify.swf b/platforma/static/filebrowser/uploadify/example/scripts/uploadify.swf deleted file mode 100644 index 4d27952f..00000000 Binary files a/platforma/static/filebrowser/uploadify/example/scripts/uploadify.swf and /dev/null differ diff --git a/platforma/static/filebrowser/uploadify/expressInstall.swf b/platforma/static/filebrowser/uploadify/expressInstall.swf deleted file mode 100644 index 0fbf8fca..00000000 Binary files a/platforma/static/filebrowser/uploadify/expressInstall.swf and /dev/null differ diff --git a/platforma/static/filebrowser/uploadify/jquery-1.3.2.min.js b/platforma/static/filebrowser/uploadify/jquery-1.3.2.min.js deleted file mode 100644 index b1ae21d8..00000000 --- a/platforma/static/filebrowser/uploadify/jquery-1.3.2.min.js +++ /dev/null @@ -1,19 +0,0 @@ -/* - * jQuery JavaScript Library v1.3.2 - * http://jquery.com/ - * - * Copyright (c) 2009 John Resig - * Dual licensed under the MIT and GPL licenses. - * http://docs.jquery.com/License - * - * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009) - * Revision: 6246 - */ -(function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("",""]||!O.indexOf("",""]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"","
"]||!O.indexOf("",""]||(!O.indexOf("",""]||!O.indexOf("",""]||!o.support.htmlSerialize&&[1,"div
","
"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}}); -/* - * Sizzle CSS Selector Engine - v0.9.3 - * Copyright 2009, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * More information: http://sizzlejs.com/ - */ -(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return UT[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="

";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="
";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("
").append(M.responseText.replace(//g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function(){G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='
';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})(); \ No newline at end of file diff --git a/platforma/static/filebrowser/uploadify/jquery.uploadify.v2.1.0.js b/platforma/static/filebrowser/uploadify/jquery.uploadify.v2.1.0.js deleted file mode 100644 index 43c87be6..00000000 --- a/platforma/static/filebrowser/uploadify/jquery.uploadify.v2.1.0.js +++ /dev/null @@ -1,258 +0,0 @@ -/* -Uploadify v2.1.0 -Release Date: August 24, 2009 - -Copyright (c) 2009 Ronnie Garcia, Travis Nickels - -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 -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -*/ - -if(jQuery)( - function(jQuery){ - jQuery.extend(jQuery.fn,{ - uploadify:function(options) { - jQuery(this).each(function(){ - settings = jQuery.extend({ - id : jQuery(this).attr('id'), // The ID of the object being Uploadified - uploader : 'uploadify.swf', // The path to the uploadify swf file - script : 'uploadify.php', // The path to the uploadify backend upload script - expressInstall : null, // The path to the express install swf file - folder : '', // The path to the upload folder - height : 30, // The height of the flash button - width : 110, // The width of the flash button - cancelImg : 'cancel.png', // The path to the cancel image for the default file queue item container - wmode : 'opaque', // The wmode of the flash file - scriptAccess : 'sameDomain', // Set to "always" to allow script access across domains - fileDataName : 'Filedata', // The name of the file collection object in the backend upload script - method : 'POST', // The method for sending variables to the backend upload script - queueSizeLimit : 999, // The maximum size of the file queue - simUploadLimit : 1, // The number of simultaneous uploads allowed - queueID : false, // The optional ID of the queue container - displayData : 'percentage', // Set to "speed" to show the upload speed in the default queue item - onInit : function() {}, // Function to run when uploadify is initialized - onSelect : function() {}, // Function to run when a file is selected - onQueueFull : function() {}, // Function to run when the queue reaches capacity - onCheck : function() {}, // Function to run when script checks for duplicate files on the server - onCancel : function() {}, // Function to run when an item is cleared from the queue - onError : function() {}, // Function to run when an upload item returns an error - onProgress : function() {}, // Function to run each time the upload progress is updated - onComplete : function() {}, // Function to run when an upload is completed - onAllComplete : function() {} // Functino to run when all uploads are completed - }, options); - var pagePath = location.pathname; - pagePath = pagePath.split('/'); - pagePath.pop(); - pagePath = pagePath.join('/') + '/'; - var data = {}; - data.uploadifyID = settings.id; - data.pagepath = pagePath; - if (settings.buttonImg) data.buttonImg = escape(settings.buttonImg); - if (settings.buttonText) data.buttonText = escape(settings.buttonText); - if (settings.rollover) data.rollover = true; - data.script = settings.script; - data.folder = escape(settings.folder); - if (settings.scriptData) { - var scriptDataString = ''; - for (var name in settings.scriptData) { - scriptDataString += '&' + name + '=' + settings.scriptData[name]; - } - data.scriptData = escape(scriptDataString.substr(1)); - } - data.width = settings.width; - data.height = settings.height; - data.wmode = settings.wmode; - data.method = settings.method; - data.queueSizeLimit = settings.queueSizeLimit; - data.simUploadLimit = settings.simUploadLimit; - if (settings.hideButton) data.hideButton = true; - if (settings.fileDesc) data.fileDesc = settings.fileDesc; - if (settings.fileExt) data.fileExt = settings.fileExt; - if (settings.multi) data.multi = true; - if (settings.auto) data.auto = true; - if (settings.sizeLimit) data.sizeLimit = settings.sizeLimit; - if (settings.checkScript) data.checkScript = settings.checkScript; - if (settings.fileDataName) data.fileDataName = settings.fileDataName; - if (settings.queueID) data.queueID = settings.queueID; - if (settings.onInit() !== false) { - jQuery(this).css('display','none'); - jQuery(this).after('
'); - swfobject.embedSWF(settings.uploader, settings.id + 'Uploader', settings.width, settings.height, '9.0.24', settings.expressInstall, data, {'quality':'high','wmode':settings.wmode,'allowScriptAccess':settings.scriptAccess}); - if (settings.queueID == false) { - jQuery("#" + jQuery(this).attr('id') + "Uploader").after('
'); - } - } - if (typeof(settings.onOpen) == 'function') { - jQuery(this).bind("uploadifyOpen", settings.onOpen); - } - jQuery(this).bind("uploadifySelect", {'action': settings.onSelect, 'queueID': settings.queueID}, function(event, ID, fileObj) { - if (event.data.action(event, ID, fileObj) !== false) { - var byteSize = Math.round(fileObj.size / 1024 * 100) * .01; - var suffix = 'KB'; - if (byteSize > 1000) { - byteSize = Math.round(byteSize *.001 * 100) * .01; - suffix = 'MB'; - } - var sizeParts = byteSize.toString().split('.'); - if (sizeParts.length > 1) { - byteSize = sizeParts[0] + '.' + sizeParts[1].substr(0,2); - } else { - byteSize = sizeParts[0]; - } - if (fileObj.name.length > 20) { - fileName = fileObj.name.substr(0,20) + '...'; - } else { - fileName = fileObj.name; - } - queue = '#' + jQuery(this).attr('id') + 'Queue'; - if (event.data.queueID) { - queue = '#' + event.data.queueID; - } - jQuery(queue).append('
\ -
\ - \ -
\ - ' + fileName + ' (' + byteSize + suffix + ')\ -
\ -
\ -
\ -
'); - } - }); - if (typeof(settings.onSelectOnce) == 'function') { - jQuery(this).bind("uploadifySelectOnce", settings.onSelectOnce); - } - jQuery(this).bind("uploadifyQueueFull", {'action': settings.onQueueFull}, function(event, queueSizeLimit) { - if (event.data.action(event, queueSizeLimit) !== false) { - alert('The queue is full. The max size is ' + queueSizeLimit + '.'); - } - }); - jQuery(this).bind("uploadifyCheckExist", {'action': settings.onCheck}, function(event, checkScript, fileQueueObj, folder, single) { - var postData = new Object(); - postData = fileQueueObj; - postData.folder = pagePath + folder; - if (single) { - for (var ID in fileQueueObj) { - var singleFileID = ID; - } - } - jQuery.post(checkScript, postData, function(data) { - for(var key in data) { - if (event.data.action(event, checkScript, fileQueueObj, folder, single) !== false) { - var replaceFile = confirm("Do you want to replace the file " + data[key] + "?"); - if (!replaceFile) { - document.getElementById(jQuery(event.target).attr('id') + 'Uploader').cancelFileUpload(key, true,true); - } - } - } - if (single) { - document.getElementById(jQuery(event.target).attr('id') + 'Uploader').startFileUpload(singleFileID, true); - } else { - document.getElementById(jQuery(event.target).attr('id') + 'Uploader').startFileUpload(null, true); - } - }, "json"); - }); - jQuery(this).bind("uploadifyCancel", {'action': settings.onCancel}, function(event, ID, fileObj, data, clearFast) { - if (event.data.action(event, ID, fileObj, data, clearFast) !== false) { - var fadeSpeed = (clearFast == true) ? 0 : 250; - jQuery("#" + jQuery(this).attr('id') + ID).fadeOut(fadeSpeed, function() { jQuery(this).remove() }); - } - }); - if (typeof(settings.onClearQueue) == 'function') { - jQuery(this).bind("uploadifyClearQueue", settings.onClearQueue); - } - var errorArray = []; - jQuery(this).bind("uploadifyError", {'action': settings.onError}, function(event, ID, fileObj, errorObj) { - if (event.data.action(event, ID, fileObj, errorObj) !== false) { - var fileArray = new Array(ID, fileObj, errorObj); - errorArray.push(fileArray); - jQuery("#" + jQuery(this).attr('id') + ID + " .percentage").text(" - " + errorObj.type + " Error"); - jQuery("#" + jQuery(this).attr('id') + ID).addClass('uploadifyError'); - } - }); - jQuery(this).bind("uploadifyProgress", {'action': settings.onProgress, 'toDisplay': settings.displayData}, function(event, ID, fileObj, data) { - if (event.data.action(event, ID, fileObj, data) !== false) { - jQuery("#" + jQuery(this).attr('id') + ID + "ProgressBar").css('width', data.percentage + '%'); - if (event.data.toDisplay == 'percentage') displayData = ' - ' + data.percentage + '%'; - if (event.data.toDisplay == 'speed') displayData = ' - ' + data.speed + 'KB/s'; - if (event.data.toDisplay == null) displayData = ' '; - jQuery("#" + jQuery(this).attr('id') + ID + " .percentage").text(displayData); - } - }); - jQuery(this).bind("uploadifyComplete", {'action': settings.onComplete}, function(event, ID, fileObj, response, data) { - if (event.data.action(event, ID, fileObj, unescape(response), data) !== false) { - jQuery("#" + jQuery(this).attr('id') + ID + " .percentage").text(' - Completed'); - jQuery("#" + jQuery(this).attr('id') + ID).fadeOut(250, function() { jQuery(this).remove()}); - } - }); - if (typeof(settings.onAllComplete) == 'function') { - jQuery(this).bind("uploadifyAllComplete", {'action': settings.onAllComplete}, function(event, uploadObj) { - if (event.data.action(event, uploadObj) !== false) { - errorArray = []; - } - }); - } - }); - }, - uploadifySettings:function(settingName, settingValue, resetObject) { - var returnValue = false; - jQuery(this).each(function() { - if (settingName == 'scriptData' && settingValue != null) { - if (resetObject) { - var scriptData = settingValue; - } else { - var scriptData = jQuery.extend(settings.scriptData, settingValue); - } - var scriptDataString = ''; - for (var name in scriptData) { - scriptDataString += '&' + name + '=' + escape(scriptData[name]); - } - settingValue = scriptDataString.substr(1); - } - returnValue = document.getElementById(jQuery(this).attr('id') + 'Uploader').updateSettings(settingName, settingValue); - }); - if (settingValue == null) { - if (settingName == 'scriptData') { - var returnSplit = unescape(returnValue).split('&'); - var returnObj = new Object(); - for (var i = 0; i < returnSplit.length; i++) { - var iSplit = returnSplit[i].split('='); - returnObj[iSplit[0]] = iSplit[1]; - } - returnValue = returnObj; - } - return returnValue; - } - }, - uploadifyUpload:function(ID) { - jQuery(this).each(function() { - document.getElementById(jQuery(this).attr('id') + 'Uploader').startFileUpload(ID, false); - }); - }, - uploadifyCancel:function(ID) { - jQuery(this).each(function() { - document.getElementById(jQuery(this).attr('id') + 'Uploader').cancelFileUpload(ID, true, false); - }); - }, - uploadifyClearQueue:function() { - jQuery(this).each(function() { - document.getElementById(jQuery(this).attr('id') + 'Uploader').clearFileUploadQueue(false); - }); - } - }) -})(jQuery); \ No newline at end of file diff --git a/platforma/static/filebrowser/uploadify/jquery.uploadify.v2.1.0.min.js b/platforma/static/filebrowser/uploadify/jquery.uploadify.v2.1.0.min.js deleted file mode 100644 index 43053119..00000000 --- a/platforma/static/filebrowser/uploadify/jquery.uploadify.v2.1.0.min.js +++ /dev/null @@ -1,26 +0,0 @@ -/* -Uploadify v2.1.0 -Release Date: August 24, 2009 - -Copyright (c) 2009 Ronnie Garcia, Travis Nickels - -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 -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -*/ - -if(jQuery){(function(a){a.extend(a.fn,{uploadify:function(b){a(this).each(function(){settings=a.extend({id:a(this).attr("id"),uploader:"uploadify.swf",script:"uploadify.php",expressInstall:null,folder:"",height:30,width:110,cancelImg:"cancel.png",wmode:"opaque",scriptAccess:"sameDomain",fileDataName:"Filedata",method:"POST",queueSizeLimit:999,simUploadLimit:1,queueID:false,displayData:"percentage",onInit:function(){},onSelect:function(){},onQueueFull:function(){},onCheck:function(){},onCancel:function(){},onError:function(){},onProgress:function(){},onComplete:function(){},onAllComplete:function(){}},b);var e=location.pathname;e=e.split("/");e.pop();e=e.join("/")+"/";var f={};f.uploadifyID=settings.id;f.pagepath=e;if(settings.buttonImg){f.buttonImg=escape(settings.buttonImg)}if(settings.buttonText){f.buttonText=escape(settings.buttonText)}if(settings.rollover){f.rollover=true}f.script=settings.script;f.folder=escape(settings.folder);if(settings.scriptData){var g="";for(var d in settings.scriptData){g+="&"+d+"="+settings.scriptData[d]}f.scriptData=escape(g.substr(1))}f.width=settings.width;f.height=settings.height;f.wmode=settings.wmode;f.method=settings.method;f.queueSizeLimit=settings.queueSizeLimit;f.simUploadLimit=settings.simUploadLimit;if(settings.hideButton){f.hideButton=true}if(settings.fileDesc){f.fileDesc=settings.fileDesc}if(settings.fileExt){f.fileExt=settings.fileExt}if(settings.multi){f.multi=true}if(settings.auto){f.auto=true}if(settings.sizeLimit){f.sizeLimit=settings.sizeLimit}if(settings.checkScript){f.checkScript=settings.checkScript}if(settings.fileDataName){f.fileDataName=settings.fileDataName}if(settings.queueID){f.queueID=settings.queueID}if(settings.onInit()!==false){a(this).css("display","none");a(this).after('
');swfobject.embedSWF(settings.uploader,settings.id+"Uploader",settings.width,settings.height,"9.0.24",settings.expressInstall,f,{quality:"high",wmode:settings.wmode,allowScriptAccess:settings.scriptAccess});if(settings.queueID==false){a("#"+a(this).attr("id")+"Uploader").after('
')}}if(typeof(settings.onOpen)=="function"){a(this).bind("uploadifyOpen",settings.onOpen)}a(this).bind("uploadifySelect",{action:settings.onSelect,queueID:settings.queueID},function(j,h,i){if(j.data.action(j,h,i)!==false){var k=Math.round(i.size/1024*100)*0.01;var l="KB";if(k>1000){k=Math.round(k*0.001*100)*0.01;l="MB"}var m=k.toString().split(".");if(m.length>1){k=m[0]+"."+m[1].substr(0,2)}else{k=m[0]}if(i.name.length>20){fileName=i.name.substr(0,20)+"..."}else{fileName=i.name}queue="#"+a(this).attr("id")+"Queue";if(j.data.queueID){queue="#"+j.data.queueID}a(queue).append('
'+fileName+" ("+k+l+')
')}});if(typeof(settings.onSelectOnce)=="function"){a(this).bind("uploadifySelectOnce",settings.onSelectOnce)}a(this).bind("uploadifyQueueFull",{action:settings.onQueueFull},function(h,i){if(h.data.action(h,i)!==false){alert("The queue is full. The max size is "+i+".")}});a(this).bind("uploadifyCheckExist",{action:settings.onCheck},function(m,l,k,j,o){var i=new Object();i=k;i.folder=e+j;if(o){for(var h in k){var n=h}}a.post(l,i,function(r){for(var p in r){if(m.data.action(m,l,k,j,o)!==false){var q=confirm("Do you want to replace the file "+r[p]+"?");if(!q){document.getElementById(a(m.target).attr("id")+"Uploader").cancelFileUpload(p,true,true)}}}if(o){document.getElementById(a(m.target).attr("id")+"Uploader").startFileUpload(n,true)}else{document.getElementById(a(m.target).attr("id")+"Uploader").startFileUpload(null,true)}},"json")});a(this).bind("uploadifyCancel",{action:settings.onCancel},function(l,h,k,m,j){if(l.data.action(l,h,k,m,j)!==false){var i=(j==true)?0:250;a("#"+a(this).attr("id")+h).fadeOut(i,function(){a(this).remove()})}});if(typeof(settings.onClearQueue)=="function"){a(this).bind("uploadifyClearQueue",settings.onClearQueue)}var c=[];a(this).bind("uploadifyError",{action:settings.onError},function(l,h,k,j){if(l.data.action(l,h,k,j)!==false){var i=new Array(h,k,j);c.push(i);a("#"+a(this).attr("id")+h+" .percentage").text(" - "+j.type+" Error");a("#"+a(this).attr("id")+h).addClass("uploadifyError")}});a(this).bind("uploadifyProgress",{action:settings.onProgress,toDisplay:settings.displayData},function(j,h,i,k){if(j.data.action(j,h,i,k)!==false){a("#"+a(this).attr("id")+h+"ProgressBar").css("width",k.percentage+"%");if(j.data.toDisplay=="percentage"){displayData=" - "+k.percentage+"%"}if(j.data.toDisplay=="speed"){displayData=" - "+k.speed+"KB/s"}if(j.data.toDisplay==null){displayData=" "}a("#"+a(this).attr("id")+h+" .percentage").text(displayData)}});a(this).bind("uploadifyComplete",{action:settings.onComplete},function(k,h,j,i,l){if(k.data.action(k,h,j,unescape(i),l)!==false){a("#"+a(this).attr("id")+h+" .percentage").text(" - Completed");a("#"+a(this).attr("id")+h).fadeOut(250,function(){a(this).remove()})}});if(typeof(settings.onAllComplete)=="function"){a(this).bind("uploadifyAllComplete",{action:settings.onAllComplete},function(h,i){if(h.data.action(h,i)!==false){c=[]}})}})},uploadifySettings:function(f,j,c){var g=false;a(this).each(function(){if(f=="scriptData"&&j!=null){if(c){var i=j}else{var i=a.extend(settings.scriptData,j)}var l="";for(var k in i){l+="&"+k+"="+escape(i[k])}j=l.substr(1)}g=document.getElementById(a(this).attr("id")+"Uploader").updateSettings(f,j)});if(j==null){if(f=="scriptData"){var b=unescape(g).split("&");var e=new Object();for(var d=0;d - is released under the MIT License -*/ -var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y0){for(var af=0;af0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad'}}aa.outerHTML='"+af+"";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab \ No newline at end of file diff --git a/platforma/static/filebrowser/uploadify/uploadify.swf b/platforma/static/filebrowser/uploadify/uploadify.swf deleted file mode 100644 index 0385d9e6..00000000 Binary files a/platforma/static/filebrowser/uploadify/uploadify.swf and /dev/null differ diff --git a/platforma/static/icons/close.png b/platforma/static/icons/close.png deleted file mode 100644 index 5c08b05c..00000000 Binary files a/platforma/static/icons/close.png and /dev/null differ diff --git a/platforma/static/icons/go-next.png b/platforma/static/icons/go-next.png deleted file mode 100644 index 6ef8de76..00000000 Binary files a/platforma/static/icons/go-next.png and /dev/null differ diff --git a/platforma/static/icons/go-previous.png b/platforma/static/icons/go-previous.png deleted file mode 100644 index 659cd90d..00000000 Binary files a/platforma/static/icons/go-previous.png and /dev/null differ diff --git a/platforma/static/icons/zoom.png b/platforma/static/icons/zoom.png deleted file mode 100644 index 6033b4d5..00000000 Binary files a/platforma/static/icons/zoom.png and /dev/null differ diff --git a/platforma/static/icons/zoom_in.png b/platforma/static/icons/zoom_in.png deleted file mode 100644 index c7feedc6..00000000 Binary files a/platforma/static/icons/zoom_in.png and /dev/null differ diff --git a/platforma/static/icons/zoom_out.png b/platforma/static/icons/zoom_out.png deleted file mode 100644 index fdd7124e..00000000 Binary files a/platforma/static/icons/zoom_out.png and /dev/null differ diff --git a/platforma/static/img/gallery.png b/platforma/static/img/gallery.png deleted file mode 100644 index 851a6784..00000000 Binary files a/platforma/static/img/gallery.png and /dev/null differ diff --git a/platforma/static/img/logo.png b/platforma/static/img/logo.png deleted file mode 100644 index 398f45d0..00000000 Binary files a/platforma/static/img/logo.png and /dev/null differ diff --git a/platforma/static/img/sample_cover.png b/platforma/static/img/sample_cover.png deleted file mode 100644 index eb7e7d13..00000000 Binary files a/platforma/static/img/sample_cover.png and /dev/null differ diff --git a/platforma/static/img/spinner.gif b/platforma/static/img/spinner.gif deleted file mode 100644 index c69e9372..00000000 Binary files a/platforma/static/img/spinner.gif and /dev/null differ diff --git a/platforma/static/js/button_scripts.js b/platforma/static/js/button_scripts.js deleted file mode 100644 index 0d38b004..00000000 --- a/platforma/static/js/button_scripts.js +++ /dev/null @@ -1,293 +0,0 @@ -(function() { - var slice = Array.prototype.slice; - - function update(array, args) { - var arrayLength = array.length, length = args.length; - while (length--) array[arrayLength + length] = args[length]; - return array; - }; - - function merge(array, args) { - array = slice.call(array, 0); - return update(array, args); - }; - - Function.prototype.bind = function(context) { - if (arguments.length < 2 && typeof arguments[0] === 'undefined') { - return this; - } - var __method = this; - var args = slice.call(arguments, 1); - return function() { - var a = merge(args, arguments); - return __method.apply(context, a); - } - } - -})(); - -function nblck_each(array, body, after) { - $.each(array, function(i) { - body(this, i); - }); - - after(); -}; - -function nblck_map(array, func, after) { - var acc = []; - - nblck_each(array, function(elem, index) { - acc.push(func(elem, index)); - }, function(){ - after(acc); - }); -}; - -function ScriptletCenter() -{ - this.scriptlets = {}; - - this.scriptlets['insert_tag'] = function(context, params, done) - { - var text = this.XMLEditorSelectedText(context); - var start_tag = '<'+params.tag; - var move_cursor = false; - - for (var attr in params.attrs) { - start_tag += ' '+attr+'="' + params.attrs[attr] + '"'; - } - - start_tag += '>'; - var end_tag = ''; - - if(text.length > 0) { - // tokenize - var output = ''; - var token = ''; - for(var index=0; index < text.length; index++) - { - if (text[index].match(/\s/)) { // whitespace - token += text[index]; - } - else { // character - output += token; - if(output == token) output += start_tag; - token = ''; - output += text[index]; - } - } - - if( output[output.length-1] == '\\' ) { - output = output.substr(0, output.length-1) + end_tag + '\\'; - } else { - output += end_tag; - } - output += token; - } - else { - if(params.nocontent) { - output = "<"+params.tag +" />"; - } - else { - output = start_tag + end_tag; - move_cursor = true; - } - } - - this.XMLEditorReplaceSelectedText(context, output); - - try { - if (move_cursor) { - this.XMLEditorMoveCursorForward(context, params.tag.length+2); - } - } catch(e) {} - - done(); - }.bind(this); - - this.scriptlets['lineregexp'] = function(context, params, done) { - var self = this; - - var exprs = $.map(params.exprs, function(expr) { - var opts = "g"; - if(expr.length > 2) { - opts = expr[2]; - } return { - rx: new RegExp(expr[0], opts), - repl: expr[1] - }; - }); - - var partial = true; - var text = this.XMLEditorSelectedText(context); - if(!text) return done(); - - var changed = 0; - var lines = text.split('\n'); - - nblck_map(lines, function(line, index) { - var old_line = line; - $(exprs).each(function() { - var expr = this; - line = line.replace(expr.rx, expr.repl); - }); - - $progress.html(index); - - if(old_line != line) changed += 1; - return line; - }, function(newlines) { - if(changed > 0) { - self.XMLEditorReplaceSelectedText(context, newlines.join('\n') ); - }; - - done(); - }); - }.bind(this); - - this.scriptlets['fulltextregexp'] = function(context, params, done) { - var self = this; - - var exprs = $.map(params.exprs, function(expr) { - var opts = "mg"; - if(expr.length > 2) { - opts = expr[2]; - } - return { - rx: new RegExp(expr[0], opts), - repl: expr[1] - }; - }); - - var text = this.XMLEditorSelectedText(context); - if(!text) return done(); - var original = text; - - nblck_each(exprs, function(expr, index) { - $progress.html(600 + index); - text = text.replace(expr.rx, expr.repl); - }, function() { - if( original != text) { - self.XMLEditorReplaceSelectedText(context, text); - } - - done(); - }); - }.bind(this); - - this.scriptlets['macro'] = function(context, params, done) { - var self = this; - var i = 0; - - function next() { - if (i < params.length) { - var e = params[i]; - i = i + 1; - self.scriptlets[e[0]](context, e[1], next); - } - else { - done(); - } - }; - - next(); - }.bind(this); - - this.scriptlets['lowercase'] = function(context, params, done) - { - var text = this.XMLEditorSelectedText(context); - - if(!text) return; - - var repl = ''; - var lcase = text.toLowerCase(); - var ucase = text.toUpperCase(); - - if(lcase == text) repl = ucase; /* was lowercase */ - else if(ucase != text) repl = lcase; /* neither lower- or upper-case */ - else { /* upper case -> camel-case */ - var words = $(lcase.split(/\s/)).map(function() { - if(this.length > 0) { - return this[0].toUpperCase() + this.slice(1); - } else { - return ''; - } - }); - repl = words.join(' '); - } - - if(repl != text) this.XMLEditorReplaceSelectedText(context, repl); - - done(); - }.bind(this); - - - this.scriptlets["insert_stanza"] = function(context, params, done) { - var text = this.XMLEditorSelectedText(context); - - if(text) { - var verses = text.split('\n'); - text = ''; var buf = ''; var ebuf = ''; - var first = true; - - for(var i=0; i < verses.length; i++) { - var verse = verses[i].replace(/^\s+/, "").replace(/\s+$/, ""); - if(verse) { - text += (buf ? buf + '/\n' : '') + ebuf; - buf = (first ? '\n' : '') + verses[i]; - ebuf = ''; - first = false; - } else { - ebuf += '\n' + verses[i]; - } - } - text = text + buf + '\n' + ebuf; - this.XMLEditorReplaceSelectedText(context, text); - } - - if (!text) { - this.XMLEditorMoveCursorForward(context, params.tag.length + 2); - } - - done(); - }.bind(this); - -} - -ScriptletCenter.prototype.callInteractive = function(opts) { - $progress = $('Executing script'); - var self = this; - - $.blockUI({ - message: $progress, - - }); - - - self.scriptlets[opts.action](opts.context, opts.extra, function(){ - $.unblockUI(); // done - }); -} - -ScriptletCenter.prototype.XMLEditorSelectedText = function(editor) { - - return editor.selection(); -}; - -ScriptletCenter.prototype.XMLEditorReplaceSelectedText = function(editor, replacement) -{ - $progress.html("Replacing text"); - editor.replaceSelection(replacement); -}; - -ScriptletCenter.prototype.XMLEditorMoveCursorForward = function(panel, n) { - var pos = panel.cursorPosition(); - panel.selectLines(pos.line, pos.character + n); -}; - -var scriptletCenter; - -$(function() { - scriptletCenter = new ScriptletCenter(); -}); \ No newline at end of file diff --git a/platforma/static/js/jquery-1.4.2.min.js b/platforma/static/js/jquery-1.4.2.min.js deleted file mode 100644 index 7c243080..00000000 --- a/platforma/static/js/jquery-1.4.2.min.js +++ /dev/null @@ -1,154 +0,0 @@ -/*! - * jQuery JavaScript Library v1.4.2 - * http://jquery.com/ - * - * Copyright 2010, John Resig - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * Includes Sizzle.js - * http://sizzlejs.com/ - * Copyright 2010, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * - * Date: Sat Feb 13 22:33:48 2010 -0500 - */ -(function(A,w){function ma(){if(!c.isReady){try{s.documentElement.doScroll("left")}catch(a){setTimeout(ma,1);return}c.ready()}}function Qa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,j){var i=a.length;if(typeof b==="object"){for(var o in b)X(a,o,b[o],f,e,d);return a}if(d!==w){f=!j&&f&&c.isFunction(d);for(o=0;o)[^>]*$|^#([\w-]+)$/,Ua=/^.[^:#\[\.,]*$/,Va=/\S/, -Wa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Xa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,P=navigator.userAgent,xa=false,Q=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,R=Array.prototype.slice,ya=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(a==="body"&&!b){this.context=s;this[0]=s.body;this.selector="body";this.length=1;return this}if(typeof a==="string")if((d=Ta.exec(a))&& -(d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:s;if(a=Xa.exec(a))if(c.isPlainObject(b)){a=[s.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=sa([d[1]],[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}return c.merge(this,a)}else{if(b=s.getElementById(d[2])){if(b.id!==d[2])return T.find(a);this.length=1;this[0]=b}this.context=s;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=s;a=s.getElementsByTagName(a);return c.merge(this, -a)}else return!b||b.jquery?(b||T).find(a):c(b).find(a);else if(c.isFunction(a))return T.ready(a);if(a.selector!==w){this.selector=a.selector;this.context=a.context}return c.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){var f=c();c.isArray(a)?ba.apply(f,a):c.merge(f,a);f.prevObject=this;f.context=this.context;if(b=== -"find")f.selector=this.selector+(this.selector?" ":"")+d;else if(b)f.selector=this.selector+"."+b+"("+d+")";return f},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(s,c);else Q&&Q.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(R.apply(this,arguments),"slice",R.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this, -function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,j,i,o;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b
a"; -var e=d.getElementsByTagName("*"),j=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!j)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(j.getAttribute("style")),hrefNormalized:j.getAttribute("href")==="/a",opacity:/^0.55$/.test(j.style.opacity),cssFloat:!!j.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:s.createElement("select").appendChild(s.createElement("option")).selected, -parentNode:d.removeChild(d.appendChild(s.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};b.type="text/javascript";try{b.appendChild(s.createTextNode("window."+f+"=1;"))}catch(i){}a.insertBefore(b,a.firstChild);if(A[f]){c.support.scriptEval=true;delete A[f]}try{delete b.test}catch(o){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function k(){c.support.noCloneEvent= -false;d.detachEvent("onclick",k)});d.cloneNode(true).fireEvent("onclick")}d=s.createElement("div");d.innerHTML="";a=s.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var k=s.createElement("div");k.style.width=k.style.paddingLeft="1px";s.body.appendChild(k);c.boxModel=c.support.boxModel=k.offsetWidth===2;s.body.removeChild(k).style.display="none"});a=function(k){var n= -s.createElement("div");k="on"+k;var r=k in n;if(!r){n.setAttribute(k,"return;");r=typeof n[k]==="function"}return r};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=j=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ya=0,za={};c.extend({cache:{},expando:G,noData:{embed:true,object:true, -applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var f=a[G],e=c.cache;if(!f&&typeof b==="string"&&d===w)return null;f||(f=++Ya);if(typeof b==="object"){a[G]=f;e[f]=c.extend(true,{},b)}else if(!e[f]){a[G]=f;e[f]={}}a=e[f];if(d!==w)a[b]=d;return typeof b==="string"?a[b]:a}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{if(c.support.deleteExpando)delete a[c.expando]; -else a.removeAttribute&&a.removeAttribute(c.expando);delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===w){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===w&&this.length)f=c.data(this[0],a);return f===w&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this, -a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d);return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b=== -w)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var Aa=/[\n\t]/g,ca=/\s+/,Za=/\r/g,$a=/href|src|style/,ab=/(button|input)/i,bb=/(button|input|object|select|textarea)/i, -cb=/^(a|area)$/i,Ba=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(n){var r=c(this);r.addClass(a.call(this,n,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d-1)return true;return false},val:function(a){if(a===w){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var j=b?d:0;for(d=b?d+1:e.length;j=0;else if(c.nodeName(this,"select")){var u=c.makeArray(r);c("option",this).each(function(){this.selected= -c.inArray(c(this).val(),u)>=0});if(!u.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return w;if(f&&b in c.attrFn)return c(a)[b](d);f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==w;b=f&&c.props[b]||b;if(a.nodeType===1){var j=$a.test(b);if(b in a&&f&&!j){if(e){b==="type"&&ab.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed"); -a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:bb.test(a.nodeName)||cb.test(a.nodeName)&&a.href?0:w;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText=""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&j?a.getAttribute(b,2):a.getAttribute(b);return a===null?w:a}return c.style(a,b,d)}});var O=/\.(.*)$/,db=function(a){return a.replace(/[^\w\s\.\|`]/g, -function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==A&&!a.frameElement)a=A;var e,j;if(d.handler){e=d;d=e.handler}if(!d.guid)d.guid=c.guid++;if(j=c.data(a)){var i=j.events=j.events||{},o=j.handle;if(!o)j.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,arguments):w};o.elem=a;b=b.split(" ");for(var k,n=0,r;k=b[n++];){j=e?c.extend({},e):{handler:d,data:f};if(k.indexOf(".")>-1){r=k.split("."); -k=r.shift();j.namespace=r.slice(0).sort().join(".")}else{r=[];j.namespace=""}j.type=k;j.guid=d.guid;var u=i[k],z=c.event.special[k]||{};if(!u){u=i[k]=[];if(!z.setup||z.setup.call(a,f,r,o)===false)if(a.addEventListener)a.addEventListener(k,o,false);else a.attachEvent&&a.attachEvent("on"+k,o)}if(z.add){z.add.call(a,j);if(!j.handler.guid)j.handler.guid=d.guid}u.push(j);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){var e,j=0,i,o,k,n,r,u,z=c.data(a), -C=z&&z.events;if(z&&C){if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(e in C)c.event.remove(a,e+b)}else{for(b=b.split(" ");e=b[j++];){n=e;i=e.indexOf(".")<0;o=[];if(!i){o=e.split(".");e=o.shift();k=new RegExp("(^|\\.)"+c.map(o.slice(0).sort(),db).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(r=C[e])if(d){n=c.event.special[e]||{};for(B=f||0;B=0){a.type= -e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return w;a.result=w;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d,b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(j){}if(!a.isPropagationStopped()&& -f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){f=a.target;var i,o=c.nodeName(f,"a")&&e==="click",k=c.event.special[e]||{};if((!k._default||k._default.call(d,a)===false)&&!o&&!(f&&f.nodeName&&c.noData[f.nodeName.toLowerCase()])){try{if(f[e]){if(i=f["on"+e])f["on"+e]=null;c.event.triggered=true;f[e]()}}catch(n){}if(i)f["on"+e]=i;c.event.triggered=false}}},handle:function(a){var b,d,f,e;a=arguments[0]=c.event.fix(a||A.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive; -if(!b){d=a.type.split(".");a.type=d.shift();f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}e=c.data(this,"events");d=e[a.type];if(e&&d){d=d.slice(0);e=0;for(var j=d.length;e-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},fa=function(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Fa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data", -e);if(!(f===w||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:fa,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return fa.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return fa.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a, -"_change_data",Fa(a))}},setup:function(){if(this.type==="file")return false;for(var a in ea)c.event.add(this,a+".specialChange",ea[a]);return da.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return da.test(this.nodeName)}};ea=c.event.special.change.filters}s.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this,f)}c.event.special[b]={setup:function(){this.addEventListener(a, -d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var j in d)this[b](j,f,d[j],e);return this}if(c.isFunction(f)){e=f;f=w}var i=b==="one"?c.proxy(e,function(k){c(this).unbind(k,i);return e.apply(this,arguments)}):e;if(d==="unload"&&b!=="one")this.one(d,f,e);else{j=0;for(var o=this.length;j0){y=t;break}}t=t[g]}m[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, -e=0,j=Object.prototype.toString,i=false,o=true;[0,0].sort(function(){o=false;return 0});var k=function(g,h,l,m){l=l||[];var q=h=h||s;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g||typeof g!=="string")return l;for(var p=[],v,t,y,S,H=true,M=x(h),I=g;(f.exec(""),v=f.exec(I))!==null;){I=v[3];p.push(v[1]);if(v[2]){S=v[3];break}}if(p.length>1&&r.exec(g))if(p.length===2&&n.relative[p[0]])t=ga(p[0]+p[1],h);else for(t=n.relative[p[0]]?[h]:k(p.shift(),h);p.length;){g=p.shift();if(n.relative[g])g+=p.shift(); -t=ga(g,t)}else{if(!m&&p.length>1&&h.nodeType===9&&!M&&n.match.ID.test(p[0])&&!n.match.ID.test(p[p.length-1])){v=k.find(p.shift(),h,M);h=v.expr?k.filter(v.expr,v.set)[0]:v.set[0]}if(h){v=m?{expr:p.pop(),set:z(m)}:k.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=v.expr?k.filter(v.expr,v.set):v.set;if(p.length>0)y=z(t);else H=false;for(;p.length;){var D=p.pop();v=D;if(n.relative[D])v=p.pop();else D="";if(v==null)v=h;n.relative[D](y,v,M)}}else y=[]}y||(y=t);y||k.error(D|| -g);if(j.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))l.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&l.push(t[g]);else l.push.apply(l,y);else z(y,l);if(S){k(S,q,l,m);k.uniqueSort(l)}return l};k.uniqueSort=function(g){if(B){i=o;g.sort(B);if(i)for(var h=1;h":function(g,h){var l=typeof h==="string";if(l&&!/\W/.test(h)){h=h.toLowerCase();for(var m=0,q=g.length;m=0))l||m.push(v);else if(l)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()}, -CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,l,m,q,p){h=g[1].replace(/\\/g,"");if(!p&&n.attrMap[h])g[1]=n.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,l,m,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,h);else{g=k.filter(g[3],h,l,true^q);l||m.push.apply(m, -g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,l){return!!k(l[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)}, -text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}}, -setFilters:{first:function(g,h){return h===0},last:function(g,h,l,m){return h===m.length-1},even:function(g,h){return h%2===0},odd:function(g,h){return h%2===1},lt:function(g,h,l){return hl[3]-0},nth:function(g,h,l){return l[3]-0===h},eq:function(g,h,l){return l[3]-0===h}},filter:{PSEUDO:function(g,h,l,m){var q=h[1],p=n.filters[q];if(p)return p(g,l,h,m);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h= -h[3];l=0;for(m=h.length;l=0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var l=h[1];g=n.attrHandle[l]?n.attrHandle[l](g):g[l]!=null?g[l]:g.getAttribute(l);l=g+"";var m=h[2];h=h[4];return g==null?m==="!=":m=== -"="?l===h:m==="*="?l.indexOf(h)>=0:m==="~="?(" "+l+" ").indexOf(h)>=0:!h?l&&g!==false:m==="!="?l!==h:m==="^="?l.indexOf(h)===0:m==="$="?l.substr(l.length-h.length)===h:m==="|="?l===h||l.substr(0,h.length+1)===h+"-":false},POS:function(g,h,l,m){var q=n.setFilters[h[2]];if(q)return q(g,l,h,m)}}},r=n.match.POS;for(var u in n.match){n.match[u]=new RegExp(n.match[u].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[u]=new RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[u].source.replace(/\\(\d+)/g,function(g, -h){return"\\"+(h-0+1)}))}var z=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};try{Array.prototype.slice.call(s.documentElement.childNodes,0)}catch(C){z=function(g,h){h=h||[];if(j.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var l=0,m=g.length;l";var l=s.documentElement;l.insertBefore(g,l.firstChild);if(s.getElementById(h)){n.find.ID=function(m,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(m[1]))?q.id===m[1]||typeof q.getAttributeNode!=="undefined"&& -q.getAttributeNode("id").nodeValue===m[1]?[q]:w:[]};n.filter.ID=function(m,q){var p=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&p&&p.nodeValue===q}}l.removeChild(g);l=g=null})();(function(){var g=s.createElement("div");g.appendChild(s.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(h,l){l=l.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var m=0;l[m];m++)l[m].nodeType===1&&h.push(l[m]);l=h}return l};g.innerHTML=""; -if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(h){return h.getAttribute("href",2)};g=null})();s.querySelectorAll&&function(){var g=k,h=s.createElement("div");h.innerHTML="

";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){k=function(m,q,p,v){q=q||s;if(!v&&q.nodeType===9&&!x(q))try{return z(q.querySelectorAll(m),p)}catch(t){}return g(m,q,p,v)};for(var l in g)k[l]=g[l];h=null}}(); -(function(){var g=s.createElement("div");g.innerHTML="
";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(h,l,m){if(typeof l.getElementsByClassName!=="undefined"&&!m)return l.getElementsByClassName(h[1])};g=null}}})();var E=s.compareDocumentPosition?function(g,h){return!!(g.compareDocumentPosition(h)&16)}: -function(g,h){return g!==h&&(g.contains?g.contains(h):true)},x=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},ga=function(g,h){var l=[],m="",q;for(h=h.nodeType?[h]:h;q=n.match.PSEUDO.exec(g);){m+=q[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;q=0;for(var p=h.length;q=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f0)for(var j=d;j0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,j= -{},i;if(f&&a.length){e=0;for(var o=a.length;e-1:c(f).is(e)){d.push({selector:i,elem:f});delete j[i]}}f=f.parentNode}}return d}var k=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(n,r){for(;r&&r.ownerDocument&&r!==b;){if(k?k.index(r)>-1:c(r).is(a))return r;r=r.parentNode}return null})},index:function(a){if(!a||typeof a=== -"string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),a);return this.pushStack(qa(a[0])||qa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode", -d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")? -a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);eb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e):e;if((this.length>1||gb.test(f))&&fb.test(a))e=e.reverse();return this.pushStack(e,a,R.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===w||a.nodeType!==1||!c(a).is(d));){a.nodeType=== -1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var Ja=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ka=/(<([\w:]+)[^>]*?)\/>/g,hb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,La=/<([\w:]+)/,ib=/"},F={option:[1,""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div
","
"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d= -c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==w)return this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this}, -wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})}, -prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b, -this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,f;(f=this[d])!=null;d++)if(!a||c.filter(a,[f]).length){if(!b&&f.nodeType===1){c.cleanData(f.getElementsByTagName("*"));c.cleanData([f])}f.parentNode&&f.parentNode.removeChild(f)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild); -return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Ja,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){ra(this,b);ra(this.find("*"),b.find("*"))}return b},html:function(a){if(a===w)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Ja, -""):null;else if(typeof a==="string"&&!ta.test(a)&&(c.support.leadingWhitespace||!V.test(a))&&!F[(La.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ka,Ma);try{for(var b=0,d=this.length;b0||e.cacheable||this.length>1?k.cloneNode(true):k)}o.length&&c.each(o,Qa)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var f=[];d=c(d);var e=this.length===1&&this[0].parentNode;if(e&&e.nodeType===11&&e.childNodes.length===1&&d.length===1){d[b](this[0]); -return this}else{e=0;for(var j=d.length;e0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),i);f=f.concat(i)}return this.pushStack(f,a,d.selector)}}});c.extend({clean:function(a,b,d,f){b=b||s;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||s;for(var e=[],j=0,i;(i=a[j])!=null;j++){if(typeof i==="number")i+="";if(i){if(typeof i==="string"&&!jb.test(i))i=b.createTextNode(i);else if(typeof i==="string"){i=i.replace(Ka,Ma);var o=(La.exec(i)||["", -""])[1].toLowerCase(),k=F[o]||F._default,n=k[0],r=b.createElement("div");for(r.innerHTML=k[1]+i+k[2];n--;)r=r.lastChild;if(!c.support.tbody){n=ib.test(i);o=o==="table"&&!n?r.firstChild&&r.firstChild.childNodes:k[1]===""&&!n?r.childNodes:[];for(k=o.length-1;k>=0;--k)c.nodeName(o[k],"tbody")&&!o[k].childNodes.length&&o[k].parentNode.removeChild(o[k])}!c.support.leadingWhitespace&&V.test(i)&&r.insertBefore(b.createTextNode(V.exec(i)[0]),r.firstChild);i=r.childNodes}if(i.nodeType)e.push(i);else e= -c.merge(e,i)}}if(d)for(j=0;e[j];j++)if(f&&c.nodeName(e[j],"script")&&(!e[j].type||e[j].type.toLowerCase()==="text/javascript"))f.push(e[j].parentNode?e[j].parentNode.removeChild(e[j]):e[j]);else{e[j].nodeType===1&&e.splice.apply(e,[j+1,0].concat(c.makeArray(e[j].getElementsByTagName("script"))));d.appendChild(e[j])}return e},cleanData:function(a){for(var b,d,f=c.cache,e=c.event.special,j=c.support.deleteExpando,i=0,o;(o=a[i])!=null;i++)if(d=o[c.expando]){b=f[d];if(b.events)for(var k in b.events)e[k]? -c.event.remove(o,k):Ca(o,k,b.handle);if(j)delete o[c.expando];else o.removeAttribute&&o.removeAttribute(c.expando);delete f[d]}}});var kb=/z-?index|font-?weight|opacity|zoom|line-?height/i,Na=/alpha\([^)]*\)/,Oa=/opacity=([^)]*)/,ha=/float/i,ia=/-([a-z])/ig,lb=/([A-Z])/g,mb=/^-?\d+(?:px)?$/i,nb=/^-?\d/,ob={position:"absolute",visibility:"hidden",display:"block"},pb=["Left","Right"],qb=["Top","Bottom"],rb=s.defaultView&&s.defaultView.getComputedStyle,Pa=c.support.cssFloat?"cssFloat":"styleFloat",ja= -function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===w)return c.curCSS(d,f);if(typeof e==="number"&&!kb.test(f))e+="px";c.style(d,f,e)})};c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return w;if((b==="width"||b==="height")&&parseFloat(d)<0)d=w;var f=a.style||a,e=d!==w;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter= -Na.test(a)?a.replace(Na,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Oa.exec(f.filter)[1])/100+"":""}if(ha.test(b))b=Pa;b=b.replace(ia,ja);if(e)f[b]=d;return f[b]},css:function(a,b,d,f){if(b==="width"||b==="height"){var e,j=b==="width"?pb:qb;function i(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(j,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a, -"border"+this+"Width",true))||0})}a.offsetWidth!==0?i():c.swap(a,ob,i);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&&a.currentStyle){f=Oa.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ha.test(b))b=Pa;if(!d&&e&&e[b])f=e[b];else if(rb){if(ha.test(b))b="float";b=b.replace(lb,"-$1").toLowerCase();e=a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f= -a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ia,ja);f=a.currentStyle[b]||a.currentStyle[d];if(!mb.test(f)&&nb.test(f)){b=e.left;var j=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=j}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b= -a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var sb=J(),tb=//gi,ub=/select|textarea/i,vb=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,N=/=\?(&|$)/,ka=/\?/,wb=/(\?|&)_=.*?(&|$)/,xb=/^(\w+:)?\/\/([^\/?#]+)/,yb=/%20/g,zb=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!== -"string")return zb.call(this,a);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var e=a.slice(f,a.length);a=a.slice(0,f)}f="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);f="POST"}var j=this;c.ajax({url:a,type:f,dataType:"html",data:b,complete:function(i,o){if(o==="success"||o==="notmodified")j.html(e?c("
").append(i.responseText.replace(tb,"")).find(e):i.responseText);d&&j.each(d,[i.responseText,o,i])}});return this}, -serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ub.test(this.nodeName)||vb.test(this.type))}).map(function(a,b){a=c(this).val();return a==null?null:c.isArray(a)?c.map(a,function(d){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), -function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:f})},getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:f})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href, -global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:A.XMLHttpRequest&&(A.location.protocol!=="file:"||!A.ActiveXObject)?function(){return new A.XMLHttpRequest}:function(){try{return new A.ActiveXObject("Microsoft.XMLHTTP")}catch(a){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(a){function b(){e.success&& -e.success.call(k,o,i,x);e.global&&f("ajaxSuccess",[x,e])}function d(){e.complete&&e.complete.call(k,x,i);e.global&&f("ajaxComplete",[x,e]);e.global&&!--c.active&&c.event.trigger("ajaxStop")}function f(q,p){(e.context?c(e.context):c.event).trigger(q,p)}var e=c.extend(true,{},c.ajaxSettings,a),j,i,o,k=a&&a.context||e,n=e.type.toUpperCase();if(e.data&&e.processData&&typeof e.data!=="string")e.data=c.param(e.data,e.traditional);if(e.dataType==="jsonp"){if(n==="GET")N.test(e.url)||(e.url+=(ka.test(e.url)? -"&":"?")+(e.jsonp||"callback")+"=?");else if(!e.data||!N.test(e.data))e.data=(e.data?e.data+"&":"")+(e.jsonp||"callback")+"=?";e.dataType="json"}if(e.dataType==="json"&&(e.data&&N.test(e.data)||N.test(e.url))){j=e.jsonpCallback||"jsonp"+sb++;if(e.data)e.data=(e.data+"").replace(N,"="+j+"$1");e.url=e.url.replace(N,"="+j+"$1");e.dataType="script";A[j]=A[j]||function(q){o=q;b();d();A[j]=w;try{delete A[j]}catch(p){}z&&z.removeChild(C)}}if(e.dataType==="script"&&e.cache===null)e.cache=false;if(e.cache=== -false&&n==="GET"){var r=J(),u=e.url.replace(wb,"$1_="+r+"$2");e.url=u+(u===e.url?(ka.test(e.url)?"&":"?")+"_="+r:"")}if(e.data&&n==="GET")e.url+=(ka.test(e.url)?"&":"?")+e.data;e.global&&!c.active++&&c.event.trigger("ajaxStart");r=(r=xb.exec(e.url))&&(r[1]&&r[1]!==location.protocol||r[2]!==location.host);if(e.dataType==="script"&&n==="GET"&&r){var z=s.getElementsByTagName("head")[0]||s.documentElement,C=s.createElement("script");C.src=e.url;if(e.scriptCharset)C.charset=e.scriptCharset;if(!j){var B= -false;C.onload=C.onreadystatechange=function(){if(!B&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){B=true;b();d();C.onload=C.onreadystatechange=null;z&&C.parentNode&&z.removeChild(C)}}}z.insertBefore(C,z.firstChild);return w}var E=false,x=e.xhr();if(x){e.username?x.open(n,e.url,e.async,e.username,e.password):x.open(n,e.url,e.async);try{if(e.data||a&&a.contentType)x.setRequestHeader("Content-Type",e.contentType);if(e.ifModified){c.lastModified[e.url]&&x.setRequestHeader("If-Modified-Since", -c.lastModified[e.url]);c.etag[e.url]&&x.setRequestHeader("If-None-Match",c.etag[e.url])}r||x.setRequestHeader("X-Requested-With","XMLHttpRequest");x.setRequestHeader("Accept",e.dataType&&e.accepts[e.dataType]?e.accepts[e.dataType]+", */*":e.accepts._default)}catch(ga){}if(e.beforeSend&&e.beforeSend.call(k,x,e)===false){e.global&&!--c.active&&c.event.trigger("ajaxStop");x.abort();return false}e.global&&f("ajaxSend",[x,e]);var g=x.onreadystatechange=function(q){if(!x||x.readyState===0||q==="abort"){E|| -d();E=true;if(x)x.onreadystatechange=c.noop}else if(!E&&x&&(x.readyState===4||q==="timeout")){E=true;x.onreadystatechange=c.noop;i=q==="timeout"?"timeout":!c.httpSuccess(x)?"error":e.ifModified&&c.httpNotModified(x,e.url)?"notmodified":"success";var p;if(i==="success")try{o=c.httpData(x,e.dataType,e)}catch(v){i="parsererror";p=v}if(i==="success"||i==="notmodified")j||b();else c.handleError(e,x,i,p);d();q==="timeout"&&x.abort();if(e.async)x=null}};try{var h=x.abort;x.abort=function(){x&&h.call(x); -g("abort")}}catch(l){}e.async&&e.timeout>0&&setTimeout(function(){x&&!E&&g("timeout")},e.timeout);try{x.send(n==="POST"||n==="PUT"||n==="DELETE"?e.data:null)}catch(m){c.handleError(e,x,null,m);d()}e.async||g();return x}},handleError:function(a,b,d,f){if(a.error)a.error.call(a.context||a,b,d,f);if(a.global)(a.context?c(a.context):c.event).trigger("ajaxError",[b,a,f])},active:0,httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status=== -1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(f)c.etag[b]=f;return a.status===304||a.status===0},httpData:function(a,b,d){var f=a.getResponseHeader("content-type")||"",e=b==="xml"||!b&&f.indexOf("xml")>=0;a=e?a.responseXML:a.responseText;e&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b=== -"json"||!b&&f.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a},param:function(a,b){function d(i,o){if(c.isArray(o))c.each(o,function(k,n){b||/\[\]$/.test(i)?f(i,n):d(i+"["+(typeof n==="object"||c.isArray(n)?k:"")+"]",n)});else!b&&o!=null&&typeof o==="object"?c.each(o,function(k,n){d(i+"["+k+"]",n)}):f(i,o)}function f(i,o){o=c.isFunction(o)?o():o;e[e.length]=encodeURIComponent(i)+"="+encodeURIComponent(o)}var e=[];if(b===w)b=c.ajaxSettings.traditional; -if(c.isArray(a)||a.jquery)c.each(a,function(){f(this.name,this.value)});else for(var j in a)d(j,a[j]);return e.join("&").replace(yb,"+")}});var la={},Ab=/toggle|show|hide/,Bb=/^([+-]=)?([\d+-.]+)(.*)$/,W,va=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b){if(a||a===0)return this.animate(K("show",3),a,b);else{a=0;for(b=this.length;a").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove();la[d]=f}c.data(this[a],"olddisplay",f)}}a=0;for(b=this.length;a=0;f--)if(d[f].elem===this){b&&d[f](true);d.splice(f,1)}});b||this.dequeue();return this}});c.each({slideDown:K("show",1),slideUp:K("hide",1),slideToggle:K("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,f){return this.animate(b,d,f)}});c.extend({speed:function(a,b,d){var f=a&&typeof a==="object"?a:{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};f.duration=c.fx.off?0:typeof f.duration=== -"number"?f.duration:c.fx.speeds[f.duration]||c.fx.speeds._default;f.old=f.complete;f.complete=function(){f.queue!==false&&c(this).dequeue();c.isFunction(f.old)&&f.old.call(this)};return f},easing:{linear:function(a,b,d,f){return d+f*a},swing:function(a,b,d,f){return(-Math.cos(a*Math.PI)/2+0.5)*f+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]|| -c.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style)this.elem.style.display="block"},cur:function(a){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];return(a=parseFloat(c.css(this.elem,this.prop,a)))&&a>-10000?a:parseFloat(c.curCSS(this.elem,this.prop))||0},custom:function(a,b,d){function f(j){return e.step(j)}this.startTime=J();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start; -this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now= -this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem, -e,this.options.orig[e]);this.options.complete.call(this.elem)}return false}else{e=b-this.startTime;this.state=e/this.options.duration;a=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,e,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b
"; -a.insertBefore(b,a.firstChild);d=b.firstChild;f=d.firstChild;e=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=f.offsetTop!==5;this.doesAddBorderForTableAndCells=e.offsetTop===5;f.style.position="fixed";f.style.top="20px";this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15;f.style.position=f.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==j;a.removeChild(b); -c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.curCSS(a,"marginTop",true))||0;d+=parseFloat(c.curCSS(a,"marginLeft",true))||0}return{top:b,left:d}},setOffset:function(a,b,d){if(/static/.test(c.curCSS(a,"position")))a.style.position="relative";var f=c(a),e=f.offset(),j=parseInt(c.curCSS(a,"top",true),10)||0,i=parseInt(c.curCSS(a,"left",true),10)||0;if(c.isFunction(b))b=b.call(a, -d,e);d={top:b.top-e.top+j,left:b.left-e.left+i};"using"in b?b.using.call(a,d):f.css(d)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),f=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.curCSS(a,"marginTop",true))||0;d.left-=parseFloat(c.curCSS(a,"marginLeft",true))||0;f.top+=parseFloat(c.curCSS(b[0],"borderTopWidth",true))||0;f.left+=parseFloat(c.curCSS(b[0],"borderLeftWidth",true))||0;return{top:d.top- -f.top,left:d.left-f.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||s.body;a&&!/^body|html$/i.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(f){var e=this[0],j;if(!e)return null;if(f!==w)return this.each(function(){if(j=wa(this))j.scrollTo(!a?f:c(j).scrollLeft(),a?f:c(j).scrollTop());else this[d]=f});else return(j=wa(e))?"pageXOffset"in j?j[a?"pageYOffset": -"pageXOffset"]:c.support.boxModel&&j.document.documentElement[d]||j.document.body[d]:e[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?c.css(this[0],d,false,"padding"):null};c.fn["outer"+b]=function(f){return this[0]?c.css(this[0],d,false,f?"margin":"border"):null};c.fn[d]=function(f){var e=this[0];if(!e)return f==null?null:this;if(c.isFunction(f))return this.each(function(j){var i=c(this);i[d](f.call(this,j,i[d]()))});return"scrollTo"in -e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]||e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===w?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});A.jQuery=A.$=c})(window); diff --git a/platforma/static/js/jquery.autocomplete.js b/platforma/static/js/jquery.autocomplete.js deleted file mode 100644 index 0d25ba66..00000000 --- a/platforma/static/js/jquery.autocomplete.js +++ /dev/null @@ -1,808 +0,0 @@ -/* - * jQuery Autocomplete plugin 1.1 - * - * Copyright (c) 2009 Jörn Zaefferer - * - * Dual licensed under the MIT and GPL licenses: - * http://www.opensource.org/licenses/mit-license.php - * http://www.gnu.org/licenses/gpl.html - * - * Revision: $Id: jquery.autocomplete.js 15 2009-08-22 10:30:27Z joern.zaefferer $ - */ - -;(function($) { - -$.fn.extend({ - autocomplete: function(urlOrData, options) { - var isUrl = typeof urlOrData == "string"; - options = $.extend({}, $.Autocompleter.defaults, { - url: isUrl ? urlOrData : null, - data: isUrl ? null : urlOrData, - delay: isUrl ? $.Autocompleter.defaults.delay : 10, - max: options && !options.scroll ? 10 : 150 - }, options); - - // if highlight is set to false, replace it with a do-nothing function - options.highlight = options.highlight || function(value) { return value; }; - - // if the formatMatch option is not specified, then use formatItem for backwards compatibility - options.formatMatch = options.formatMatch || options.formatItem; - - return this.each(function() { - new $.Autocompleter(this, options); - }); - }, - result: function(handler) { - return this.bind("result", handler); - }, - search: function(handler) { - return this.trigger("search", [handler]); - }, - flushCache: function() { - return this.trigger("flushCache"); - }, - setOptions: function(options){ - return this.trigger("setOptions", [options]); - }, - unautocomplete: function() { - return this.trigger("unautocomplete"); - } -}); - -$.Autocompleter = function(input, options) { - - var KEY = { - UP: 38, - DOWN: 40, - DEL: 46, - TAB: 9, - RETURN: 13, - ESC: 27, - COMMA: 188, - PAGEUP: 33, - PAGEDOWN: 34, - BACKSPACE: 8 - }; - - // Create $ object for input element - var $input = $(input).attr("autocomplete", "off").addClass(options.inputClass); - - var timeout; - var previousValue = ""; - var cache = $.Autocompleter.Cache(options); - var hasFocus = 0; - var lastKeyPressCode; - var config = { - mouseDownOnSelect: false - }; - var select = $.Autocompleter.Select(options, input, selectCurrent, config); - - var blockSubmit; - - // prevent form submit in opera when selecting with return key - $.browser.opera && $(input.form).bind("submit.autocomplete", function() { - if (blockSubmit) { - blockSubmit = false; - return false; - } - }); - - // only opera doesn't trigger keydown multiple times while pressed, others don't work with keypress at all - $input.bind(($.browser.opera ? "keypress" : "keydown") + ".autocomplete", function(event) { - // a keypress means the input has focus - // avoids issue where input had focus before the autocomplete was applied - hasFocus = 1; - // track last key pressed - lastKeyPressCode = event.keyCode; - switch(event.keyCode) { - - case KEY.UP: - event.preventDefault(); - if ( select.visible() ) { - select.prev(); - } else { - onChange(0, true); - } - break; - - case KEY.DOWN: - event.preventDefault(); - if ( select.visible() ) { - select.next(); - } else { - onChange(0, true); - } - break; - - case KEY.PAGEUP: - event.preventDefault(); - if ( select.visible() ) { - select.pageUp(); - } else { - onChange(0, true); - } - break; - - case KEY.PAGEDOWN: - event.preventDefault(); - if ( select.visible() ) { - select.pageDown(); - } else { - onChange(0, true); - } - break; - - // matches also semicolon - case options.multiple && $.trim(options.multipleSeparator) == "," && KEY.COMMA: - case KEY.TAB: - case KEY.RETURN: - if( selectCurrent() ) { - // stop default to prevent a form submit, Opera needs special handling - event.preventDefault(); - blockSubmit = true; - return false; - } - break; - - case KEY.ESC: - select.hide(); - break; - - default: - clearTimeout(timeout); - timeout = setTimeout(onChange, options.delay); - break; - } - }).focus(function(){ - // track whether the field has focus, we shouldn't process any - // results if the field no longer has focus - hasFocus++; - }).blur(function() { - hasFocus = 0; - if (!config.mouseDownOnSelect) { - hideResults(); - } - }).click(function() { - // show select when clicking in a focused field - if ( hasFocus++ > 1 && !select.visible() ) { - onChange(0, true); - } - }).bind("search", function() { - // TODO why not just specifying both arguments? - var fn = (arguments.length > 1) ? arguments[1] : null; - function findValueCallback(q, data) { - var result; - if( data && data.length ) { - for (var i=0; i < data.length; i++) { - if( data[i].result.toLowerCase() == q.toLowerCase() ) { - result = data[i]; - break; - } - } - } - if( typeof fn == "function" ) fn(result); - else $input.trigger("result", result && [result.data, result.value]); - } - $.each(trimWords($input.val()), function(i, value) { - request(value, findValueCallback, findValueCallback); - }); - }).bind("flushCache", function() { - cache.flush(); - }).bind("setOptions", function() { - $.extend(options, arguments[1]); - // if we've updated the data, repopulate - if ( "data" in arguments[1] ) - cache.populate(); - }).bind("unautocomplete", function() { - select.unbind(); - $input.unbind(); - $(input.form).unbind(".autocomplete"); - }); - - - function selectCurrent() { - var selected = select.selected(); - if( !selected ) - return false; - - var v = selected.result; - previousValue = v; - - if ( options.multiple ) { - var words = trimWords($input.val()); - if ( words.length > 1 ) { - var seperator = options.multipleSeparator.length; - var cursorAt = $(input).selection().start; - var wordAt, progress = 0; - $.each(words, function(i, word) { - progress += word.length; - if (cursorAt <= progress) { - wordAt = i; - return false; - } - progress += seperator; - }); - words[wordAt] = v; - // TODO this should set the cursor to the right position, but it gets overriden somewhere - //$.Autocompleter.Selection(input, progress + seperator, progress + seperator); - v = words.join( options.multipleSeparator ); - } - v += options.multipleSeparator; - } - - $input.val(v); - hideResultsNow(); - $input.trigger("result", [selected.data, selected.value]); - return true; - } - - function onChange(crap, skipPrevCheck) { - if( lastKeyPressCode == KEY.DEL ) { - select.hide(); - return; - } - - var currentValue = $input.val(); - - if ( !skipPrevCheck && currentValue == previousValue ) - return; - - previousValue = currentValue; - - currentValue = lastWord(currentValue); - if ( currentValue.length >= options.minChars) { - $input.addClass(options.loadingClass); - if (!options.matchCase) - currentValue = currentValue.toLowerCase(); - request(currentValue, receiveData, hideResultsNow); - } else { - stopLoading(); - select.hide(); - } - }; - - function trimWords(value) { - if (!value) - return [""]; - if (!options.multiple) - return [$.trim(value)]; - return $.map(value.split(options.multipleSeparator), function(word) { - return $.trim(value).length ? $.trim(word) : null; - }); - } - - function lastWord(value) { - if ( !options.multiple ) - return value; - var words = trimWords(value); - if (words.length == 1) - return words[0]; - var cursorAt = $(input).selection().start; - if (cursorAt == value.length) { - words = trimWords(value) - } else { - words = trimWords(value.replace(value.substring(cursorAt), "")); - } - return words[words.length - 1]; - } - - // fills in the input box w/the first match (assumed to be the best match) - // q: the term entered - // sValue: the first matching result - function autoFill(q, sValue){ - // autofill in the complete box w/the first match as long as the user hasn't entered in more data - // if the last user key pressed was backspace, don't autofill - if( options.autoFill && (lastWord($input.val()).toLowerCase() == q.toLowerCase()) && lastKeyPressCode != KEY.BACKSPACE ) { - // fill in the value (keep the case the user has typed) - $input.val($input.val() + sValue.substring(lastWord(previousValue).length)); - // select the portion of the value not typed by the user (so the next character will erase) - $(input).selection(previousValue.length, previousValue.length + sValue.length); - } - }; - - function hideResults() { - clearTimeout(timeout); - timeout = setTimeout(hideResultsNow, 200); - }; - - function hideResultsNow() { - var wasVisible = select.visible(); - select.hide(); - clearTimeout(timeout); - stopLoading(); - if (options.mustMatch) { - // call search and run callback - $input.search( - function (result){ - // if no value found, clear the input box - if( !result ) { - if (options.multiple) { - var words = trimWords($input.val()).slice(0, -1); - $input.val( words.join(options.multipleSeparator) + (words.length ? options.multipleSeparator : "") ); - } - else { - $input.val( "" ); - $input.trigger("result", null); - } - } - } - ); - } - }; - - function receiveData(q, data) { - if ( data && data.length && hasFocus ) { - stopLoading(); - select.display(data, q); - autoFill(q, data[0].value); - select.show(); - } else { - hideResultsNow(); - } - }; - - function request(term, success, failure) { - if (!options.matchCase) - term = term.toLowerCase(); - var data = cache.load(term); - // recieve the cached data - if (data && data.length) { - success(term, data); - // if an AJAX url has been supplied, try loading the data now - } else if( (typeof options.url == "string") && (options.url.length > 0) ){ - - var extraParams = { - timestamp: +new Date() - }; - $.each(options.extraParams, function(key, param) { - extraParams[key] = typeof param == "function" ? param() : param; - }); - - $.ajax({ - // try to leverage ajaxQueue plugin to abort previous requests - mode: "abort", - // limit abortion to this input - port: "autocomplete" + input.name, - dataType: options.dataType, - url: options.url, - data: $.extend({ - q: lastWord(term), - limit: options.max - }, extraParams), - success: function(data) { - var parsed = options.parse && options.parse(data) || parse(data); - cache.add(term, parsed); - success(term, parsed); - } - }); - } else { - // if we have a failure, we need to empty the list -- this prevents the the [TAB] key from selecting the last successful match - select.emptyList(); - failure(term); - } - }; - - function parse(data) { - var parsed = []; - var rows = data.split("\n"); - for (var i=0; i < rows.length; i++) { - var row = $.trim(rows[i]); - if (row) { - row = row.split("|"); - parsed[parsed.length] = { - data: row, - value: row[0], - result: options.formatResult && options.formatResult(row, row[0]) || row[0] - }; - } - } - return parsed; - }; - - function stopLoading() { - $input.removeClass(options.loadingClass); - }; - -}; - -$.Autocompleter.defaults = { - inputClass: "ac_input", - resultsClass: "ac_results", - loadingClass: "ac_loading", - minChars: 1, - delay: 400, - matchCase: false, - matchSubset: true, - matchContains: false, - cacheLength: 10, - max: 100, - mustMatch: false, - extraParams: {}, - selectFirst: true, - formatItem: function(row) { return row[0]; }, - formatMatch: null, - autoFill: false, - width: 0, - multiple: false, - multipleSeparator: ", ", - highlight: function(value, term) { - return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1") + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "$1"); - }, - scroll: true, - scrollHeight: 180 -}; - -$.Autocompleter.Cache = function(options) { - - var data = {}; - var length = 0; - - function matchSubset(s, sub) { - if (!options.matchCase) - s = s.toLowerCase(); - var i = s.indexOf(sub); - if (options.matchContains == "word"){ - i = s.toLowerCase().search("\\b" + sub.toLowerCase()); - } - if (i == -1) return false; - return i == 0 || options.matchContains; - }; - - function add(q, value) { - if (length > options.cacheLength){ - flush(); - } - if (!data[q]){ - length++; - } - data[q] = value; - } - - function populate(){ - if( !options.data ) return false; - // track the matches - var stMatchSets = {}, - nullData = 0; - - // no url was specified, we need to adjust the cache length to make sure it fits the local data store - if( !options.url ) options.cacheLength = 1; - - // track all options for minChars = 0 - stMatchSets[""] = []; - - // loop through the array and create a lookup structure - for ( var i = 0, ol = options.data.length; i < ol; i++ ) { - var rawValue = options.data[i]; - // if rawValue is a string, make an array otherwise just reference the array - rawValue = (typeof rawValue == "string") ? [rawValue] : rawValue; - - var value = options.formatMatch(rawValue, i+1, options.data.length); - if ( value === false ) - continue; - - var firstChar = value.charAt(0).toLowerCase(); - // if no lookup array for this character exists, look it up now - if( !stMatchSets[firstChar] ) - stMatchSets[firstChar] = []; - - // if the match is a string - var row = { - value: value, - data: rawValue, - result: options.formatResult && options.formatResult(rawValue) || value - }; - - // push the current match into the set list - stMatchSets[firstChar].push(row); - - // keep track of minChars zero items - if ( nullData++ < options.max ) { - stMatchSets[""].push(row); - } - }; - - // add the data items to the cache - $.each(stMatchSets, function(i, value) { - // increase the cache size - options.cacheLength++; - // add to the cache - add(i, value); - }); - } - - // populate any existing data - setTimeout(populate, 25); - - function flush(){ - data = {}; - length = 0; - } - - return { - flush: flush, - add: add, - populate: populate, - load: function(q) { - if (!options.cacheLength || !length) - return null; - /* - * if dealing w/local data and matchContains than we must make sure - * to loop through all the data collections looking for matches - */ - if( !options.url && options.matchContains ){ - // track all matches - var csub = []; - // loop through all the data grids for matches - for( var k in data ){ - // don't search through the stMatchSets[""] (minChars: 0) cache - // this prevents duplicates - if( k.length > 0 ){ - var c = data[k]; - $.each(c, function(i, x) { - // if we've got a match, add it to the array - if (matchSubset(x.value, q)) { - csub.push(x); - } - }); - } - } - return csub; - } else - // if the exact item exists, use it - if (data[q]){ - return data[q]; - } else - if (options.matchSubset) { - for (var i = q.length - 1; i >= options.minChars; i--) { - var c = data[q.substr(0, i)]; - if (c) { - var csub = []; - $.each(c, function(i, x) { - if (matchSubset(x.value, q)) { - csub[csub.length] = x; - } - }); - return csub; - } - } - } - return null; - } - }; -}; - -$.Autocompleter.Select = function (options, input, select, config) { - var CLASSES = { - ACTIVE: "ac_over" - }; - - var listItems, - active = -1, - data, - term = "", - needsInit = true, - element, - list; - - // Create results - function init() { - if (!needsInit) - return; - element = $("
") - .hide() - .addClass(options.resultsClass) - .css("position", "absolute") - .appendTo(document.body); - - list = $("
    ").appendTo(element).mouseover( function(event) { - if(target(event).nodeName && target(event).nodeName.toUpperCase() == 'LI') { - active = $("li", list).removeClass(CLASSES.ACTIVE).index(target(event)); - $(target(event)).addClass(CLASSES.ACTIVE); - } - }).click(function(event) { - $(target(event)).addClass(CLASSES.ACTIVE); - select(); - // TODO provide option to avoid setting focus again after selection? useful for cleanup-on-focus - input.focus(); - return false; - }).mousedown(function() { - config.mouseDownOnSelect = true; - }).mouseup(function() { - config.mouseDownOnSelect = false; - }); - - if( options.width > 0 ) - element.css("width", options.width); - - needsInit = false; - } - - function target(event) { - var element = event.target; - while(element && element.tagName != "LI") - element = element.parentNode; - // more fun with IE, sometimes event.target is empty, just ignore it then - if(!element) - return []; - return element; - } - - function moveSelect(step) { - listItems.slice(active, active + 1).removeClass(CLASSES.ACTIVE); - movePosition(step); - var activeItem = listItems.slice(active, active + 1).addClass(CLASSES.ACTIVE); - if(options.scroll) { - var offset = 0; - listItems.slice(0, active).each(function() { - offset += this.offsetHeight; - }); - if((offset + activeItem[0].offsetHeight - list.scrollTop()) > list[0].clientHeight) { - list.scrollTop(offset + activeItem[0].offsetHeight - list.innerHeight()); - } else if(offset < list.scrollTop()) { - list.scrollTop(offset); - } - } - }; - - function movePosition(step) { - active += step; - if (active < 0) { - active = listItems.size() - 1; - } else if (active >= listItems.size()) { - active = 0; - } - } - - function limitNumberOfItems(available) { - return options.max && options.max < available - ? options.max - : available; - } - - function fillList() { - list.empty(); - var max = limitNumberOfItems(data.length); - for (var i=0; i < max; i++) { - if (!data[i]) - continue; - var formatted = options.formatItem(data[i].data, i+1, max, data[i].value, term); - if ( formatted === false ) - continue; - var li = $("
  • ").html( options.highlight(formatted, term) ).addClass(i%2 == 0 ? "ac_even" : "ac_odd").appendTo(list)[0]; - $.data(li, "ac_data", data[i]); - } - listItems = list.find("li"); - if ( options.selectFirst ) { - listItems.slice(0, 1).addClass(CLASSES.ACTIVE); - active = 0; - } - // apply bgiframe if available - if ( $.fn.bgiframe ) - list.bgiframe(); - } - - return { - display: function(d, q) { - init(); - data = d; - term = q; - fillList(); - }, - next: function() { - moveSelect(1); - }, - prev: function() { - moveSelect(-1); - }, - pageUp: function() { - if (active != 0 && active - 8 < 0) { - moveSelect( -active ); - } else { - moveSelect(-8); - } - }, - pageDown: function() { - if (active != listItems.size() - 1 && active + 8 > listItems.size()) { - moveSelect( listItems.size() - 1 - active ); - } else { - moveSelect(8); - } - }, - hide: function() { - element && element.hide(); - listItems && listItems.removeClass(CLASSES.ACTIVE); - active = -1; - }, - visible : function() { - return element && element.is(":visible"); - }, - current: function() { - return this.visible() && (listItems.filter("." + CLASSES.ACTIVE)[0] || options.selectFirst && listItems[0]); - }, - show: function() { - var offset = $(input).offset(); - element.css({ - width: typeof options.width == "string" || options.width > 0 ? options.width : $(input).width(), - top: offset.top + input.offsetHeight, - left: offset.left - }).show(); - if(options.scroll) { - list.scrollTop(0); - list.css({ - maxHeight: options.scrollHeight, - overflow: 'auto' - }); - - if($.browser.msie && typeof document.body.style.maxHeight === "undefined") { - var listHeight = 0; - listItems.each(function() { - listHeight += this.offsetHeight; - }); - var scrollbarsVisible = listHeight > options.scrollHeight; - list.css('height', scrollbarsVisible ? options.scrollHeight : listHeight ); - if (!scrollbarsVisible) { - // IE doesn't recalculate width when scrollbar disappears - listItems.width( list.width() - parseInt(listItems.css("padding-left")) - parseInt(listItems.css("padding-right")) ); - } - } - - } - }, - selected: function() { - var selected = listItems && listItems.filter("." + CLASSES.ACTIVE).removeClass(CLASSES.ACTIVE); - return selected && selected.length && $.data(selected[0], "ac_data"); - }, - emptyList: function (){ - list && list.empty(); - }, - unbind: function() { - element && element.remove(); - } - }; -}; - -$.fn.selection = function(start, end) { - if (start !== undefined) { - return this.each(function() { - if( this.createTextRange ){ - var selRange = this.createTextRange(); - if (end === undefined || start == end) { - selRange.move("character", start); - selRange.select(); - } else { - selRange.collapse(true); - selRange.moveStart("character", start); - selRange.moveEnd("character", end); - selRange.select(); - } - } else if( this.setSelectionRange ){ - this.setSelectionRange(start, end); - } else if( this.selectionStart ){ - this.selectionStart = start; - this.selectionEnd = end; - } - }); - } - var field = this[0]; - if ( field.createTextRange ) { - var range = document.selection.createRange(), - orig = field.value, - teststring = "<->", - textLength = range.text.length; - range.text = teststring; - var caretAt = field.value.indexOf(teststring); - field.value = orig; - this.selection(caretAt, caretAt + textLength); - return { - start: caretAt, - end: caretAt + textLength - } - } else if( field.selectionStart !== undefined ){ - return { - start: field.selectionStart, - end: field.selectionEnd - } - } -}; - -})(jQuery); \ No newline at end of file diff --git a/platforma/static/js/jquery.blockui.js b/platforma/static/js/jquery.blockui.js deleted file mode 100644 index 54916670..00000000 --- a/platforma/static/js/jquery.blockui.js +++ /dev/null @@ -1,477 +0,0 @@ -/*! - * jQuery blockUI plugin - * Version 2.31 (06-JAN-2010) - * @requires jQuery v1.2.3 or later - * - * Examples at: http://malsup.com/jquery/block/ - * Copyright (c) 2007-2008 M. Alsup - * Dual licensed under the MIT and GPL licenses: - * http://www.opensource.org/licenses/mit-license.php - * http://www.gnu.org/licenses/gpl.html - * - * Thanks to Amir-Hossein Sobhi for some excellent contributions! - */ - -;(function($) { - -if (/1\.(0|1|2)\.(0|1|2)/.test($.fn.jquery) || /^1.1/.test($.fn.jquery)) { - alert('blockUI requires jQuery v1.2.3 or later! You are using v' + $.fn.jquery); - return; -} - -$.fn._fadeIn = $.fn.fadeIn; - -var noOp = function() {}; - -// this bit is to ensure we don't call setExpression when we shouldn't (with extra muscle to handle -// retarded userAgent strings on Vista) -var mode = document.documentMode || 0; -var setExpr = $.browser.msie && (($.browser.version < 8 && !mode) || mode < 8); -var ie6 = $.browser.msie && /MSIE 6.0/.test(navigator.userAgent) && !mode; - -// global $ methods for blocking/unblocking the entire page -$.blockUI = function(opts) { install(window, opts); }; -$.unblockUI = function(opts) { remove(window, opts); }; - -// convenience method for quick growl-like notifications (http://www.google.com/search?q=growl) -$.growlUI = function(title, message, timeout, onClose) { - var $m = $('
    '); - if (title) $m.append('

    '+title+'

    '); - if (message) $m.append('

    '+message+'

    '); - if (timeout == undefined) timeout = 3000; - $.blockUI({ - message: $m, fadeIn: 700, fadeOut: 1000, centerY: false, - timeout: timeout, showOverlay: false, - onUnblock: onClose, - css: $.blockUI.defaults.growlCSS - }); -}; - -// plugin method for blocking element content -$.fn.block = function(opts) { - return this.unblock({ fadeOut: 0 }).each(function() { - if ($.css(this,'position') == 'static') - this.style.position = 'relative'; - if ($.browser.msie) - this.style.zoom = 1; // force 'hasLayout' - install(this, opts); - }); -}; - -// plugin method for unblocking element content -$.fn.unblock = function(opts) { - return this.each(function() { - remove(this, opts); - }); -}; - -$.blockUI.version = 2.31; // 2nd generation blocking at no extra cost! - -// override these in your code to change the default behavior and style -$.blockUI.defaults = { - // message displayed when blocking (use null for no message) - message: '

    Please wait...

    ', - - title: null, // title string; only used when theme == true - draggable: true, // only used when theme == true (requires jquery-ui.js to be loaded) - - theme: false, // set to true to use with jQuery UI themes - - // styles for the message when blocking; if you wish to disable - // these and use an external stylesheet then do this in your code: - // $.blockUI.defaults.css = {}; - css: { - padding: 0, - margin: 0, - width: '30%', - top: '40%', - left: '35%', - textAlign: 'center', - color: '#000', - border: '3px solid #aaa', - backgroundColor:'#fff', - cursor: 'wait' - }, - - // minimal style set used when themes are used - themedCSS: { - width: '30%', - top: '40%', - left: '35%' - }, - - // styles for the overlay - overlayCSS: { - backgroundColor: '#000', - opacity: 0.6, - cursor: 'wait' - }, - - // styles applied when using $.growlUI - growlCSS: { - width: '350px', - top: '10px', - left: '', - right: '10px', - border: 'none', - padding: '5px', - opacity: 0.6, - cursor: 'default', - color: '#fff', - backgroundColor: '#000', - '-webkit-border-radius': '10px', - '-moz-border-radius': '10px' - }, - - // IE issues: 'about:blank' fails on HTTPS and javascript:false is s-l-o-w - // (hat tip to Jorge H. N. de Vasconcelos) - iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank', - - // force usage of iframe in non-IE browsers (handy for blocking applets) - forceIframe: false, - - // z-index for the blocking overlay - baseZ: 1000, - - // set these to true to have the message automatically centered - centerX: true, // <-- only effects element blocking (page block controlled via css above) - centerY: true, - - // allow body element to be stetched in ie6; this makes blocking look better - // on "short" pages. disable if you wish to prevent changes to the body height - allowBodyStretch: true, - - // enable if you want key and mouse events to be disabled for content that is blocked - bindEvents: true, - - // be default blockUI will supress tab navigation from leaving blocking content - // (if bindEvents is true) - constrainTabKey: true, - - // fadeIn time in millis; set to 0 to disable fadeIn on block - fadeIn: 200, - - // fadeOut time in millis; set to 0 to disable fadeOut on unblock - fadeOut: 400, - - // time in millis to wait before auto-unblocking; set to 0 to disable auto-unblock - timeout: 0, - - // disable if you don't want to show the overlay - showOverlay: true, - - // if true, focus will be placed in the first available input field when - // page blocking - focusInput: true, - - // suppresses the use of overlay styles on FF/Linux (due to performance issues with opacity) - applyPlatformOpacityRules: true, - - // callback method invoked when fadeIn has completed and blocking message is visible - onBlock: null, - - // callback method invoked when unblocking has completed; the callback is - // passed the element that has been unblocked (which is the window object for page - // blocks) and the options that were passed to the unblock call: - // onUnblock(element, options) - onUnblock: null, - - // don't ask; if you really must know: http://groups.google.com/group/jquery-en/browse_thread/thread/36640a8730503595/2f6a79a77a78e493#2f6a79a77a78e493 - quirksmodeOffsetHack: 4 -}; - -// private data and functions follow... - -var pageBlock = null; -var pageBlockEls = []; - -function install(el, opts) { - var full = (el == window); - var msg = opts && opts.message !== undefined ? opts.message : undefined; - opts = $.extend({}, $.blockUI.defaults, opts || {}); - opts.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, opts.overlayCSS || {}); - var css = $.extend({}, $.blockUI.defaults.css, opts.css || {}); - var themedCSS = $.extend({}, $.blockUI.defaults.themedCSS, opts.themedCSS || {}); - msg = msg === undefined ? opts.message : msg; - - // remove the current block (if there is one) - if (full && pageBlock) - remove(window, {fadeOut:0}); - - // if an existing element is being used as the blocking content then we capture - // its current place in the DOM (and current display style) so we can restore - // it when we unblock - if (msg && typeof msg != 'string' && (msg.parentNode || msg.jquery)) { - var node = msg.jquery ? msg[0] : msg; - var data = {}; - $(el).data('blockUI.history', data); - data.el = node; - data.parent = node.parentNode; - data.display = node.style.display; - data.position = node.style.position; - if (data.parent) - data.parent.removeChild(node); - } - - var z = opts.baseZ; - - // blockUI uses 3 layers for blocking, for simplicity they are all used on every platform; - // layer1 is the iframe layer which is used to supress bleed through of underlying content - // layer2 is the overlay layer which has opacity and a wait cursor (by default) - // layer3 is the message content that is displayed while blocking - - var lyr1 = ($.browser.msie || opts.forceIframe) - ? $('') - : $(''); - var lyr2 = $(''); - - var lyr3; - if (opts.theme && full) { - var s = ''; - lyr3 = $(s); - } - else { - lyr3 = full ? $('') - : $(''); - } - - // if we have a message, style it - if (msg) { - if (opts.theme) { - lyr3.css(themedCSS); - lyr3.addClass('ui-widget-content'); - } - else - lyr3.css(css); - } - - // style the overlay - if (!opts.applyPlatformOpacityRules || !($.browser.mozilla && /Linux/.test(navigator.platform))) - lyr2.css(opts.overlayCSS); - lyr2.css('position', full ? 'fixed' : 'absolute'); - - // make iframe layer transparent in IE - if ($.browser.msie || opts.forceIframe) - lyr1.css('opacity',0.0); - - //$([lyr1[0],lyr2[0],lyr3[0]]).appendTo(full ? 'body' : el); - var layers = [lyr1,lyr2,lyr3], $par = full ? $('body') : $(el); - $.each(layers, function() { - this.appendTo($par); - }); - - if (opts.theme && opts.draggable && $.fn.draggable) { - lyr3.draggable({ - handle: '.ui-dialog-titlebar', - cancel: 'li' - }); - } - - // ie7 must use absolute positioning in quirks mode and to account for activex issues (when scrolling) - var expr = setExpr && (!$.boxModel || $('object,embed', full ? null : el).length > 0); - if (ie6 || expr) { - // give body 100% height - if (full && opts.allowBodyStretch && $.boxModel) - $('html,body').css('height','100%'); - - // fix ie6 issue when blocked element has a border width - if ((ie6 || !$.boxModel) && !full) { - var t = sz(el,'borderTopWidth'), l = sz(el,'borderLeftWidth'); - var fixT = t ? '(0 - '+t+')' : 0; - var fixL = l ? '(0 - '+l+')' : 0; - } - - // simulate fixed position - $.each([lyr1,lyr2,lyr3], function(i,o) { - var s = o[0].style; - s.position = 'absolute'; - if (i < 2) { - full ? s.setExpression('height','Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.boxModel?0:'+opts.quirksmodeOffsetHack+') + "px"') - : s.setExpression('height','this.parentNode.offsetHeight + "px"'); - full ? s.setExpression('width','jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"') - : s.setExpression('width','this.parentNode.offsetWidth + "px"'); - if (fixL) s.setExpression('left', fixL); - if (fixT) s.setExpression('top', fixT); - } - else if (opts.centerY) { - if (full) s.setExpression('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"'); - s.marginTop = 0; - } - else if (!opts.centerY && full) { - var top = (opts.css && opts.css.top) ? parseInt(opts.css.top) : 0; - var expression = '((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + '+top+') + "px"'; - s.setExpression('top',expression); - } - }); - } - - // show the message - if (msg) { - if (opts.theme) - lyr3.find('.ui-widget-content').append(msg); - else - lyr3.append(msg); - if (msg.jquery || msg.nodeType) - $(msg).show(); - } - - if (($.browser.msie || opts.forceIframe) && opts.showOverlay) - lyr1.show(); // opacity is zero - if (opts.fadeIn) { - var cb = opts.onBlock ? opts.onBlock : noOp; - var cb1 = (opts.showOverlay && !msg) ? cb : noOp; - var cb2 = msg ? cb : noOp; - if (opts.showOverlay) - lyr2._fadeIn(opts.fadeIn, cb1); - if (msg) - lyr3._fadeIn(opts.fadeIn, cb2); - } - else { - if (opts.showOverlay) - lyr2.show(); - if (msg) - lyr3.show(); - if (opts.onBlock) - opts.onBlock(); - } - - // bind key and mouse events - bind(1, el, opts); - - if (full) { - pageBlock = lyr3[0]; - pageBlockEls = $(':input:enabled:visible',pageBlock); - if (opts.focusInput) - setTimeout(focus, 20); - } - else - center(lyr3[0], opts.centerX, opts.centerY); - - if (opts.timeout) { - // auto-unblock - var to = setTimeout(function() { - full ? $.unblockUI(opts) : $(el).unblock(opts); - }, opts.timeout); - $(el).data('blockUI.timeout', to); - } -}; - -// remove the block -function remove(el, opts) { - var full = (el == window); - var $el = $(el); - var data = $el.data('blockUI.history'); - var to = $el.data('blockUI.timeout'); - if (to) { - clearTimeout(to); - $el.removeData('blockUI.timeout'); - } - opts = $.extend({}, $.blockUI.defaults, opts || {}); - bind(0, el, opts); // unbind events - - var els; - if (full) // crazy selector to handle odd field errors in ie6/7 - els = $('body').children().filter('.blockUI').add('body > .blockUI'); - else - els = $('.blockUI', el); - - if (full) - pageBlock = pageBlockEls = null; - - if (opts.fadeOut) { - els.fadeOut(opts.fadeOut); - setTimeout(function() { reset(els,data,opts,el); }, opts.fadeOut); - } - else - reset(els, data, opts, el); -}; - -// move blocking element back into the DOM where it started -function reset(els,data,opts,el) { - els.each(function(i,o) { - // remove via DOM calls so we don't lose event handlers - if (this.parentNode) - this.parentNode.removeChild(this); - }); - - if (data && data.el) { - data.el.style.display = data.display; - data.el.style.position = data.position; - if (data.parent) - data.parent.appendChild(data.el); - $(el).removeData('blockUI.history'); - } - - if (typeof opts.onUnblock == 'function') - opts.onUnblock(el,opts); -}; - -// bind/unbind the handler -function bind(b, el, opts) { - var full = el == window, $el = $(el); - - // don't bother unbinding if there is nothing to unbind - if (!b && (full && !pageBlock || !full && !$el.data('blockUI.isBlocked'))) - return; - if (!full) - $el.data('blockUI.isBlocked', b); - - // don't bind events when overlay is not in use or if bindEvents is false - if (!opts.bindEvents || (b && !opts.showOverlay)) - return; - - // bind anchors and inputs for mouse and key events - var events = 'mousedown mouseup keydown keypress'; - b ? $(document).bind(events, opts, handler) : $(document).unbind(events, handler); - -// former impl... -// var $e = $('a,:input'); -// b ? $e.bind(events, opts, handler) : $e.unbind(events, handler); -}; - -// event handler to suppress keyboard/mouse events when blocking -function handler(e) { - // allow tab navigation (conditionally) - if (e.keyCode && e.keyCode == 9) { - if (pageBlock && e.data.constrainTabKey) { - var els = pageBlockEls; - var fwd = !e.shiftKey && e.target == els[els.length-1]; - var back = e.shiftKey && e.target == els[0]; - if (fwd || back) { - setTimeout(function(){focus(back)},10); - return false; - } - } - } - // allow events within the message content - if ($(e.target).parents('div.blockMsg').length > 0) - return true; - - // allow events for content that is not being blocked - return $(e.target).parents().children().filter('div.blockUI').length == 0; -}; - -function focus(back) { - if (!pageBlockEls) - return; - var e = pageBlockEls[back===true ? pageBlockEls.length-1 : 0]; - if (e) - e.focus(); -}; - -function center(el, x, y) { - var p = el.parentNode, s = el.style; - var l = ((p.offsetWidth - el.offsetWidth)/2) - sz(p,'borderLeftWidth'); - var t = ((p.offsetHeight - el.offsetHeight)/2) - sz(p,'borderTopWidth'); - if (x) s.left = l > 0 ? (l+'px') : '0'; - if (y) s.top = t > 0 ? (t+'px') : '0'; -}; - -function sz(el, p) { - return parseInt($.css(el,p))||0; -}; - -})(jQuery); \ No newline at end of file diff --git a/platforma/static/js/jquery.elastic.js b/platforma/static/js/jquery.elastic.js deleted file mode 100644 index 24e16f44..00000000 --- a/platforma/static/js/jquery.elastic.js +++ /dev/null @@ -1,6 +0,0 @@ -(function(jQuery){jQuery.fn.extend({elastic:function(){var mimics=['paddingTop','paddingRight','paddingBottom','paddingLeft','fontSize','lineHeight','fontFamily','width','fontWeight'];return this.each(function(){if(this.type!='textarea'){return false;} -var $textarea=jQuery(this),$twin=jQuery('
    ').css({'position':'absolute','display':'none','word-wrap':'break-word'}),lineHeight=parseInt($textarea.css('line-height'),10)||parseInt($textarea.css('font-size'),'10'),minheight=parseInt($textarea.css('height'),10)||lineHeight*3,maxheight=parseInt($textarea.css('max-height'),10)||Number.MAX_VALUE,goalheight=0,i=0;if(maxheight<0){maxheight=Number.MAX_VALUE;} -$twin.appendTo($textarea.parent());var i=mimics.length;while(i--){$twin.css(mimics[i].toString(),$textarea.css(mimics[i].toString()));} -function setHeightAndOverflow(height,overflow){curratedHeight=Math.floor(parseInt(height,10));if($textarea.height()!=curratedHeight){$textarea.css({'height':curratedHeight+'px','overflow':overflow});}} -function update(){var textareaContent=$textarea.val().replace(/&/g,'&').replace(/ /g,' ').replace(/<|>/g,'>').replace(/\n/g,'
    ');var twinContent=$twin.html();if(textareaContent+' '!=twinContent){$twin.html(textareaContent+' ');if(Math.abs($twin.height()+lineHeight-$textarea.height())>3){var goalheight=$twin.height()+lineHeight;if(goalheight>=maxheight){setHeightAndOverflow(maxheight,'auto');}else if(goalheight<=minheight){setHeightAndOverflow(minheight,'hidden');}else{setHeightAndOverflow(goalheight,'hidden');}}}} -$textarea.css({'overflow':'hidden'});$textarea.keyup(function(){update();});$textarea.live('input paste',function(e){setTimeout(update,250);});update();});}});})(jQuery); \ No newline at end of file diff --git a/platforma/static/js/lib/codemirror/codemirror.js b/platforma/static/js/lib/codemirror/codemirror.js deleted file mode 100644 index 8c62dab9..00000000 --- a/platforma/static/js/lib/codemirror/codemirror.js +++ /dev/null @@ -1,295 +0,0 @@ -/* CodeMirror main module - * - * Implements the CodeMirror constructor and prototype, which take care - * of initializing the editor frame, and providing the outside interface. - */ - -// The CodeMirrorConfig object is used to specify a default -// configuration. If you specify such an object before loading this -// file, the values you put into it will override the defaults given -// below. You can also assign to it after loading. -var CodeMirrorConfig = window.CodeMirrorConfig || {}; - -var CodeMirror = (function(){ - function setDefaults(object, defaults) { - for (var option in defaults) { - if (!object.hasOwnProperty(option)) - object[option] = defaults[option]; - } - } - function forEach(array, action) { - for (var i = 0; i < array.length; i++) - action(array[i]); - } - - // These default options can be overridden by passing a set of - // options to a specific CodeMirror constructor. See manual.html for - // their meaning. - setDefaults(CodeMirrorConfig, { - stylesheet: "", - path: "", - parserfile: [], - basefiles: ["util.js", "stringstream.js", "select.js", "undo.js", "editor.js", "tokenize.js"], - iframeClass: null, - passDelay: 200, - passTime: 50, - continuousScanning: false, - saveFunction: null, - onChange: null, - undoDepth: 50, - undoDelay: 800, - disableSpellcheck: true, - textWrapping: true, - readOnly: false, - width: "100%", - height: "300px", - autoMatchParens: false, - parserConfig: null, - tabMode: "indent", // or "spaces", "default", "shift" - reindentOnLoad: false, - activeTokens: null, - cursorActivity: null, - lineNumbers: false, - indentUnit: 2 - }); - - function wrapLineNumberDiv(place) { - return function(node) { - var container = document.createElement("div"), - nums = document.createElement("div"), - scroller = document.createElement("div"); - container.style.position = "relative"; - nums.style.position = "absolute"; - nums.style.height = "100%"; - if (nums.style.setExpression) { - try {nums.style.setExpression("height", "this.previousSibling.offsetHeight + 'px'");} - catch(e) {} // Seems to throw 'Not Implemented' on some IE8 versions - } - nums.style.top = "0px"; - nums.style.overflow = "hidden"; - place(container); - container.appendChild(node); - container.appendChild(nums); - scroller.className = "CodeMirror-line-numbers"; - nums.appendChild(scroller); - } - } - - function applyLineNumbers(frame) { - var win = frame.contentWindow, doc = win.document, - nums = frame.nextSibling, scroller = nums.firstChild; - - var nextNum = 1; - - function update() { - var diff = 20 + Math.max(doc.body.offsetHeight, frame.offsetHeight) - scroller.offsetHeight; - for (var n = Math.ceil(diff / 10); n > 0; n--) { - var div = document.createElement("div"); - div.appendChild(document.createTextNode(nextNum++)); - scroller.appendChild(div); - } - nums.scrollTop = doc.body.scrollTop || doc.documentElement.scrollTop || 0; - } - - update(); - win.addEventHandler(win, "scroll", update); - win.addEventHandler(win, "resize", update); - } - - function CodeMirror(place, options) { - // Backward compatibility for deprecated options. - if (options.dumbTabs) options.tabMode = "spaces"; - else if (options.normalTab) options.tabMode = "default"; - - // Use passed options, if any, to override defaults. - this.options = options = options || {}; - setDefaults(options, CodeMirrorConfig); - - var frame = this.frame = document.createElement("iframe"); - if (options.iframeClass) frame.className = options.iframeClass; - frame.frameBorder = 0; - frame.src = "javascript:false;"; - frame.style.border = "0"; - frame.style.width = options.width; - frame.style.height = options.height; - // display: block occasionally suppresses some Firefox bugs, so we - // always add it, redundant as it sounds. - frame.style.display = "block"; - - if (place.appendChild) { - var node = place; - place = function(n){node.appendChild(n);}; - } - if (options.lineNumbers) place = wrapLineNumberDiv(place); - place(frame); - - // Link back to this object, so that the editor can fetch options - // and add a reference to itself. - frame.CodeMirror = this; - this.win = frame.contentWindow; - - if (typeof options.parserfile == "string") - options.parserfile = [options.parserfile]; - if (typeof options.stylesheet == "string") - options.stylesheet = [options.stylesheet]; - - var html = [""]; - // Hack to work around a bunch of IE8-specific problems. - html.push(""); - forEach(options.stylesheet, function(file) { - html.push(""); - }); - forEach(options.basefiles.concat(options.parserfile), function(file) { - html.push(""); - }); - html.push(""); - - var doc = this.win.document; - doc.open(); - doc.write(html.join("")); - doc.close(); - } - - CodeMirror.prototype = { - init: function() { - if (this.options.initCallback) this.options.initCallback(this); - if (this.options.lineNumbers) applyLineNumbers(this.frame); - if (this.options.reindentOnLoad) this.reindent(); - }, - - getCode: function() {return this.editor.getCode();}, - setCode: function(code) {this.editor.importCode(code);}, - selection: function() {return this.editor.selectedText();}, - reindent: function() {this.editor.reindent();}, - reindentSelection: function() {this.editor.reindentSelection(null);}, - - focus: function() { - this.win.focus(); - if (this.editor.selectionSnapshot) // IE hack - this.win.select.selectCoords(this.win, this.editor.selectionSnapshot); - }, - replaceSelection: function(text) { - this.focus(); - this.editor.replaceSelection(text); - return true; - }, - replaceChars: function(text, start, end) { - this.editor.replaceChars(text, start, end); - }, - getSearchCursor: function(string, fromCursor) { - return this.editor.getSearchCursor(string, fromCursor); - }, - - undo: function() {this.editor.history.undo();}, - redo: function() {this.editor.history.redo();}, - historySize: function() {return this.editor.history.historySize();}, - clearHistory: function() {this.editor.history.clear();}, - - grabKeys: function(callback, filter) {this.editor.grabKeys(callback, filter);}, - ungrabKeys: function() {this.editor.ungrabKeys();}, - - setParser: function(name) {this.editor.setParser(name);}, - - cursorPosition: function(start) { - if (this.win.select.ie_selection) this.focus(); - return this.editor.cursorPosition(start); - }, - firstLine: function() {return this.editor.firstLine();}, - lastLine: function() {return this.editor.lastLine();}, - nextLine: function(line) {return this.editor.nextLine(line);}, - prevLine: function(line) {return this.editor.prevLine(line);}, - lineContent: function(line) {return this.editor.lineContent(line);}, - setLineContent: function(line, content) {this.editor.setLineContent(line, content);}, - insertIntoLine: function(line, position, content) {this.editor.insertIntoLine(line, position, content);}, - selectLines: function(startLine, startOffset, endLine, endOffset) { - this.win.focus(); - this.editor.selectLines(startLine, startOffset, endLine, endOffset); - }, - nthLine: function(n) { - var line = this.firstLine(); - for (; n > 1 && line !== false; n--) - line = this.nextLine(line); - return line; - }, - lineNumber: function(line) { - var num = 0; - while (line !== false) { - num++; - line = this.prevLine(line); - } - return num; - }, - - // Old number-based line interface - jumpToLine: function(n) { - this.selectLines(this.nthLine(n), 0); - this.win.focus(); - }, - currentLine: function() { - return this.lineNumber(this.cursorPosition().line); - } - }; - - CodeMirror.InvalidLineHandle = {toString: function(){return "CodeMirror.InvalidLineHandle";}}; - - CodeMirror.replace = function(element) { - if (typeof element == "string") - element = document.getElementById(element); - return function(newElement) { - element.parentNode.replaceChild(newElement, element); - }; - }; - - CodeMirror.fromTextArea = function(area, options) { - if (typeof area == "string") - area = document.getElementById(area); - - options = options || {}; - if (area.style.width && options.width == null) - options.width = area.style.width; - if (area.style.height && options.height == null) - options.height = area.style.height; - if (options.content == null) options.content = area.value; - - if (area.form) { - function updateField() { - area.value = mirror.getCode(); - } - if (typeof area.form.addEventListener == "function") - area.form.addEventListener("submit", updateField, false); - else - area.form.attachEvent("onsubmit", updateField); - } - - function insert(frame) { - if (area.nextSibling) - area.parentNode.insertBefore(frame, area.nextSibling); - else - area.parentNode.appendChild(frame); - } - - area.style.display = "none"; - var mirror = new CodeMirror(insert, options); - return mirror; - }; - - CodeMirror.isProbablySupported = function() { - // This is rather awful, but can be useful. - var match; - if (window.opera) - return Number(window.opera.version()) >= 9.52; - else if (/Apple Computers, Inc/.test(navigator.vendor) && (match = navigator.userAgent.match(/Version\/(\d+(?:\.\d+)?)\./))) - return Number(match[1]) >= 3; - else if (document.selection && window.ActiveXObject && (match = navigator.userAgent.match(/MSIE (\d+(?:\.\d*)?)\b/))) - return Number(match[1]) >= 6; - else if (match = navigator.userAgent.match(/gecko\/(\d{8})/i)) - return Number(match[1]) >= 20050901; - else if (match = navigator.userAgent.match(/AppleWebKit\/(\d+)/)) - return Number(match[1]) >= 525; - else - return null; - }; - - return CodeMirror; -})(); diff --git a/platforma/static/js/lib/codemirror/editor.js b/platforma/static/js/lib/codemirror/editor.js deleted file mode 100644 index f5fe8417..00000000 --- a/platforma/static/js/lib/codemirror/editor.js +++ /dev/null @@ -1,1320 +0,0 @@ -/* The Editor object manages the content of the editable frame. It - * catches events, colours nodes, and indents lines. This file also - * holds some functions for transforming arbitrary DOM structures into - * plain sequences of and
    elements - */ - -// Make sure a string does not contain two consecutive 'collapseable' -// whitespace characters. -function makeWhiteSpace(n) { - var buffer = [], nb = true; - for (; n > 0; n--) { - buffer.push((nb || n == 1) ? nbsp : " "); - nb = !nb; - } - return buffer.join(""); -} - -// Create a set of white-space characters that will not be collapsed -// by the browser, but will not break text-wrapping either. -function fixSpaces(string) { - if (string.charAt(0) == " ") string = nbsp + string.slice(1); - return string.replace(/\t/g, function(){return makeWhiteSpace(indentUnit);}) - .replace(/[ \u00a0]{2,}/g, function(s) {return makeWhiteSpace(s.length);}); -} - -function cleanText(text) { - return text.replace(/\u00a0/g, " ").replace(/\u200b/g, ""); -} - -// Create a SPAN node with the expected properties for document part -// spans. -function makePartSpan(value, doc) { - var text = value; - if (value.nodeType == 3) text = value.nodeValue; - else value = doc.createTextNode(text); - - var span = doc.createElement("SPAN"); - span.isPart = true; - span.appendChild(value); - span.currentText = text; - return span; -} - -// On webkit, when the last BR of the document does not have text -// behind it, the cursor can not be put on the line after it. This -// makes pressing enter at the end of the document occasionally do -// nothing (or at least seem to do nothing). To work around it, this -// function makes sure the document ends with a span containing a -// zero-width space character. The traverseDOM iterator filters such -// character out again, so that the parsers won't see them. This -// function is called from a few strategic places to make sure the -// zwsp is restored after the highlighting process eats it. -var webkitLastLineHack = webkit ? - function(container) { - var last = container.lastChild; - if (!last || !last.isPart || last.textContent != "\u200b") - container.appendChild(makePartSpan("\u200b", container.ownerDocument)); - } : function() {}; - -var Editor = (function(){ - // The HTML elements whose content should be suffixed by a newline - // when converting them to flat text. - var newlineElements = {"P": true, "DIV": true, "LI": true}; - - function asEditorLines(string) { - var tab = makeWhiteSpace(indentUnit); - return map(string.replace(/\t/g, tab).replace(/\u00a0/g, " ").replace(/\r\n?/g, "\n").split("\n"), fixSpaces); - } - - // Helper function for traverseDOM. Flattens an arbitrary DOM node - // into an array of textnodes and
    tags. - function simplifyDOM(root, atEnd) { - var doc = root.ownerDocument; - var result = []; - var leaving = true; - - function simplifyNode(node, top) { - if (node.nodeType == 3) { - var text = node.nodeValue = fixSpaces(node.nodeValue.replace(/[\r\u200b]/g, "").replace(/\n/g, " ")); - if (text.length) leaving = false; - result.push(node); - } - else if (node.nodeName == "BR" && node.childNodes.length == 0) { - leaving = true; - result.push(node); - } - else { - forEach(node.childNodes, simplifyNode); - if (!leaving && newlineElements.hasOwnProperty(node.nodeName)) { - leaving = true; - if (!atEnd || !top) - result.push(doc.createElement("BR")); - } - } - } - - simplifyNode(root, true); - return result; - } - - // Creates a MochiKit-style iterator that goes over a series of DOM - // nodes. The values it yields are strings, the textual content of - // the nodes. It makes sure that all nodes up to and including the - // one whose text is being yielded have been 'normalized' to be just - // and
    elements. - // See the story.html file for some short remarks about the use of - // continuation-passing style in this iterator. - function traverseDOM(start){ - function yield(value, c){cc = c; return value;} - function push(fun, arg, c){return function(){return fun(arg, c);};} - function stop(){cc = stop; throw StopIteration;}; - var cc = push(scanNode, start, stop); - var owner = start.ownerDocument; - var nodeQueue = []; - - // Create a function that can be used to insert nodes after the - // one given as argument. - function pointAt(node){ - var parent = node.parentNode; - var next = node.nextSibling; - return function(newnode) { - parent.insertBefore(newnode, next); - }; - } - var point = null; - - // Insert a normalized node at the current point. If it is a text - // node, wrap it in a , and give that span a currentText - // property -- this is used to cache the nodeValue, because - // directly accessing nodeValue is horribly slow on some browsers. - // The dirty property is used by the highlighter to determine - // which parts of the document have to be re-highlighted. - function insertPart(part){ - var text = "\n"; - if (part.nodeType == 3) { - select.snapshotChanged(); - part = makePartSpan(part, owner); - text = part.currentText; - } - part.dirty = true; - nodeQueue.push(part); - point(part); - return text; - } - - // Extract the text and newlines from a DOM node, insert them into - // the document, and yield the textual content. Used to replace - // non-normalized nodes. - function writeNode(node, c, end) { - var toYield = []; - forEach(simplifyDOM(node, end), function(part) { - toYield.push(insertPart(part)); - }); - return yield(toYield.join(""), c); - } - - // Check whether a node is a normalized element. - function partNode(node){ - if (node.isPart && node.childNodes.length == 1 && node.firstChild.nodeType == 3) { - node.currentText = node.firstChild.nodeValue; - return !/[\n\t\r]/.test(node.currentText); - } - return false; - } - - // Handle a node. Add its successor to the continuation if there - // is one, find out whether the node is normalized. If it is, - // yield its content, otherwise, normalize it (writeNode will take - // care of yielding). - function scanNode(node, c){ - if (node.nextSibling) - c = push(scanNode, node.nextSibling, c); - - if (partNode(node)){ - nodeQueue.push(node); - return yield(node.currentText, c); - } - else if (node.nodeName == "BR") { - nodeQueue.push(node); - return yield("\n", c); - } - else { - var end = !node.nextSibling; - point = pointAt(node); - removeElement(node); - return writeNode(node, c, end); - } - } - - // MochiKit iterators are objects with a next function that - // returns the next value or throws StopIteration when there are - // no more values. - return {next: function(){return cc();}, nodes: nodeQueue}; - } - - // Determine the text size of a processed node. - function nodeSize(node) { - if (node.nodeName == "BR") - return 1; - else - return node.currentText.length; - } - - // Search backwards through the top-level nodes until the next BR or - // the start of the frame. - function startOfLine(node) { - while (node && node.nodeName != "BR") node = node.previousSibling; - return node; - } - function endOfLine(node, container) { - if (!node) node = container.firstChild; - else if (node.nodeName == "BR") node = node.nextSibling; - - while (node && node.nodeName != "BR") node = node.nextSibling; - return node; - } - - function time() {return new Date().getTime();} - - // Client interface for searching the content of the editor. Create - // these by calling CodeMirror.getSearchCursor. To use, call - // findNext on the resulting object -- this returns a boolean - // indicating whether anything was found, and can be called again to - // skip to the next find. Use the select and replace methods to - // actually do something with the found locations. - function SearchCursor(editor, string, fromCursor) { - this.editor = editor; - this.history = editor.history; - this.history.commit(); - - // Are we currently at an occurrence of the search string? - this.atOccurrence = false; - // The object stores a set of nodes coming after its current - // position, so that when the current point is taken out of the - // DOM tree, we can still try to continue. - this.fallbackSize = 15; - var cursor; - // Start from the cursor when specified and a cursor can be found. - if (fromCursor && (cursor = select.cursorPos(this.editor.container))) { - this.line = cursor.node; - this.offset = cursor.offset; - } - else { - this.line = null; - this.offset = 0; - } - this.valid = !!string; - - // Create a matcher function based on the kind of string we have. - var target = string.split("\n"), self = this; - this.matches = (target.length == 1) ? - // For one-line strings, searching can be done simply by calling - // indexOf on the current line. - function() { - var match = cleanText(self.history.textAfter(self.line).slice(self.offset)).indexOf(string); - if (match > -1) - return {from: {node: self.line, offset: self.offset + match}, - to: {node: self.line, offset: self.offset + match + string.length}}; - } : - // Multi-line strings require internal iteration over lines, and - // some clunky checks to make sure the first match ends at the - // end of the line and the last match starts at the start. - function() { - var firstLine = cleanText(self.history.textAfter(self.line).slice(self.offset)); - var match = firstLine.lastIndexOf(target[0]); - if (match == -1 || match != firstLine.length - target[0].length) - return false; - var startOffset = self.offset + match; - - var line = self.history.nodeAfter(self.line); - for (var i = 1; i < target.length - 1; i++) { - if (cleanText(self.history.textAfter(line)) != target[i]) - return false; - line = self.history.nodeAfter(line); - } - - if (cleanText(self.history.textAfter(line)).indexOf(target[target.length - 1]) != 0) - return false; - - return {from: {node: self.line, offset: startOffset}, - to: {node: line, offset: target[target.length - 1].length}}; - }; - } - - SearchCursor.prototype = { - findNext: function() { - if (!this.valid) return false; - this.atOccurrence = false; - var self = this; - - // Go back to the start of the document if the current line is - // no longer in the DOM tree. - if (this.line && !this.line.parentNode) { - this.line = null; - this.offset = 0; - } - - // Set the cursor's position one character after the given - // position. - function saveAfter(pos) { - if (self.history.textAfter(pos.node).length > pos.offset) { - self.line = pos.node; - self.offset = pos.offset + 1; - } - else { - self.line = self.history.nodeAfter(pos.node); - self.offset = 0; - } - } - - while (true) { - var match = this.matches(); - // Found the search string. - if (match) { - this.atOccurrence = match; - saveAfter(match.from); - return true; - } - this.line = this.history.nodeAfter(this.line); - this.offset = 0; - // End of document. - if (!this.line) { - this.valid = false; - return false; - } - } - }, - - select: function() { - if (this.atOccurrence) { - select.setCursorPos(this.editor.container, this.atOccurrence.from, this.atOccurrence.to); - select.scrollToCursor(this.editor.container); - } - }, - - replace: function(string) { - if (this.atOccurrence) { - var end = this.editor.replaceRange(this.atOccurrence.from, this.atOccurrence.to, string); - this.line = end.node; - this.offset = end.offset; - this.atOccurrence = false; - } - } - }; - - // The Editor object is the main inside-the-iframe interface. - function Editor(options) { - this.options = options; - window.indentUnit = options.indentUnit; - this.parent = parent; - this.doc = document; - var container = this.container = this.doc.body; - this.win = window; - this.history = new History(container, options.undoDepth, options.undoDelay, - this, options.onChange); - var self = this; - - if (!Editor.Parser) - throw "No parser loaded."; - if (options.parserConfig && Editor.Parser.configure) - Editor.Parser.configure(options.parserConfig); - - if (!options.readOnly) - select.setCursorPos(container, {node: null, offset: 0}); - - this.dirty = []; - if (options.content) - this.importCode(options.content); - else // FF acts weird when the editable document is completely empty - container.appendChild(this.doc.createElement("BR")); - - if (!options.readOnly) { - if (options.continuousScanning !== false) { - this.scanner = this.documentScanner(options.passTime); - this.delayScanning(); - } - - function setEditable() { - // In IE, designMode frames can not run any scripts, so we use - // contentEditable instead. - if (document.body.contentEditable != undefined && internetExplorer) - document.body.contentEditable = "true"; - else - document.designMode = "on"; - - document.documentElement.style.borderWidth = "0"; - if (!options.textWrapping) - container.style.whiteSpace = "nowrap"; - } - - // If setting the frame editable fails, try again when the user - // focus it (happens when the frame is not visible on - // initialisation, in Firefox). - try { - setEditable(); - } - catch(e) { - var focusEvent = addEventHandler(document, "focus", function() { - focusEvent(); - setEditable(); - }, true); - } - - addEventHandler(document, "keydown", method(this, "keyDown")); - addEventHandler(document, "keypress", method(this, "keyPress")); - addEventHandler(document, "keyup", method(this, "keyUp")); - - function cursorActivity() {self.cursorActivity(false);} - addEventHandler(document.body, "mouseup", cursorActivity); - addEventHandler(document.body, "cut", cursorActivity); - - addEventHandler(document.body, "paste", function(event) { - cursorActivity(); - var text = null; - try { - var clipboardData = event.clipboardData || window.clipboardData; - if (clipboardData) text = clipboardData.getData('Text'); - } - catch(e) {} - if (text !== null) { - self.replaceSelection(text); - event.stop(); - } - }); - - addEventHandler(document.body, "beforepaste", method(this, "reroutePasteEvent")); - - if (this.options.autoMatchParens) - addEventHandler(document.body, "click", method(this, "scheduleParenBlink")); - } - else if (!options.textWrapping) { - container.style.whiteSpace = "nowrap"; - } - } - - function isSafeKey(code) { - return (code >= 16 && code <= 18) || // shift, control, alt - (code >= 33 && code <= 40); // arrows, home, end - } - - Editor.prototype = { - // Import a piece of code into the editor. - importCode: function(code) { - this.history.push(null, null, asEditorLines(code)); - this.history.reset(); - }, - - // Extract the code from the editor. - getCode: function() { - if (!this.container.firstChild) - return ""; - - var accum = []; - select.markSelection(this.win); - forEach(traverseDOM(this.container.firstChild), method(accum, "push")); - webkitLastLineHack(this.container); - select.selectMarked(); - return cleanText(accum.join("")); - }, - - checkLine: function(node) { - if (node === false || !(node == null || node.parentNode == this.container)) - throw parent.CodeMirror.InvalidLineHandle; - }, - - cursorPosition: function(start) { - if (start == null) start = true; - var pos = select.cursorPos(this.container, start); - if (pos) return {line: pos.node, character: pos.offset}; - else return {line: null, character: 0}; - }, - - firstLine: function() { - return null; - }, - - lastLine: function() { - if (this.container.lastChild) return startOfLine(this.container.lastChild); - else return null; - }, - - nextLine: function(line) { - this.checkLine(line); - var end = endOfLine(line, this.container); - return end || false; - }, - - prevLine: function(line) { - this.checkLine(line); - if (line == null) return false; - return startOfLine(line.previousSibling); - }, - - selectLines: function(startLine, startOffset, endLine, endOffset) { - this.checkLine(startLine); - var start = {node: startLine, offset: startOffset}, end = null; - if (endOffset !== undefined) { - this.checkLine(endLine); - end = {node: endLine, offset: endOffset}; - } - select.setCursorPos(this.container, start, end); - select.scrollToCursor(this.container); - }, - - lineContent: function(line) { - this.checkLine(line); - var accum = []; - for (line = line ? line.nextSibling : this.container.firstChild; - line && line.nodeName != "BR"; line = line.nextSibling) - accum.push(nodeText(line)); - return cleanText(accum.join("")); - }, - - setLineContent: function(line, content) { - this.history.commit(); - this.replaceRange({node: line, offset: 0}, - {node: line, offset: this.history.textAfter(line).length}, - content); - this.addDirtyNode(line); - this.scheduleHighlight(); - }, - - insertIntoLine: function(line, position, content) { - var before = null; - if (position == "end") { - before = endOfLine(line, this.container); - } - else { - for (var cur = line ? line.nextSibling : this.container.firstChild; cur; cur = cur.nextSibling) { - if (position == 0) { - before = cur; - break; - } - var text = (cur.innerText || cur.textContent || cur.nodeValue || ""); - if (text.length > position) { - before = cur.nextSibling; - content = text.slice(0, position) + content + text.slice(position); - removeElement(cur); - break; - } - position -= text.length; - } - } - - var lines = asEditorLines(content), doc = this.container.ownerDocument; - for (var i = 0; i < lines.length; i++) { - if (i > 0) this.container.insertBefore(doc.createElement("BR"), before); - this.container.insertBefore(makePartSpan(lines[i], doc), before); - } - this.addDirtyNode(line); - this.scheduleHighlight(); - }, - - // Retrieve the selected text. - selectedText: function() { - var h = this.history; - h.commit(); - - var start = select.cursorPos(this.container, true), - end = select.cursorPos(this.container, false); - if (!start || !end) return ""; - - if (start.node == end.node) - return h.textAfter(start.node).slice(start.offset, end.offset); - - var text = [h.textAfter(start.node).slice(start.offset)]; - for (var pos = h.nodeAfter(start.node); pos != end.node; pos = h.nodeAfter(pos)) - text.push(h.textAfter(pos)); - text.push(h.textAfter(end.node).slice(0, end.offset)); - return cleanText(text.join("\n")); - }, - - // Replace the selection with another p - // iece of text. - replaceSelection: function(text) { - this.history.commit(); - - var start = select.cursorPos(this.container, true), - end = select.cursorPos(this.container, false); - if (!start || !end) return; - - end = this.replaceRange(start, end, text); - // select.setCursorPos(this.container, end); - webkitLastLineHack(this.container); - }, - - reroutePasteEvent: function() { - if (this.capturingPaste || window.opera) return; - this.capturingPaste = true; - var te = parent.document.createElement("TEXTAREA"); - te.style.position = "absolute"; - te.style.left = "-500px"; - te.style.width = "10px"; - te.style.top = nodeTop(frameElement) + "px"; - parent.document.body.appendChild(te); - parent.focus(); - te.focus(); - - var self = this; - this.parent.setTimeout(function() { - self.capturingPaste = false; - self.win.focus(); - if (self.selectionSnapshot) // IE hack - self.win.select.selectCoords(self.win, self.selectionSnapshot); - var text = te.value; - if (text) self.replaceSelection(text); - removeElement(te); - }, 10); - }, - - replaceRange: function(from, to, text) { - var lines = asEditorLines(text); - lines[0] = this.history.textAfter(from.node).slice(0, from.offset) + lines[0]; - var lastLine = lines[lines.length - 1]; - lines[lines.length - 1] = lastLine + this.history.textAfter(to.node).slice(to.offset); - var end = this.history.nodeAfter(to.node); - this.history.push(from.node, end, lines); - return {node: this.history.nodeBefore(end), - offset: lastLine.length}; - }, - - getSearchCursor: function(string, fromCursor) { - return new SearchCursor(this, string, fromCursor); - }, - - // Re-indent the whole buffer - reindent: function() { - if (this.container.firstChild) - this.indentRegion(null, this.container.lastChild); - }, - - reindentSelection: function(direction) { - if (!select.somethingSelected(this.win)) { - this.indentAtCursor(direction); - } - else { - var start = select.selectionTopNode(this.container, true), - end = select.selectionTopNode(this.container, false); - if (start === false || end === false) return; - this.indentRegion(start, end, direction); - } - }, - - grabKeys: function(eventHandler, filter) { - this.frozen = eventHandler; - this.keyFilter = filter; - }, - ungrabKeys: function() { - this.frozen = "leave"; - this.keyFilter = null; - }, - - setParser: function(name) { - Editor.Parser = window[name]; - if (this.container.firstChild) { - forEach(this.container.childNodes, function(n) { - if (n.nodeType != 3) n.dirty = true; - }); - this.addDirtyNode(this.firstChild); - this.scheduleHighlight(); - } - }, - - // Intercept enter and tab, and assign their new functions. - keyDown: function(event) { - if (this.frozen == "leave") this.frozen = null; - if (this.frozen && (!this.keyFilter || this.keyFilter(event))) { - event.stop(); - this.frozen(event); - return; - } - - var code = event.keyCode; - // Don't scan when the user is typing. - this.delayScanning(); - // Schedule a paren-highlight event, if configured. - if (this.options.autoMatchParens) - this.scheduleParenBlink(); - - // The various checks for !altKey are there because AltGr sets both - // ctrlKey and altKey to true, and should not be recognised as - // Control. - if (code == 13) { // enter - if (event.ctrlKey && !event.altKey) { - this.reparseBuffer(); - } - else { - select.insertNewlineAtCursor(this.win); - this.indentAtCursor(); - select.scrollToCursor(this.container); - } - event.stop(); - } - else if (code == 9 && this.options.tabMode != "default") { // tab - this.handleTab(!event.ctrlKey && !event.shiftKey); - event.stop(); - } - else if (code == 32 && event.shiftKey && this.options.tabMode == "default") { // space - this.handleTab(true); - event.stop(); - } - else if (code == 36 && !event.shiftKey && !event.ctrlKey) { // home - if (this.home()) - event.stop(); - } - else if ((code == 219 || code == 221) && event.ctrlKey && !event.altKey) { // [, ] - this.blinkParens(event.shiftKey); - event.stop(); - } - else if (event.metaKey && !event.shiftKey && (code == 37 || code == 39)) { // Meta-left/right - var cursor = select.selectionTopNode(this.container); - if (cursor === false || !this.container.firstChild) return; - - if (code == 37) select.focusAfterNode(startOfLine(cursor), this.container); - else { - var end = endOfLine(cursor, this.container); - select.focusAfterNode(end ? end.previousSibling : this.container.lastChild, this.container); - } - event.stop(); - } - else if ((event.ctrlKey || event.metaKey) && !event.altKey) { - if ((event.shiftKey && code == 90) || code == 89) { // shift-Z, Y - select.scrollToNode(this.history.redo()); - event.stop(); - } - else if (code == 90 || (safari && code == 8)) { // Z, backspace - select.scrollToNode(this.history.undo()); - event.stop(); - } - else if (code == 83 && this.options.saveFunction) { // S - this.options.saveFunction(); - event.stop(); - } - } - }, - - // Check for characters that should re-indent the current line, - // and prevent Opera from handling enter and tab anyway. - keyPress: function(event) { - var electric = Editor.Parser.electricChars, self = this; - // Hack for Opera, and Firefox on OS X, in which stopping a - // keydown event does not prevent the associated keypress event - // from happening, so we have to cancel enter and tab again - // here. - if ((this.frozen && (!this.keyFilter || this.keyFilter(event.keyCode))) || - event.code == 13 || (event.code == 9 && this.options.tabMode != "default") || - (event.keyCode == 32 && event.shiftKey && this.options.tabMode == "default")) - event.stop(); - else if (electric && electric.indexOf(event.character) != -1) - this.parent.setTimeout(function(){self.indentAtCursor(null);}, 0); - else if ((event.character == "v" || event.character == "V") - && (event.ctrlKey || event.metaKey) && !event.altKey) // ctrl-V - this.reroutePasteEvent(); - }, - - // Mark the node at the cursor dirty when a non-safe key is - // released. - keyUp: function(event) { - this.cursorActivity(isSafeKey(event.keyCode)); - }, - - // Indent the line following a given
    , or null for the first - // line. If given a
    element, this must have been highlighted - // so that it has an indentation method. Returns the whitespace - // element that has been modified or created (if any). - indentLineAfter: function(start, direction) { - // whiteSpace is the whitespace span at the start of the line, - // or null if there is no such node. - var whiteSpace = start ? start.nextSibling : this.container.firstChild; - if (whiteSpace && !hasClass(whiteSpace, "whitespace")) - whiteSpace = null; - - // Sometimes the start of the line can influence the correct - // indentation, so we retrieve it. - var firstText = whiteSpace ? whiteSpace.nextSibling : (start ? start.nextSibling : this.container.firstChild); - var nextChars = (start && firstText && firstText.currentText) ? firstText.currentText : ""; - - // Ask the lexical context for the correct indentation, and - // compute how much this differs from the current indentation. - var newIndent = 0, curIndent = whiteSpace ? whiteSpace.currentText.length : 0; - if (direction != null && this.options.tabMode == "shift") - newIndent = direction ? curIndent + indentUnit : Math.max(0, curIndent - indentUnit) - else if (start) - newIndent = start.indentation(nextChars, curIndent, direction); - else if (Editor.Parser.firstIndentation) - newIndent = Editor.Parser.firstIndentation(nextChars, curIndent, direction); - var indentDiff = newIndent - curIndent; - - // If there is too much, this is just a matter of shrinking a span. - if (indentDiff < 0) { - if (newIndent == 0) { - if (firstText) select.snapshotMove(whiteSpace.firstChild, firstText.firstChild, 0); - removeElement(whiteSpace); - whiteSpace = null; - } - else { - select.snapshotMove(whiteSpace.firstChild, whiteSpace.firstChild, indentDiff, true); - whiteSpace.currentText = makeWhiteSpace(newIndent); - whiteSpace.firstChild.nodeValue = whiteSpace.currentText; - } - } - // Not enough... - else if (indentDiff > 0) { - // If there is whitespace, we grow it. - if (whiteSpace) { - whiteSpace.currentText = makeWhiteSpace(newIndent); - whiteSpace.firstChild.nodeValue = whiteSpace.currentText; - } - // Otherwise, we have to add a new whitespace node. - else { - whiteSpace = makePartSpan(makeWhiteSpace(newIndent), this.doc); - whiteSpace.className = "whitespace"; - if (start) insertAfter(whiteSpace, start); - else this.container.insertBefore(whiteSpace, this.container.firstChild); - } - if (firstText) select.snapshotMove(firstText.firstChild, whiteSpace.firstChild, curIndent, false, true); - } - if (indentDiff != 0) this.addDirtyNode(start); - return whiteSpace; - }, - - // Re-highlight the selected part of the document. - highlightAtCursor: function() { - var pos = select.selectionTopNode(this.container, true); - var to = select.selectionTopNode(this.container, false); - if (pos === false || to === false) return; - - select.markSelection(this.win); - if (this.highlight(pos, endOfLine(to, this.container), true, 20) === false) - return false; - select.selectMarked(); - return true; - }, - - // When tab is pressed with text selected, the whole selection is - // re-indented, when nothing is selected, the line with the cursor - // is re-indented. - handleTab: function(direction) { - if (this.options.tabMode == "spaces") - select.insertTabAtCursor(this.win); - else - this.reindentSelection(direction); - }, - - home: function() { - var cur = select.selectionTopNode(this.container, true), start = cur; - if (cur === false || !(!cur || cur.isPart || cur.nodeName == "BR") || !this.container.firstChild) - return false; - - while (cur && cur.nodeName != "BR") cur = cur.previousSibling; - var next = cur ? cur.nextSibling : this.container.firstChild; - if (next && next != start && next.isPart && hasClass(next, "whitespace")) - select.focusAfterNode(next, this.container); - else - select.focusAfterNode(cur, this.container); - - select.scrollToCursor(this.container); - return true; - }, - - // Delay (or initiate) the next paren blink event. - scheduleParenBlink: function() { - if (this.parenEvent) this.parent.clearTimeout(this.parenEvent); - var self = this; - this.parenEvent = this.parent.setTimeout(function(){self.blinkParens();}, 300); - }, - - // Take the token before the cursor. If it contains a character in - // '()[]{}', search for the matching paren/brace/bracket, and - // highlight them in green for a moment, or red if no proper match - // was found. - blinkParens: function(jump) { - if (!window.select) return; - // Clear the event property. - if (this.parenEvent) this.parent.clearTimeout(this.parenEvent); - this.parenEvent = null; - - // Extract a 'paren' from a piece of text. - function paren(node) { - if (node.currentText) { - var match = node.currentText.match(/^[\s\u00a0]*([\(\)\[\]{}])[\s\u00a0]*$/); - return match && match[1]; - } - } - // Determine the direction a paren is facing. - function forward(ch) { - return /[\(\[\{]/.test(ch); - } - - var ch, self = this, cursor = select.selectionTopNode(this.container, true); - if (!cursor || !this.highlightAtCursor()) return; - cursor = select.selectionTopNode(this.container, true); - if (!(cursor && ((ch = paren(cursor)) || (cursor = cursor.nextSibling) && (ch = paren(cursor))))) - return; - // We only look for tokens with the same className. - var className = cursor.className, dir = forward(ch), match = matching[ch]; - - // Since parts of the document might not have been properly - // highlighted, and it is hard to know in advance which part we - // have to scan, we just try, and when we find dirty nodes we - // abort, parse them, and re-try. - function tryFindMatch() { - var stack = [], ch, ok = true;; - for (var runner = cursor; runner; runner = dir ? runner.nextSibling : runner.previousSibling) { - if (runner.className == className && runner.nodeName == "SPAN" && (ch = paren(runner))) { - if (forward(ch) == dir) - stack.push(ch); - else if (!stack.length) - ok = false; - else if (stack.pop() != matching[ch]) - ok = false; - if (!stack.length) break; - } - else if (runner.dirty || runner.nodeName != "SPAN" && runner.nodeName != "BR") { - return {node: runner, status: "dirty"}; - } - } - return {node: runner, status: runner && ok}; - } - // Temporarily give the relevant nodes a colour. - function blink(node, ok) { - node.style.fontWeight = "bold"; - node.style.color = ok ? "#8F8" : "#F88"; - self.parent.setTimeout(function() {node.style.fontWeight = ""; node.style.color = "";}, 500); - } - - while (true) { - var found = tryFindMatch(); - if (found.status == "dirty") { - this.highlight(found.node, endOfLine(found.node)); - // Needed because in some corner cases a highlight does not - // reach a node. - found.node.dirty = false; - continue; - } - else { - blink(cursor, found.status); - if (found.node) { - blink(found.node, found.status); - if (jump) select.focusAfterNode(found.node.previousSibling, this.container); - } - break; - } - } - }, - - // Adjust the amount of whitespace at the start of the line that - // the cursor is on so that it is indented properly. - indentAtCursor: function(direction) { - if (!this.container.firstChild) return; - // The line has to have up-to-date lexical information, so we - // highlight it first. - if (!this.highlightAtCursor()) return; - var cursor = select.selectionTopNode(this.container, false); - // If we couldn't determine the place of the cursor, - // there's nothing to indent. - if (cursor === false) - return; - var lineStart = startOfLine(cursor); - var whiteSpace = this.indentLineAfter(lineStart, direction); - if (cursor == lineStart && whiteSpace) - cursor = whiteSpace; - // This means the indentation has probably messed up the cursor. - if (cursor == whiteSpace) - select.focusAfterNode(cursor, this.container); - }, - - // Indent all lines whose start falls inside of the current - // selection. - indentRegion: function(start, end, direction) { - var current = (start = startOfLine(start)), before = start && startOfLine(start.previousSibling); - if (end.nodeName != "BR") end = endOfLine(end, this.container); - - do { - var next = endOfLine(current, this.container); - if (current) this.highlight(before, next, true); - this.indentLineAfter(current, direction); - before = current; - current = next; - } while (current != end); - select.setCursorPos(this.container, {node: start, offset: 0}, {node: end, offset: 0}); - }, - - // Find the node that the cursor is in, mark it as dirty, and make - // sure a highlight pass is scheduled. - cursorActivity: function(safe) { - if (internetExplorer) { - this.container.createTextRange().execCommand("unlink"); - this.selectionSnapshot = select.selectionCoords(this.win); - } - - var activity = this.options.cursorActivity; - if (!safe || activity) { - var cursor = select.selectionTopNode(this.container, false); - if (cursor === false || !this.container.firstChild) return; - cursor = cursor || this.container.firstChild; - if (activity) activity(cursor); - if (!safe) { - this.scheduleHighlight(); - this.addDirtyNode(cursor); - } - } - }, - - reparseBuffer: function() { - forEach(this.container.childNodes, function(node) {node.dirty = true;}); - if (this.container.firstChild) - this.addDirtyNode(this.container.firstChild); - }, - - // Add a node to the set of dirty nodes, if it isn't already in - // there. - addDirtyNode: function(node) { - node = node || this.container.firstChild; - if (!node) return; - - for (var i = 0; i < this.dirty.length; i++) - if (this.dirty[i] == node) return; - - if (node.nodeType != 3) - node.dirty = true; - this.dirty.push(node); - }, - - // Cause a highlight pass to happen in options.passDelay - // milliseconds. Clear the existing timeout, if one exists. This - // way, the passes do not happen while the user is typing, and - // should as unobtrusive as possible. - scheduleHighlight: function() { - // Timeouts are routed through the parent window, because on - // some browsers designMode windows do not fire timeouts. - var self = this; - this.parent.clearTimeout(this.highlightTimeout); - this.highlightTimeout = this.parent.setTimeout(function(){self.highlightDirty();}, this.options.passDelay); - }, - - // Fetch one dirty node, and remove it from the dirty set. - getDirtyNode: function() { - while (this.dirty.length > 0) { - var found = this.dirty.pop(); - // IE8 sometimes throws an unexplainable 'invalid argument' - // exception for found.parentNode - try { - // If the node has been coloured in the meantime, or is no - // longer in the document, it should not be returned. - while (found && found.parentNode != this.container) - found = found.parentNode - if (found && (found.dirty || found.nodeType == 3)) - return found; - } catch (e) {} - } - return null; - }, - - // Pick dirty nodes, and highlight them, until options.passTime - // milliseconds have gone by. The highlight method will continue - // to next lines as long as it finds dirty nodes. It returns - // information about the place where it stopped. If there are - // dirty nodes left after this function has spent all its lines, - // it shedules another highlight to finish the job. - highlightDirty: function(force) { - // Prevent FF from raising an error when it is firing timeouts - // on a page that's no longer loaded. - if (!window.select) return; - - if (!this.options.readOnly) select.markSelection(this.win); - var start, endTime = force ? null : time() + this.options.passTime; - while ((time() < endTime || force) && (start = this.getDirtyNode())) { - var result = this.highlight(start, endTime); - if (result && result.node && result.dirty) - this.addDirtyNode(result.node); - } - if (!this.options.readOnly) select.selectMarked(); - if (start) this.scheduleHighlight(); - return this.dirty.length == 0; - }, - - // Creates a function that, when called through a timeout, will - // continuously re-parse the document. - documentScanner: function(passTime) { - var self = this, pos = null; - return function() { - // FF timeout weirdness workaround. - if (!window.select) return; - // If the current node is no longer in the document... oh - // well, we start over. - if (pos && pos.parentNode != self.container) - pos = null; - select.markSelection(self.win); - var result = self.highlight(pos, time() + passTime, true); - select.selectMarked(); - var newPos = result ? (result.node && result.node.nextSibling) : null; - pos = (pos == newPos) ? null : newPos; - self.delayScanning(); - }; - }, - - // Starts the continuous scanning process for this document after - // a given interval. - delayScanning: function() { - if (this.scanner) { - this.parent.clearTimeout(this.documentScan); - this.documentScan = this.parent.setTimeout(this.scanner, this.options.continuousScanning); - } - }, - - // The function that does the actual highlighting/colouring (with - // help from the parser and the DOM normalizer). Its interface is - // rather overcomplicated, because it is used in different - // situations: ensuring that a certain line is highlighted, or - // highlighting up to X milliseconds starting from a certain - // point. The 'from' argument gives the node at which it should - // start. If this is null, it will start at the beginning of the - // document. When a timestamp is given with the 'target' argument, - // it will stop highlighting at that time. If this argument holds - // a DOM node, it will highlight until it reaches that node. If at - // any time it comes across two 'clean' lines (no dirty nodes), it - // will stop, except when 'cleanLines' is true. maxBacktrack is - // the maximum number of lines to backtrack to find an existing - // parser instance. This is used to give up in situations where a - // highlight would take too long and freeze the browser interface. - highlight: function(from, target, cleanLines, maxBacktrack){ - var container = this.container, self = this, active = this.options.activeTokens; - var endTime = (typeof target == "number" ? target : null); - - if (!container.firstChild) - return; - // Backtrack to the first node before from that has a partial - // parse stored. - while (from && (!from.parserFromHere || from.dirty)) { - if (maxBacktrack != null && from.nodeName == "BR" && (--maxBacktrack) < 0) - return false; - from = from.previousSibling; - } - // If we are at the end of the document, do nothing. - if (from && !from.nextSibling) - return; - - // Check whether a part ( node) and the corresponding token - // match. - function correctPart(token, part){ - return !part.reduced && part.currentText == token.value && part.className == token.style; - } - // Shorten the text associated with a part by chopping off - // characters from the front. Note that only the currentText - // property gets changed. For efficiency reasons, we leave the - // nodeValue alone -- we set the reduced flag to indicate that - // this part must be replaced. - function shortenPart(part, minus){ - part.currentText = part.currentText.substring(minus); - part.reduced = true; - } - // Create a part corresponding to a given token. - function tokenPart(token){ - var part = makePartSpan(token.value, self.doc); - part.className = token.style; - return part; - } - - function maybeTouch(node) { - if (node) { - var old = node.oldNextSibling; - if (lineDirty || old === undefined || node.nextSibling != old) - self.history.touch(node); - node.oldNextSibling = node.nextSibling; - } - else { - var old = self.container.oldFirstChild; - if (lineDirty || old === undefined || self.container.firstChild != old) - self.history.touch(null); - self.container.oldFirstChild = self.container.firstChild; - } - } - - // Get the token stream. If from is null, we start with a new - // parser from the start of the frame, otherwise a partial parse - // is resumed. - var traversal = traverseDOM(from ? from.nextSibling : container.firstChild), - stream = stringStream(traversal), - parsed = from ? from.parserFromHere(stream) : Editor.Parser.make(stream); - - // parts is an interface to make it possible to 'delay' fetching - // the next DOM node until we are completely done with the one - // before it. This is necessary because often the next node is - // not yet available when we want to proceed past the current - // one. - var parts = { - current: null, - // Fetch current node. - get: function(){ - if (!this.current) - this.current = traversal.nodes.shift(); - return this.current; - }, - // Advance to the next part (do not fetch it yet). - next: function(){ - this.current = null; - }, - // Remove the current part from the DOM tree, and move to the - // next. - remove: function(){ - container.removeChild(this.get()); - this.current = null; - }, - // Advance to the next part that is not empty, discarding empty - // parts. - getNonEmpty: function(){ - var part = this.get(); - // Allow empty nodes when they are alone on a line, needed - // for the FF cursor bug workaround (see select.js, - // insertNewlineAtCursor). - while (part && part.nodeName == "SPAN" && part.currentText == "") { - var old = part; - this.remove(); - part = this.get(); - // Adjust selection information, if any. See select.js for details. - select.snapshotMove(old.firstChild, part && (part.firstChild || part), 0); - } - return part; - } - }; - - var lineDirty = false, prevLineDirty = true, lineNodes = 0; - - // This forEach loops over the tokens from the parsed stream, and - // at the same time uses the parts object to proceed through the - // corresponding DOM nodes. - forEach(parsed, function(token){ - var part = parts.getNonEmpty(); - - if (token.value == "\n"){ - // The idea of the two streams actually staying synchronized - // is such a long shot that we explicitly check. - if (part.nodeName != "BR") - throw "Parser out of sync. Expected BR."; - - if (part.dirty || !part.indentation) lineDirty = true; - maybeTouch(from); - from = part; - - // Every
    gets a copy of the parser state and a lexical - // context assigned to it. The first is used to be able to - // later resume parsing from this point, the second is used - // for indentation. - part.parserFromHere = parsed.copy(); - part.indentation = token.indentation; - part.dirty = false; - - // If the target argument wasn't an integer, go at least - // until that node. - if (endTime == null && part == target) throw StopIteration; - - // A clean line with more than one node means we are done. - // Throwing a StopIteration is the way to break out of a - // MochiKit forEach loop. - if ((endTime != null && time() >= endTime) || (!lineDirty && !prevLineDirty && lineNodes > 1 && !cleanLines)) - throw StopIteration; - prevLineDirty = lineDirty; lineDirty = false; lineNodes = 0; - parts.next(); - } - else { - if (part.nodeName != "SPAN") - throw "Parser out of sync. Expected SPAN."; - if (part.dirty) - lineDirty = true; - lineNodes++; - - // If the part matches the token, we can leave it alone. - if (correctPart(token, part)){ - part.dirty = false; - parts.next(); - } - // Otherwise, we have to fix it. - else { - lineDirty = true; - // Insert the correct part. - var newPart = tokenPart(token); - container.insertBefore(newPart, part); - if (active) active(newPart, token, self); - var tokensize = token.value.length; - var offset = 0; - // Eat up parts until the text for this token has been - // removed, adjusting the stored selection info (see - // select.js) in the process. - while (tokensize > 0) { - part = parts.get(); - var partsize = part.currentText.length; - select.snapshotReplaceNode(part.firstChild, newPart.firstChild, tokensize, offset); - if (partsize > tokensize){ - shortenPart(part, tokensize); - tokensize = 0; - } - else { - tokensize -= partsize; - offset += partsize; - parts.remove(); - } - } - } - } - }); - maybeTouch(from); - webkitLastLineHack(this.container); - - // The function returns some status information that is used by - // hightlightDirty to determine whether and where it has to - // continue. - return {node: parts.getNonEmpty(), - dirty: lineDirty}; - } - }; - - return Editor; -})(); - -addEventHandler(window, "load", function() { - var CodeMirror = window.frameElement.CodeMirror; - CodeMirror.editor = new Editor(CodeMirror.options); - this.parent.setTimeout(method(CodeMirror, "init"), 0); -}); diff --git a/platforma/static/js/lib/codemirror/parsexml.js b/platforma/static/js/lib/codemirror/parsexml.js deleted file mode 100644 index 87fbf0c0..00000000 --- a/platforma/static/js/lib/codemirror/parsexml.js +++ /dev/null @@ -1,292 +0,0 @@ -/* This file defines an XML parser, with a few kludges to make it - * useable for HTML. autoSelfClosers defines a set of tag names that - * are expected to not have a closing tag, and doNotIndent specifies - * the tags inside of which no indentation should happen (see Config - * object). These can be disabled by passing the editor an object like - * {useHTMLKludges: false} as parserConfig option. - */ - -var XMLParser = Editor.Parser = (function() { - var Kludges = { - autoSelfClosers: {"br": true, "img": true, "hr": true, "link": true, "input": true, - "meta": true, "col": true, "frame": true, "base": true, "area": true}, - doNotIndent: {"pre": true, "!cdata": true} - }; - var NoKludges = {autoSelfClosers: {}, doNotIndent: {"!cdata": true}}; - var UseKludges = Kludges; - var alignCDATA = false; - - // Simple stateful tokenizer for XML documents. Returns a - // MochiKit-style iterator, with a state property that contains a - // function encapsulating the current state. See tokenize.js. - var tokenizeXML = (function() { - function inText(source, setState) { - var ch = source.next(); - if (ch == "<") { - if (source.equals("!")) { - source.next(); - if (source.equals("[")) { - if (source.lookAhead("[CDATA[", true)) { - setState(inBlock("xml-cdata", "]]>")); - return null; - } - else { - return "xml-text"; - } - } - else if (source.lookAhead("--", true)) { - setState(inBlock("xml-comment", "-->")); - return null; - } - else { - return "xml-text"; - } - } - else if (source.equals("?")) { - source.next(); - source.nextWhileMatches(/[\w\._\-]/); - setState(inBlock("xml-processing", "?>")); - return "xml-processing"; - } - else { - if (source.equals("/")) source.next(); - setState(inTag); - return "xml-punctuation"; - } - } - else if (ch == "&") { - while (!source.endOfLine()) { - if (source.next() == ";") - break; - } - return "xml-entity"; - } - else { - source.nextWhileMatches(/[^&<\n]/); - return "xml-text"; - } - } - - function inTag(source, setState) { - var ch = source.next(); - if (ch == ">") { - setState(inText); - return "xml-punctuation"; - } - else if (/[?\/]/.test(ch) && source.equals(">")) { - source.next(); - setState(inText); - return "xml-punctuation"; - } - else if (ch == "=") { - return "xml-punctuation"; - } - else if (/[\'\"]/.test(ch)) { - setState(inAttribute(ch)); - return null; - } - else { - source.nextWhileMatches(/[^\s\u00a0=<>\"\'\/?]/); - return "xml-name"; - } - } - - function inAttribute(quote) { - return function(source, setState) { - while (!source.endOfLine()) { - if (source.next() == quote) { - setState(inTag); - break; - } - } - return "xml-attribute"; - }; - } - - function inBlock(style, terminator) { - return function(source, setState) { - while (!source.endOfLine()) { - if (source.lookAhead(terminator, true)) { - setState(inText); - break; - } - source.next(); - } - return style; - }; - } - - return function(source, startState) { - return tokenizer(source, startState || inText); - }; - })(); - - // The parser. The structure of this function largely follows that of - // parseJavaScript in parsejavascript.js (there is actually a bit more - // shared code than I'd like), but it is quite a bit simpler. - function parseXML(source) { - var tokens = tokenizeXML(source); - var cc = [base]; - var tokenNr = 0, indented = 0; - var currentTag = null, context = null; - var consume, marked; - - function push(fs) { - for (var i = fs.length - 1; i >= 0; i--) - cc.push(fs[i]); - } - function cont() { - push(arguments); - consume = true; - } - function pass() { - push(arguments); - consume = false; - } - - function mark(style) { - marked = style; - } - function expect(text) { - return function(style, content) { - if (content == text) cont(); - else mark("xml-error") || cont(arguments.callee); - }; - } - - function pushContext(tagname, startOfLine) { - var noIndent = UseKludges.doNotIndent.hasOwnProperty(tagname) || (context && context.noIndent); - context = {prev: context, name: tagname, indent: indented, startOfLine: startOfLine, noIndent: noIndent}; - } - function popContext() { - context = context.prev; - } - function computeIndentation(baseContext) { - return function(nextChars, current) { - var context = baseContext; - if (context && context.noIndent) - return current; - if (alignCDATA && /")); - else if (style == "xml-cdata") { - if (!context || context.name != "!cdata") pushContext("!cdata"); - if (/\]\]>$/.test(content)) popContext(); - cont(); - } - else if (harmlessTokens.hasOwnProperty(style)) cont(); - else mark("xml-error") || cont(); - } - function tagname(style, content) { - if (style == "xml-name") { - currentTag = content.toLowerCase(); - mark("xml-tagname"); - cont(); - } - else { - currentTag = null; - pass(); - } - } - function closetagname(style, content) { - if (style == "xml-name" && context && content.toLowerCase() == context.name) { - popContext(); - mark("xml-tagname"); - } - else { - mark("xml-error"); - } - cont(); - } - function endtag(startOfLine) { - return function(style, content) { - if (content == "/>" || (content == ">" && UseKludges.autoSelfClosers.hasOwnProperty(currentTag))) cont(); - else if (content == ">") pushContext(currentTag, startOfLine) || cont(); - else mark("xml-error") || cont(arguments.callee); - }; - } - function attributes(style) { - if (style == "xml-name") mark("xml-attname") || cont(attribute, attributes); - else pass(); - } - function attribute(style, content) { - if (content == "=") cont(value); - else if (content == ">" || content == "/>") pass(endtag); - else pass(); - } - function value(style) { - if (style == "xml-attribute") cont(value); - else pass(); - } - - return { - indentation: function() {return indented;}, - - next: function(){ - var token = tokens.next(); - if (token.style == "whitespace" && tokenNr == 0) - indented = token.value.length; - else - tokenNr++; - if (token.content == "\n") { - indented = tokenNr = 0; - token.indentation = computeIndentation(context); - } - - if (token.style == "whitespace" || token.type == "xml-comment") - return token; - - while(true){ - consume = marked = false; - cc.pop()(token.style, token.content); - if (consume){ - if (marked) - token.style = marked; - return token; - } - } - }, - - copy: function(){ - var _cc = cc.concat([]), _tokenState = tokens.state, _context = context; - var parser = this; - - return function(input){ - cc = _cc.concat([]); - tokenNr = indented = 0; - context = _context; - tokens = tokenizeXML(input, _tokenState); - return parser; - }; - } - }; - } - - return { - make: parseXML, - electricChars: "/", - configure: function(config) { - if (config.useHTMLKludges != null) - UseKludges = config.useHTMLKludges ? Kludges : NoKludges; - if (config.alignCDATA) - alignCDATA = config.alignCDATA; - } - }; -})(); diff --git a/platforma/static/js/lib/codemirror/select.js b/platforma/static/js/lib/codemirror/select.js deleted file mode 100644 index d513ba5f..00000000 --- a/platforma/static/js/lib/codemirror/select.js +++ /dev/null @@ -1,619 +0,0 @@ -/* Functionality for finding, storing, and restoring selections - * - * This does not provide a generic API, just the minimal functionality - * required by the CodeMirror system. - */ - -// Namespace object. -var select = {}; - -(function() { - select.ie_selection = document.selection && document.selection.createRangeCollection; - - // Find the 'top-level' (defined as 'a direct child of the node - // passed as the top argument') node that the given node is - // contained in. Return null if the given node is not inside the top - // node. - function topLevelNodeAt(node, top) { - while (node && node.parentNode != top) - node = node.parentNode; - return node; - } - - // Find the top-level node that contains the node before this one. - function topLevelNodeBefore(node, top) { - while (!node.previousSibling && node.parentNode != top) - node = node.parentNode; - return topLevelNodeAt(node.previousSibling, top); - } - - var fourSpaces = "\u00a0\u00a0\u00a0\u00a0"; - - select.scrollToNode = function(element) { - if (!element) return; - var doc = element.ownerDocument, body = doc.body, - win = (doc.defaultView || doc.parentWindow), - html = doc.documentElement, - atEnd = !element.nextSibling || !element.nextSibling.nextSibling - || !element.nextSibling.nextSibling.nextSibling; - // In Opera (and recent Webkit versions), BR elements *always* - // have a scrollTop property of zero. - var compensateHack = 0; - while (element && !element.offsetTop) { - compensateHack++; - element = element.previousSibling; - } - // atEnd is another kludge for these browsers -- if the cursor is - // at the end of the document, and the node doesn't have an - // offset, just scroll to the end. - if (compensateHack == 0) atEnd = false; - - var y = compensateHack * (element ? element.offsetHeight : 0), x = 0, pos = element; - while (pos && pos.offsetParent) { - y += pos.offsetTop; - // Don't count X offset for
    nodes - if (pos.nodeName != "BR") - x += pos.offsetLeft; - pos = pos.offsetParent; - } - - var scroll_x = body.scrollLeft || html.scrollLeft || 0, - scroll_y = body.scrollTop || html.scrollTop || 0, - screen_x = x - scroll_x, screen_y = y - scroll_y, scroll = false; - - if (screen_x < 0 || screen_x > (win.innerWidth || html.clientWidth || 0)) { - scroll_x = x; - scroll = true; - } - if (screen_y < 0 || atEnd || screen_y > (win.innerHeight || html.clientHeight || 0) - 50) { - scroll_y = atEnd ? 1e10 : y; - scroll = true; - } - if (scroll) win.scrollTo(scroll_x, scroll_y); - }; - - select.scrollToCursor = function(container) { - select.scrollToNode(select.selectionTopNode(container, true) || container.firstChild); - }; - - // Used to prevent restoring a selection when we do not need to. - var currentSelection = null; - - select.snapshotChanged = function() { - if (currentSelection) currentSelection.changed = true; - }; - - // This is called by the code in editor.js whenever it is replacing - // a text node. The function sees whether the given oldNode is part - // of the current selection, and updates this selection if it is. - // Because nodes are often only partially replaced, the length of - // the part that gets replaced has to be taken into account -- the - // selection might stay in the oldNode if the newNode is smaller - // than the selection's offset. The offset argument is needed in - // case the selection does move to the new object, and the given - // length is not the whole length of the new node (part of it might - // have been used to replace another node). - select.snapshotReplaceNode = function(from, to, length, offset) { - if (!currentSelection) return; - - function replace(point) { - if (from == point.node) { - currentSelection.changed = true; - if (length && point.offset > length) { - point.offset -= length; - } - else { - point.node = to; - point.offset += (offset || 0); - } - } - } - replace(currentSelection.start); - replace(currentSelection.end); - }; - - select.snapshotMove = function(from, to, distance, relative, ifAtStart) { - if (!currentSelection) return; - - function move(point) { - if (from == point.node && (!ifAtStart || point.offset == 0)) { - currentSelection.changed = true; - point.node = to; - if (relative) point.offset = Math.max(0, point.offset + distance); - else point.offset = distance; - } - } - move(currentSelection.start); - move(currentSelection.end); - }; - - // Most functions are defined in two ways, one for the IE selection - // model, one for the W3C one. - if (select.ie_selection) { - function selectionNode(win, start) { - var range = win.document.selection.createRange(); - range.collapse(start); - - function nodeAfter(node) { - var found = null; - while (!found && node) { - found = node.nextSibling; - node = node.parentNode; - } - return nodeAtStartOf(found); - } - - function nodeAtStartOf(node) { - while (node && node.firstChild) node = node.firstChild; - return {node: node, offset: 0}; - } - - var containing = range.parentElement(); - if (!isAncestor(win.document.body, containing)) return null; - if (!containing.firstChild) return nodeAtStartOf(containing); - - var working = range.duplicate(); - working.moveToElementText(containing); - working.collapse(true); - for (var cur = containing.firstChild; cur; cur = cur.nextSibling) { - if (cur.nodeType == 3) { - var size = cur.nodeValue.length; - working.move("character", size); - } - else { - working.moveToElementText(cur); - working.collapse(false); - } - - var dir = range.compareEndPoints("StartToStart", working); - if (dir == 0) return nodeAfter(cur); - if (dir == 1) continue; - if (cur.nodeType != 3) return nodeAtStartOf(cur); - - working.setEndPoint("StartToEnd", range); - return {node: cur, offset: size - working.text.length}; - } - return nodeAfter(containing); - } - - select.markSelection = function(win) { - currentSelection = null; - var sel = win.document.selection; - if (!sel) return; - var start = selectionNode(win, true), - end = selectionNode(win, false); - if (!start || !end) return; - currentSelection = {start: start, end: end, window: win, changed: false}; - }; - - select.selectMarked = function() { - if (!currentSelection || !currentSelection.changed) return; - var win = currentSelection.window, doc = win.document; - - function makeRange(point) { - var range = doc.body.createTextRange(), - node = point.node; - if (!node) { - range.moveToElementText(currentSelection.window.document.body); - range.collapse(false); - } - else if (node.nodeType == 3) { - range.moveToElementText(node.parentNode); - var offset = point.offset; - while (node.previousSibling) { - node = node.previousSibling; - offset += (node.innerText || "").length; - } - range.move("character", offset); - } - else { - range.moveToElementText(node); - range.collapse(true); - } - return range; - } - - var start = makeRange(currentSelection.start), end = makeRange(currentSelection.end); - start.setEndPoint("StartToEnd", end); - start.select(); - }; - - // Get the top-level node that one end of the cursor is inside or - // after. Note that this returns false for 'no cursor', and null - // for 'start of document'. - select.selectionTopNode = function(container, start) { - var selection = container.ownerDocument.selection; - if (!selection) return false; - - var range = selection.createRange(), range2 = range.duplicate(); - range.collapse(start); - var around = range.parentElement(); - if (around && isAncestor(container, around)) { - // Only use this node if the selection is not at its start. - range2.moveToElementText(around); - if (range.compareEndPoints("StartToStart", range2) == 1) - return topLevelNodeAt(around, container); - } - - // Move the start of a range to the start of a node, - // compensating for the fact that you can't call - // moveToElementText with text nodes. - function moveToNodeStart(range, node) { - if (node.nodeType == 3) { - var count = 0, cur = node.previousSibling; - while (cur && cur.nodeType == 3) { - count += cur.nodeValue.length; - cur = cur.previousSibling; - } - if (cur) { - try{range.moveToElementText(cur);} - catch(e){} - range.collapse(false); - } - else range.moveToElementText(node.parentNode); - if (count) range.move("character", count); - } - else range.moveToElementText(node); - } - - // Do a binary search through the container object, comparing - // the start of each node to the selection - var start = 0, end = container.childNodes.length - 1; - while (start < end) { - var middle = Math.ceil((end + start) / 2), node = container.childNodes[middle]; - if (!node) return false; // Don't ask. IE6 manages this sometimes. - moveToNodeStart(range2, node); - if (range.compareEndPoints("StartToStart", range2) == 1) - start = middle; - else - end = middle - 1; - } - return container.childNodes[start] || null; - }; - - // Place the cursor after this.start. This is only useful when - // manually moving the cursor instead of restoring it to its old - // position. - select.focusAfterNode = function(node, container) { - var range = container.ownerDocument.body.createTextRange(); - range.moveToElementText(node || container); - range.collapse(!node); - range.select(); - }; - - select.somethingSelected = function(win) { - var sel = win.document.selection; - return sel && (sel.createRange().text != ""); - }; - - function insertAtCursor(window, html) { - var selection = window.document.selection; - if (selection) { - var range = selection.createRange(); - range.pasteHTML(html); - range.collapse(false); - range.select(); - } - } - - // Used to normalize the effect of the enter key, since browsers - // do widely different things when pressing enter in designMode. - select.insertNewlineAtCursor = function(window) { - insertAtCursor(window, "
    "); - }; - - select.insertTabAtCursor = function(window) { - insertAtCursor(window, fourSpaces); - }; - - // Get the BR node at the start of the line on which the cursor - // currently is, and the offset into the line. Returns null as - // node if cursor is on first line. - select.cursorPos = function(container, start) { - var selection = container.ownerDocument.selection; - if (!selection) return null; - - var topNode = select.selectionTopNode(container, start); - while (topNode && topNode.nodeName != "BR") - topNode = topNode.previousSibling; - - var range = selection.createRange(), range2 = range.duplicate(); - range.collapse(start); - if (topNode) { - range2.moveToElementText(topNode); - range2.collapse(false); - } - else { - // When nothing is selected, we can get all kinds of funky errors here. - try { range2.moveToElementText(container); } - catch (e) { return null; } - range2.collapse(true); - } - range.setEndPoint("StartToStart", range2); - - return {node: topNode, offset: range.text.length}; - }; - - select.setCursorPos = function(container, from, to) { - function rangeAt(pos) { - var range = container.ownerDocument.body.createTextRange(); - if (!pos.node) { - range.moveToElementText(container); - range.collapse(true); - } - else { - range.moveToElementText(pos.node); - range.collapse(false); - } - range.move("character", pos.offset); - return range; - } - - var range = rangeAt(from); - if (to && to != from) - range.setEndPoint("EndToEnd", rangeAt(to)); - range.select(); - } - - // Some hacks for storing and re-storing the selection when the editor loses and regains focus. - select.selectionCoords = function (win) { - var selection = win.document.selection; - if (!selection) return null; - var start = selection.createRange(), end = start.duplicate(); - start.collapse(true); - end.collapse(false); - - var body = win.document.body; - return {start: {x: start.boundingLeft + body.scrollLeft - 1, - y: start.boundingTop + body.scrollTop}, - end: {x: end.boundingLeft + body.scrollLeft - 1, - y: end.boundingTop + body.scrollTop}}; - }; - - // Restore a stored selection. - select.selectCoords = function(win, coords) { - if (!coords) return; - - var range1 = win.document.body.createTextRange(), range2 = range1.duplicate(); - // This can fail for various hard-to-handle reasons. - try { - range1.moveToPoint(coords.start.x, coords.start.y); - range2.moveToPoint(coords.end.x, coords.end.y); - range1.setEndPoint("EndToStart", range2); - range1.select(); - } catch(e) {} - }; - } - // W3C model - else { - // Store start and end nodes, and offsets within these, and refer - // back to the selection object from those nodes, so that this - // object can be updated when the nodes are replaced before the - // selection is restored. - select.markSelection = function (win) { - var selection = win.getSelection(); - if (!selection || selection.rangeCount == 0) - return (currentSelection = null); - var range = selection.getRangeAt(0); - - currentSelection = { - start: {node: range.startContainer, offset: range.startOffset}, - end: {node: range.endContainer, offset: range.endOffset}, - window: win, - changed: false - }; - - // We want the nodes right at the cursor, not one of their - // ancestors with a suitable offset. This goes down the DOM tree - // until a 'leaf' is reached (or is it *up* the DOM tree?). - function normalize(point){ - while (point.node.nodeType != 3 && point.node.nodeName != "BR") { - var newNode = point.node.childNodes[point.offset] || point.node.nextSibling; - point.offset = 0; - while (!newNode && point.node.parentNode) { - point.node = point.node.parentNode; - newNode = point.node.nextSibling; - } - point.node = newNode; - if (!newNode) - break; - } - } - - normalize(currentSelection.start); - normalize(currentSelection.end); - }; - - select.selectMarked = function () { - if (!currentSelection || !currentSelection.changed) return; - var win = currentSelection.window, range = win.document.createRange(); - - function setPoint(point, which) { - if (point.node) { - // Some magic to generalize the setting of the start and end - // of a range. - if (point.offset == 0) - range["set" + which + "Before"](point.node); - else - range["set" + which](point.node, point.offset); - } - else { - range.setStartAfter(win.document.body.lastChild || win.document.body); - } - } - - setPoint(currentSelection.end, "End"); - setPoint(currentSelection.start, "Start"); - selectRange(range, win); - }; - - // Helper for selecting a range object. - function selectRange(range, window) { - var selection = window.getSelection(); - selection.removeAllRanges(); - selection.addRange(range); - }; - function selectionRange(window) { - var selection = window.getSelection(); - if (!selection || selection.rangeCount == 0) - return false; - else - return selection.getRangeAt(0); - } - - // Finding the top-level node at the cursor in the W3C is, as you - // can see, quite an involved process. - select.selectionTopNode = function(container, start) { - var range = selectionRange(container.ownerDocument.defaultView); - if (!range) return false; - - var node = start ? range.startContainer : range.endContainer; - var offset = start ? range.startOffset : range.endOffset; - // Work around (yet another) bug in Opera's selection model. - if (window.opera && !start && range.endContainer == container && range.endOffset == range.startOffset + 1 && - container.childNodes[range.startOffset] && container.childNodes[range.startOffset].nodeName == "BR") - offset--; - - // For text nodes, we look at the node itself if the cursor is - // inside, or at the node before it if the cursor is at the - // start. - if (node.nodeType == 3){ - if (offset > 0) - return topLevelNodeAt(node, container); - else - return topLevelNodeBefore(node, container); - } - // Occasionally, browsers will return the HTML node as - // selection. If the offset is 0, we take the start of the frame - // ('after null'), otherwise, we take the last node. - else if (node.nodeName == "HTML") { - return (offset == 1 ? null : container.lastChild); - } - // If the given node is our 'container', we just look up the - // correct node by using the offset. - else if (node == container) { - return (offset == 0) ? null : node.childNodes[offset - 1]; - } - // In any other case, we have a regular node. If the cursor is - // at the end of the node, we use the node itself, if it is at - // the start, we use the node before it, and in any other - // case, we look up the child before the cursor and use that. - else { - if (offset == node.childNodes.length) - return topLevelNodeAt(node, container); - else if (offset == 0) - return topLevelNodeBefore(node, container); - else - return topLevelNodeAt(node.childNodes[offset - 1], container); - } - }; - - select.focusAfterNode = function(node, container) { - var win = container.ownerDocument.defaultView, - range = win.document.createRange(); - range.setStartBefore(container.firstChild || container); - // In Opera, setting the end of a range at the end of a line - // (before a BR) will cause the cursor to appear on the next - // line, so we set the end inside of the start node when - // possible. - if (node && !node.firstChild) - range.setEndAfter(node); - else if (node) - range.setEnd(node, node.childNodes.length); - else - range.setEndBefore(container.firstChild || container); - range.collapse(false); - selectRange(range, win); - }; - - select.somethingSelected = function(win) { - var range = selectionRange(win); - return range && !range.collapsed; - }; - - function insertNodeAtCursor(window, node) { - var range = selectionRange(window); - if (!range) return; - - range.deleteContents(); - range.insertNode(node); - webkitLastLineHack(window.document.body); - range = window.document.createRange(); - range.selectNode(node); - range.collapse(false); - selectRange(range, window); - } - - select.insertNewlineAtCursor = function(window) { - insertNodeAtCursor(window, window.document.createElement("BR")); - }; - - select.insertTabAtCursor = function(window) { - insertNodeAtCursor(window, window.document.createTextNode(fourSpaces)); - }; - - select.cursorPos = function(container, start) { - var range = selectionRange(window); - if (!range) return; - - var topNode = select.selectionTopNode(container, start); - while (topNode && topNode.nodeName != "BR") - topNode = topNode.previousSibling; - - range = range.cloneRange(); - range.collapse(start); - if (topNode) - range.setStartAfter(topNode); - else - range.setStartBefore(container); - return {node: topNode, offset: range.toString().length}; - }; - - select.setCursorPos = function(container, from, to) { - var win = container.ownerDocument.defaultView, - range = win.document.createRange(); - - function setPoint(node, offset, side) { - if (!node) - node = container.firstChild; - else - node = node.nextSibling; - - if (!node) - return; - - if (offset == 0) { - range["set" + side + "Before"](node); - return true; - } - - var backlog = [] - function decompose(node) { - if (node.nodeType == 3) - backlog.push(node); - else - forEach(node.childNodes, decompose); - } - while (true) { - while (node && !backlog.length) { - decompose(node); - node = node.nextSibling; - } - var cur = backlog.shift(); - if (!cur) return false; - - var length = cur.nodeValue.length; - if (length >= offset) { - range["set" + side](cur, offset); - return true; - } - offset -= length; - } - } - - to = to || from; - if (setPoint(to.node, to.offset, "End") && setPoint(from.node, from.offset, "Start")) - selectRange(range, win); - }; - } -})(); diff --git a/platforma/static/js/lib/codemirror/stringstream.js b/platforma/static/js/lib/codemirror/stringstream.js deleted file mode 100644 index 8c1c0422..00000000 --- a/platforma/static/js/lib/codemirror/stringstream.js +++ /dev/null @@ -1,140 +0,0 @@ -/* String streams are the things fed to parsers (which can feed them - * to a tokenizer if they want). They provide peek and next methods - * for looking at the current character (next 'consumes' this - * character, peek does not), and a get method for retrieving all the - * text that was consumed since the last time get was called. - * - * An easy mistake to make is to let a StopIteration exception finish - * the token stream while there are still characters pending in the - * string stream (hitting the end of the buffer while parsing a - * token). To make it easier to detect such errors, the stringstreams - * throw an exception when this happens. - */ - -// Make a stringstream stream out of an iterator that returns strings. -// This is applied to the result of traverseDOM (see codemirror.js), -// and the resulting stream is fed to the parser. -window.stringStream = function(source){ - // String that's currently being iterated over. - var current = ""; - // Position in that string. - var pos = 0; - // Accumulator for strings that have been iterated over but not - // get()-ed yet. - var accum = ""; - // Make sure there are more characters ready, or throw - // StopIteration. - function ensureChars() { - while (pos == current.length) { - accum += current; - current = ""; // In case source.next() throws - pos = 0; - try {current = source.next();} - catch (e) { - if (e != StopIteration) throw e; - else return false; - } - } - return true; - } - - return { - // Return the next character in the stream. - peek: function() { - if (!ensureChars()) return null; - return current.charAt(pos); - }, - // Get the next character, throw StopIteration if at end, check - // for unused content. - next: function() { - if (!ensureChars()) { - if (accum.length > 0) - throw "End of stringstream reached without emptying buffer ('" + accum + "')."; - else - throw StopIteration; - } - return current.charAt(pos++); - }, - // Return the characters iterated over since the last call to - // .get(). - get: function() { - var temp = accum; - accum = ""; - if (pos > 0){ - temp += current.slice(0, pos); - current = current.slice(pos); - pos = 0; - } - return temp; - }, - // Push a string back into the stream. - push: function(str) { - current = current.slice(0, pos) + str + current.slice(pos); - }, - lookAhead: function(str, consume, skipSpaces, caseInsensitive) { - function cased(str) {return caseInsensitive ? str.toLowerCase() : str;} - str = cased(str); - var found = false; - - var _accum = accum, _pos = pos; - if (skipSpaces) this.nextWhileMatches(/[\s\u00a0]/); - - while (true) { - var end = pos + str.length, left = current.length - pos; - if (end <= current.length) { - found = str == cased(current.slice(pos, end)); - pos = end; - break; - } - else if (str.slice(0, left) == cased(current.slice(pos))) { - accum += current; current = ""; - try {current = source.next();} - catch (e) {break;} - pos = 0; - str = str.slice(left); - } - else { - break; - } - } - - if (!(found && consume)) { - current = accum.slice(_accum.length) + current; - pos = _pos; - accum = _accum; - } - - return found; - }, - - // Utils built on top of the above - more: function() { - return this.peek() !== null; - }, - applies: function(test) { - var next = this.peek(); - return (next !== null && test(next)); - }, - nextWhile: function(test) { - var next; - while ((next = this.peek()) !== null && test(next)) - this.next(); - }, - matches: function(re) { - var next = this.peek(); - return (next !== null && re.test(next)); - }, - nextWhileMatches: function(re) { - var next; - while ((next = this.peek()) !== null && re.test(next)) - this.next(); - }, - equals: function(ch) { - return ch === this.peek(); - }, - endOfLine: function() { - var next = this.peek(); - return next == null || next == "\n"; - } - }; -}; diff --git a/platforma/static/js/lib/codemirror/tokenize.js b/platforma/static/js/lib/codemirror/tokenize.js deleted file mode 100644 index b0c9545f..00000000 --- a/platforma/static/js/lib/codemirror/tokenize.js +++ /dev/null @@ -1,57 +0,0 @@ -// A framework for simple tokenizers. Takes care of newlines and -// white-space, and of getting the text from the source stream into -// the token object. A state is a function of two arguments -- a -// string stream and a setState function. The second can be used to -// change the tokenizer's state, and can be ignored for stateless -// tokenizers. This function should advance the stream over a token -// and return a string or object containing information about the next -// token, or null to pass and have the (new) state be called to finish -// the token. When a string is given, it is wrapped in a {style, type} -// object. In the resulting object, the characters consumed are stored -// under the content property. Any whitespace following them is also -// automatically consumed, and added to the value property. (Thus, -// content is the actual meaningful part of the token, while value -// contains all the text it spans.) - -function tokenizer(source, state) { - // Newlines are always a separate token. - function isWhiteSpace(ch) { - // The messy regexp is because IE's regexp matcher is of the - // opinion that non-breaking spaces are no whitespace. - return ch != "\n" && /^[\s\u00a0]*$/.test(ch); - } - - var tokenizer = { - state: state, - - take: function(type) { - if (typeof(type) == "string") - type = {style: type, type: type}; - - type.content = (type.content || "") + source.get(); - if (!/\n$/.test(type.content)) - source.nextWhile(isWhiteSpace); - type.value = type.content + source.get(); - return type; - }, - - next: function () { - if (!source.more()) throw StopIteration; - - var type; - if (source.equals("\n")) { - source.next(); - return this.take("whitespace"); - } - - if (source.applies(isWhiteSpace)) - type = "whitespace"; - else - while (!type) - type = this.state(source, function(s) {tokenizer.state = s;}); - - return this.take(type); - } - }; - return tokenizer; -} diff --git a/platforma/static/js/lib/codemirror/undo.js b/platforma/static/js/lib/codemirror/undo.js deleted file mode 100644 index 5f717a9e..00000000 --- a/platforma/static/js/lib/codemirror/undo.js +++ /dev/null @@ -1,403 +0,0 @@ -/** - * Storage and control for undo information within a CodeMirror - * editor. 'Why on earth is such a complicated mess required for - * that?', I hear you ask. The goal, in implementing this, was to make - * the complexity of storing and reverting undo information depend - * only on the size of the edited or restored content, not on the size - * of the whole document. This makes it necessary to use a kind of - * 'diff' system, which, when applied to a DOM tree, causes some - * complexity and hackery. - * - * In short, the editor 'touches' BR elements as it parses them, and - * the History stores these. When nothing is touched in commitDelay - * milliseconds, the changes are committed: It goes over all touched - * nodes, throws out the ones that did not change since last commit or - * are no longer in the document, and assembles the rest into zero or - * more 'chains' -- arrays of adjacent lines. Links back to these - * chains are added to the BR nodes, while the chain that previously - * spanned these nodes is added to the undo history. Undoing a change - * means taking such a chain off the undo history, restoring its - * content (text is saved per line) and linking it back into the - * document. - */ - -// A history object needs to know about the DOM container holding the -// document, the maximum amount of undo levels it should store, the -// delay (of no input) after which it commits a set of changes, and, -// unfortunately, the 'parent' window -- a window that is not in -// designMode, and on which setTimeout works in every browser. -function History(container, maxDepth, commitDelay, editor, onChange) { - this.container = container; - this.maxDepth = maxDepth; this.commitDelay = commitDelay; - this.editor = editor; this.parent = editor.parent; - this.onChange = onChange; - // This line object represents the initial, empty editor. - var initial = {text: "", from: null, to: null}; - // As the borders between lines are represented by BR elements, the - // start of the first line and the end of the last one are - // represented by null. Since you can not store any properties - // (links to line objects) in null, these properties are used in - // those cases. - this.first = initial; this.last = initial; - // Similarly, a 'historyTouched' property is added to the BR in - // front of lines that have already been touched, and 'firstTouched' - // is used for the first line. - this.firstTouched = false; - // History is the set of committed changes, touched is the set of - // nodes touched since the last commit. - this.history = []; this.redoHistory = []; this.touched = []; -} - -History.prototype = { - // Schedule a commit (if no other touches come in for commitDelay - // milliseconds). - scheduleCommit: function() { - var self = this; - this.parent.clearTimeout(this.commitTimeout); - this.commitTimeout = this.parent.setTimeout(function(){self.tryCommit();}, this.commitDelay); - }, - - // Mark a node as touched. Null is a valid argument. - touch: function(node) { - this.setTouched(node); - this.scheduleCommit(); - }, - - // Undo the last change. - undo: function() { - // Make sure pending changes have been committed. - this.commit(); - - if (this.history.length) { - // Take the top diff from the history, apply it, and store its - // shadow in the redo history. - var item = this.history.pop(); - this.redoHistory.push(this.updateTo(item, "applyChain")); - if (this.onChange) this.onChange(); - return this.chainNode(item); - } - }, - - // Redo the last undone change. - redo: function() { - this.commit(); - if (this.redoHistory.length) { - // The inverse of undo, basically. - var item = this.redoHistory.pop(); - this.addUndoLevel(this.updateTo(item, "applyChain")); - if (this.onChange) this.onChange(); - return this.chainNode(item); - } - }, - - clear: function() { - this.history = []; - this.redoHistory = []; - }, - - // Ask for the size of the un/redo histories. - historySize: function() { - return {undo: this.history.length, redo: this.redoHistory.length}; - }, - - // Push a changeset into the document. - push: function(from, to, lines) { - var chain = []; - for (var i = 0; i < lines.length; i++) { - var end = (i == lines.length - 1) ? to : this.container.ownerDocument.createElement("BR"); - chain.push({from: from, to: end, text: cleanText(lines[i])}); - from = end; - } - this.pushChains([chain], from == null && to == null); - }, - - pushChains: function(chains, doNotHighlight) { - this.commit(doNotHighlight); - this.addUndoLevel(this.updateTo(chains, "applyChain")); - this.redoHistory = []; - }, - - // Retrieve a DOM node from a chain (for scrolling to it after undo/redo). - chainNode: function(chains) { - for (var i = 0; i < chains.length; i++) { - var start = chains[i][0], node = start && (start.from || start.to); - if (node) return node; - } - }, - - // Clear the undo history, make the current document the start - // position. - reset: function() { - this.history = []; this.redoHistory = []; - }, - - textAfter: function(br) { - return this.after(br).text; - }, - - nodeAfter: function(br) { - return this.after(br).to; - }, - - nodeBefore: function(br) { - return this.before(br).from; - }, - - // Commit unless there are pending dirty nodes. - tryCommit: function() { - if (!window.History) return; // Stop when frame has been unloaded - if (this.editor.highlightDirty()) this.commit(true); - else this.scheduleCommit(); - }, - - // Check whether the touched nodes hold any changes, if so, commit - // them. - commit: function(doNotHighlight) { - this.parent.clearTimeout(this.commitTimeout); - // Make sure there are no pending dirty nodes. - if (!doNotHighlight) this.editor.highlightDirty(true); - // Build set of chains. - var chains = this.touchedChains(), self = this; - - if (chains.length) { - this.addUndoLevel(this.updateTo(chains, "linkChain")); - this.redoHistory = []; - if (this.onChange) this.onChange(); - } - }, - - // [ end of public interface ] - - // Update the document with a given set of chains, return its - // shadow. updateFunc should be "applyChain" or "linkChain". In the - // second case, the chains are taken to correspond the the current - // document, and only the state of the line data is updated. In the - // first case, the content of the chains is also pushed iinto the - // document. - updateTo: function(chains, updateFunc) { - var shadows = [], dirty = []; - for (var i = 0; i < chains.length; i++) { - shadows.push(this.shadowChain(chains[i])); - dirty.push(this[updateFunc](chains[i])); - } - if (updateFunc == "applyChain") - this.notifyDirty(dirty); - return shadows; - }, - - // Notify the editor that some nodes have changed. - notifyDirty: function(nodes) { - forEach(nodes, method(this.editor, "addDirtyNode")) - this.editor.scheduleHighlight(); - }, - - // Link a chain into the DOM nodes (or the first/last links for null - // nodes). - linkChain: function(chain) { - for (var i = 0; i < chain.length; i++) { - var line = chain[i]; - if (line.from) line.from.historyAfter = line; - else this.first = line; - if (line.to) line.to.historyBefore = line; - else this.last = line; - } - }, - - // Get the line object after/before a given node. - after: function(node) { - return node ? node.historyAfter : this.first; - }, - before: function(node) { - return node ? node.historyBefore : this.last; - }, - - // Mark a node as touched if it has not already been marked. - setTouched: function(node) { - if (node) { - if (!node.historyTouched) { - this.touched.push(node); - node.historyTouched = true; - } - } - else { - this.firstTouched = true; - } - }, - - // Store a new set of undo info, throw away info if there is more of - // it than allowed. - addUndoLevel: function(diffs) { - this.history.push(diffs); - if (this.history.length > this.maxDepth) - this.history.shift(); - }, - - // Build chains from a set of touched nodes. - touchedChains: function() { - var self = this; - - // The temp system is a crummy hack to speed up determining - // whether a (currently touched) node has a line object associated - // with it. nullTemp is used to store the object for the first - // line, other nodes get it stored in their historyTemp property. - var nullTemp = null; - function temp(node) {return node ? node.historyTemp : nullTemp;} - function setTemp(node, line) { - if (node) node.historyTemp = line; - else nullTemp = line; - } - - function buildLine(node) { - var text = []; - for (var cur = node ? node.nextSibling : self.container.firstChild; - cur && cur.nodeName != "BR"; cur = cur.nextSibling) - if (cur.currentText) text.push(cur.currentText); - return {from: node, to: cur, text: cleanText(text.join(""))}; - } - - // Filter out unchanged lines and nodes that are no longer in the - // document. Build up line objects for remaining nodes. - var lines = []; - if (self.firstTouched) self.touched.push(null); - forEach(self.touched, function(node) { - if (node && node.parentNode != self.container) return; - - if (node) node.historyTouched = false; - else self.firstTouched = false; - - var line = buildLine(node), shadow = self.after(node); - if (!shadow || shadow.text != line.text || shadow.to != line.to) { - lines.push(line); - setTemp(node, line); - } - }); - - // Get the BR element after/before the given node. - function nextBR(node, dir) { - var link = dir + "Sibling", search = node[link]; - while (search && search.nodeName != "BR") - search = search[link]; - return search; - } - - // Assemble line objects into chains by scanning the DOM tree - // around them. - var chains = []; self.touched = []; - forEach(lines, function(line) { - // Note that this makes the loop skip line objects that have - // been pulled into chains by lines before them. - if (!temp(line.from)) return; - - var chain = [], curNode = line.from, safe = true; - // Put any line objects (referred to by temp info) before this - // one on the front of the array. - while (true) { - var curLine = temp(curNode); - if (!curLine) { - if (safe) break; - else curLine = buildLine(curNode); - } - chain.unshift(curLine); - setTemp(curNode, null); - if (!curNode) break; - safe = self.after(curNode); - curNode = nextBR(curNode, "previous"); - } - curNode = line.to; safe = self.before(line.from); - // Add lines after this one at end of array. - while (true) { - if (!curNode) break; - var curLine = temp(curNode); - if (!curLine) { - if (safe) break; - else curLine = buildLine(curNode); - } - chain.push(curLine); - setTemp(curNode, null); - safe = self.before(curNode); - curNode = nextBR(curNode, "next"); - } - chains.push(chain); - }); - - return chains; - }, - - // Find the 'shadow' of a given chain by following the links in the - // DOM nodes at its start and end. - shadowChain: function(chain) { - var shadows = [], next = this.after(chain[0].from), end = chain[chain.length - 1].to; - while (true) { - shadows.push(next); - var nextNode = next.to; - if (!nextNode || nextNode == end) - break; - else - next = nextNode.historyAfter || this.before(end); - // (The this.before(end) is a hack -- FF sometimes removes - // properties from BR nodes, in which case the best we can hope - // for is to not break.) - } - return shadows; - }, - - // Update the DOM tree to contain the lines specified in a given - // chain, link this chain into the DOM nodes. - applyChain: function(chain) { - // Some attempt is made to prevent the cursor from jumping - // randomly when an undo or redo happens. It still behaves a bit - // strange sometimes. - var cursor = select.cursorPos(this.container, false), self = this; - - // Remove all nodes in the DOM tree between from and to (null for - // start/end of container). - function removeRange(from, to) { - var pos = from ? from.nextSibling : self.container.firstChild; - while (pos != to) { - var temp = pos.nextSibling; - removeElement(pos); - pos = temp; - } - } - - var start = chain[0].from, end = chain[chain.length - 1].to; - // Clear the space where this change has to be made. - removeRange(start, end); - - // Insert the content specified by the chain into the DOM tree. - for (var i = 0; i < chain.length; i++) { - var line = chain[i]; - // The start and end of the space are already correct, but BR - // tags inside it have to be put back. - if (i > 0) - self.container.insertBefore(line.from, end); - - // Add the text. - var node = makePartSpan(fixSpaces(line.text), this.container.ownerDocument); - self.container.insertBefore(node, end); - // See if the cursor was on this line. Put it back, adjusting - // for changed line length, if it was. - if (cursor && cursor.node == line.from) { - var cursordiff = 0; - var prev = this.after(line.from); - if (prev && i == chain.length - 1) { - // Only adjust if the cursor is after the unchanged part of - // the line. - for (var match = 0; match < cursor.offset && - line.text.charAt(match) == prev.text.charAt(match); match++); - if (cursor.offset > match) - cursordiff = line.text.length - prev.text.length; - } - select.setCursorPos(this.container, {node: line.from, offset: Math.max(0, cursor.offset + cursordiff)}); - } - // Cursor was in removed line, this is last new line. - else if (cursor && (i == chain.length - 1) && cursor.node && cursor.node.parentNode != this.container) { - select.setCursorPos(this.container, {node: line.from, offset: line.text.length}); - } - } - - // Anchor the chain in the DOM tree. - this.linkChain(chain); - return start; - } -}; diff --git a/platforma/static/js/lib/codemirror/util.js b/platforma/static/js/lib/codemirror/util.js deleted file mode 100644 index 796025ee..00000000 --- a/platforma/static/js/lib/codemirror/util.js +++ /dev/null @@ -1,125 +0,0 @@ -/* A few useful utility functions. */ - -var internetExplorer = document.selection && window.ActiveXObject && /MSIE/.test(navigator.userAgent); -var webkit = /AppleWebKit/.test(navigator.userAgent); -var safari = /Apple Computers, Inc/.test(navigator.vendor); - -// Capture a method on an object. -function method(obj, name) { - return function() {obj[name].apply(obj, arguments);}; -} - -// The value used to signal the end of a sequence in iterators. -var StopIteration = {toString: function() {return "StopIteration"}}; - -// Apply a function to each element in a sequence. -function forEach(iter, f) { - if (iter.next) { - try {while (true) f(iter.next());} - catch (e) {if (e != StopIteration) throw e;} - } - else { - for (var i = 0; i < iter.length; i++) - f(iter[i]); - } -} - -// Map a function over a sequence, producing an array of results. -function map(iter, f) { - var accum = []; - forEach(iter, function(val) {accum.push(f(val));}); - return accum; -} - -// Create a predicate function that tests a string againsts a given -// regular expression. No longer used but might be used by 3rd party -// parsers. -function matcher(regexp){ - return function(value){return regexp.test(value);}; -} - -// Test whether a DOM node has a certain CSS class. Much faster than -// the MochiKit equivalent, for some reason. -function hasClass(element, className){ - var classes = element.className; - return classes && new RegExp("(^| )" + className + "($| )").test(classes); -} - -// Insert a DOM node after another node. -function insertAfter(newNode, oldNode) { - var parent = oldNode.parentNode; - parent.insertBefore(newNode, oldNode.nextSibling); - return newNode; -} - -function removeElement(node) { - if (node.parentNode) - node.parentNode.removeChild(node); -} - -function clearElement(node) { - while (node.firstChild) - node.removeChild(node.firstChild); -} - -// Check whether a node is contained in another one. -function isAncestor(node, child) { - while (child = child.parentNode) { - if (node == child) - return true; - } - return false; -} - -// The non-breaking space character. -var nbsp = "\u00a0"; -var matching = {"{": "}", "[": "]", "(": ")", - "}": "{", "]": "[", ")": "("}; - -// Standardize a few unportable event properties. -function normalizeEvent(event) { - if (!event.stopPropagation) { - event.stopPropagation = function() {this.cancelBubble = true;}; - event.preventDefault = function() {this.returnValue = false;}; - } - if (!event.stop) { - event.stop = function() { - this.stopPropagation(); - this.preventDefault(); - }; - } - - if (event.type == "keypress") { - event.code = (event.charCode == null) ? event.keyCode : event.charCode; - event.character = String.fromCharCode(event.code); - } - return event; -} - -// Portably register event handlers. -function addEventHandler(node, type, handler, removeFunc) { - function wrapHandler(event) { - handler(normalizeEvent(event || window.event)); - } - if (typeof node.addEventListener == "function") { - node.addEventListener(type, wrapHandler, false); - if (removeFunc) return function() {node.removeEventListener(type, wrapHandler, false);}; - } - else { - node.attachEvent("on" + type, wrapHandler); - if (removeFunc) return function() {node.detachEvent("on" + type, wrapHandler);}; - } -} - -function nodeText(node) { - return node.textContent || node.innerText || node.nodeValue || ""; -} - -function nodeTop(node) { - var top = 0; - while (node.offsetParent) { - top += node.offsetTop; - node = node.offsetParent; - } - return top; -} diff --git a/platforma/static/js/slugify.js b/platforma/static/js/slugify.js deleted file mode 100644 index 9e17ba70..00000000 --- a/platforma/static/js/slugify.js +++ /dev/null @@ -1,126 +0,0 @@ -(function() { - var ALL_DOWNCODE_MAPS = new Array() - - ALL_DOWNCODE_MAPS[0] = { - // LATIN_MAP - 'À': 'A', 'Á': 'A', 'Â': 'A', 'Ã': 'A', 'Ä': 'A', 'Å': 'A', 'Æ': 'AE', 'Ç': - 'C', 'È': 'E', 'É': 'E', 'Ê': 'E', 'Ë': 'E', 'Ì': 'I', 'Í': 'I', 'Î': 'I', - 'Ï': 'I', 'Ð': 'D', 'Ñ': 'N', 'Ò': 'O', 'Ó': 'O', 'Ô': 'O', 'Õ': 'O', 'Ö': - 'O', 'Ő': 'O', 'Ø': 'O', 'Ù': 'U', 'Ú': 'U', 'Û': 'U', 'Ü': 'U', 'Ű': 'U', - 'Ý': 'Y', 'Þ': 'TH', 'ß': 'ss', 'à':'a', 'á':'a', 'â': 'a', 'ã': 'a', 'ä': - 'a', 'å': 'a', 'æ': 'ae', 'ç': 'c', 'è': 'e', 'é': 'e', 'ê': 'e', 'ë': 'e', - 'ì': 'i', 'í': 'i', 'î': 'i', 'ï': 'i', 'ð': 'd', 'ñ': 'n', 'ò': 'o', 'ó': - 'o', 'ô': 'o', 'õ': 'o', 'ö': 'o', 'ő': 'o', 'ø': 'o', 'ù': 'u', 'ú': 'u', - 'û': 'u', 'ü': 'u', 'ű': 'u', 'ý': 'y', 'þ': 'th', 'ÿ': 'y' - } - ALL_DOWNCODE_MAPS[1] = { - // LATIN_SYMBOLS_MAP - '©':'(c)' - } - ALL_DOWNCODE_MAPS[2] = { - // GREEK_MAP - 'α':'a', 'β':'b', 'γ':'g', 'δ':'d', 'ε':'e', 'ζ':'z', 'η':'h', 'θ':'8', - 'ι':'i', 'κ':'k', 'λ':'l', 'μ':'m', 'ν':'n', 'ξ':'3', 'ο':'o', 'π':'p', - 'ρ':'r', 'σ':'s', 'τ':'t', 'υ':'y', 'φ':'f', 'χ':'x', 'ψ':'ps', 'ω':'w', - 'ά':'a', 'έ':'e', 'ί':'i', 'ό':'o', 'ύ':'y', 'ή':'h', 'ώ':'w', 'ς':'s', - 'ϊ':'i', 'ΰ':'y', 'ϋ':'y', 'ΐ':'i', - 'Α':'A', 'Β':'B', 'Γ':'G', 'Δ':'D', 'Ε':'E', 'Ζ':'Z', 'Η':'H', 'Θ':'8', - 'Ι':'I', 'Κ':'K', 'Λ':'L', 'Μ':'M', 'Ν':'N', 'Ξ':'3', 'Ο':'O', 'Π':'P', - 'Ρ':'R', 'Σ':'S', 'Τ':'T', 'Υ':'Y', 'Φ':'F', 'Χ':'X', 'Ψ':'PS', 'Ω':'W', - 'Ά':'A', 'Έ':'E', 'Ί':'I', 'Ό':'O', 'Ύ':'Y', 'Ή':'H', 'Ώ':'W', 'Ϊ':'I', - 'Ϋ':'Y' - } - ALL_DOWNCODE_MAPS[3] = { - // TURKISH_MAP - 'ş':'s', 'Ş':'S', 'ı':'i', 'İ':'I', 'ç':'c', 'Ç':'C', 'ü':'u', 'Ü':'U', - 'ö':'o', 'Ö':'O', 'ğ':'g', 'Ğ':'G' - } - ALL_DOWNCODE_MAPS[4] = { - // RUSSIAN_MAP - 'а':'a', 'б':'b', 'в':'v', 'г':'g', 'д':'d', 'е':'e', 'ё':'yo', 'ж':'zh', - 'з':'z', 'и':'i', 'й':'j', 'к':'k', 'л':'l', 'м':'m', 'н':'n', 'о':'o', - 'п':'p', 'р':'r', 'с':'s', 'т':'t', 'у':'u', 'ф':'f', 'х':'h', 'ц':'c', - 'ч':'ch', 'ш':'sh', 'щ':'sh', 'ъ':'', 'ы':'y', 'ь':'', 'э':'e', 'ю':'yu', - 'я':'ya', - 'А':'A', 'Б':'B', 'В':'V', 'Г':'G', 'Д':'D', 'Е':'E', 'Ё':'Yo', 'Ж':'Zh', - 'З':'Z', 'И':'I', 'Й':'J', 'К':'K', 'Л':'L', 'М':'M', 'Н':'N', 'О':'O', - 'П':'P', 'Р':'R', 'С':'S', 'Т':'T', 'У':'U', 'Ф':'F', 'Х':'H', 'Ц':'C', - 'Ч':'Ch', 'Ш':'Sh', 'Щ':'Sh', 'Ъ':'', 'Ы':'Y', 'Ь':'', 'Э':'E', 'Ю':'Yu', - 'Я':'Ya' - } - ALL_DOWNCODE_MAPS[5] = { - // UKRAINIAN_MAP - 'Є':'Ye', 'І':'I', 'Ї':'Yi', 'Ґ':'G', 'є':'ye', 'і':'i', 'ї':'yi', 'ґ':'g' - } - ALL_DOWNCODE_MAPS[6] = { - // CZECH_MAP - 'č':'c', 'ď':'d', 'ě':'e', 'ň': 'n', 'ř':'r', 'š':'s', 'ť':'t', 'ů':'u', - 'ž':'z', 'Č':'C', 'Ď':'D', 'Ě':'E', 'Ň': 'N', 'Ř':'R', 'Š':'S', 'Ť':'T', - 'Ů':'U', 'Ž':'Z' - } - - ALL_DOWNCODE_MAPS[7] = { - // POLISH_MAP - 'ą':'a', 'ć':'c', 'ę':'e', 'ł':'l', 'ń':'n', 'ó':'o', 'ś':'s', 'ź':'z', - 'ż':'z', 'Ą':'A', 'Ć':'C', 'Ę':'e', 'Ł':'L', 'Ń':'N', 'Ó':'o', 'Ś':'S', - 'Ź':'Z', 'Ż':'Z' - } - - ALL_DOWNCODE_MAPS[8] = { - // LATVIAN_MAP - 'ā':'a', 'č':'c', 'ē':'e', 'ģ':'g', 'ī':'i', 'ķ':'k', 'ļ':'l', 'ņ':'n', - 'š':'s', 'ū':'u', 'ž':'z', 'Ā':'A', 'Č':'C', 'Ē':'E', 'Ģ':'G', 'Ī':'i', - 'Ķ':'k', 'Ļ':'L', 'Ņ':'N', 'Š':'S', 'Ū':'u', 'Ž':'Z' - } - - var Downcoder = new Object(); - - Downcoder.Initialize = function() { - if (Downcoder.map) // already made - return ; - Downcoder.map ={} - Downcoder.chars = ''; - for(var i in ALL_DOWNCODE_MAPS) { - var lookup = ALL_DOWNCODE_MAPS[i] - for (var c in lookup) { - Downcoder.map[c] = lookup[c]; - Downcoder.chars += c; - } - } - Downcoder.regex = new RegExp('[' + Downcoder.chars + ']|[^' + Downcoder.chars + ']+','g'); - } - - downcode = function(slug) { - Downcoder.Initialize(); - var downcoded ="" - var pieces = slug.match(Downcoder.regex); - if(pieces) { - for (var i = 0 ; i < pieces.length ; i++) { - if (pieces[i].length == 1) { - var mapped = Downcoder.map[pieces[i]]; - if (mapped != null) { - downcoded+=mapped; - continue; - } - } - downcoded+=pieces[i]; - } - } else { - downcoded = slug; - } - return downcoded; - } - - slugify = function(s) { - s = downcode(s); - // if downcode doesn't hit, the char will be stripped here - s = s.replace(/[^-\w\s]/g, ''); // remove unneeded chars - s = s.replace(/^\s+|\s+$/g, ''); // trim leading/trailing spaces - s = s.replace(/[-\s]+/g, '-'); // convert spaces to hyphens - s = s.toLowerCase(); // convert to lowercase - - return s; - } -})(); - - diff --git a/platforma/static/js/wiki/base.js b/platforma/static/js/wiki/base.js deleted file mode 100644 index 523ad96e..00000000 --- a/platforma/static/js/wiki/base.js +++ /dev/null @@ -1,338 +0,0 @@ -(function($) -{ - var noop = function() { }; - - $.wiki = { - perspectives: {}, - cls: {}, - state: { - "version": 1, - "perspectives": { - "ScanGalleryPerspective": { - "show": true, - "page": 1 - }, - "CodeMirrorPerspective": {} - /* - "VisualPerspective": {}, - "HistoryPerspective": {}, - "SummaryPerspective": {} - */ - } - } - }; - - $.wiki.loadConfig = function() { - if(!window.localStorage) - return; - - try { - var value = window.localStorage.getItem(CurrentDocument.id) || "{}"; - var config = JSON.parse(value); - - if (config.version == $.wiki.state.version) { - $.wiki.state.perspectives = $.extend($.wiki.state.perspectives, config.perspectives); - } - } catch(e) { - console.log("Failed to load config, using default."); - } - - console.log("Loaded:", $.wiki.state, $.wiki.state.version); - }; - - $(window).bind('unload', function() { - if(window.localStorage) - window.localStorage.setItem(CurrentDocument.id, JSON.stringify($.wiki.state)); - }) - - - $.wiki.activePerspective = function() { - return this.perspectives[$("#tabs li.active").attr('id')]; - }; - - $.wiki.exitContext = function() { - var ap = this.activePerspective(); - if(ap) ap.onExit(); - return ap; - }; - - $.wiki.enterContext = function(ap) { - if(ap) ap.onEnter(); - }; - - $.wiki.isDirty = function() { - var ap = this.activePerspective(); - return (!!CurrentDocument && CurrentDocument.has_local_changes) || ap.dirty(); - }; - - $.wiki.newTab = function(doc, title, klass) { - var base_id = 'id' + Math.floor(Math.random()* 5000000000); - var id = (''+klass)+'_' + base_id; - var $tab = $('
  • ' - + title + '
  • '); - var $view = $('
    '); - - this.perspectives[id] = new $.wiki[klass]({ - doc: doc, - id: id, - base_id: base_id, - }); - - $('#tabs').append($tab); - $view.hide().appendTo('#editor'); - return { - tab: $tab[0], - view: $view[0], - }; - }; - - $.wiki.initTab = function(options) { - var klass = $(options.tab).attr('data-ui-jsclass'); - - return new $.wiki[klass]({ - doc: options.doc, - id: $(options.tab).attr('id'), - callback: function() { - $.wiki.perspectives[this.perspective_id] = this; - if(options.callback) - options.callback.call(this); - } - }); - }; - - $.wiki.perspectiveForTab = function(tab) { // element or id - return this.perspectives[ $(tab).attr('id')]; - } - - $.wiki.switchToTab = function(tab){ - var self = this; - var $tab = $(tab); - - if($tab.length != 1) - $tab = $(DEFAULT_PERSPECTIVE); - - var $old = $('#tabs li').filter('.active'); - - $old.each(function(){ - $(this).removeClass('active'); - self.perspectives[$(this).attr('id')].onExit(); - $('#' + $(this).attr('data-ui-related')).hide(); - }); - - /* show new */ - $tab.addClass('active'); - $('#' + $tab.attr('data-ui-related')).show(); - - console.log($tab); - console.log($.wiki.perspectives); - - $.wiki.perspectives[$tab.attr('id')].onEnter(); - }; - - /* - * Basic perspective. - */ - $.wiki.Perspective = function(options) { - if(!options) return; - - this.doc = options.doc; - if (options.id) { - this.perspective_id = options.id; - } - else { - this.perspective_id = ''; - } - - if(options.callback) - options.callback.call(this); - }; - - $.wiki.Perspective.prototype.config = function() { - return $.wiki.state.perspectives[this.perspective_id]; - } - - $.wiki.Perspective.prototype.toString = function() { - return this.perspective_id; - }; - - $.wiki.Perspective.prototype.dirty = function() { - return true; - }; - - $.wiki.Perspective.prototype.onEnter = function () { - // called when perspective in initialized - if (!this.noupdate_hash_onenter) { - document.location.hash = '#' + this.perspective_id; - } - }; - - $.wiki.Perspective.prototype.onExit = function () { - // called when user switches to another perspective - if (!this.noupdate_hash_onenter) { - document.location.hash = ''; - } - }; - - $.wiki.Perspective.prototype.destroy = function() { - // pass - }; - - $.wiki.Perspective.prototype.freezeState = function () { - // free UI state (don't store data here) - }; - - $.wiki.Perspective.prototype.unfreezeState = function (frozenState) { - // restore UI state - }; - - /* - * Stub rendering (used in generating history) - */ - $.wiki.renderStub = function(params) - { - params = $.extend({ 'filters': {} }, params); - var $elem = params.stub.clone(); - $elem.removeClass('row-stub'); - params.container.append($elem); - - $('*[data-stub-value]', $elem).each(function() { - var $this = $(this); - var field = $this.attr('data-stub-value'); - - var value = params.data[field]; - - if(params.filters[field]) - value = params.filters[field](value); - - if(value === null || value === undefined) return; - - if(!$this.attr('data-stub-target')) { - $this.text(value); - } - else { - $this.attr($this.attr('data-stub-target'), value); - $this.removeAttr('data-stub-target'); - $this.removeAttr('data-stub-value'); - } - }); - - $elem.show(); - return $elem; - }; - - /* - * Dialogs - */ - function GenericDialog(element) { - if(!element) return; - - var self = this; - - self.$elem = $(element); - - if(!self.$elem.attr('data-ui-initialized')) { - console.log("Initializing dialog", this); - self.initialize(); - self.$elem.attr('data-ui-initialized', true); - } - - self.show(); - }; - - GenericDialog.prototype = { - - /* - * Steps to follow when the dialog in first loaded on page. - */ - initialize: function(){ - var self = this; - - /* bind buttons */ - $('button[data-ui-action]', self.$elem).click(function(event) { - event.preventDefault(); - - var action = $(this).attr('data-ui-action'); - console.log("Button pressed, action: ", action); - - try { - self[action + "Action"].call(self); - } catch(e) { - console.log("Action failed:", e); - // always hide on cancel - if(action == 'cancel') - self.hide(); - } - }); - }, - - /* - * Prepare dialog for user. Clear any unnessary data. - */ - show: function() { - $.blockUI({ - message: this.$elem, - css: { - 'top': '25%', - 'left': '25%', - 'width': '50%' - } - }); - }, - - hide: function(){ - $.unblockUI(); - }, - - cancelAction: function() { - this.hide(); - }, - - doneAction: function() { - this.hide(); - }, - - clearForm: function() { - $("*[data-ui-error-for]", this.$elem).text(''); - }, - - reportErrors: function(errors) { - var global = $("*[data-ui-error-for='__all__']", this.$elem); - var unassigned = []; - - for (var field_name in errors) - { - var span = $("*[data-ui-error-for='"+field_name+"']", this.$elem); - - if(!span.length) { - unassigned.push(field_name); - continue; - } - - span.text(errors[field_name].join(' ')); - } - - if(unassigned.length > 0) - global.text( global.text() + 'W formularzu wystąpiły błędy'); - } - }; - - $.wiki.cls.GenericDialog = GenericDialog; - - $.wiki.showDialog = function(selector, options) { - var elem = $(selector); - - if(elem.length != 1) { - console.log("Failed to show dialog:", selector, elem); - return false; - } - - try { - var klass = elem.attr('data-ui-jsclass'); - return new $.wiki.cls[klass](elem, options); - } catch(e) { - console.log("Failed to show dialog", selector, klass, e); - return false; - } - }; - -})(jQuery); diff --git a/platforma/static/js/wiki/dialog_addtag.js b/platforma/static/js/wiki/dialog_addtag.js deleted file mode 100644 index 1a90ccf6..00000000 --- a/platforma/static/js/wiki/dialog_addtag.js +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Dialog for saving document to the server - * - */ -(function($){ - - function AddTagDialog(element, options){ - if (!options.revision && options.revision != 0) - throw "AddTagDialog needs a revision number."; - - this.ctx = $.wiki.exitContext(); - this.clearForm(); - - /* fill out hidden fields */ - this.$form = $('form', element); - - $("input[name='addtag-id']", this.$form).val(CurrentDocument.id); - $("input[name='addtag-revision']", this.$form).val(options.revision); - - $.wiki.cls.GenericDialog.call(this, element); - }; - - AddTagDialog.prototype = $.extend(new $.wiki.cls.GenericDialog(), { - cancelAction: function(){ - $.wiki.enterContext(this.ctx); - this.hide(); - }, - - saveAction: function(){ - var self = this; - - self.$elem.block({ - message: "Dodawanie tagu", - fadeIn: 0, - }); - - CurrentDocument.setTag({ - form: self.$form, - success: function(doc, changed, info){ - self.$elem.block({ - message: info, - timeout: 2000, - fadeOut: 0, - onUnblock: function(){ - self.hide(); - $.wiki.enterContext(self.ctx); - } - }); - }, - failure: function(doc, info){ - console.log("Failure", info); - self.reportErrors(info); - self.$elem.unblock(); - } - }); - } - }); - - /* make it global */ - $.wiki.cls.AddTagDialog = AddTagDialog; -})(jQuery); diff --git a/platforma/static/js/wiki/dialog_save.js b/platforma/static/js/wiki/dialog_save.js deleted file mode 100644 index 916f3260..00000000 --- a/platforma/static/js/wiki/dialog_save.js +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Dialog for saving document to the server - * - */ -(function($) { - - function SaveDialog(element) { - this.ctx = $.wiki.exitContext(); - this.clearForm(); - - /* fill out hidden fields */ - this.$form = $('form', element); - - $("input[name='textsave-id']", this.$form).val(CurrentDocument.id); - $("input[name='textsave-parent_revision']", this.$form).val(CurrentDocument.revision); - - $.wiki.cls.GenericDialog.call(this, element); - }; - - SaveDialog.prototype = new $.wiki.cls.GenericDialog(); - - SaveDialog.prototype.cancelAction = function() { - $.wiki.enterContext(this.ctx); - this.hide(); - }; - - SaveDialog.prototype.saveAction = function() { - var self = this; - - self.$elem.block({ - message: "Zapisywanie...", - fadeIn: 0, - }); - - try { - - CurrentDocument.save({ - form: self.$form, - success: function(doc, changed, info){ - self.$elem.block({ - message: info, - timeout: 2000, - fadeOut: 0, - onUnblock: function() { - self.hide(); - $.wiki.enterContext(self.ctx); - } - }); - }, - failure: function(doc, info) { - console.log("Failure", info); - self.reportErrors(info); - self.$elem.unblock(); - } - }); - } catch(e) { - console.log('Exception:', e) - self.$elem.unblock(); - } - }; /* end of save dialog */ - - /* make it global */ - $.wiki.cls.SaveDialog = SaveDialog; -})(jQuery); diff --git a/platforma/static/js/wiki/loader.js b/platforma/static/js/wiki/loader.js deleted file mode 100644 index a4414027..00000000 --- a/platforma/static/js/wiki/loader.js +++ /dev/null @@ -1,146 +0,0 @@ -if (!window.console) { - window.console = { - log: function(){ - } - } -} - -var DEFAULT_PERSPECTIVE = "#SummaryPerspective"; - -THEMES = [ - 'Alkohol', 'Ambicja', 'Anioł', 'Antysemityzm', 'Arkadia', 'Artysta', 'Bezdomność', 'Bezpieczeństwo', 'Bieda', 'Bijatyka', 'Błazen', 'Błądzenie', 'Błoto', 'Bogactwo', 'Bóg', 'Brat', 'Bunt', 'Buntownik', 'Burza', 'Car', 'Carpe diem', 'Ciemność', 'Cień', 'Cisza', 'Chciwość', 'Chleb', 'Chłop', 'Choroba', 'Chrystus', 'Chrzest', 'Ciało', 'Cierpienie', 'Cmentarz', 'Cnota', 'Córka', 'Cud', 'Czarownika', 'Czary', 'Czas', 'Czyn', 'Czyściec', 'Dama', 'Danse macabre', 'Deszcz', 'Diabeł', 'Dobro', 'Dom', 'Dorosłość', 'Drzewo', 'Duch', 'Dusza', 'Duma', 'Dworek', 'Dworzanin', 'Dwór', 'Dzieciństwo', 'Dziecko', 'Dziedzictwo', 'Dziewictwo', 'Dźwięk', 'Egzorcyzm', 'Elita', 'Emigrant', 'Fałsz', 'Filozof', 'Fircyk', 'Flirt', 'Głupiec', 'Głupota', 'Głód', 'Gospodarz', 'Gospodyni', 'Gość', 'Gotycyzm', 'Góra', 'Gra', 'Grób', 'Grzech', 'Grzeczność', 'Gwiazda', 'Handel', 'Hańba', 'Historia', 'Honor', 'Idealista', 'Imię', 'Interes', 'Jabłka', 'Jedzenie', 'Jesień', 'Kaleka', 'Kara', 'Karczma', 'Klęska', 'Kłamstwo', 'Kłótnia', 'Kobieta', 'Kobieta demoniczna', 'Kobieta "upadła"', 'Kochanek', 'Kochanek romantyczny', 'Kolonializm', 'Kondycja ludzka', 'Konflikt', 'Konflikt wewnętrzny', 'Koniec świata', 'Koń', 'Korzyść', 'Kot', 'Kradzież', 'Krew', 'Król', 'Krzywda', 'Ksiądz', 'Książka', 'Księżyc', 'Kuchnia', 'Kuszenie', 'Kwiaty', 'Labirynt', 'Las', 'Lato', 'Lekarz', 'Lenistwo', 'List', 'Liberat', 'Los', 'Lud', 'Lustro', 'Łzy', 'Małżeństwo', 'Marzenie', 'Maska', 'Maszyna', 'Matka', 'Matka Boska', 'Mądrość', 'Mąż', 'Melancholia', 'Mędrzec', 'Mężczyzna', 'Miasto', 'Mieszczanin', 'Miłosierdzie', 'Miłość', 'Miłość niespełniona', 'Miłość platoniczna', 'Miłość romantyczna', 'Miłość silniejsza niż śmierć', 'Miłość spełniona', 'Miłość tragiczna', 'Mizoginia', 'Młodość', 'Moda', 'Modlitwa', 'Morderstwo', 'Morze', 'Motyl', 'Mucha', 'Muzyka', 'Narodziny', 'Naród', 'Natura', 'Nauczyciel', 'Nauczycielka', 'Nauka', 'Niebezpieczeństwo', 'Niedziela', 'Niemiec', 'Nienawiść', 'Nieśmiertelność', 'Niewola', 'Noc', 'Nuda', 'Obcy', 'Obłok', 'Obowiązek', 'Obraz świata', 'Obrzędy', 'Obyczaje', 'Obywatel', 'Odrodzenie przez grób', 'Odwaga', 'Ofiara', 'Ogień', 'Ogród', 'Ojciec', 'Ojczyzna', 'Oko', 'Okręt', 'Okrucieństwo', 'Omen', 'Opieka', 'Organizm', 'Otchłań', 'Pająk', 'Pamięć', 'Pan', 'Panna młoda', 'Państwo', 'Patriota', 'Piekło', 'Pielgrzym', 'Pieniądz', 'Pies', 'Piętno', 'Pijaństwo', 'Piwnica', 'Plotka', 'Pobożność', 'Pocałunek', 'Pochlebstwo', 'Poeta', 'Poetka', 'Poezja', 'Podróż', 'Podstęp', 'Pogrzeb', 'Pojedynek', 'Pokora', 'Pokusa', 'Polak', 'Polityka', 'Polowanie', 'Polska', 'Portret', 'Porwanie', 'Poświęcenie', 'Potwór', 'Powstanie', 'Powstaniec', 'Pozory', 'Pozycja społeczna', 'Pożar', 'Pożądanie', 'Praca', 'Praca u podstaw', 'Praca organiczna', 'Prawda', 'Prawnik', 'Prometeusz', 'Proroctwo', 'Prorok', 'Próżność', 'Przebranie', 'Przeczucie', 'Przedmurze chrześcijaństwa', 'Przekleństwo', 'Przekupstwo', 'Przemiana', 'Przemijanie', 'Przemoc', 'Przestrzeń', 'Przyjaźń', 'Przyroda nieożywiona', 'Przysięga', 'Przywódca', 'Ptak', 'Pustynia', 'Pycha', 'Raj', 'Realista', 'Religia', 'Rewolucja', 'Robak', 'Robotnik', 'Rodzina', 'Rosja', 'Rosjanin', 'Rośliny', 'Rozczarowanie', 'Rozpacz', 'Rozstanie', 'Rozum', 'Ruiny', 'Rycerz', 'Rzeka', 'Salon', 'Samobójstwo', 'Samolubstwo', 'Samotnik', 'Samotność', 'Sarmata', 'Sąsiad', 'Sąd', 'Sąd Ostateczny', 'Sen', 'Serce', 'Sędzia', 'Sielanka', 'Sierota', 'Siła', 'Siostra', 'Sława', 'Słońce', 'Słowo', 'Sługa', 'Służalczość', 'Skąpiec', 'Sobowtór', 'Społecznik', 'Spowiedź', 'Sprawiedliwość', 'Starość', 'Strach', 'Strój', 'Stworzenie', 'Sumienie', 'Swaty', 'Syberia', 'Syn', 'Syn marnotrawny', 'Syzyf', 'Szaleniec', 'Szaleństwo', 'Szantaż', 'Szatan', 'Szczęście', 'Szkoła', 'Szlachcic', 'Szpieg', 'Sztuka', 'Ślub', 'Śmiech', 'Śmierć', 'Śmierć bohaterska', 'Śpiew', 'Światło', 'Świętoszek', 'Święty', 'Świt', 'Tajemnica', 'Taniec', 'Tchórzostwo', 'Teatr', 'Testament', 'Tęsknota', 'Theatrum mundi', 'Tłum', 'Trucizna', 'Trup', 'Twórczość', 'Uczeń', 'Uczta', 'Uroda', 'Umiarkowanie', 'Upadek', 'Upiór', 'Urzędnik', 'Vanitas', 'Walka', 'Walka klas', 'Wampir', 'Warszawa', 'Wąż', 'Wdowa', 'Wdowiec', 'Wesele', 'Wiatr', 'Wierność', 'Wierzenia', 'Wieś', 'Wiedza', 'Wieża Babel', 'Więzienie', 'Więzień', 'Wina', 'Wino', 'Wiosna', 'Wizja', 'Władza', 'Własność', 'Woda', 'Wojna', 'Wojna pokoleń', 'Wolność', 'Wróg', 'Wspomnienia', 'Współpraca', 'Wygnanie', 'Wyrzuty sumienia', 'Wyspa', 'Wzrok', 'Zabawa', 'Zabobony', 'Zamek', 'Zaręczyny', 'Zaświaty', 'Zazdrość', 'Zbawienie', 'Zbrodnia', 'Zbrodniarz', 'Zdrada', 'Zdrowie', 'Zemsta', 'Zesłaniec', 'Ziarno', 'Ziemia', 'Zima', 'Zło', 'Złodziej', 'Złoty wiek', 'Zmartwychwstanie', 'Zwątpienie', 'Zwierzęta', 'Zwycięstwo', 'Żałoba', 'Żebrak', 'Żołnierz', 'Żona', 'Życie jako wędrówka', 'Życie snem', 'Żyd', 'Żywioły', 'Oświadczyny' -]; - -$(function() -{ - var tabs = $('ol#tabs li'); - var gallery = null; - CurrentDocument = new $.wikiapi.WikiDocument("document-meta"); - - $.blockUI.defaults.baseZ = 10000; - - function initialize() - { - gallery = new $.wiki.ScanGalleryPerspective({ - doc: CurrentDocument, id: "ScanGalleryPerspective" - }); - - $(document).keydown(function(event) { - console.log("Received key:", event); - }); - - /* The save button */ - $('#save-button').click(function(event){ - event.preventDefault(); - $.wiki.showDialog('#save_dialog'); - }); - - $('.editor').hide(); - - /* - * TABS - */ - $('#tabs li').live('click', function(event, callback) { - $.wiki.switchToTab(this); - }); - - $('#tabs li > .tabclose').live('click', function(event, callback) { - var $tab = $(this).parent(); - - if($tab.is('.active')) - $.wiki.switchToTab(DEFAULT_PERSPECTIVE); - - var p = $.wiki.perspectiveForTab($tab); - p.destroy(); - - return false; - }); - - - $(window).resize(function(){ - $('iframe').height($(window).height() - $('#tabs').outerHeight() - $('#source-editor .toolbar').outerHeight()); - }); - - $(window).resize(); - - $('.vsplitbar').toggle( - function() { - $.wiki.state.perspectives.ScanGalleryPerspective.show = true; - $('#side-gallery').show(); - $('.vsplitbar').css('right', 480).addClass('.active'); - $('#editor .editor').css('right', 510); - $(window).resize(); - gallery.onEnter(); - }, - function() { - $.wiki.state.perspectives.ScanGalleryPerspective.show = false; - $('#side-gallery').hide(); - $('.vsplitbar').css('right', 0).removeClass('active'); - $('#editor .editor').css('right', 30); - $(window).resize(); - gallery.onExit(); - } - ); - - if($.wiki.state.perspectives.ScanGalleryPerspective.show) - $('.vsplitbar').trigger('click'); - - window.onbeforeunload = function(e) { - if($.wiki.isDirty()) { - e.returnValue = "Na stronie mogą być nie zapisane zmiany."; - return "Na stronie mogą być nie zapisane zmiany."; - }; - }; - - console.log("Fetching document's text"); - - $(document).bind('wlapi_document_changed', function(event, doc) { - try { - $('#document-revision').text(doc.revision); - } catch(e) { - console.log("Failed handler", e); - } - }); - - CurrentDocument.fetch({ - success: function(){ - console.log("Fetch success"); - $('#loading-overlay').fadeOut(); - var active_tab = document.location.hash || DEFAULT_PERSPECTIVE; - - if(active_tab == "#ScanGalleryPerspective") - active_tab = DEFAULT_PERSPECTIVE; - - console.log("Initial tab is:", active_tab) - $.wiki.switchToTab(active_tab); - }, - failure: function() { - $('#loading-overlay').fadeOut(); - alert("FAILURE"); - } - }); - }; /* end of initialize() */ - - - /* Load configuration */ - $.wiki.loadConfig(); - - var initAll = function(a, f) { - if (a.length == 0) return f(); - - $.wiki.initTab({ - tab: a.pop(), - doc: CurrentDocument, - callback: function(){ - initAll(a, f); - } - }); - }; - - - /* - * Initialize all perspectives - */ - initAll( $.makeArray($('ol#tabs li')), initialize); - console.log(location.hash); -}); diff --git a/platforma/static/js/wiki/loader_readonly.js b/platforma/static/js/wiki/loader_readonly.js deleted file mode 100644 index c22e9d7a..00000000 --- a/platforma/static/js/wiki/loader_readonly.js +++ /dev/null @@ -1,92 +0,0 @@ -if (!window.console) { - window.console = { - log: function(){ - } - } -} - - -DEFAULT_PERSPECTIVE = "#VisualPerspective"; - -$(function() -{ - var tabs = $('ol#tabs li'); - var gallery = null; - - CurrentDocument = new $.wikiapi.WikiDocument("document-meta"); - $.blockUI.defaults.baseZ = 10000; - - function initialize() - { - $('.editor').hide(); - - /* - * TABS - */ - $('#tabs li').live('click', function(event, callback) { - $.wiki.switchToTab(this); - }); - - $('#tabs li > .tabclose').live('click', function(event, callback) { - var $tab = $(this).parent(); - - if($tab.is('.active')) - $.wiki.switchToTab(DEFAULT_PERSPECTIVE); - - var p = $.wiki.perspectiveForTab($tab); - p.destroy(); - return false; - }); - - $(window).resize(function(){ - $('iframe').height($(window).height() - $('#tabs').outerHeight() - $('#source-editor .toolbar').outerHeight()); - }); - - $(document).bind('wlapi_document_changed', function(event, doc) { - try { - $('#document-revision').text(doc.revision); - } catch(e) { - console.log("Failed handler", e); - } - }); - - CurrentDocument.fetch({ - success: function(){ - console.log("Fetch success"); - $('#loading-overlay').fadeOut(); - var active_tab = document.location.hash || DEFAULT_PERSPECTIVE; - - $(window).resize(); - - console.log("Initial tab is:", active_tab) - $.wiki.switchToTab(active_tab); - }, - failure: function() { - $('#loading-overlay').fadeOut(); - alert("FAILURE"); - } - }); - }; /* end of initialize() */ - - /* Load configuration */ - $.wiki.loadConfig(); - - var initAll = function(a, f) { - if (a.length == 0) return f(); - - $.wiki.initTab({ - tab: a.pop(), - doc: CurrentDocument, - callback: function(){ - initAll(a, f); - } - }); - }; - - - /* - * Initialize all perspectives - */ - initAll( $.makeArray($('ol#tabs li')), initialize); - console.log(location.hash); -}); \ No newline at end of file diff --git a/platforma/static/js/wiki/view_column_diff.js b/platforma/static/js/wiki/view_column_diff.js deleted file mode 100644 index a212f813..00000000 --- a/platforma/static/js/wiki/view_column_diff.js +++ /dev/null @@ -1,34 +0,0 @@ -(function($){ - - function DiffPerspective(options) { - var old_callback = options.callback || function() {}; - var self = this; - - options.callback = function(){ - self.base_id = options.base_id; - old_callback.call(this); - }; - - $.wiki.Perspective.call(this, options); - }; - - DiffPerspective.prototype = new $.wiki.Perspective(); - - DiffPerspective.prototype.freezeState = function(){ - // must - }; - - DiffPerspective.prototype.destroy = function() { - $('#' + this.base_id).remove(); - $('#' + this.perspective_id).remove(); - }; - - DiffPerspective.prototype.onEnter = function(success, failure){ - $.wiki.Perspective.prototype.onEnter.call(this); - console.log("Entered diff view"); - }; - - $.wiki.DiffPerspective = DiffPerspective; - -})(jQuery); - diff --git a/platforma/static/js/wiki/view_editor_source.js b/platforma/static/js/wiki/view_editor_source.js deleted file mode 100644 index a0a2e69a..00000000 --- a/platforma/static/js/wiki/view_editor_source.js +++ /dev/null @@ -1,124 +0,0 @@ -/* COMMENT */ -(function($) { - - function CodeMirrorPerspective(options) - { - var old_callback = options.callback; - options.callback = function(){ - var self = this; - - this.codemirror = CodeMirror.fromTextArea('codemirror_placeholder', { - parserfile: 'parsexml.js', - path: STATIC_URL + "js/lib/codemirror/", - stylesheet: STATIC_URL + "css/xmlcolors_15032010.css", - parserConfig: { - useHTMLKludges: false - }, - iframeClass: 'xml-iframe', - textWrapping: true, - lineNumbers: true, - width: "100%", - tabMode: 'spaces', - indentUnit: 0, - readOnly: CurrentDocument.readonly || false, - initCallback: function(){ - - self.codemirror.grabKeys(function(event) { - if (event.button) { - $(event.button).trigger('click'); - event.button = null; - } - }, function(event) { - /* CM reports characters 2 times - as event and as code */ - if((typeof event) != "object") - return false; - - if(!event.altKey) - return false; - - var c = String.fromCharCode(event.keyCode).toLowerCase(); - var button = $("#source-editor button[data-ui-accesskey='"+c+"']"); - if(button.length == 0) - return false; - - /* it doesn't matter which button we pick - all do the same */ - event.button = button[0]; - return true; - }); - - $('#source-editor .toolbar button').click(function(event){ - event.preventDefault(); - var params = eval("(" + $(this).attr('data-ui-action-params') + ")"); - scriptletCenter.callInteractive({ - action: $(this).attr('data-ui-action'), - context: self.codemirror, - extra: params - }); - }); - - $('.toolbar select').change(function(event){ - var slug = $(this).val(); - - $('.toolbar-buttons-container').hide().filter('[data-group=' + slug + ']').show(); - $(window).resize(); - }); - - $('.toolbar-buttons-container').hide(); - $('.toolbar select').change(); - - console.log("Initialized CodeMirror"); - - // textarea is no longer needed - $('codemirror_placeholder').remove(); - - old_callback.call(self); - } - }); - }; - - $.wiki.Perspective.call(this, options); - }; - - - CodeMirrorPerspective.prototype = new $.wiki.Perspective(); - - CodeMirrorPerspective.prototype.freezeState = function() { - this.config().position = this.codemirror.win.scrollY || 0; - }; - - CodeMirrorPerspective.prototype.unfreezeState = function () { - this.codemirror.win.scroll(0, this.config().position || 0); - }; - - CodeMirrorPerspective.prototype.onEnter = function(success, failure) { - $.wiki.Perspective.prototype.onEnter.call(this); - - console.log('Entering', this.doc); - this.codemirror.setCode(this.doc.text); - - /* fix line numbers bar */ - var $nums = $('.CodeMirror-line-numbers'); - var barWidth = $nums.width(); - - $(this.codemirror.frame.contentDocument.body).css('padding-left', barWidth); - // $nums.css('left', -barWidth); - - $(window).resize(); - this.unfreezeState(this._uistate); - - if(success) success(); - } - - CodeMirrorPerspective.prototype.onExit = function(success, failure) { - this.freezeState(); - - $.wiki.Perspective.prototype.onExit.call(this); - console.log('Exiting', this.doc); - this.doc.setText(this.codemirror.getCode()); - - if(success) success(); - } - - $.wiki.CodeMirrorPerspective = CodeMirrorPerspective; - -})(jQuery); diff --git a/platforma/static/js/wiki/view_editor_wysiwyg.js b/platforma/static/js/wiki/view_editor_wysiwyg.js deleted file mode 100644 index 2ae1a8dd..00000000 --- a/platforma/static/js/wiki/view_editor_wysiwyg.js +++ /dev/null @@ -1,425 +0,0 @@ -(function($){ - - /* Show theme to the user */ - function selectTheme(themeId){ - var selection = window.getSelection(); - selection.removeAllRanges(); - - var range = document.createRange(); - var s = $(".motyw[theme-class='" + themeId + "']")[0]; - var e = $(".end[theme-class='" + themeId + "']")[0]; - - if (s && e) { - range.setStartAfter(s); - range.setEndBefore(e); - selection.addRange(range); - } - }; - - /* Verify insertion port for annotation or theme */ - function verifyTagInsertPoint(node){ - if (node.nodeType == 3) { // Text Node - node = node.parentNode; - } - - if (node.nodeType != 1) { - return false; - } - - node = $(node); - var xtype = node.attr('x-node'); - - if (!xtype || (xtype.search(':') >= 0) || - xtype == 'motyw' || - xtype == 'begin' || - xtype == 'end') { - return false; - } - - // don't allow themes inside annotations - if (node.is('*[x-annotation-box] *')) - return false; - - return true; - } - - /* Convert HTML frament to plaintext */ - var ANNOT_ALLOWED = ['wyroznienie', 'slowo_obce', 'osoba']; - - function html2plainText(fragment){ - var text = ""; - - $(fragment.childNodes).each(function(){ - if (this.nodeType == 3) // textNode - text += this.nodeValue; - else - if (this.nodeType == 1 && - $.inArray($(this).attr('x-node'), ANNOT_ALLOWED) != -1) { - text += html2plainText(this); - } - }); - - return text; - } - - - /* Insert annotation using current selection */ - function addAnnotation(){ - var selection = window.getSelection(); - var n = selection.rangeCount; - - if (n == 0) { - window.alert("Nie zaznaczono żadnego obszaru"); - return false; - } - - // for now allow only 1 range - if (n > 1) { - window.alert("Zaznacz jeden obszar"); - return false; - } - - // remember the selected range - var range = selection.getRangeAt(0); - - if (!verifyTagInsertPoint(range.endContainer)) { - window.alert("Nie można wstawić w to miejsce przypisu."); - return false; - } - - // BUG #273 - selected text can contain themes, which should be omited from - // defining term - var text = html2plainText(range.cloneContents()); - - var tag = $(''); - range.collapse(false); - range.insertNode(tag[0]); - - xml2html({ - xml: '' + text + ' --- ', - success: function(text){ - var t = $(text); - tag.replaceWith(t); - openForEdit(t); - }, - error: function(){ - tag.remove(); - alert('Błąd przy dodawaniu przypisu:' + errors); - } - }) - } - - - /* Insert theme using current selection */ - - function addTheme(){ - var selection = window.getSelection(); - var n = selection.rangeCount; - - if (n == 0) { - window.alert("Nie zaznaczono żadnego obszaru"); - return false; - } - - // for now allow only 1 range - if (n > 1) { - window.alert("Zaznacz jeden obszar."); - return false; - } - - - // remember the selected range - var range = selection.getRangeAt(0); - - - if ($(range.startContainer).is('.html-editarea') || - $(range.endContainer).is('.html-editarea')) { - window.alert("Motywy można oznaczać tylko na tekście nie otwartym do edycji. \n Zamknij edytowany fragment i spróbuj ponownie."); - return false; - } - - // verify if the start/end points make even sense - - // they must be inside a x-node (otherwise they will be discarded) - // and the x-node must be a main text - if (!verifyTagInsertPoint(range.startContainer)) { - window.alert("Motyw nie może się zaczynać w tym miejscu."); - return false; - } - - if (!verifyTagInsertPoint(range.endContainer)) { - window.alert("Motyw nie może się kończyć w tym miejscu."); - return false; - } - - var date = (new Date()).getTime(); - var random = Math.floor(4000000000 * Math.random()); - var id = ('' + date) + '-' + ('' + random); - - var spoint = document.createRange(); - var epoint = document.createRange(); - - spoint.setStart(range.startContainer, range.startOffset); - epoint.setStart(range.endContainer, range.endOffset); - - var mtag, btag, etag, errors; - - // insert theme-ref - - xml2html({ - xml: '', - success: function(text){ - etag = $(''); - epoint.insertNode(etag[0]); - etag.replaceWith(text); - xml2html({ - xml: '', - success: function(text){ - mtag = $(''); - spoint.insertNode(mtag[0]); - mtag.replaceWith(text); - xml2html({ - xml: '', - success: function(text){ - btag = $(''); - spoint.insertNode(btag[0]) - btag.replaceWith(text); - selection.removeAllRanges(); - openForEdit($('.motyw[theme-class=' + id + ']')); - } - }); - } - }); - } - }); - } - - /* open edition window for selected fragment */ - function openForEdit($origin){ - var $box = null - - // annotations overlay their sub box - not their own box // - if ($origin.is(".annotation-inline-box")) { - $box = $("*[x-annotation-box]", $origin); - } - else { - $box = $origin; - } - - var x = $box[0].offsetLeft; - var y = $box[0].offsetTop; - var w = $box.outerWidth(); - var h = $box.innerHeight(); - - if ($origin.is(".annotation-inline-box")) { - w = Math.max(w, 400); - h = Math.max(h, 60); - } - - // start edition on this node - var $overlay = $('
    ').css({ - position: 'absolute', - height: h, - left: x, - top: y, - width: w - }).appendTo($box[0].offsetParent || $box.parent()).show(); - - if ($origin.is('.motyw')) { - $('textarea', $overlay).autocomplete(THEMES, { - autoFill: true, - multiple: true, - selectFirst: true - }); - } - - if ($origin.is('.motyw')) { - $('.delete-button', $overlay).click(function(){ - if (window.confirm("Czy jesteś pewien, że chcesz usunąć ten motyw ?")) { - $('[theme-class=' + $origin.attr('theme-class') + ']').remove(); - $overlay.remove(); - $(document).unbind('click.blur-overlay'); - return false; - }; - }); - } - else { - $('.delete-button', $overlay).hide(); - } - - - var serializer = new XMLSerializer(); - - html2text({ - element: $box[0], - stripOuter: true, - success: function(text){ - $('textarea', $overlay).val($.trim(text)); - - setTimeout(function(){ - $('textarea', $overlay).elastic().focus(); - }, 50); - - function save(argument){ - var nodeName = $box.attr('x-node') || 'pe'; - var insertedText = $('textarea', $overlay).val(); - - if ($origin.is('.motyw')) { - insertedText = insertedText.replace(/,\s*$/, ''); - } - - xml2html({ - xml: '<' + nodeName + '>' + insertedText + '', - success: function(element){ - $origin.html($(element).html()); - $overlay.remove(); - }, - error: function(text){ - $overlay.remove(); - alert('Błąd! ' + text); - } - }) - } - - $('.accept-button', $overlay).click(function(){ - save(); - }); - - $(document).bind('click.blur-overlay', function(event){ - if ($(event.target).parents('.html-editarea').length > 0) { - return; - } - save(); - - $(document).unbind('click.blur-overlay'); - }); - - }, - error: function(text){ - alert('Błąd! ' + text); - } - }); - } - - function VisualPerspective(options){ - - var old_callback = options.callback; - - options.callback = function(){ - var element = $("#html-view"); - var button = $(''); - - if (!CurrentDocument.readonly) { - $('#html-view').bind('mousemove', function(event){ - var editable = $(event.target).closest('*[x-editable]'); - $('.active', element).not(editable).removeClass('active').children('.edit-button').remove(); - - if (!editable.hasClass('active')) { - editable.addClass('active').append(button); - } - if (editable.is('.annotation-inline-box')) { - $('*[x-annotation-box]', editable).css({ - position: 'absolute', - left: event.clientX - editable.offset().left + 5, - top: event.clientY - editable.offset().top + 5 - }).show(); - } - else { - $('*[x-annotation-box]').hide(); - } - }); - - $('#insert-annotation-button').click(function(){ - addAnnotation(); - return false; - }); - - $('#insert-theme-button').click(function(){ - addTheme(); - return false; - }); - - $('.edit-button').live('click', function(event){ - event.preventDefault(); - openForEdit($(this).parent()); - }); - - } - - $('.motyw').live('click', function(){ - selectTheme($(this).attr('theme-class')); - }); - - old_callback.call(this); - }; - - $.wiki.Perspective.call(this, options); - }; - - VisualPerspective.prototype = new $.wiki.Perspective(); - - VisualPerspective.prototype.freezeState = function(){ - - }; - - VisualPerspective.prototype.onEnter = function(success, failure){ - $.wiki.Perspective.prototype.onEnter.call(this); - - $.blockUI({ - message: 'Uaktualnianie widoku...' - }); - - function _finalize(callback){ - $.unblockUI(); - if (callback) - callback(); - } - - xml2html({ - xml: this.doc.text, - success: function(element){ - $('#html-view').html(element); - _finalize(success); - }, - error: function(text){ - var message = $('
    ');
    -                message.text(text);
    -                $('#html-view').html('

    Wystąpił błąd:

    ' +
    -                message.html() +
    -                '
    '); - _finalize(failure); - } - }); - }; - - VisualPerspective.prototype.onExit = function(success, failure){ - var self = this; - - $.blockUI({ - message: 'Zapisywanie widoku...' - }); - - function _finalize(callback){ - $.unblockUI(); - if (callback) - callback(); - } - - if ($('#html-view .error').length > 0) - return _finalize(failure); - - html2text({ - element: $('#html-view div').get(0), - success: function(text){ - self.doc.setText(text); - _finalize(success); - }, - error: function(text){ - $('#source-editor').html('

    Wystąpił błąd:

    ' + text + '
    '); - _finalize(failure); - } - }); - }; - - $.wiki.VisualPerspective = VisualPerspective; - -})(jQuery); diff --git a/platforma/static/js/wiki/view_gallery.js b/platforma/static/js/wiki/view_gallery.js deleted file mode 100644 index aa39e15f..00000000 --- a/platforma/static/js/wiki/view_gallery.js +++ /dev/null @@ -1,251 +0,0 @@ -(function($){ - - function normalizeNumber(pageNumber, pageCount){ - // Numer strony musi być pomiędzy 1 a najwyższym numerem - var pageNumber = parseInt(pageNumber, 10); - - if (!pageNumber || - pageNumber == NaN || - pageNumber == Infinity || - pageNumber == -Infinity || - pageNumber < 1) - return 1; - - if (pageNumber > pageCount) - return pageCount; - - return pageNumber; - } - - function bounds(galleryWidth, galleryHeight, imageWidth, imageHeight){ - return { - maxX: 0, - maxY: 0, - minX: galleryWidth - imageWidth, - minY: galleryHeight - imageHeight - } - }; - - function normalizePosition(x, y, galleryWidth, galleryHeight, imageWidth, imageHeight){ - var b = bounds(galleryWidth, galleryHeight, imageWidth, imageHeight); - return { - x: Math.min(b.maxX, Math.max(b.minX, x)), - y: Math.min(b.maxY, Math.max(b.minY, y)) - } - }; - - function fixImageSize(){ - - } - - /* - * Perspective - */ - function ScanGalleryPerspective(options){ - var old_callback = options.callback || function() { }; - - this.noupdate_hash_onenter = true; - - options.callback = function(){ - var self = this; - - this.dimensions = {}; - this.zoomFactor = 1; - this.$element = $("#side-gallery"); - this.$numberInput = $('.page-number', this.$element); - - // ... - var origin = {}; - var imageOrigin = {}; - - this.$image = $('.gallery-image img', this.$element).attr('unselectable', 'on'); - - // button handlers - this.$numberInput.change(function(event){ - event.preventDefault(); - self.setPage($(this).val()); - }); - - $('.previous-page', this.$element).click(function(){ - self.setPage(parseInt(self.$numberInput.val(),10) - 1); - }); - - $('.next-page', this.$element).click(function(){ - self.setPage(parseInt(self.$numberInput.val(),10) + 1); - }); - - $('.zoom-in', this.$element).click(function(){ - self.alterZoom(0.2); - }); - - $('.zoom-out', this.$element).click(function(){ - self.alterZoom((-0.2)); - }); - - $(window).resize(function(){ - self.dimensions.galleryWidth = self.$image.parent().width(); - self.dimensions.galleryHeight = self.$image.parent().height(); - }); - - $('.gallery-image img', this.$element).load(function(){ - console.log("Image loaded.") - self._resizeImage(); - }).bind('mousedown', function() { - self.imageMoveStart.apply(self, arguments); - }); - - - - old_callback.call(this); - }; - - $.wiki.Perspective.call(this, options); - }; - - ScanGalleryPerspective.prototype = new $.wiki.Perspective(); - - ScanGalleryPerspective.prototype._resizeImage = function(){ - var $img = this.$image; - - $img.css({ - width: null, - height: null - }); - - this.dimensions = { - width: $img.width() * this.zoomFactor, - height: $img.height() * this.zoomFactor, - originWidth: $img.width(), - originHeight: $img.height(), - galleryWidth: $img.parent().width(), - galleryHeight: $img.parent().height() - }; - - if (!(this.dimensions.width && this.dimensions.height)) { - setTimeout(function(){ - $img.load(); - }, 100); - } - - var position = normalizePosition($img.position().left, $img.position().top, this.dimensions.galleryWidth, this.dimensions.galleryHeight, this.dimensions.width, this.dimensions.height); - - $img.css({ - left: position.x, - top: position.y, - width: $img.width() * this.zoomFactor, - height: $img.height() * this.zoomFactor - }); - }; - - ScanGalleryPerspective.prototype.setPage = function(newPage){ - newPage = normalizeNumber(newPage, this.doc.galleryImages.length); - this.$numberInput.val(newPage); - this.config().page = newPage; - $('.gallery-image img', this.$element).attr('src', this.doc.galleryImages[newPage - 1]); - }; - - ScanGalleryPerspective.prototype.alterZoom = function(delta){ - var zoomFactor = this.zoomFactor + delta; - if (zoomFactor < 0.2) - zoomFactor = 0.2; - if (zoomFactor > 2) - zoomFactor = 2; - this.setZoom(zoomFactor); - }; - - ScanGalleryPerspective.prototype.setZoom = function(factor){ - this.zoomFactor = factor; - - this.dimensions.width = this.dimensions.originWidth * this.zoomFactor; - this.dimensions.height = this.dimensions.originHeight * this.zoomFactor; - - // var position = normalizePosition(this.$image.position().left, this.$image.position().top, this.dimensions.galleryWidth, this.dimensions.galleryHeight, this.dimensions.width, this.dimensions.height); - - this._resizeImage(); - /* this.$image.css({ - width: this.dimensions.width, - height: this.dimensions.height, - left: position.x, - top: position.y - });*/ - }; - - /* - * Movement - */ - ScanGalleryPerspective.prototype.imageMoved = function(event){ - event.preventDefault(); - - // origin is where the drag started - // imageOrigin is where the drag started on the image - - var newX = event.clientX - this.origin.x + this.imageOrigin.left; - var newY = event.clientY - this.origin.y + this.imageOrigin.top; - - var position = normalizePosition(newX, newY, this.dimensions.galleryWidth, this.dimensions.galleryHeight, this.dimensions.width, this.dimensions.height); - - this.$image.css({ - left: position.x, - top: position.y, - }); - - return false; - }; - - ScanGalleryPerspective.prototype.imageMoveStart = function(event){ - event.preventDefault(); - - var self = this; - - this.origin = { - x: event.clientX, - y: event.clientY - }; - - this.imageOrigin = self.$image.position(); - $(document).bind('mousemove.gallery', function(){ - self.imageMoved.apply(self, arguments); - }).bind('mouseup.gallery', function() { - self.imageMoveStop.apply(self, arguments); - }); - - return false; - }; - - ScanGalleryPerspective.prototype.imageMoveStop = function(event){ - $(document).unbind('mousemove.gallery').unbind('mouseup.gallery'); - }; - - /* - * Loading gallery - */ - ScanGalleryPerspective.prototype.onEnter = function(success, failure){ - var self = this; - - $.wiki.Perspective.prototype.onEnter.call(this); - - this.doc.refreshGallery({ - success: function(doc, data){ - self.$image.show(); - console.log("gconfig:", self.config().page ); - self.setPage( self.config().page ); - - $('.error_message', self.$element).hide(); - if(success) success(); - }, - failure: function(doc, message){ - self.$image.hide(); - $('.error_message', self.$element).show().html(message); - if(failure) failure(); - } - }); - - }; - - ScanGalleryPerspective.prototype.onExit = function(success, failure) { - - }; - - $.wiki.ScanGalleryPerspective = ScanGalleryPerspective; - -})(jQuery); \ No newline at end of file diff --git a/platforma/static/js/wiki/view_history.js b/platforma/static/js/wiki/view_history.js deleted file mode 100644 index b4a9dd8a..00000000 --- a/platforma/static/js/wiki/view_history.js +++ /dev/null @@ -1,158 +0,0 @@ -(function($){ - - function HistoryPerspective(options) { - var old_callback = options.callback || function() {}; - - options.callback = function() { - var self = this; - - // first time page is rendered - $('#make-diff-button').click(function() { - self.makeDiff(); - }); - - $('#tag-changeset-button').click(function() { - self.showTagForm(); - }); - - $('#open-preview-button').click(function(event) { - var selected = $('#changes-list .entry.selected'); - - if (selected.length != 1) { - window.alert("Wybierz dokładnie *jedną* wersję."); - return; - } - - var version = parseInt($("*[data-stub-value='version']", selected[0]).text()); - window.open($(this).attr('data-basehref') + "?revision=" + version); - - event.preventDefault(); - }); - - $('#changes-list .entry').live('click', function(){ - var $this = $(this); - if ($this.hasClass('selected')) - return $this.removeClass('selected'); - - if ($("#changes-list .entry.selected").length < 2) - return $this.addClass('selected'); - }); - - $('#changes-list span.tag').live('click', function(event){ - return false; - }); - - old_callback.call(this); - } - - $.wiki.Perspective.call(this, options); - }; - - HistoryPerspective.prototype = new $.wiki.Perspective(); - - HistoryPerspective.prototype.freezeState = function(){ - // must - }; - - HistoryPerspective.prototype.onEnter = function(success, failure){ - $.wiki.Perspective.prototype.onEnter.call(this); - - $.blockUI({ - message: 'Odświeżanie historii...' - }); - - function _finalize(s){ - $.unblockUI(); - - if (s) { - if (success) - success(); - } - else { - if (failure) - failure(); - } - } - - function _failure(doc, message){ - $('#history-view .message-box').html('Nie udało się odświeżyć historii:' + message).show(); - _finalize(false); - }; - - function _success(doc, data){ - $('#history-view .message-box').hide(); - var changes_list = $('#changes-list'); - var $stub = $('#history-view .row-stub'); - changes_list.html(''); - - var tags = $('select#id_addtag-tag option'); - - $.each(data, function(){ - $.wiki.renderStub({ - container: changes_list, - stub: $stub, - data: this, - filters: { - tag: function(value) { - return tags.filter("*[value='"+value+"']").text(); - } - } - }); - }); - - _finalize(true); - }; - - return this.doc.fetchHistory({ - success: _success, - failure: _failure - }); - }; - - HistoryPerspective.prototype.showTagForm = function(){ - var selected = $('#changes-list .entry.selected'); - - if (selected.length != 1) { - window.alert("Musisz zaznaczyć dokładnie jedną wersję."); - return; - } - - var version = parseInt($("*[data-stub-value='version']", selected[0]).text()); - $.wiki.showDialog('#add_tag_dialog', {'revision': version}); - }; - - HistoryPerspective.prototype.makeDiff = function() { - var changelist = $('#changes-list'); - var selected = $('.entry.selected', changelist); - - if (selected.length != 2) { - window.alert("Musisz zaznaczyć dokładnie dwie wersje do porównania."); - return; - } - - $.blockUI({ - message: 'Wczytywanie porównania...' - }); - - var rev_from = $("*[data-stub-value='version']", selected[1]).text(); - var rev_to = $("*[data-stub-value='version']", selected[0]).text(); - - return this.doc.fetchDiff({ - from: rev_from, - to: rev_to, - success: function(doc, data){ - var result = $.wiki.newTab(doc, ''+rev_from +' -> ' + rev_to, 'DiffPerspective'); - - $(result.view).html(data); - $.wiki.switchToTab(result.tab); - $.unblockUI(); - }, - failure: function(doc){ - $.unblockUI(); - } - }); - }; - - $.wiki.HistoryPerspective = HistoryPerspective; - -})(jQuery); diff --git a/platforma/static/js/wiki/view_summary.js b/platforma/static/js/wiki/view_summary.js deleted file mode 100644 index 811096dd..00000000 --- a/platforma/static/js/wiki/view_summary.js +++ /dev/null @@ -1,45 +0,0 @@ -(function($){ - - function SummaryPerspective(options) { - var old_callback = options.callback; - var self = this; - - options.callback = function(){ - $('#publish_button').click(function() { - $.blockUI({message: "Oczekiwanie na odpowiedź serwera..."}); - self.doc.publish({ - success: function(doc, data) { - $.blockUI({message: "Udało się.", timeout: 2000}); - }, - failure: function(doc, message) { - $.blockUI({ - message: message, - timeout: 5000 - }); - } - - }); - }); - - old_callback.call(this); - }; - - $.wiki.Perspective.call(this, options); - }; - - SummaryPerspective.prototype = new $.wiki.Perspective(); - - SummaryPerspective.prototype.freezeState = function(){ - // must - }; - - SummaryPerspective.prototype.onEnter = function(success, failure){ - $.wiki.Perspective.prototype.onEnter.call(this); - - console.log("Entered summery view"); - }; - - $.wiki.SummaryPerspective = SummaryPerspective; - -})(jQuery); - diff --git a/platforma/static/js/wiki/wikiapi.js b/platforma/static/js/wiki/wikiapi.js deleted file mode 100644 index 27ab97e2..00000000 --- a/platforma/static/js/wiki/wikiapi.js +++ /dev/null @@ -1,316 +0,0 @@ -(function($) { - $.wikiapi = {}; - var noop = function() { - }; - var noops = { - success: noop, - failure: noop - }; - /* - * Return absolute reverse path of given named view. - * (at least he have it hard-coded in one place) - * - * TODO: think of a way, not to hard-code it here ;) - * - */ - function reverse() { - var vname = arguments[0]; - var base_path = "/documents"; - - if (vname == "ajax_document_text") { - var path = "/" + arguments[1] + "/text"; - - if (arguments[2] !== undefined) - path += "/" + arguments[2]; - - return base_path + path; - } - - if (vname == "ajax_document_history") { - - return base_path + "/" + arguments[1] + "/history"; - } - - if (vname == "ajax_document_gallery") { - - return base_path + "/gallery/" + arguments[1]; - } - - if (vname == "ajax_document_diff") - return base_path + "/" + arguments[1] + "/diff"; - - if (vname == "ajax_document_addtag") - return base_path + "/" + arguments[1] + "/tags"; - - if (vname == "ajax_publish") - return base_path + "/" + arguments[1] + "/publish"; - - console.log("Couldn't reverse match:", vname); - return "/404.html"; - }; - - /* - * Document Abstraction - */ - function WikiDocument(element_id) { - var meta = $('#' + element_id); - this.id = meta.attr('data-document-name'); - - this.revision = $("*[data-key='revision']", meta).text(); - this.readonly = !!$("*[data-key='readonly']", meta).text(); - - this.galleryLink = $("*[data-key='gallery']", meta).text(); - this.galleryImages = []; - this.text = null; - this.has_local_changes = false; - this._lock = -1; - this._context_lock = -1; - this._lock_count = 0; - }; - - WikiDocument.prototype.triggerDocumentChanged = function() { - $(document).trigger('wlapi_document_changed', this); - }; - /* - * Fetch text of this document. - */ - WikiDocument.prototype.fetch = function(params) { - params = $.extend({}, noops, params); - var self = this; - $.ajax({ - method: "GET", - url: reverse("ajax_document_text", self.id), - data: {"revision": self.revision}, - dataType: 'json', - success: function(data) { - var changed = false; - - if (self.text === null || self.revision !== data.revision) { - self.text = data.text; - self.revision = data.revision; - self.gallery = data.gallery; - changed = true; - self.triggerDocumentChanged(); - }; - - self.has_local_changes = false; - params['success'](self, changed); - }, - error: function() { - params['failure'](self, "Nie udało się wczytać treści dokumentu."); - } - }); - }; - /* - * Fetch history of this document. - * - * from - First revision to fetch (default = 0) - * upto - Last revision to fetch (default = tip) - * - */ - WikiDocument.prototype.fetchHistory = function(params) { - /* this doesn't modify anything, so no locks */ - params = $.extend({}, noops, params); - var self = this; - $.ajax({ - method: "GET", - url: reverse("ajax_document_history", self.id), - dataType: 'json', - data: { - "from": params['from'], - "upto": params['upto'] - }, - success: function(data) { - params['success'](self, data); - }, - error: function() { - params['failure'](self, "Nie udało się wczytać historii dokumentu."); - } - }); - }; - WikiDocument.prototype.fetchDiff = function(params) { - /* this doesn't modify anything, so no locks */ - var self = this; - params = $.extend({ - 'from': self.revision, - 'to': self.revision - }, noops, params); - $.ajax({ - method: "GET", - url: reverse("ajax_document_diff", self.id), - dataType: 'html', - data: { - "from": params['from'], - "to": params['to'] - }, - success: function(data) { - params['success'](self, data); - }, - error: function() { - params['failure'](self, "Nie udało się wczytać porównania wersji."); - } - }); - }; - - /* - * Fetch gallery - */ - WikiDocument.prototype.refreshGallery = function(params) { - params = $.extend({}, noops, params); - var self = this; - $.ajax({ - method: "GET", - url: reverse("ajax_document_gallery", self.galleryLink), - dataType: 'json', - // data: {}, - success: function(data) { - self.galleryImages = data; - params['success'](self, data); - }, - error: function() { - self.galleryImages = []; - params['failure'](self, "

    Nie udało się wczytać gallerii pod nazwą: '" + self.galleryLink + "'.

    "); - } - }); - }; - - /* - * Set document's text - */ - WikiDocument.prototype.setText = function(text) { - this.text = text; - this.has_local_changes = true; - }; - - /* - * Set document's gallery link - */ - WikiDocument.prototype.setGalleryLink = function(gallery) { - this.galleryLink = gallery; - this.has_local_changes = true; - }; - - /* - * Save text back to the server - */ - WikiDocument.prototype.save = function(params) { - params = $.extend({}, noops, params); - var self = this; - - if (!self.has_local_changes) { - console.log("Abort: no changes."); - return params['success'](self, false, "Nie ma zmian do zapisania."); - }; - - // Serialize form to dictionary - var data = {}; - $.each(params['form'].serializeArray(), function() { - data[this.name] = this.value; - }); - - var metaComment = '\n' - - data['textsave-text'] = metaComment + self.text; - - $.ajax({ - url: reverse("ajax_document_text", self.id), - type: "POST", - dataType: "json", - data: data, - success: function(data) { - var changed = false; - - if (data.text) { - self.text = data.text; - self.revision = data.revision; - self.gallery = data.gallery; - changed = true; - self.triggerDocumentChanged(); - }; - - params['success'](self, changed, ((changed && "Udało się zapisać :)") || "Twoja wersja i serwera jest identyczna")); - }, - error: function(xhr) { - try { - params['failure'](self, $.parseJSON(xhr.responseText)); - } - catch (e) { - params['failure'](self, { - "__message": "

    Nie udało się zapisać - błąd serwera.

    " - }); - }; - - } - }); - }; /* end of save() */ - - WikiDocument.prototype.publish = function(params) { - params = $.extend({}, noops, params); - var self = this; - $.ajax({ - url: reverse("ajax_publish", self.id), - type: "POST", - dataType: "json", - success: function(data) { - params.success(self, data); - }, - error: function(xhr) { - if (xhr.status == 403 || xhr.status == 401) { - params.failure(self, "Nie masz uprawnień lub nie jesteś zalogowany."); - } - else { - try { - params.failure(self, xhr.responseText); - } - catch (e) { - params.failure(self, "Nie udało się - błąd serwera."); - }; - }; - - } - }); - }; - WikiDocument.prototype.setTag = function(params) { - params = $.extend({}, noops, params); - var self = this; - var data = { - "addtag-id": self.id, - }; - - /* unpack form */ - $.each(params.form.serializeArray(), function() { - data[this.name] = this.value; - }); - - $.ajax({ - url: reverse("ajax_document_addtag", self.id), - type: "POST", - dataType: "json", - data: data, - success: function(data) { - params.success(self, data.message); - }, - error: function(xhr) { - if (xhr.status == 403 || xhr.status == 401) { - params.failure(self, { - "__all__": ["Nie masz uprawnień lub nie jesteś zalogowany."] - }); - } - else { - try { - params.failure(self, $.parseJSON(xhr.responseText)); - } - catch (e) { - params.failure(self, { - "__all__": ["Nie udało się - błąd serwera."] - }); - }; - }; - } - }); - }; - - $.wikiapi.WikiDocument = WikiDocument; -})(jQuery); diff --git a/platforma/static/js/wiki/xslt.js b/platforma/static/js/wiki/xslt.js deleted file mode 100644 index dda12a16..00000000 --- a/platforma/static/js/wiki/xslt.js +++ /dev/null @@ -1,378 +0,0 @@ -/* - * - * XSLT STUFF - * - */ -function createXSLT(xsl) { - var p = new XSLTProcessor(); - p.importStylesheet(xsl); - return p; -} - -var xml2htmlStylesheet = null; - -// Wykonuje block z załadowanymi arkuszami stylów -function withStylesheets(code_block, onError) -{ - if (!xml2htmlStylesheet) { - $.blockUI({message: 'Ładowanie arkuszy stylów...'}); - $.ajax({ - url: STATIC_URL + 'xsl/wl2html_client.xsl', - dataType: 'xml', - success: function(data) { - xml2htmlStylesheet = createXSLT(data); - $.unblockUI(); - code_block(); - - }, - error: onError - }) - } - else { - code_block(); - } -} - - -function xml2html(options) { - withStylesheets(function() { - var xml = options.xml.replace(/\/\s+/g, '
    '); - var parser = new DOMParser(); - var serializer = new XMLSerializer(); - var doc = parser.parseFromString(xml, 'text/xml'); - var error = $('parsererror', doc); - - if (error.length == 0) { - doc = xml2htmlStylesheet.transformToFragment(doc, document); - console.log(doc.firstChild); - - if(doc.firstChild === null) { - options.error("Błąd w przetwarzaniu XML."); - return; - } - - error = $('parsererror', doc); - } - - if (error.length > 0 && options.error) { - options.error(error.text()); - } else { - options.success(doc.firstChild); - } - }, function() { options.error && options.error('Nie udało się załadować XSLT'); }); -} - -/* USEFULL CONSTANTS */ -const ELEMENT_NODE = 1; -const ATTRIBUTE_NODE = 2; -const TEXT_NODE = 3; -const CDATA_SECTION_NODE = 4; -const ENTITY_REFERENCE_NODE = 5; -const ENTITY_NODE = 6; -const PROCESSING_INSTRUCTION_NODE = 7; -const COMMENT_NODE = 8; -const DOCUMENT_NODE = 9; -const DOCUMENT_TYPE_NODE = 10; -const DOCUMENT_FRAGMENT_NODE = 11; -const NOTATION_NODE = 12; -const XATTR_RE = /^x-attr-name-(.*)$/; - -const ELEM_START = 1; -const ELEM_END = 2; -const NS_END = 3; - -const NAMESPACES = { - // namespaces not listed here will be assigned random names - "http://www.w3.org/1999/02/22-rdf-syntax-ns#": "rdf", - "http://purl.org/dc/elements/1.1/": "dc", - "http://www.w3.org/XML/1998/namespace": "xml" -}; - -/* - * PADDING for pretty-printing - */ -const PADDING = { - dramat_wierszowany_l: 4, - dramat_wierszowany_lp: 4, - dramat_wspolczesny: 4, - wywiad: 4, - opowiadanie: 4, - powiesc: 4, - liryka_l: 4, - liryka_lp: 4, - naglowek_czesc: 4, - naglowek_akt: 4, - naglowek_rozdzial: 4, - naglowek_osoba: 4, - lista_osob: 4, - - akap: 3, - akap_cd: 3, - akap_dialog: 3, - strofa: 3, - motto: 3, - miejsce_czas: 3, - - autor_utworu: 2, - nazwa_utworu: 2, - dzielo_nadrzedne: 2, - - didaskalia: 2, - motto_podpis: 2, - naglowek_listy: 2, - kwestia: 1, - lista_osoba: 1, - - "podpis": 1, - "wers": 0, - "wers_cd": 0, - "wers_akap": 0, - "wers_wciety": 0, - - "rdf:RDF": 3, - "rdf:Description": 1, -}; - -function getPadding(name) { - - if(name.match(/^dc:.*$/)) - return -1; - - if(PADDING[name]) - return PADDING[name]; - - return 0; -} - -function HTMLSerializer() { - // empty constructor -} - - - -HTMLSerializer.prototype._prepare = function() { - this.stack = []; - - // XML namespace is implicit - this.nsMap = {"http://www.w3.org/XML/1998/namespace": "xml"}; - - this.result = ""; - this.nsCounter = 1; -} - -HTMLSerializer.prototype._pushElement = function(element) { - this.stack.push({ - "type": ELEM_START, - "node": element - }); -} - -HTMLSerializer.prototype._pushChildren = function(element) { - for(var i = element.childNodes.length-1; i >= 0; i--) - this._pushElement(element.childNodes.item(i)); -} - -HTMLSerializer.prototype._pushTagEnd = function(tagName) { - this.stack.push({ - "type": ELEM_END, - "tagName": tagName - }); -} - -HTMLSerializer.prototype._verseBefore = function(node) { - var prev = node.previousSibling; - - while((prev !== null) && (prev.nodeType != ELEMENT_NODE)) { - prev = prev.previousSibling; - } - - return (prev !== null) && prev.hasAttribute('x-verse'); -} - -HTMLSerializer.prototype.serialize = function(rootElement, stripOuter) -{ - var self = this; - self._prepare(); - - if(!stripOuter) - self._pushElement(rootElement); - else - self._pushChildren(rootElement); - - while(self.stack.length > 0) { - var token = self.stack.pop(); - - if(token.type === ELEM_END) { - self.result += ""; - for(var padding = getPadding(token.tagName); padding > 0; padding--) { - self.result += "\n"; - } - continue; - }; - - if(token.type === NS_END) { - self._unassignNamespace(token.namespace); - continue; - } - - - switch(token.node.nodeType) { - case ELEMENT_NODE: - if(token.node.hasAttribute('x-pass-thru')) { - self._pushChildren(token.node); - break; - } - - if(!token.node.hasAttribute('x-node')) - break; - - var xnode = token.node.getAttribute('x-node'); - - if(xnode === 'wers') { - /* push children */ - if(self._verseBefore(token.node)) - self.result += '/\n'; - self._pushChildren(token.node); - break; - }; - - if(xnode === 'out-of-flow-text') { - self._pushChildren(token.node); - break; - } - - if(token.node.hasAttribute('x-verse') && self._verseBefore(token.node)) { - self.result += '/\n'; - }; - - self._serializeElement(token.node); - break; - case TEXT_NODE: - self.result += token.node.nodeValue; - break; - }; - }; - - return this.result; -} - -/* - * TODO: this doesn't support prefix redefinitions - */ -HTMLSerializer.prototype._unassignNamespace = function(nsData) { - this.nsMap[nsData.uri] = undefined; -}; - -HTMLSerializer.prototype._assignNamespace = function(uri) { - if(uri === null) { - // default namespace - return ({"prefix": "", "uri": "", "fresh": false}); - } - - if(this.nsMap[uri] === undefined) { - // this prefix hasn't been defined yet in current context - var prefix = NAMESPACES[uri]; - - if (prefix === undefined) { // not predefined - prefix = "ns" + this.nsCounter; - this.nsCounter += 1; - } - - this.nsMap[uri] = prefix; - return ({ - "prefix": prefix, - "uri": uri, - "fresh": true - }); - } - - return ({"prefix": this.nsMap[uri], "uri": uri, "fresh": false}); -}; - -HTMLSerializer.prototype._join = function(prefix, name) { - if(!!prefix) - return prefix + ":" + name; - return name; -}; - -HTMLSerializer.prototype._rjoin = function(prefix, name) { - if(!!name) - return prefix + ":" + name; - return prefix; -}; - -HTMLSerializer.prototype._serializeElement = function(node) { - var self = this; - - var ns = node.getAttribute('x-ns'); - var nsPrefix = null; - var newNamespaces = []; - - var nsData = self._assignNamespace(node.getAttribute('x-ns')); - - if(nsData.fresh) { - newNamespaces.push(nsData); - self.stack.push({ - "type": NS_END, - "namespace": nsData - }); - } - - var tagName = self._join(nsData.prefix, node.getAttribute('x-node')); - - /* retrieve attributes */ - var attributeIDs = []; - for (var i = 0; i < node.attributes.length; i++) { - var attr = node.attributes.item(i); - - // check if name starts with "x-attr-name" - var m = attr.name.match(XATTR_RE); - if (m !== null) - attributeIDs.push(m[1]); - }; - - /* print out */ - if (getPadding(tagName)) - self.result += '\n'; - - self.result += '<' + tagName; - - $.each(attributeIDs, function() { - var nsData = self._assignNamespace(node.getAttribute('x-attr-ns-'+this)); - - if(nsData.fresh) { - newNamespaces.push(nsData); - self.stack.push({ - "type": NS_END, - "namespace": nsData - }); - }; - - self.result += ' ' + self._join(nsData.prefix, node.getAttribute('x-attr-name-'+this)); - self.result += '="'+node.getAttribute('x-attr-value-'+this) +'"'; - }); - - /* print new namespace declarations */ - $.each(newNamespaces, function() { - self.result += " " + self._rjoin("xmlns", this.prefix); - self.result += '="' + this.uri + '"'; - }); - - if (node.childNodes.length > 0) { - self.result += ">"; - self._pushTagEnd(tagName); - self._pushChildren(node); - } - else { - self.result += "/>"; - }; -}; - -function html2text(params) { - try { - var s = new HTMLSerializer(); - params.success( s.serialize(params.element, params.stripOuter) ); - } catch(e) { - params.error("Nie udało się zserializować tekstu:" + e) - } -} \ No newline at end of file diff --git a/platforma/static/xsl/wl2html_client.xsl b/platforma/static/xsl/wl2html_client.xsl deleted file mode 100644 index 6dd50806..00000000 --- a/platforma/static/xsl/wl2html_client.xsl +++ /dev/null @@ -1,810 +0,0 @@ - - - - - - - - - - - - - - - - -
    - - - - -
    -
    - - - - - - - -
    - - - - -
    -
    - - - -
    - - - - -
    -
    - - - -
    - - - - -
    -
    - - - -
    - - - - -
    -
    - - - - - - -

    - - - - - -

    -
    - - - - -

    - - - - - -

    -
    - - - - -

    - - - - - -

    -
    - - - - -

    - - - - - -

    -
    - - - - - -
    - - - - -
    -
    - - - - -
    - - - - -
    -
    - - - - -
    -
    - - - - -
    - - - -
    -
    - - - - - - - - - - -

    - - - - - -

    -
    - - - - - - - - -
    - - - - -
    -
    - - - -

    - - - - - -

    -
    - - - -

    - - - - - -

    -
    - - - - -

    - - - - - -

    -
    - - - - - - - -

    - - - - - -

    -
    - - - - -

    - - - - - -

    -
    - - - - -

    - - - - - -

    -
    - - - - - -

    - - - - - -

    -
    - - - -

    - - - - - -

    -
    - - - - - -

    - - - - - -

    -
    - - - -

    - - - - - -

    -
    - - - - - -
    - - - - -
    -
    - - - -
    - - - - -
    -
    - - - -
    - - - - -
    -
    - - - -
    - - - - -
    -
    - - - -
    - - - - -
    -
    - - - -
    - - - - -
    -
    - - - - - -

    - - - - - -

    -
    - - - -

    - - - - - -

    -
    - - - -

    - - - - - -

    -
    - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - - - - - - - - - - -

    - - - -

    -
    - - - - - - -
    -
    - - - - -

    - - - - -

    - -
    - - / - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

    -
    - - - -
    -
    - - - -
    -
    - - - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    \ No newline at end of file diff --git a/platforma/templates/404.html b/platforma/templates/404.html deleted file mode 100644 index 72d18758..00000000 --- a/platforma/templates/404.html +++ /dev/null @@ -1,69 +0,0 @@ - - - - - Platforma Redakcyjna - - - -
    -

    - - - Nie odnaleziono strony

    -

    Strona o podanym przez ciebie adresie:

    -
    {{request.build_absolute_uri}}
    -

    nie instnieje.

    -
      -
    • Sprawdź, czy adres nie zawiera literówek, np: - bog_mnie_oposcil, zamiast bog_mnie_opuscil. -
    • -
    • - Upewnij się, że dokument do którego chcesz się dostać jest na - liście utworów. -
    • -
    -

    Jeśli nadal nie jesteś w stanie odszukać dokumentu, skontaktuj się - z administratorem.

    - - -
    -
- - diff --git a/platforma/templates/500.html b/platforma/templates/500.html deleted file mode 100644 index 1774b5af..00000000 --- a/platforma/templates/500.html +++ /dev/null @@ -1,56 +0,0 @@ - - - - - Platforma Redakcyjna - - - -
-

- - - Błąd po stronie serwera.

-

Niestety nasz serwer WWW nie był w stanie dostarczyć Ci strony o którą prosiłeś.

-

Serdecznie przepraszamy.

-

Administrator został już powiadomiony o błędzie, ale jeśli chciałbyś - przekazać nam więcej informacji na temat błędu, napisz nasz adres.

-
-
- - diff --git a/platforma/templates/503.html b/platforma/templates/503.html deleted file mode 100644 index 7f852762..00000000 --- a/platforma/templates/503.html +++ /dev/null @@ -1,56 +0,0 @@ - - - - - Platforma Redakcyjna - - - -
-

- - - Serwis tymczasowo niedostępny

-

Platfroma redakcyjna serwisu wolnelektury.pl jest - tymczasowo niedostępna z powodu prac administracyjnych. -

-

Prosimy o wyrozumiałość i ponowne odwiedziny.

-
-
- - diff --git a/platforma/templates/admin/index.html b/platforma/templates/admin/index.html deleted file mode 100644 index 45de219d..00000000 --- a/platforma/templates/admin/index.html +++ /dev/null @@ -1,83 +0,0 @@ -{% extends "admin/base_site.html" %} -{% load i18n %} - -{% block extrastyle %}{{ block.super }}{% endblock %} - -{% block coltype %}colMS{% endblock %} - -{% block bodyclass %}dashboard{% endblock %} - -{% block breadcrumbs %}{% endblock %} - -{% block content %} -
- -{% if app_list %} - - {% include "filebrowser/append.html" %} - - {% for app in app_list %} -
- - - {% for model in app.models %} - - {% if model.perms.change %} - - {% else %} - - {% endif %} - - {% if model.perms.add %} - - {% else %} - - {% endif %} - - {% if model.perms.change %} - - {% else %} - - {% endif %} - - {% endfor %} -
{% blocktrans with app.name as name %}{{ name }}{% endblocktrans %}
{{ model.name }}{{ model.name }}{% trans 'Add' %} {% trans 'Change' %} 
-
- {% endfor %} -{% else %} -

{% trans "You don't have permission to edit anything." %}

-{% endif %} -
-{% endblock %} - -{% block sidebar %} - -{% endblock %} diff --git a/platforma/templates/base.html b/platforma/templates/base.html deleted file mode 100644 index ac728d06..00000000 --- a/platforma/templates/base.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - {% block title %}Platforma Redakcyjna{% block subtitle %}{% endblock subtitle %}{% endblock title%} - {% block extrahead %} - {% endblock %} - - -
-
{% block maincontent %} {% endblock %}
-
- - {% block extrabody %}{% endblock %} - - diff --git a/platforma/templates/registration/head_login.html b/platforma/templates/registration/head_login.html deleted file mode 100644 index f051213a..00000000 --- a/platforma/templates/registration/head_login.html +++ /dev/null @@ -1,11 +0,0 @@ -{% load i18n %} - -{% if user.is_authenticated %} -{{ user.username }} | -{% trans "Log Out" %} -{% else %} -{% url login as login_url %} -{% ifnotequal login_url request.path %} - {% trans "Log In" %} -{% endifnotequal %} -{% endif %} diff --git a/platforma/templates/registration/login.html b/platforma/templates/registration/login.html deleted file mode 100644 index e4b0897c..00000000 --- a/platforma/templates/registration/login.html +++ /dev/null @@ -1,15 +0,0 @@ -{% extends "base.html" %} - -{% block subtitle %} - Logowanie {% endblock subtitle %} - -{% block maincontent %} - -
-
-{{ form.as_p }} -

- -
-
- -{% endblock maincontent %} diff --git a/platforma/urls.py b/platforma/urls.py deleted file mode 100644 index 904ad447..00000000 --- a/platforma/urls.py +++ /dev/null @@ -1,29 +0,0 @@ -# -*- coding: utf-8 -*- - -from django.conf.urls.defaults import * -from django.contrib import admin -from django.conf import settings - -admin.autodiscover() - -urlpatterns = patterns('', - # Auth - url(r'^accounts/login/$', 'django_cas.views.login', name='login'), - url(r'^accounts/logout/$', 'django_cas.views.logout', name='logout'), - - # Admin panel - (r'^admin/filebrowser/', include('filebrowser.urls')), - url(r'^admin/doc/', include('django.contrib.admindocs.urls')), - (r'^admin/', include(admin.site.urls)), - - # Static files (should be served by Apache) - url(r'^%s(?P.+)$' % settings.MEDIA_URL[1:], 'django.views.static.serve', - {'document_root': settings.MEDIA_ROOT, 'show_indexes': True}), - url(r'^%s(?P.+)$' % settings.ADMIN_MEDIA_PREFIX[1:], 'django.views.static.serve', - {'document_root': settings.MEDIA_ROOT, 'show_indexes': True}), - url(r'^%s(?P.+)$' % settings.STATIC_URL[1:], 'django.views.static.serve', - {'document_root': settings.STATIC_ROOT, 'show_indexes': True}), - - url(r'^$', 'django.views.generic.simple.redirect_to', {'url': '/documents/'}), - url(r'^documents/', include('wiki.urls')), -) diff --git a/redakcja.vhost.template b/redakcja.vhost.template new file mode 100644 index 00000000..fbd21a9a --- /dev/null +++ b/redakcja.vhost.template @@ -0,0 +1,25 @@ + + ServerName $DOMAIN + ServerAlias $DOMAIN_ALIASES + ServerAdmin $ADMIN_EMAIL + + WSGIDaemonProcess $PROJECT_NAME user=$WSGI_USER group=$WSGI_USER processes=$WSGI_PROCESSES threads=$WSGI_THREADS display-name=%{GROUP} + WSGIProcessGroup $PROJECT_NAME + + WSGIScriptAlias / $WSGI_TARGET + + Order allow,deny + allow from all + + + Alias /media $MEDIA_ROOT + + Options Indexes, FollowLinks + Order allow,deny + Allow from all + + + LogLevel warn + ErrorLog /var/log/apache2/$PROJECT_NAME/error.log + CustomLog /var/log/apache2/$PROJECT_NAME/access.log combined + diff --git a/redakcja.wsgi.template b/redakcja.wsgi.template new file mode 100644 index 00000000..6b772f34 --- /dev/null +++ b/redakcja.wsgi.template @@ -0,0 +1,24 @@ +#!$PYTHON +import site +site.addsitedir('$PYTHON_SITE') + +import os +from os.path import abspath, dirname, join +import sys + +# Redirect sys.stdout to sys.stderr for bad libraries like geopy that use +# print statements for optional import exceptions. +sys.stdout = sys.stderr + +# Add apps and lib directories to PYTHONPATH +sys.path = [ + '$PROJECT_ROOT', + '$PROJECT_ROOT/lib', + '$PROJECT_ROOT/apps', +] + sys.path + +# Run Django +os.environ['DJANGO_SETTINGS_MODULE'] = '$PROJECT_NAME.settings' + +from django.core.handlers.wsgi import WSGIHandler +application = WSGIHandler() diff --git a/redakcja/__init__.py b/redakcja/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/redakcja/compress_settings.py b/redakcja/compress_settings.py new file mode 100644 index 00000000..fa416c41 --- /dev/null +++ b/redakcja/compress_settings.py @@ -0,0 +1,70 @@ +# CSS and JS files to compress +COMPRESS_CSS = { + 'detail': { + 'source_filenames': ( + 'css/master.css', + 'css/gallery.css', + 'css/history.css', + 'css/summary.css', + 'css/html.css', + 'css/jquery.autocomplete.css', + 'css/dialogs.css', + ), + 'output_filename': 'compressed/detail_styles_?.css', + }, + 'listing': { + 'source_filenames': ( + 'css/filelist.css', + ), + 'output_filename': 'compressed/listing_styles_?.css', + } +} + +COMPRESS_JS = { + # everything except codemirror + 'detail': { + 'source_filenames': ( + # libraries + 'js/jquery-1.4.2.min.js', + 'js/jquery.autocomplete.js', + 'js/jquery.blockui.js', + 'js/jquery.elastic.js', + 'js/button_scripts.js', + 'js/slugify.js', + + # wiki scripts + 'js/wiki/wikiapi.js', + 'js/wiki/xslt.js', + + # base UI + 'js/wiki/base.js', + + # dialogs + 'js/wiki/dialog_save.js', + 'js/wiki/dialog_addtag.js', + + # views + 'js/wiki/view_history.js', + 'js/wiki/view_summary.js', + 'js/wiki/view_editor_source.js', + 'js/wiki/view_editor_wysiwyg.js', + 'js/wiki/view_gallery.js', + 'js/wiki/view_column_diff.js', + ), + 'output_filename': 'compressed/detail_scripts_?.js', + }, + 'listing': { + 'source_filenames': ( + 'js/jquery-1.4.2.min.js', + 'js/slugify.js', + ), + 'output_filename': 'compressed/listing_scripts_?.js', + } +} + +COMPRESS = True +COMPRESS_CSS_FILTERS = None +COMPRESS_JS_FILTERS = None +COMPRESS_AUTO = False +COMPRESS_VERSION = True +COMPRESS_VERSIONING = 'compress.versioning.hash.MD5Versioning' diff --git a/redakcja/context_processors.py b/redakcja/context_processors.py new file mode 100644 index 00000000..813d8f36 --- /dev/null +++ b/redakcja/context_processors.py @@ -0,0 +1,9 @@ +# -*- coding: utf-8 + + +def settings(request): + from django.conf import settings + return { + 'MEDIA_URL': settings.MEDIA_URL, + 'STATIC_URL': settings.STATIC_URL, + } diff --git a/redakcja/locale/pl/LC_MESSAGES/django.mo b/redakcja/locale/pl/LC_MESSAGES/django.mo new file mode 100644 index 00000000..a0cefb7b Binary files /dev/null and b/redakcja/locale/pl/LC_MESSAGES/django.mo differ diff --git a/redakcja/locale/pl/LC_MESSAGES/django.po b/redakcja/locale/pl/LC_MESSAGES/django.po new file mode 100644 index 00000000..52d7a6d2 --- /dev/null +++ b/redakcja/locale/pl/LC_MESSAGES/django.po @@ -0,0 +1,69 @@ +# Polskie tłumaczenie dla platformy wolnych lektur. +# Copyright (C) 2009 +# This file is distributed under the same license as the 'platforma' package. +# lrekucki@gmail.com, 2009. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2009-10-16 10:52+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: templates/explorer/editor.html:53 +msgid "Refresh panel" +msgstr "Odśwież panel" + +#: templates/explorer/editor.html:67 +msgid "Print version" +msgstr "Wersja do druku" + +#: templates/explorer/editor.html:96 +msgid "Next page" +msgstr "Następna strona" + +#: templates/explorer/editor.html:100 +msgid "Zoom in" +msgstr "Powiększ" + +#: templates/explorer/editor.html:103 +msgid "Zoom out" +msgstr "Zmniejsz" + +#: templates/explorer/editor.html:106 +msgid "Reset zoom" +msgstr "Oryginalny rozmiar" + +#: templates/explorer/editor.html:155 +msgid "History" +msgstr "Historia" + +#: templates/explorer/editor.html:156 +msgid "Push" +msgstr "Zatwierdź" + +#: templates/explorer/editor.html:157 +msgid "Pull" +msgstr "Uaktualnij" + +#: templates/explorer/editor.html:158 +msgid "Save" +msgstr "Zapisz" + +#: templates/explorer/editor.html:159 +msgid "Quick save" +msgstr "Szybki zapis" + +#: templates/registration/head_login.html:5 +msgid "Log Out" +msgstr "Wyloguj" + +#: templates/registration/head_login.html:9 +msgid "Log In" +msgstr "Logowanie" diff --git a/redakcja/manage.py b/redakcja/manage.py new file mode 100755 index 00000000..1fc25dde --- /dev/null +++ b/redakcja/manage.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python +from django.core.management import execute_manager +try: + import settings # Assumed to be in the same directory. +except ImportError: + import sys + sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__) + sys.exit(1) + +if __name__ == "__main__": + # Append lib and apps directories to PYTHONPATH + from os import path + import sys + + PROJECT_ROOT = path.realpath(path.dirname(__file__)) + sys.path += [PROJECT_ROOT + '/../apps', PROJECT_ROOT + '/../lib'] + + execute_manager(settings) diff --git a/redakcja/settings.py b/redakcja/settings.py new file mode 100644 index 00000000..8fd71c71 --- /dev/null +++ b/redakcja/settings.py @@ -0,0 +1,186 @@ +# -*- coding: utf-8 -*- +import os.path + +PROJECT_ROOT = os.path.realpath(os.path.dirname(__file__)) + +DEBUG = False +TEMPLATE_DEBUG = DEBUG + +MAINTENANCE_MODE = False + +ADMINS = ( + # (u'Marek Stępniowski', 'marek@stepniowski.com'), + (u'Łukasz Rekucki', 'lrekucki@gmail.com'), +) + +MANAGERS = ADMINS + +DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. +DATABASE_NAME = PROJECT_ROOT + '/dev.sqlite' # Or path to database file if using sqlite3. +DATABASE_USER = '' # Not used with sqlite3. +DATABASE_PASSWORD = '' # Not used with sqlite3. +DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3. +DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3. + +# Local time zone for this installation. Choices can be found here: +# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name +# although not all choices may be available on all operating systems. +# If running in a Windows environment this must be set to the same as your +# system time zone. +TIME_ZONE = 'Europe/Warsaw' + +# Language code for this installation. All choices can be found here: +# http://www.i18nguy.com/unicode/language-identifiers.html +LANGUAGE_CODE = 'pl' + +#import locale +#locale.setlocale(locale.LC_ALL, '') + +SITE_ID = 1 + +# If you set this to False, Django will make some optimizations so as not +# to load the internationalization machinery. +USE_I18N = True + +# Absolute path to the directory that holds media. +# Example: "/home/media/media.lawrence.com/" +MEDIA_ROOT = PROJECT_ROOT + '/media/dynamic' +STATIC_ROOT = PROJECT_ROOT + '/static/' + +# URL that handles the media served from MEDIA_ROOT. Make sure to use a +# trailing slash if there is a path component (optional in other cases). +# Examples: "http://media.lawrence.com", "http://example.com/media/" +MEDIA_URL = '/media/dynamic/' +STATIC_URL = '/media/static/' + +# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a +# trailing slash. +# Examples: "http://foo.com/media/", "/media/". +ADMIN_MEDIA_PREFIX = '/media/admin-media/' + +# Make this unique, and don't share it with anybody. +SECRET_KEY = 'ife@x^_lak+x84=lxtr!-ur$5g$+s6xt85gbbm@e_fk6q3r8=+' +SESSION_COOKIE_NAME = "redakcja_sessionid" + +# List of callables that know how to import templates from various sources. +TEMPLATE_LOADERS = ( + 'django.template.loaders.filesystem.load_template_source', + 'django.template.loaders.app_directories.load_template_source', +# 'django.template.loaders.eggs.load_template_source', +) + +TEMPLATE_CONTEXT_PROCESSORS = ( + "django.core.context_processors.auth", + "django.core.context_processors.debug", + "django.core.context_processors.i18n", + "redakcja.context_processors.settings", # this is instead of media + "django.core.context_processors.request", +) + + +MIDDLEWARE_CLASSES = ( + 'django.middleware.common.CommonMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django_cas.middleware.CASMiddleware', + + 'django.middleware.doc.XViewMiddleware', + 'maintenancemode.middleware.MaintenanceModeMiddleware', + # 'debug_toolbar.middleware.DebugToolbarMiddleware' # +) + +AUTHENTICATION_BACKENDS = ( + 'django.contrib.auth.backends.ModelBackend', + 'django_cas.backends.CASBackend', +) + +ROOT_URLCONF = 'redakcja.urls' + +TEMPLATE_DIRS = ( + PROJECT_ROOT + '/templates', +) + + +# +# Central Auth System +# +## Set this to where the CAS server lives +# CAS_SERVER_URL = "http://cas.fnp.pl/ +CAS_LOGOUT_COMPLETELY = True + +from compress_settings import * + +INSTALLED_APPS = ( + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.sites', + 'django.contrib.admin', + 'django.contrib.admindocs', + + 'django_cas', + 'compress', + 'south', + 'sorl.thumbnail', + 'filebrowser', + + 'wiki', + 'toolbar', +) + + +# +# Nose tests +# + +TEST_RUNNER = 'django_nose.run_tests' +TEST_MODULES = ('wiki', 'toolbar', 'vstorage') +NOSE_ARGS = ( + '--tests=' + ','.join(TEST_MODULES), + '--cover-package=' + ','.join(TEST_MODULES), + '-d', + '--with-coverage', + '--with-doctest', +) + + +FILEBROWSER_URL_FILEBROWSER_MEDIA = STATIC_URL + 'filebrowser/' +FILEBROWSER_DIRECTORY = 'images/' +FILEBROWSER_ADMIN_VERSIONS = [] +FILEBROWSER_VERSIONS_BASEDIR = 'thumbnails/' +FILEBROWSER_DEFAULT_ORDER = "path_relative" + +# REPOSITORY_PATH = '/Users/zuber/Projekty/platforma/files/books' +IMAGE_DIR = 'images' + + +WL_API_CONFIG = { + "URL": "http://localhost:7000/api/", + "AUTH_REALM": "WL API", + "AUTH_USER": "platforma", + "AUTH_PASSWD": "platforma", +} + +# Import localsettings file, which may override settings defined here +try: + from localsettings import * +except ImportError: + pass + +try: + LOGGING_CONFIG_FILE +except NameError: + LOGGING_CONFIG_FILE = os.path.join(PROJECT_ROOT, 'config', + ('logging.cfg' if not DEBUG else 'logging.cfg.dev')) +try: + import logging + + if os.path.isfile(LOGGING_CONFIG_FILE): + import logging.config + logging.config.fileConfig(LOGGING_CONFIG_FILE) + else: + import sys + logging.basicConfig(stream=sys.stderr) +except ImportError as exc: + raise diff --git a/redakcja/static/css/dialogs.css b/redakcja/static/css/dialogs.css new file mode 100644 index 00000000..1c22868f --- /dev/null +++ b/redakcja/static/css/dialogs.css @@ -0,0 +1,32 @@ +.dialog { + display: none; + padding: 5px; + text-align: left; + cursor: auto; + background-color: #E1E1E1; /* #e0ffb8; */ +} + +.dialog .help_text { + font-size: 11px; + color: #2e3536; +} + +.dialog .action_area { + padding: 1em 0.5em 0.5em; + border-top: 1px solid black; + margin-top: 0.5em; +} + +.dialog p { + margin: 0.5em; +} + +*[data-ui-error-for] { + color: red; + font-weight: bold; +} + +#save_dialog textarea { + width: 90%; + margin: 0.2em 4%; +} \ No newline at end of file diff --git a/redakcja/static/css/filelist.css b/redakcja/static/css/filelist.css new file mode 100644 index 00000000..a0b4995f --- /dev/null +++ b/redakcja/static/css/filelist.css @@ -0,0 +1,67 @@ +/* + Document : filelist + Created on : 2009-09-04, 20:44:44 + Author : lreqc + Description: + Dodatkowe style dla listy plików na stronie głównej. +*/ + +body { + background-color: #84BF2A; +} + +#content { + background: #EFEFEF; + border: 1px solid black; + padding: 0.5em 2em; + margin: 1em; + overflow: hidden; +} + +#content h1 img { + vertical-align: middle; +} + +#content h1 { + border-bottom: 2px solid black; + padding: 0.5em; + font-size: 2opt; + font-family: sans-serif; +} + +#file-list { + overflow: visible; + float: left; + max-width: 50%; + padding-right: 2%; + border-right: 1px dashed black; + +} + +#last-edited-list { + float: left; + max-width: 35%; + margin-left: 5%; +} + +#last-edited-list ul { + margin: 0px; +} + +#last-edited-list li { + margin-bottom: 1em; +} + +#last-edited-list .date { + font-size: 70%; + color: grey; +} + +a, a:visited, a:active { + color: blue; + text-decoration: none; +} + +a:hover { + text-decoration: underline; +} \ No newline at end of file diff --git a/redakcja/static/css/gallery.css b/redakcja/static/css/gallery.css new file mode 100644 index 00000000..379abcce --- /dev/null +++ b/redakcja/static/css/gallery.css @@ -0,0 +1,60 @@ +/* =========== */ +/* = Gallery = */ +/* =========== */ + +#side-gallery { + position: absolute; + /* overflow: hidden; */ + top: 0px; + right: 0px; + bottom: 0px; + width: 480px; + display: none; + background-color: #FFF; +} + +#side-gallery .error_message +{ + background-color: white; + color: black; + padding: 0.5em 1em; +} + +.change-gallery-panel { + width: 100%; + border-bottom: 1px solid #777; + background-color: #C1C1C1; + margin: 0; + padding: 2px; + z-index: 10; +} + +.gallery-image { + position: absolute; + top: 30px; + right: 0; + bottom: 0; + left: 0; + margin: 0; + border: none; + background-color: transparent; + overflow: hidden; +} + +.gallery-image img { + position: absolute; + -moz-drag: none; + user-select: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + cursor: pointer; + + background-color: white; + min-height: 100px; + min-width: 100px; +} + +.gallery-image img[src=''] { + background-color: red; +} diff --git a/redakcja/static/css/history.css b/redakcja/static/css/history.css new file mode 100644 index 00000000..b3191165 --- /dev/null +++ b/redakcja/static/css/history.css @@ -0,0 +1,155 @@ +#history-view { + overflow: auto; + position: absolute; + top: 30px; /* 0 for no toolbar, 30 for toolbar */ + bottom: 0px; + left: 0px; + right: 0px; + z-index: 1; +} + +/* + * File History + */ +#changes-list-container { + margin: 1em auto; + width: 70%; +} + +table#changes-list-container { + border-spacing: 0px 15px; +} + +#changes-list { + margin: 0.5em 0.2em; +} + +#changes-list td { + padding: 0.5em 1em; +} + +#changes-list .entry { + position: relative; + padding: 0.5em; + padding-left: 3em; + margin: 0.5em; +} + +#changes-list .entry:hover { + background-color: #f0f0f0; +} + +#changes-list .entry.selected { + background-color: #ffec63; +} + +#changes-list .tag { + display: inline-block; + visibility: hidden; + width: 60px; + margin: 0 0.5em 0 0; + font-size: 11px; + padding: 3px 2px; + text-align: center; + color: black; + background: #add8e6; + cursor: pointer; + vertical-align: middle; + -moz-border-radius: 10px; + -webkit-border-radius: 10px; + border-radius: 10px; +} + +#changes-list .entry:hover .tag { + visibility: visible; +} + +#changes-list .tag:hover { + background: #bde8f6; +} + +#changes-list *[data-version-tag] { + visibility: visible; + border: 1px solid black; + color: black; +} + +#changes-list *[data-stub-value = +'version'] { + font-weight: bold; +} + +#changes-list td[data-stub-value = +'version'] { + vertical-align: text-top; +} + +#changes-list *[data-stub-value = +'date'], #changes-list *[data-stub-value = 'author'] { + font-size: 11px; + color: gray; +} + +/* + * Graphical DIFF view + * + */ +#history-view .diff_table { + width: 90%; +} + +.editor.DiffPerspective { + overflow-y: scroll; +} + +.diff_table { + border-width: 1px; + border-style: solid; + border-color: black; + empty-cells: show; + border-spacing: 0px; +} + +.diff_table td { + border-width: 0px 1px 1px 0px; + border-style: dotted; + border-color: grey; + font-size: 10px; + line-height: 20px; + font-family: monospace; + padding: 0px; + white-space: pre-line; + /*word-wrap:break-word; + word-break:break-all; */ +} + +.diff_table th { + border-width: 0px 1px 1px 0px; + border-style: solid; + border-color: black; + background: #e5ffe5; +} + +/* .diff_table td.left, .diff_table td.right { + width: 50%; + }*/ +.diff_table tr.change { + background-color: #dcdcdc; +} + +.diff_mark { + display: inline-block; + padding: 2px; +} + +.diff_mark_removed { + background-color: #ff9c94; +} + +.diff_mark_added { + background-color: #90ee90; +} + +.diff_mark_changed { + background-color: yellow; +} \ No newline at end of file diff --git a/redakcja/static/css/html.css b/redakcja/static/css/html.css new file mode 100644 index 00000000..bd710a8c --- /dev/null +++ b/redakcja/static/css/html.css @@ -0,0 +1,569 @@ +/* Style widoku HTML. Nie należy tu ustawiać position ani marginesów */ +.htmlview { + counter-reset: main; + font-size: 16px; + font-family: "Georgia", "Times New Roman", serif; + line-height: 1.5em; + padding: 3em; + padding-left: 45px; + overflow-y: scroll; + overflow-x: auto; +} + +.htmlview[data-tag-names-visible] { + padding-left: 90px; +} + +/* + .htmlview[data-tag-names-visible] *[x-editable]:not(*[x-common])::before { + display: block; + float: left; + clear: left; + content: attr(x-node); + font-weight: bold; + font-style: normal; + font-variant:normal; + font-size: 8px; + line-height: 8px; + margin-bottom: 4px; + + padding: 3px 4px; + vertical-align: super; + background-color:#add8e6; + margin-left: -80px; + width: 70px; + text-align: center; + + -webkit-border-radius: 4px; + } + */ +.htmlview *[x-node = 'RDF'] { + display: none; +} + +.htmlview * { + position: relative; +} + +.htmlview div { + max-width: 36em; +} + +.htmlview #toc { + display: none; +} + +.htmlview a { + color: blue; + text-decoration: none; +} + +.htmlview a:hover { + text-decoration: none; +} + +.htmlview h1 { + font-size: 3em; + margin: 1.5em 0; + text-align: center; + line-height: 1.5em; + font-weight: bold; +} + +.htmlview h2 { + font-size: 2em; + margin: 1.5em 0 0; + font-weight: bold; + line-height: 1.5em; +} + +.htmlview h3 { + font-size: 1.5em; + margin: 1.5em 0 0; + font-weight: normal; + line-height: 1.5em; +} + +.htmlview h4 { + font-size: 1em; + margin: 1.5em 0 0; + line-height: 1.5em; +} + +.htmlview p { + margin: 0; +} + +.htmlview #footnotes div { + margin: 1.5em 0 0 0; +} + +.htmlview #footnotes p { + margin-left: 2.5em; + font-size: 0.875em; +} + +.htmlview blockquote { + font-size: 0.875em; +} + +/* ============= */ +/* = Numbering = */ +/* ============= */ +.htmlview .anchor { + position: relative; + margin: 0em; + left: -2.2em; + color: #777; + font-size: 12px; + width: 2em; + text-align: center; + padding: 0.25em 0.7em; + line-height: 1.5em; +} + +.htmlview .anchor:hover, .htmlview .anchor:active { + color: #FFF; + background-color: #CCC; +} + +/* =================== */ +/* = Custom elements = */ +/* =================== */ +.htmlview .autor_utwor { + font-size: 0.5em; + display: block; + line-height: 1.5em; + margin-bottom: 0.25em; +} + +.htmlview .dzielo_nadrzedne { + /* */ +} + +.htmlview .podtytul { + /* */ +} + +.htmlview .didaskalia { + font-style: italic; + margin: 0.5em 0 0 1.5em; +} + +.htmlview .kwestia { + margin: 0.5em 0 0; +} + +.htmlview .strofa { + margin: 1.5em 0 0.5em auto; +} + +/* wersy */ +.htmlview .strofa .wers_wciety, .htmlview .strofa .wers_wciety[data-wlf-typ='1'] { + margin-left: 1em; +} + +.htmlview .strofa .wers_wciety[data-wlf-typ='2'], .htmlview .strofa .wers_cd { + margin-left: 2em; +} + +.htmlview .strofa .wers_wciety[data-wlf-typ='3'] { + margin-left: 3em; +} + +.htmlview .strofa .wers_wciety[data-wlf-typ='4'] { + margin-left: 4em; +} + +.htmlview .strofa .wers_wciety[data-wlf-typ='5'] { + margin-left: 5em; +} + +.htmlview .strofa .wers_wciety[data-wlf-typ='6'] { + margin-left: 6em; +} + +/* błędne wersy */ +.htmlview *: +not(.strofa) > *[x-verse]::after { + content: "Ten wers znajduje się poza strofą."; + display: inline; + background: red; + font-size: 8pt; + border: 1px solid black; + -moz-border-radius: 10px; + -webkit-border-radius: 10px; + padding: 1px 1em; + margin-left: 1em; + vertical-align: super; +} + +.htmlview .kwestia .strofa { + margin: 0; +} + +.htmlview .akap, .htmlview .akap_cd, .htmlview .akap_dialog { + text-align: justify; + margin: 1.5em 0 0; +} + +.htmlview .motto_container { + display: inline-block; + margin: 1.5em 0 0; + clear: right; +} + +.htmlview .motto { + text-align: justify; + font-style: italic; +} + +.htmlview p.motto_podpis { + position: relative; + right: -3em; + text-align: right; +} + +.htmlview div.fragment { + border-bottom: 0.1em solid #999; + padding-bottom: 1.5em; +} + +.htmlview div.nota p, .htmlview div.dedykacja p { + text-align: right; + font-style: italic; +} + +.htmlview br.sekcja_swiatlo { + height: 3em; + /* visibility: hidden; */ +} + +.htmlview hr.separator_linia { + margin: 1.5em 0; + border: none; + border-bottom: 0.1em solid #000; +} + +.htmlview p.sekcja_asterysk { + padding: 0; + margin: 1.5em 0; + text-align: center; +} + +.htmlview div.lista_osob ol { + list-style: none; + padding: 0 0 0 1.5em; +} + +.htmlview p.miejsce_czas { + font-style: italic; +} + +.htmlview .mat, .htmlview .slowo_obce, .htmlview .tytul_dziela, .htmlview .didaskalia { + font-style: italic; +} + +.htmlview .wyroznienie { + letter-spacing: 0.1em; +} + +.htmlview .osoba { + font-style: normal; + font-variant: small-caps; +} + +.htmlview .parse-warning { + display: block; + font-size: 10pt; + background: #C0C0C0; + margin: 1em; +} + +.parse-warning .message { + color: purple; + font-weight: bold; +} + +/* Uwaga/Extra */ +.htmlview .uwaga { + background-color: #96e0e4; + border: 1px solid black; + -moz-border-radius: 10px; + -webkit-border-radius: 10px; + display: block; + font-size: 10pt; + line-height: 12pt; + padding: 2px 1em; + float: right; + max-width: 20%; + max-height: 24pt; + margin-left: 0.5em; + overflow: hidden; + z-index: 500; +} + +div[x-node] > .uwaga { + float: none; + padding: 0.5em 1em; + margin: 1em; + max-width: 100%; + max-height: 100%; +} + +.htmlview .uwaga:hover { + max-height: 100%; +} + +.htmlview .annotation-inline-box .uwaga { + max-height: 100%; +} + +/* Motywy */ +/* ======================== */ +/* = Footnotes and themes = */ +/* ======================== */ +.htmlview .begin, .htmlview .end { + background: green; +} + +.htmlview .motyw { + /* position: absolute; */ + float: right; + left: auto; + clear: right; + width: 10em; + font-weight: normal; + font-size: 13px; + line-height: 18px; + font-variant: normal; + text-decoration: none; + background-color: #fff; + /* border: 1px solid gray; + + border-right: none; + */ + z-index: 1; + -moz-user-select: -moz-none; + -webkit-user-select: none; + user-select: none; + margin-right: -12em; + text-align: left; +} + +.htmlview .motyw[x-editable] { + border-left: 4px solid #DDD; + padding: 0.2em 0.2em 0.2em 0.5em; + margin-top: 0.2em; +} + +/* + * Przypisy + */ +/* Znaczniki w tekście */ +.htmlview .annotation:before { + content: "[" counter(main) "]"; + counter-increment: main; + vertical-align: super; + text-decoration: none; + font-size: 66%; +} + +.htmlview .annotation:hover { + background-color: #96e0e4; +} +*.htmlview *.annotation-inline-box { + position: static; +} + +/* + * Przypisy w tekście + */ +.htmlview .annotation-inline-box > span[x-annotation-box] { + display: none; + position: absolute; + width: 300px; + font-size: 10pt; + line-height: 12pt; + font-weight: normal; + font-style: normal; + background: #fffe93; + border-color: black; + border-width: 1px; + border-style: solid; + border-radius: 10px; + -moz-border-radius: 10px; + -webkit-border-radius: 10px; + padding: 3px 5px; + text-decoration: none; + z-index: 600; +} + +/* + * Przypisy na końcu utworu (aktualnie nieuzywane) + */ +.htmlview .annotations-block { + counter-reset: secondary; +} + +.htmlview .annotations-block .annotation-body { + position: relative; + padding-left: 2.5em; + padding-top: 0.2em; +} + +.htmlview .annotations-block .annotation-backref { + position: absolute; + top: 0.4em; + left: -0.4em; + width: 2.5em; + text-align: right; +} + +.htmlview .annotations-block .annotation-backref:before { + content: "[" counter(secondary) "]"; + counter-increment: secondary; +} + +/* + * EDITABLE ELEMENTS + */ +.htmlview *[x-editable] { + position: relative; + padding: 2px; + margin-left: 0; + border: 1px solid #FFF; +} + +/* focused editable element */ +.htmlview *[x-editable]:hover { + z-index: 900; +} + +.htmlview *[x-editable][x-open] { + visibility: hidden; +} + +.edit-button, .delete-button, .accept-button { + position: absolute; + top: -21px; + left: -1px; + width: 72px; + height: 21px; + display: block; + /* margin: 4px 0 2px 0;*/ + padding: 5px 5px 2px 5px; + border: none; + background-color: #FAFAFA; + /* z-index: 3000;*/ + /* color: #FFF; + z-index: 1500; + */ + border: 1px solid #DDD; + border-bottom: none; +} + +.delete-button { + left: 70px; +} + +.edit-button:hover, .edit-button:active, +.delete-button:hover, .delete-button:active, +.accept-button:hover, .accept-button:active { + /* color: #FFF;*/ + background-color: #999; + color: #FFF; +} + +/* + * VISIBILITY RULES + */ +.default-menu { + visibility: inherit; + opacity: 0.2; +} + +.default-menu:hover { + opacity: 1; + z-index: 5000; +} + +.htmlview *[x-annotation-box] > .default-menu { + opacity: 1; +} + +.htmlview *[x-editable][x-open] > .default-menu { + visibility: hidden; +} + +.htmlview *[x-editable][x-open] *[x-annotation-box] > .default-menu { + visibility: hidden; +} + +.htmlview *[x-editable] > .edit-menu { + visibility: hidden; +} + +.htmlview *[x-editable] *[x-annotation-box] > .edit-menu { + visibility: hidden; +} + +.htmlview *[x-editable][x-open] > .edit-menu { + visibility: visible; +} + +.htmlview *[x-editable][x-open] *[x-annotation-box] > .edit-menu { + visibility: visible; +} + +.html-editarea { + border: 0px; + background-color: gray; + padding: 1px; + z-index: 2000; + position: absolute; +} + +.html-editarea textarea { + position: absolute; + top: 0; + margin: 0px; + padding: 0px; + width: 100%; + height: 100%; + z-index: 0; + font-size: 10pt; + /* background-color: ivory;*/ +} + +.htmlview .out-of-flow-text { + display: block; + font-face: monospace; + border: 2px solid red !important; + white-space: pre-line; +} + +.htmlview .out-of-flow-text::before { + content: "Tekst w tej ramce nie jest otagowany!"; + background-color: #ff6c6c; + color: black; + font-size: 10pt; + line-height: 12pt; + border: 1px solid black; + -moz-border-radius: 10px; + -webkit-border-radius: 10px; + padding: 5px 1em; + margin: 0em; + margin-left: 1em; + text-align: justify; + display: inline; + float: right; + max-width: 25%; +} + +.unknown-tag { + background-color: yellow; + margin: -0.25em; + padding: 0.25em; + border: 1px solid orange; +} \ No newline at end of file diff --git a/redakcja/static/css/html_print.css b/redakcja/static/css/html_print.css new file mode 100644 index 00000000..38cb5968 --- /dev/null +++ b/redakcja/static/css/html_print.css @@ -0,0 +1,229 @@ +/* Style widoku HTML. Nie należy tu ustawiać position ani marginesów */ +.htmlview { + font-size: 16px; + font: Georgia, "Times New Roman", serif; + line-height: 1.5em; + padding: 3em; +} + +.htmlview div { + max-width: 36em; +} + +.htmlview #toc { + display: none; +} + +.htmlview a { + color: blue; + text-decoration: none; +} + +.htmlview h1 { + font-size: 3em; + margin: 1.5em 0; + text-align: center; + line-height: 1.5em; + font-weight: bold; +} + +.htmlview h2 { + font-size: 2em; + margin: 1.5em 0 0; + font-weight: bold; + line-height: 1.5em; +} + +.htmlview h3 { + font-size: 1.5em; + margin: 1.5em 0 0; + font-weight: normal; + line-height: 1.5em; +} + +.htmlview h4 { + font-size: 1em; + margin: 1.5em 0 0; + line-height: 1.5em; +} + +.htmlview p { + margin: 0; +} + +/* ======================== */ +/* = Footnotes and themes = */ +/* ======================== */ +.htmlview .theme-begin { + border-left: 0.1em solid #DDDDDD; + color: #777; + padding: 0 0.5em; + width: 7.5em; + font-style: normal; + font-weight: normal; + font-size: 16px; + float: right; + margin-right: -9.5em; + clear: both; + left: 40em; + line-height: 1.5em; + text-align: left; +} + +.htmlview .annotation { + font-style: normal; + font-weight: normal; + font-size: 12px; +} + +.htmlview #footnotes .annotation { + display: block; + float: left; + width: 2.5em; + clear: both; +} + +.htmlview #footnotes div { + margin: 1.5em 0 0 0; +} + +.htmlview #footnotes p { + margin-left: 2.5em; + font-size: 0.875em; +} + +.htmlview blockquote { + font-size: 0.875em; +} + +/* ============= */ +/* = Numbering = */ +/* ============= */ +.htmlview p { + position: relative; +} + +.htmlview .anchor { + position: absolute; + margin: 0em; + left: -3em; + color: #777; + font-size: 12px; + width: 2em; + text-align: center; + padding: 0.25em 0.5em; + line-height: 1.5em; +} + +.htmlview .anchor:hover, .htmlview .anchor:active { + color: #FFF; + background-color: #CCC; +} + +/* =================== */ +/* = Custom elements = */ +/* =================== */ +.htmlview span.author { + font-size: 0.5em; + display: block; + line-height: 1.5em; + margin-bottom: 0.25em; +} + +.htmlview span.collection { + font-size: 0.375em; + display: block; + line-height: 1.5em; + margin-bottom: -0.25em; +} + +.htmlview span.subtitle { + font-size: 0.5em; + display: block; + line-height: 1.5em; + margin-top: -0.25em; +} + +.htmlview div.didaskalia { + font-style: italic; + margin: 0.5em 0 0 1.5em; +} + +.htmlview div.kwestia { + margin: 0.5em 0 0; +} + +.htmlview div.stanza { + margin: 1.5em 0 0; +} + +.htmlview div.kwestia div.stanza { + margin: 0; +} + +.htmlview p.paragraph { + text-align: justify; + margin: 1.5em 0 0; +} + +.htmlview p.motto { + text-align: justify; + font-style: italic; + margin: 1.5em 0 0; +} + +.htmlview p.motto_podpis { + font-size: 0.875em; + text-align: right; +} + +.htmlview div.fragment { + border-bottom: 0.1em solid #999; + padding-bottom: 1.5em; +} + +.htmlview div.note p, .htmlview div.dedication p, +.htmlview div.note p.paragraph, .htmlview div.dedication p.paragraph { + text-align: right; + font-style: italic; +} + +.htmlview hr.spacer { + height: 3em; + visibility: hidden; +} + +.htmlview hr.spacer-line { + margin: 1.5em 0; + border: none; + border-bottom: 0.1em solid #000; +} + +.htmlview p.spacer-asterisk { + padding: 0; + margin: 1.5em 0; + text-align: center; +} + +.htmlview div.person-list ol { + list-style: none; + padding: 0 0 0 1.5em; +} + +.htmlview p.place-and-time { + font-style: italic; +} + +.htmlview em.math, .htmlview em.foreign-word, +.htmlview em.book-title, .htmlview em.didaskalia { + font-style: italic; +} + +.htmlview em.author-emphasis { + letter-spacing: 0.1em; +} + +.htmlview em.person { + font-style: normal; + font-variant: small-caps; +} diff --git a/redakcja/static/css/jquery.autocomplete.css b/redakcja/static/css/jquery.autocomplete.css new file mode 100644 index 00000000..91b62283 --- /dev/null +++ b/redakcja/static/css/jquery.autocomplete.css @@ -0,0 +1,48 @@ +.ac_results { + padding: 0px; + border: 1px solid black; + background-color: white; + overflow: hidden; + z-index: 99999; +} + +.ac_results ul { + width: 100%; + list-style-position: outside; + list-style: none; + padding: 0; + margin: 0; +} + +.ac_results li { + margin: 0px; + padding: 2px 5px; + cursor: default; + display: block; + /* + if width will be 100% horizontal scrollbar will apear + when scroll mode will be used + */ + /*width: 100%;*/ + font: menu; + font-size: 12px; + /* + it is very important, if line-height not setted or setted + in relative units scroll will be broken in firefox + */ + line-height: 16px; + overflow: hidden; +} + +.ac_loading { + background: white url('indicator.gif') right center no-repeat; +} + +.ac_odd { + background-color: #eee; +} + +.ac_over { + background-color: #0A246A; + color: white; +} diff --git a/redakcja/static/css/master.css b/redakcja/static/css/master.css new file mode 100644 index 00000000..ae742667 --- /dev/null +++ b/redakcja/static/css/master.css @@ -0,0 +1,320 @@ +a, a:visited, a:active { + color: blue; + text-decoration: none; +} + +a:hover { + text-decoration: underline; +} + + +body { + margin: 0; + overflow: hidden; + padding: 0; + min-width: 960px; + width: 100%; + height: 100%; +} + +.vsplitbar { + position: absolute; + top: 0px; + bottom: 0; + right: 0; + width: 26px; + background: #C1C1C1 url(../img/gallery.png) no-repeat scroll center center; + border-left: 2px solid #999; + border-right: 2px solid #999; + cursor: pointer; +} + +.vsplitbar:hover { + background-color: yellow; + border-color: orange; +} + +.editor { + position: absolute; + top: 0px; + bottom: 0; + left: 0; + right: 30px; + overflow: hidden; +} + +#editor.readonly .editor { + right: 0px; +} + +#html-view { + overflow: auto; + position: absolute; + top: 33px; + bottom: 0; + left: 0; + right: 0; + z-index: 1; +} + +#splitter { + position: fixed; + top: 31px; + left: 0px; + right: 0px; + bottom: 0px; + overflow: hidden; +} + + +#header { + position: fixed; + top: 0px; + right: 0px; + left: 0px; + height: 30px; + border-bottom: 1px solid #999; + + margin: 0; + padding: 0; + background-color: #C1C1C1; + background-image: -webkit-gradient(linear, left top, left bottom, from(#C1C1C1), color-stop(0.9, #A2A2A2)); + + /* Firefox 3.6 */ + background-image: -moz-linear-gradient(top left, #C1C1C1, #A2A2A2, 90%); + + font: 11px Helvetica, Verdana, sans-serif; + font-weight: bold; +} + +#header h1, #header h1 a { + margin: 0; + padding: 0; + font: 17px Helvetica, Verdana, sans-serif; + font-weight: bold; + float: left; + padding: 3px 6px 2px 6px; + color: #222; + line-height: 20px; +} + +#header h1 a { + text-decoration: none; + color: #222; +} + +#tabs { + overflow: hidden; + margin: 0; + padding: 0; + height: 31px; + border: 0px; + padding-left: 1em; +} + +#tabs li { + height: 18px; + margin-top: 6px; + margin-bottom: 0px; + + -webkit-user-select: none; + cursor: pointer; + display: block; + float: left; + + padding-left: 12px; + padding-right: 12px; + padding-top: 5px; + + font-weight: bold; + color: #222; + margin-left: 4px; + + background-color: #A2A2A2; + + -moz-box-shadow: 1px -1px 2px rgba(127, 127, 127, 0.25); + -webkit-box-shadow: 1px -1px 2px rgba(127, 127, 127, 0.25); + + border: 1px solid #999; + border-bottom-width: 0px; + -moz-border-radius: 4px 4px 0px 0px; + -webkit-border-radius: 4px; + -webkit-border-bottom-left-radius: 0px; + -webkit-border-bottom-right-radius: 0px; +} + +#tabs li.active { + background-color: #C1C1C1; +} + +#tools { + float: right; + clear: right; + overflow: hidden; + margin: 0; + padding: 0; + height: 30px; + margin-right: 5px; + line-height: 30px; + font-size: 10px; + vertical-align: middle; +} + + +/* + * Toolbars + */ + +.toolbar { + width: 100%; + border-bottom: 1px solid #777; + background-color: #C1C1C1; + margin: 0; + padding: 2px; + z-index: 100; + height: 28px; +} + +.toolbar button { + display: block; + float: left; + margin: 4px 0 2px 0; + padding: 2px 5px; + border: none; + background: none; +} + +.toolbar button img { + margin: 0; + padding: 0; + margin-bottom: -3px; +} + + +.toolbar select { + float: left; + margin: 1px 5px 1px 0; + background: none; + border: 1px solid #999; + padding: 1px; +} + +.toolbar input { + float: left; + font-size: 11px; + padding: 0; + margin: 4px 5px 0px 5px; + vertical-align:baseline; +} + +.toolbar-end { + clear: both; +} + +.toolbar button:hover, .toolbar button:active { + background: #777; + color: #FFF; + -webkit-border-radius: 10px; + -moz-border-radius: 10px; +} + +/* Remove extra padding in Firefox */ +button::-moz-focus-inner { + border: 0; + padding: 0; +} + +p { margin: 0;} + +#body-wrap { + height: 100%; + width: 100%; +} + +#content { + height: 100%; + width: 100%; +} + +#loading-overlay { + background-color: #FFF; + position: absolute; + z-index: 1000; + padding: 0; + top: 0; + left: 0; + width: 100%; + height: 100%; +} + +#loading-message { + position: absolute; + height: 20px; + width: 120px; + left: 50%; + margin-left: -60px; + top: 50%; + margin-top: -10px; +/* text-align: center;*/ +} + +#loading-message img { + float: left; + margin-right: 10px; + margin-top: -6px; +} + +/* + * CodeMirror + */ + +.CodeMirror-line-numbers { + padding: 0px; + padding-top: 5px; + text-align: right; + overflow: hidden; + width: 40px; + border-right: 1px solid black; + background-color: #e6e6fa; +} + +.CodeMirror-line-numbers div { + display: block; + font-family:"Lucida Console", monospace; + font-size: 13px; + line-height: 18px; + padding-right: 5px; +} + +img.tabclose { + padding-left: 8px; + width: 16px; + height: 16px; + vertical-align: middle; + vertical-align: text-bottom; +} + + +/* + * HTML Editor view + */ + +.htmlview { + z-index: 1; + overflow: hidden; +} + +.htmlview *[x-editable] { + background-color: white; + +} +.htmlview .active[x-editable] { + background-color: #FAFAFA; + border: 1px solid #DDD; +/* -webkit-transition: all 1s linear;*/ +} + +.blockOverlay { + background-color: black; + opacity: 0.4; +} diff --git a/redakcja/static/css/summary.css b/redakcja/static/css/summary.css new file mode 100644 index 00000000..8fac6e1b --- /dev/null +++ b/redakcja/static/css/summary.css @@ -0,0 +1,31 @@ +#summary-view-editor { + background: white; +} + +#summary-view { + padding: 1em; +} + +#summary-view .book-cover { + float: left; + margin: 1em; + margin-right: 2em; + + height: 300px; + width: 212px; + + + border: 1px dashed black; +} + +#summary-view p { + margin: 0.5em; +} + +#summary-view label { + font-weight: bold; +} + +#summary-view .book-cover { + +} diff --git a/redakcja/static/css/xmlcolors_15032010.css b/redakcja/static/css/xmlcolors_15032010.css new file mode 100644 index 00000000..099f94aa --- /dev/null +++ b/redakcja/static/css/xmlcolors_15032010.css @@ -0,0 +1,61 @@ +.editbox { + margin: .4em; + margin-top: 5px; + margin-left: 5px; + padding: 0; + font-family:"Lucida Console", monospace; + font-size: 13px; + line-height: 18px; + color: black; +} + +.editbox p { + margin: 0; +} + +.editbox span { + display: inline; + font-size: 13px; + line-height: 18px; +} + +span.xml-tagname { + color: #0e5f0e; +} + +span.xml-attribute { + color: #8b8b8b; +} + +span.xml-punctuation { + color: black; +} + +span.xml-attname { + color: #817aff; +} + +span.xml-comment { + color: #A70; +} + +span.xml-cdata { + color: #48A; +} + +span.xml-processing { + color: #999; +} + +span.xml-entity { + color: #A22; +} + +span.xml-error { + color: #F00; + font-weight: bolder; +} + +span.xml-text { + color: black; +} diff --git a/redakcja/static/filebrowser/css/filebrowser.css b/redakcja/static/filebrowser/css/filebrowser.css new file mode 100644 index 00000000..c68126ea --- /dev/null +++ b/redakcja/static/filebrowser/css/filebrowser.css @@ -0,0 +1,29 @@ +.filebrowser table td { font-size: 10px; } +.filebrowser table a { font-size: 11px; } +.filebrowser thead th.sorted a { padding-right: 13px; } +.filebrowser td { padding: 9px 10px 7px 10px !important; } +.filebrowser td.fb_icon { padding: 6px 5px 5px 5px !important; } + +table a.fb_deletelink, table a.fb_renamelink, table a.fb_selectlink, table a.fb_showversionslink { + cursor: pointer; + display: block; padding: 0; margin: 0; + width: 23px; height: 17px; + background-color: transparent; + background-position: 0 center; + background-repeat: no-repeat; +} + +table .fb_deletelink:link, table .fb_deletelink:visited { + width: 15px; + background-image: url('../img/filebrowser_icon_delete.gif'); +} +table .fb_deletelink:hover, table .fb_deletelink:active { background-image: url('../img/filebrowser_icon_delete_hover.gif'); } +table .fb_renamelink:link, table .fb_renamelink:visited { + width: 14px; + background-image: url('../img/filebrowser_icon_rename.gif'); +} +table .fb_renamelink:hover, table .fb_renamelink:active { background-image: url('../img/filebrowser_icon_rename_hover.gif'); } +table .fb_selectlink:link, table .fb_selectlink:visited { background-image: url('../img/filebrowser_icon_select.gif'); } +table .fb_selectlink:hover, table .fb_selectlink:active { background-image: url('../img/filebrowser_icon_select_hover.gif'); } +table .fb_showversionslink:link, table .fb_showversionslink:visited { background-image: url('../img/filebrowser_icon_showversions.gif'); } +table .fb_showversionslink:hover, table .fb_showversionslink:active { background-image: url('../img/filebrowser_icon_showversions_hover.gif'); } diff --git a/redakcja/static/filebrowser/img/filebrowser_icon_delete.gif b/redakcja/static/filebrowser/img/filebrowser_icon_delete.gif new file mode 100644 index 00000000..221a6e1c Binary files /dev/null and b/redakcja/static/filebrowser/img/filebrowser_icon_delete.gif differ diff --git a/redakcja/static/filebrowser/img/filebrowser_icon_delete_hover.gif b/redakcja/static/filebrowser/img/filebrowser_icon_delete_hover.gif new file mode 100644 index 00000000..2a2142cd Binary files /dev/null and b/redakcja/static/filebrowser/img/filebrowser_icon_delete_hover.gif differ diff --git a/redakcja/static/filebrowser/img/filebrowser_icon_imagegenerator.gif b/redakcja/static/filebrowser/img/filebrowser_icon_imagegenerator.gif new file mode 100644 index 00000000..9b19a420 Binary files /dev/null and b/redakcja/static/filebrowser/img/filebrowser_icon_imagegenerator.gif differ diff --git a/redakcja/static/filebrowser/img/filebrowser_icon_imagegenerator_hover.gif b/redakcja/static/filebrowser/img/filebrowser_icon_imagegenerator_hover.gif new file mode 100644 index 00000000..aaa256f4 Binary files /dev/null and b/redakcja/static/filebrowser/img/filebrowser_icon_imagegenerator_hover.gif differ diff --git a/redakcja/static/filebrowser/img/filebrowser_icon_makethumb.gif b/redakcja/static/filebrowser/img/filebrowser_icon_makethumb.gif new file mode 100644 index 00000000..837f6cc6 Binary files /dev/null and b/redakcja/static/filebrowser/img/filebrowser_icon_makethumb.gif differ diff --git a/redakcja/static/filebrowser/img/filebrowser_icon_makethumb_hover.gif b/redakcja/static/filebrowser/img/filebrowser_icon_makethumb_hover.gif new file mode 100644 index 00000000..d1d4d4a1 Binary files /dev/null and b/redakcja/static/filebrowser/img/filebrowser_icon_makethumb_hover.gif differ diff --git a/redakcja/static/filebrowser/img/filebrowser_icon_rename.gif b/redakcja/static/filebrowser/img/filebrowser_icon_rename.gif new file mode 100644 index 00000000..bc45fe4b Binary files /dev/null and b/redakcja/static/filebrowser/img/filebrowser_icon_rename.gif differ diff --git a/redakcja/static/filebrowser/img/filebrowser_icon_rename_hover.gif b/redakcja/static/filebrowser/img/filebrowser_icon_rename_hover.gif new file mode 100644 index 00000000..be8ea08b Binary files /dev/null and b/redakcja/static/filebrowser/img/filebrowser_icon_rename_hover.gif differ diff --git a/redakcja/static/filebrowser/img/filebrowser_icon_select.gif b/redakcja/static/filebrowser/img/filebrowser_icon_select.gif new file mode 100644 index 00000000..a8384279 Binary files /dev/null and b/redakcja/static/filebrowser/img/filebrowser_icon_select.gif differ diff --git a/redakcja/static/filebrowser/img/filebrowser_icon_select_disabled.gif b/redakcja/static/filebrowser/img/filebrowser_icon_select_disabled.gif new file mode 100644 index 00000000..60ad2d53 Binary files /dev/null and b/redakcja/static/filebrowser/img/filebrowser_icon_select_disabled.gif differ diff --git a/redakcja/static/filebrowser/img/filebrowser_icon_select_hover.gif b/redakcja/static/filebrowser/img/filebrowser_icon_select_hover.gif new file mode 100644 index 00000000..319558e9 Binary files /dev/null and b/redakcja/static/filebrowser/img/filebrowser_icon_select_hover.gif differ diff --git a/redakcja/static/filebrowser/img/filebrowser_icon_show.gif b/redakcja/static/filebrowser/img/filebrowser_icon_show.gif new file mode 100644 index 00000000..dded9824 Binary files /dev/null and b/redakcja/static/filebrowser/img/filebrowser_icon_show.gif differ diff --git a/redakcja/static/filebrowser/img/filebrowser_icon_show_hover.gif b/redakcja/static/filebrowser/img/filebrowser_icon_show_hover.gif new file mode 100644 index 00000000..fbd1f33e Binary files /dev/null and b/redakcja/static/filebrowser/img/filebrowser_icon_show_hover.gif differ diff --git a/redakcja/static/filebrowser/img/filebrowser_icon_showversions.gif b/redakcja/static/filebrowser/img/filebrowser_icon_showversions.gif new file mode 100644 index 00000000..71525d74 Binary files /dev/null and b/redakcja/static/filebrowser/img/filebrowser_icon_showversions.gif differ diff --git a/redakcja/static/filebrowser/img/filebrowser_icon_showversions_hover.gif b/redakcja/static/filebrowser/img/filebrowser_icon_showversions_hover.gif new file mode 100644 index 00000000..1fbe2e49 Binary files /dev/null and b/redakcja/static/filebrowser/img/filebrowser_icon_showversions_hover.gif differ diff --git a/redakcja/static/filebrowser/img/filebrowser_object-tools_icon_imagegenerator.gif b/redakcja/static/filebrowser/img/filebrowser_object-tools_icon_imagegenerator.gif new file mode 100644 index 00000000..9b19a420 Binary files /dev/null and b/redakcja/static/filebrowser/img/filebrowser_object-tools_icon_imagegenerator.gif differ diff --git a/redakcja/static/filebrowser/img/filebrowser_object-tools_icon_imagegenerator_hover.gif b/redakcja/static/filebrowser/img/filebrowser_object-tools_icon_imagegenerator_hover.gif new file mode 100644 index 00000000..aaa256f4 Binary files /dev/null and b/redakcja/static/filebrowser/img/filebrowser_object-tools_icon_imagegenerator_hover.gif differ diff --git a/redakcja/static/filebrowser/img/filebrowser_object-tools_icon_makedirectory.gif b/redakcja/static/filebrowser/img/filebrowser_object-tools_icon_makedirectory.gif new file mode 100644 index 00000000..bcd98d91 Binary files /dev/null and b/redakcja/static/filebrowser/img/filebrowser_object-tools_icon_makedirectory.gif differ diff --git a/redakcja/static/filebrowser/img/filebrowser_object-tools_icon_makedirectory_hover.gif b/redakcja/static/filebrowser/img/filebrowser_object-tools_icon_makedirectory_hover.gif new file mode 100644 index 00000000..f9938c77 Binary files /dev/null and b/redakcja/static/filebrowser/img/filebrowser_object-tools_icon_makedirectory_hover.gif differ diff --git a/redakcja/static/filebrowser/img/filebrowser_object-tools_icon_makethumb.gif b/redakcja/static/filebrowser/img/filebrowser_object-tools_icon_makethumb.gif new file mode 100644 index 00000000..a6863cb8 Binary files /dev/null and b/redakcja/static/filebrowser/img/filebrowser_object-tools_icon_makethumb.gif differ diff --git a/redakcja/static/filebrowser/img/filebrowser_object-tools_icon_makethumb_hover.gif b/redakcja/static/filebrowser/img/filebrowser_object-tools_icon_makethumb_hover.gif new file mode 100644 index 00000000..b9aba7cc Binary files /dev/null and b/redakcja/static/filebrowser/img/filebrowser_object-tools_icon_makethumb_hover.gif differ diff --git a/redakcja/static/filebrowser/img/filebrowser_object-tools_icon_multipleupload.gif b/redakcja/static/filebrowser/img/filebrowser_object-tools_icon_multipleupload.gif new file mode 100644 index 00000000..6de016be Binary files /dev/null and b/redakcja/static/filebrowser/img/filebrowser_object-tools_icon_multipleupload.gif differ diff --git a/redakcja/static/filebrowser/img/filebrowser_object-tools_icon_multipleupload_hover.gif b/redakcja/static/filebrowser/img/filebrowser_object-tools_icon_multipleupload_hover.gif new file mode 100644 index 00000000..eaaf2542 Binary files /dev/null and b/redakcja/static/filebrowser/img/filebrowser_object-tools_icon_multipleupload_hover.gif differ diff --git a/redakcja/static/filebrowser/img/filebrowser_type_.gif b/redakcja/static/filebrowser/img/filebrowser_type_.gif new file mode 100644 index 00000000..6a908e27 Binary files /dev/null and b/redakcja/static/filebrowser/img/filebrowser_type_.gif differ diff --git a/redakcja/static/filebrowser/img/filebrowser_type_code.gif b/redakcja/static/filebrowser/img/filebrowser_type_code.gif new file mode 100644 index 00000000..96508394 Binary files /dev/null and b/redakcja/static/filebrowser/img/filebrowser_type_code.gif differ diff --git a/redakcja/static/filebrowser/img/filebrowser_type_document.gif b/redakcja/static/filebrowser/img/filebrowser_type_document.gif new file mode 100644 index 00000000..65ebd99b Binary files /dev/null and b/redakcja/static/filebrowser/img/filebrowser_type_document.gif differ diff --git a/redakcja/static/filebrowser/img/filebrowser_type_folder.gif b/redakcja/static/filebrowser/img/filebrowser_type_folder.gif new file mode 100644 index 00000000..115e3fbd Binary files /dev/null and b/redakcja/static/filebrowser/img/filebrowser_type_folder.gif differ diff --git a/redakcja/static/filebrowser/img/filebrowser_type_image.gif b/redakcja/static/filebrowser/img/filebrowser_type_image.gif new file mode 100644 index 00000000..000b31c1 Binary files /dev/null and b/redakcja/static/filebrowser/img/filebrowser_type_image.gif differ diff --git a/redakcja/static/filebrowser/img/filebrowser_type_sound.gif b/redakcja/static/filebrowser/img/filebrowser_type_sound.gif new file mode 100644 index 00000000..8a8970ab Binary files /dev/null and b/redakcja/static/filebrowser/img/filebrowser_type_sound.gif differ diff --git a/redakcja/static/filebrowser/img/filebrowser_type_video.gif b/redakcja/static/filebrowser/img/filebrowser_type_video.gif new file mode 100644 index 00000000..f456d59b Binary files /dev/null and b/redakcja/static/filebrowser/img/filebrowser_type_video.gif differ diff --git a/redakcja/static/filebrowser/img/tableheader_arrow_down.gif b/redakcja/static/filebrowser/img/tableheader_arrow_down.gif new file mode 100644 index 00000000..5ae95a60 Binary files /dev/null and b/redakcja/static/filebrowser/img/tableheader_arrow_down.gif differ diff --git a/redakcja/static/filebrowser/img/tableheader_arrow_up.gif b/redakcja/static/filebrowser/img/tableheader_arrow_up.gif new file mode 100644 index 00000000..85f1e126 Binary files /dev/null and b/redakcja/static/filebrowser/img/tableheader_arrow_up.gif differ diff --git a/redakcja/static/filebrowser/img/tableheader_arrows.gif b/redakcja/static/filebrowser/img/tableheader_arrows.gif new file mode 100644 index 00000000..39b8780c Binary files /dev/null and b/redakcja/static/filebrowser/img/tableheader_arrows.gif differ diff --git a/redakcja/static/filebrowser/js/AddFileBrowser.js b/redakcja/static/filebrowser/js/AddFileBrowser.js new file mode 100644 index 00000000..888885f5 --- /dev/null +++ b/redakcja/static/filebrowser/js/AddFileBrowser.js @@ -0,0 +1,30 @@ +var FileBrowser = { + // this is set automatically + admin_media_prefix: '', + // change this + thumb_prefix: 'thumb_', + no_thumb: 'filebrowser/img/no_thumb.gif', + + init: function() { + // Deduce admin_media_prefix by looking at the + + + + + + +
+ +

Cancel All Uploads

+ + diff --git a/redakcja/static/filebrowser/uploadify/example/scripts/_notes/dwsync.xml b/redakcja/static/filebrowser/uploadify/example/scripts/_notes/dwsync.xml new file mode 100644 index 00000000..13ca0434 --- /dev/null +++ b/redakcja/static/filebrowser/uploadify/example/scripts/_notes/dwsync.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/redakcja/static/filebrowser/uploadify/example/scripts/check.php b/redakcja/static/filebrowser/uploadify/example/scripts/check.php new file mode 100644 index 00000000..d7dc5717 --- /dev/null +++ b/redakcja/static/filebrowser/uploadify/example/scripts/check.php @@ -0,0 +1,35 @@ + $value) { + if ($key != 'folder') { + if (file_exists($_SERVER['DOCUMENT_ROOT'] . $_POST['folder'] . '/' . $value)) { + $fileArray[$key] = $value; + } + } +} +echo json_encode($fileArray); +?> \ No newline at end of file diff --git a/redakcja/static/filebrowser/uploadify/example/scripts/expressInstall.swf b/redakcja/static/filebrowser/uploadify/example/scripts/expressInstall.swf new file mode 100644 index 00000000..0fbf8fca Binary files /dev/null and b/redakcja/static/filebrowser/uploadify/example/scripts/expressInstall.swf differ diff --git a/redakcja/static/filebrowser/uploadify/example/scripts/jquery-1.3.2.min.js b/redakcja/static/filebrowser/uploadify/example/scripts/jquery-1.3.2.min.js new file mode 100644 index 00000000..b1ae21d8 --- /dev/null +++ b/redakcja/static/filebrowser/uploadify/example/scripts/jquery-1.3.2.min.js @@ -0,0 +1,19 @@ +/* + * jQuery JavaScript Library v1.3.2 + * http://jquery.com/ + * + * Copyright (c) 2009 John Resig + * Dual licensed under the MIT and GPL licenses. + * http://docs.jquery.com/License + * + * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009) + * Revision: 6246 + */ +(function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("",""]||!O.indexOf("",""]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"","
"]||!O.indexOf("",""]||(!O.indexOf("",""]||!O.indexOf("",""]||!o.support.htmlSerialize&&[1,"div
","
"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}}); +/* + * Sizzle CSS Selector Engine - v0.9.3 + * Copyright 2009, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * More information: http://sizzlejs.com/ + */ +(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return UT[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="

";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="
";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("
").append(M.responseText.replace(//g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function(){G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='
';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})(); \ No newline at end of file diff --git a/redakcja/static/filebrowser/uploadify/example/scripts/jquery.uploadify.v2.1.0.min.js b/redakcja/static/filebrowser/uploadify/example/scripts/jquery.uploadify.v2.1.0.min.js new file mode 100644 index 00000000..43053119 --- /dev/null +++ b/redakcja/static/filebrowser/uploadify/example/scripts/jquery.uploadify.v2.1.0.min.js @@ -0,0 +1,26 @@ +/* +Uploadify v2.1.0 +Release Date: August 24, 2009 + +Copyright (c) 2009 Ronnie Garcia, Travis Nickels + +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 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +if(jQuery){(function(a){a.extend(a.fn,{uploadify:function(b){a(this).each(function(){settings=a.extend({id:a(this).attr("id"),uploader:"uploadify.swf",script:"uploadify.php",expressInstall:null,folder:"",height:30,width:110,cancelImg:"cancel.png",wmode:"opaque",scriptAccess:"sameDomain",fileDataName:"Filedata",method:"POST",queueSizeLimit:999,simUploadLimit:1,queueID:false,displayData:"percentage",onInit:function(){},onSelect:function(){},onQueueFull:function(){},onCheck:function(){},onCancel:function(){},onError:function(){},onProgress:function(){},onComplete:function(){},onAllComplete:function(){}},b);var e=location.pathname;e=e.split("/");e.pop();e=e.join("/")+"/";var f={};f.uploadifyID=settings.id;f.pagepath=e;if(settings.buttonImg){f.buttonImg=escape(settings.buttonImg)}if(settings.buttonText){f.buttonText=escape(settings.buttonText)}if(settings.rollover){f.rollover=true}f.script=settings.script;f.folder=escape(settings.folder);if(settings.scriptData){var g="";for(var d in settings.scriptData){g+="&"+d+"="+settings.scriptData[d]}f.scriptData=escape(g.substr(1))}f.width=settings.width;f.height=settings.height;f.wmode=settings.wmode;f.method=settings.method;f.queueSizeLimit=settings.queueSizeLimit;f.simUploadLimit=settings.simUploadLimit;if(settings.hideButton){f.hideButton=true}if(settings.fileDesc){f.fileDesc=settings.fileDesc}if(settings.fileExt){f.fileExt=settings.fileExt}if(settings.multi){f.multi=true}if(settings.auto){f.auto=true}if(settings.sizeLimit){f.sizeLimit=settings.sizeLimit}if(settings.checkScript){f.checkScript=settings.checkScript}if(settings.fileDataName){f.fileDataName=settings.fileDataName}if(settings.queueID){f.queueID=settings.queueID}if(settings.onInit()!==false){a(this).css("display","none");a(this).after('
');swfobject.embedSWF(settings.uploader,settings.id+"Uploader",settings.width,settings.height,"9.0.24",settings.expressInstall,f,{quality:"high",wmode:settings.wmode,allowScriptAccess:settings.scriptAccess});if(settings.queueID==false){a("#"+a(this).attr("id")+"Uploader").after('
')}}if(typeof(settings.onOpen)=="function"){a(this).bind("uploadifyOpen",settings.onOpen)}a(this).bind("uploadifySelect",{action:settings.onSelect,queueID:settings.queueID},function(j,h,i){if(j.data.action(j,h,i)!==false){var k=Math.round(i.size/1024*100)*0.01;var l="KB";if(k>1000){k=Math.round(k*0.001*100)*0.01;l="MB"}var m=k.toString().split(".");if(m.length>1){k=m[0]+"."+m[1].substr(0,2)}else{k=m[0]}if(i.name.length>20){fileName=i.name.substr(0,20)+"..."}else{fileName=i.name}queue="#"+a(this).attr("id")+"Queue";if(j.data.queueID){queue="#"+j.data.queueID}a(queue).append('
'+fileName+" ("+k+l+')
')}});if(typeof(settings.onSelectOnce)=="function"){a(this).bind("uploadifySelectOnce",settings.onSelectOnce)}a(this).bind("uploadifyQueueFull",{action:settings.onQueueFull},function(h,i){if(h.data.action(h,i)!==false){alert("The queue is full. The max size is "+i+".")}});a(this).bind("uploadifyCheckExist",{action:settings.onCheck},function(m,l,k,j,o){var i=new Object();i=k;i.folder=e+j;if(o){for(var h in k){var n=h}}a.post(l,i,function(r){for(var p in r){if(m.data.action(m,l,k,j,o)!==false){var q=confirm("Do you want to replace the file "+r[p]+"?");if(!q){document.getElementById(a(m.target).attr("id")+"Uploader").cancelFileUpload(p,true,true)}}}if(o){document.getElementById(a(m.target).attr("id")+"Uploader").startFileUpload(n,true)}else{document.getElementById(a(m.target).attr("id")+"Uploader").startFileUpload(null,true)}},"json")});a(this).bind("uploadifyCancel",{action:settings.onCancel},function(l,h,k,m,j){if(l.data.action(l,h,k,m,j)!==false){var i=(j==true)?0:250;a("#"+a(this).attr("id")+h).fadeOut(i,function(){a(this).remove()})}});if(typeof(settings.onClearQueue)=="function"){a(this).bind("uploadifyClearQueue",settings.onClearQueue)}var c=[];a(this).bind("uploadifyError",{action:settings.onError},function(l,h,k,j){if(l.data.action(l,h,k,j)!==false){var i=new Array(h,k,j);c.push(i);a("#"+a(this).attr("id")+h+" .percentage").text(" - "+j.type+" Error");a("#"+a(this).attr("id")+h).addClass("uploadifyError")}});a(this).bind("uploadifyProgress",{action:settings.onProgress,toDisplay:settings.displayData},function(j,h,i,k){if(j.data.action(j,h,i,k)!==false){a("#"+a(this).attr("id")+h+"ProgressBar").css("width",k.percentage+"%");if(j.data.toDisplay=="percentage"){displayData=" - "+k.percentage+"%"}if(j.data.toDisplay=="speed"){displayData=" - "+k.speed+"KB/s"}if(j.data.toDisplay==null){displayData=" "}a("#"+a(this).attr("id")+h+" .percentage").text(displayData)}});a(this).bind("uploadifyComplete",{action:settings.onComplete},function(k,h,j,i,l){if(k.data.action(k,h,j,unescape(i),l)!==false){a("#"+a(this).attr("id")+h+" .percentage").text(" - Completed");a("#"+a(this).attr("id")+h).fadeOut(250,function(){a(this).remove()})}});if(typeof(settings.onAllComplete)=="function"){a(this).bind("uploadifyAllComplete",{action:settings.onAllComplete},function(h,i){if(h.data.action(h,i)!==false){c=[]}})}})},uploadifySettings:function(f,j,c){var g=false;a(this).each(function(){if(f=="scriptData"&&j!=null){if(c){var i=j}else{var i=a.extend(settings.scriptData,j)}var l="";for(var k in i){l+="&"+k+"="+escape(i[k])}j=l.substr(1)}g=document.getElementById(a(this).attr("id")+"Uploader").updateSettings(f,j)});if(j==null){if(f=="scriptData"){var b=unescape(g).split("&");var e=new Object();for(var d=0;d + is released under the MIT License +*/ +var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y0){for(var af=0;af0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad'}}aa.outerHTML='"+af+"";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab \ No newline at end of file diff --git a/redakcja/static/filebrowser/uploadify/example/scripts/uploadify.swf b/redakcja/static/filebrowser/uploadify/example/scripts/uploadify.swf new file mode 100644 index 00000000..4d27952f Binary files /dev/null and b/redakcja/static/filebrowser/uploadify/example/scripts/uploadify.swf differ diff --git a/redakcja/static/filebrowser/uploadify/expressInstall.swf b/redakcja/static/filebrowser/uploadify/expressInstall.swf new file mode 100644 index 00000000..0fbf8fca Binary files /dev/null and b/redakcja/static/filebrowser/uploadify/expressInstall.swf differ diff --git a/redakcja/static/filebrowser/uploadify/jquery-1.3.2.min.js b/redakcja/static/filebrowser/uploadify/jquery-1.3.2.min.js new file mode 100644 index 00000000..b1ae21d8 --- /dev/null +++ b/redakcja/static/filebrowser/uploadify/jquery-1.3.2.min.js @@ -0,0 +1,19 @@ +/* + * jQuery JavaScript Library v1.3.2 + * http://jquery.com/ + * + * Copyright (c) 2009 John Resig + * Dual licensed under the MIT and GPL licenses. + * http://docs.jquery.com/License + * + * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009) + * Revision: 6246 + */ +(function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("",""]||!O.indexOf("",""]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"","
"]||!O.indexOf("",""]||(!O.indexOf("",""]||!O.indexOf("",""]||!o.support.htmlSerialize&&[1,"div
","
"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}}); +/* + * Sizzle CSS Selector Engine - v0.9.3 + * Copyright 2009, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * More information: http://sizzlejs.com/ + */ +(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return UT[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="

";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="
";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("
").append(M.responseText.replace(//g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function(){G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='
';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})(); \ No newline at end of file diff --git a/redakcja/static/filebrowser/uploadify/jquery.uploadify.v2.1.0.js b/redakcja/static/filebrowser/uploadify/jquery.uploadify.v2.1.0.js new file mode 100644 index 00000000..43c87be6 --- /dev/null +++ b/redakcja/static/filebrowser/uploadify/jquery.uploadify.v2.1.0.js @@ -0,0 +1,258 @@ +/* +Uploadify v2.1.0 +Release Date: August 24, 2009 + +Copyright (c) 2009 Ronnie Garcia, Travis Nickels + +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 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +if(jQuery)( + function(jQuery){ + jQuery.extend(jQuery.fn,{ + uploadify:function(options) { + jQuery(this).each(function(){ + settings = jQuery.extend({ + id : jQuery(this).attr('id'), // The ID of the object being Uploadified + uploader : 'uploadify.swf', // The path to the uploadify swf file + script : 'uploadify.php', // The path to the uploadify backend upload script + expressInstall : null, // The path to the express install swf file + folder : '', // The path to the upload folder + height : 30, // The height of the flash button + width : 110, // The width of the flash button + cancelImg : 'cancel.png', // The path to the cancel image for the default file queue item container + wmode : 'opaque', // The wmode of the flash file + scriptAccess : 'sameDomain', // Set to "always" to allow script access across domains + fileDataName : 'Filedata', // The name of the file collection object in the backend upload script + method : 'POST', // The method for sending variables to the backend upload script + queueSizeLimit : 999, // The maximum size of the file queue + simUploadLimit : 1, // The number of simultaneous uploads allowed + queueID : false, // The optional ID of the queue container + displayData : 'percentage', // Set to "speed" to show the upload speed in the default queue item + onInit : function() {}, // Function to run when uploadify is initialized + onSelect : function() {}, // Function to run when a file is selected + onQueueFull : function() {}, // Function to run when the queue reaches capacity + onCheck : function() {}, // Function to run when script checks for duplicate files on the server + onCancel : function() {}, // Function to run when an item is cleared from the queue + onError : function() {}, // Function to run when an upload item returns an error + onProgress : function() {}, // Function to run each time the upload progress is updated + onComplete : function() {}, // Function to run when an upload is completed + onAllComplete : function() {} // Functino to run when all uploads are completed + }, options); + var pagePath = location.pathname; + pagePath = pagePath.split('/'); + pagePath.pop(); + pagePath = pagePath.join('/') + '/'; + var data = {}; + data.uploadifyID = settings.id; + data.pagepath = pagePath; + if (settings.buttonImg) data.buttonImg = escape(settings.buttonImg); + if (settings.buttonText) data.buttonText = escape(settings.buttonText); + if (settings.rollover) data.rollover = true; + data.script = settings.script; + data.folder = escape(settings.folder); + if (settings.scriptData) { + var scriptDataString = ''; + for (var name in settings.scriptData) { + scriptDataString += '&' + name + '=' + settings.scriptData[name]; + } + data.scriptData = escape(scriptDataString.substr(1)); + } + data.width = settings.width; + data.height = settings.height; + data.wmode = settings.wmode; + data.method = settings.method; + data.queueSizeLimit = settings.queueSizeLimit; + data.simUploadLimit = settings.simUploadLimit; + if (settings.hideButton) data.hideButton = true; + if (settings.fileDesc) data.fileDesc = settings.fileDesc; + if (settings.fileExt) data.fileExt = settings.fileExt; + if (settings.multi) data.multi = true; + if (settings.auto) data.auto = true; + if (settings.sizeLimit) data.sizeLimit = settings.sizeLimit; + if (settings.checkScript) data.checkScript = settings.checkScript; + if (settings.fileDataName) data.fileDataName = settings.fileDataName; + if (settings.queueID) data.queueID = settings.queueID; + if (settings.onInit() !== false) { + jQuery(this).css('display','none'); + jQuery(this).after('
'); + swfobject.embedSWF(settings.uploader, settings.id + 'Uploader', settings.width, settings.height, '9.0.24', settings.expressInstall, data, {'quality':'high','wmode':settings.wmode,'allowScriptAccess':settings.scriptAccess}); + if (settings.queueID == false) { + jQuery("#" + jQuery(this).attr('id') + "Uploader").after('
'); + } + } + if (typeof(settings.onOpen) == 'function') { + jQuery(this).bind("uploadifyOpen", settings.onOpen); + } + jQuery(this).bind("uploadifySelect", {'action': settings.onSelect, 'queueID': settings.queueID}, function(event, ID, fileObj) { + if (event.data.action(event, ID, fileObj) !== false) { + var byteSize = Math.round(fileObj.size / 1024 * 100) * .01; + var suffix = 'KB'; + if (byteSize > 1000) { + byteSize = Math.round(byteSize *.001 * 100) * .01; + suffix = 'MB'; + } + var sizeParts = byteSize.toString().split('.'); + if (sizeParts.length > 1) { + byteSize = sizeParts[0] + '.' + sizeParts[1].substr(0,2); + } else { + byteSize = sizeParts[0]; + } + if (fileObj.name.length > 20) { + fileName = fileObj.name.substr(0,20) + '...'; + } else { + fileName = fileObj.name; + } + queue = '#' + jQuery(this).attr('id') + 'Queue'; + if (event.data.queueID) { + queue = '#' + event.data.queueID; + } + jQuery(queue).append('
\ +
\ + \ +
\ + ' + fileName + ' (' + byteSize + suffix + ')\ +
\ +
\ +
\ +
'); + } + }); + if (typeof(settings.onSelectOnce) == 'function') { + jQuery(this).bind("uploadifySelectOnce", settings.onSelectOnce); + } + jQuery(this).bind("uploadifyQueueFull", {'action': settings.onQueueFull}, function(event, queueSizeLimit) { + if (event.data.action(event, queueSizeLimit) !== false) { + alert('The queue is full. The max size is ' + queueSizeLimit + '.'); + } + }); + jQuery(this).bind("uploadifyCheckExist", {'action': settings.onCheck}, function(event, checkScript, fileQueueObj, folder, single) { + var postData = new Object(); + postData = fileQueueObj; + postData.folder = pagePath + folder; + if (single) { + for (var ID in fileQueueObj) { + var singleFileID = ID; + } + } + jQuery.post(checkScript, postData, function(data) { + for(var key in data) { + if (event.data.action(event, checkScript, fileQueueObj, folder, single) !== false) { + var replaceFile = confirm("Do you want to replace the file " + data[key] + "?"); + if (!replaceFile) { + document.getElementById(jQuery(event.target).attr('id') + 'Uploader').cancelFileUpload(key, true,true); + } + } + } + if (single) { + document.getElementById(jQuery(event.target).attr('id') + 'Uploader').startFileUpload(singleFileID, true); + } else { + document.getElementById(jQuery(event.target).attr('id') + 'Uploader').startFileUpload(null, true); + } + }, "json"); + }); + jQuery(this).bind("uploadifyCancel", {'action': settings.onCancel}, function(event, ID, fileObj, data, clearFast) { + if (event.data.action(event, ID, fileObj, data, clearFast) !== false) { + var fadeSpeed = (clearFast == true) ? 0 : 250; + jQuery("#" + jQuery(this).attr('id') + ID).fadeOut(fadeSpeed, function() { jQuery(this).remove() }); + } + }); + if (typeof(settings.onClearQueue) == 'function') { + jQuery(this).bind("uploadifyClearQueue", settings.onClearQueue); + } + var errorArray = []; + jQuery(this).bind("uploadifyError", {'action': settings.onError}, function(event, ID, fileObj, errorObj) { + if (event.data.action(event, ID, fileObj, errorObj) !== false) { + var fileArray = new Array(ID, fileObj, errorObj); + errorArray.push(fileArray); + jQuery("#" + jQuery(this).attr('id') + ID + " .percentage").text(" - " + errorObj.type + " Error"); + jQuery("#" + jQuery(this).attr('id') + ID).addClass('uploadifyError'); + } + }); + jQuery(this).bind("uploadifyProgress", {'action': settings.onProgress, 'toDisplay': settings.displayData}, function(event, ID, fileObj, data) { + if (event.data.action(event, ID, fileObj, data) !== false) { + jQuery("#" + jQuery(this).attr('id') + ID + "ProgressBar").css('width', data.percentage + '%'); + if (event.data.toDisplay == 'percentage') displayData = ' - ' + data.percentage + '%'; + if (event.data.toDisplay == 'speed') displayData = ' - ' + data.speed + 'KB/s'; + if (event.data.toDisplay == null) displayData = ' '; + jQuery("#" + jQuery(this).attr('id') + ID + " .percentage").text(displayData); + } + }); + jQuery(this).bind("uploadifyComplete", {'action': settings.onComplete}, function(event, ID, fileObj, response, data) { + if (event.data.action(event, ID, fileObj, unescape(response), data) !== false) { + jQuery("#" + jQuery(this).attr('id') + ID + " .percentage").text(' - Completed'); + jQuery("#" + jQuery(this).attr('id') + ID).fadeOut(250, function() { jQuery(this).remove()}); + } + }); + if (typeof(settings.onAllComplete) == 'function') { + jQuery(this).bind("uploadifyAllComplete", {'action': settings.onAllComplete}, function(event, uploadObj) { + if (event.data.action(event, uploadObj) !== false) { + errorArray = []; + } + }); + } + }); + }, + uploadifySettings:function(settingName, settingValue, resetObject) { + var returnValue = false; + jQuery(this).each(function() { + if (settingName == 'scriptData' && settingValue != null) { + if (resetObject) { + var scriptData = settingValue; + } else { + var scriptData = jQuery.extend(settings.scriptData, settingValue); + } + var scriptDataString = ''; + for (var name in scriptData) { + scriptDataString += '&' + name + '=' + escape(scriptData[name]); + } + settingValue = scriptDataString.substr(1); + } + returnValue = document.getElementById(jQuery(this).attr('id') + 'Uploader').updateSettings(settingName, settingValue); + }); + if (settingValue == null) { + if (settingName == 'scriptData') { + var returnSplit = unescape(returnValue).split('&'); + var returnObj = new Object(); + for (var i = 0; i < returnSplit.length; i++) { + var iSplit = returnSplit[i].split('='); + returnObj[iSplit[0]] = iSplit[1]; + } + returnValue = returnObj; + } + return returnValue; + } + }, + uploadifyUpload:function(ID) { + jQuery(this).each(function() { + document.getElementById(jQuery(this).attr('id') + 'Uploader').startFileUpload(ID, false); + }); + }, + uploadifyCancel:function(ID) { + jQuery(this).each(function() { + document.getElementById(jQuery(this).attr('id') + 'Uploader').cancelFileUpload(ID, true, false); + }); + }, + uploadifyClearQueue:function() { + jQuery(this).each(function() { + document.getElementById(jQuery(this).attr('id') + 'Uploader').clearFileUploadQueue(false); + }); + } + }) +})(jQuery); \ No newline at end of file diff --git a/redakcja/static/filebrowser/uploadify/jquery.uploadify.v2.1.0.min.js b/redakcja/static/filebrowser/uploadify/jquery.uploadify.v2.1.0.min.js new file mode 100644 index 00000000..43053119 --- /dev/null +++ b/redakcja/static/filebrowser/uploadify/jquery.uploadify.v2.1.0.min.js @@ -0,0 +1,26 @@ +/* +Uploadify v2.1.0 +Release Date: August 24, 2009 + +Copyright (c) 2009 Ronnie Garcia, Travis Nickels + +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 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +if(jQuery){(function(a){a.extend(a.fn,{uploadify:function(b){a(this).each(function(){settings=a.extend({id:a(this).attr("id"),uploader:"uploadify.swf",script:"uploadify.php",expressInstall:null,folder:"",height:30,width:110,cancelImg:"cancel.png",wmode:"opaque",scriptAccess:"sameDomain",fileDataName:"Filedata",method:"POST",queueSizeLimit:999,simUploadLimit:1,queueID:false,displayData:"percentage",onInit:function(){},onSelect:function(){},onQueueFull:function(){},onCheck:function(){},onCancel:function(){},onError:function(){},onProgress:function(){},onComplete:function(){},onAllComplete:function(){}},b);var e=location.pathname;e=e.split("/");e.pop();e=e.join("/")+"/";var f={};f.uploadifyID=settings.id;f.pagepath=e;if(settings.buttonImg){f.buttonImg=escape(settings.buttonImg)}if(settings.buttonText){f.buttonText=escape(settings.buttonText)}if(settings.rollover){f.rollover=true}f.script=settings.script;f.folder=escape(settings.folder);if(settings.scriptData){var g="";for(var d in settings.scriptData){g+="&"+d+"="+settings.scriptData[d]}f.scriptData=escape(g.substr(1))}f.width=settings.width;f.height=settings.height;f.wmode=settings.wmode;f.method=settings.method;f.queueSizeLimit=settings.queueSizeLimit;f.simUploadLimit=settings.simUploadLimit;if(settings.hideButton){f.hideButton=true}if(settings.fileDesc){f.fileDesc=settings.fileDesc}if(settings.fileExt){f.fileExt=settings.fileExt}if(settings.multi){f.multi=true}if(settings.auto){f.auto=true}if(settings.sizeLimit){f.sizeLimit=settings.sizeLimit}if(settings.checkScript){f.checkScript=settings.checkScript}if(settings.fileDataName){f.fileDataName=settings.fileDataName}if(settings.queueID){f.queueID=settings.queueID}if(settings.onInit()!==false){a(this).css("display","none");a(this).after('
');swfobject.embedSWF(settings.uploader,settings.id+"Uploader",settings.width,settings.height,"9.0.24",settings.expressInstall,f,{quality:"high",wmode:settings.wmode,allowScriptAccess:settings.scriptAccess});if(settings.queueID==false){a("#"+a(this).attr("id")+"Uploader").after('
')}}if(typeof(settings.onOpen)=="function"){a(this).bind("uploadifyOpen",settings.onOpen)}a(this).bind("uploadifySelect",{action:settings.onSelect,queueID:settings.queueID},function(j,h,i){if(j.data.action(j,h,i)!==false){var k=Math.round(i.size/1024*100)*0.01;var l="KB";if(k>1000){k=Math.round(k*0.001*100)*0.01;l="MB"}var m=k.toString().split(".");if(m.length>1){k=m[0]+"."+m[1].substr(0,2)}else{k=m[0]}if(i.name.length>20){fileName=i.name.substr(0,20)+"..."}else{fileName=i.name}queue="#"+a(this).attr("id")+"Queue";if(j.data.queueID){queue="#"+j.data.queueID}a(queue).append('
'+fileName+" ("+k+l+')
')}});if(typeof(settings.onSelectOnce)=="function"){a(this).bind("uploadifySelectOnce",settings.onSelectOnce)}a(this).bind("uploadifyQueueFull",{action:settings.onQueueFull},function(h,i){if(h.data.action(h,i)!==false){alert("The queue is full. The max size is "+i+".")}});a(this).bind("uploadifyCheckExist",{action:settings.onCheck},function(m,l,k,j,o){var i=new Object();i=k;i.folder=e+j;if(o){for(var h in k){var n=h}}a.post(l,i,function(r){for(var p in r){if(m.data.action(m,l,k,j,o)!==false){var q=confirm("Do you want to replace the file "+r[p]+"?");if(!q){document.getElementById(a(m.target).attr("id")+"Uploader").cancelFileUpload(p,true,true)}}}if(o){document.getElementById(a(m.target).attr("id")+"Uploader").startFileUpload(n,true)}else{document.getElementById(a(m.target).attr("id")+"Uploader").startFileUpload(null,true)}},"json")});a(this).bind("uploadifyCancel",{action:settings.onCancel},function(l,h,k,m,j){if(l.data.action(l,h,k,m,j)!==false){var i=(j==true)?0:250;a("#"+a(this).attr("id")+h).fadeOut(i,function(){a(this).remove()})}});if(typeof(settings.onClearQueue)=="function"){a(this).bind("uploadifyClearQueue",settings.onClearQueue)}var c=[];a(this).bind("uploadifyError",{action:settings.onError},function(l,h,k,j){if(l.data.action(l,h,k,j)!==false){var i=new Array(h,k,j);c.push(i);a("#"+a(this).attr("id")+h+" .percentage").text(" - "+j.type+" Error");a("#"+a(this).attr("id")+h).addClass("uploadifyError")}});a(this).bind("uploadifyProgress",{action:settings.onProgress,toDisplay:settings.displayData},function(j,h,i,k){if(j.data.action(j,h,i,k)!==false){a("#"+a(this).attr("id")+h+"ProgressBar").css("width",k.percentage+"%");if(j.data.toDisplay=="percentage"){displayData=" - "+k.percentage+"%"}if(j.data.toDisplay=="speed"){displayData=" - "+k.speed+"KB/s"}if(j.data.toDisplay==null){displayData=" "}a("#"+a(this).attr("id")+h+" .percentage").text(displayData)}});a(this).bind("uploadifyComplete",{action:settings.onComplete},function(k,h,j,i,l){if(k.data.action(k,h,j,unescape(i),l)!==false){a("#"+a(this).attr("id")+h+" .percentage").text(" - Completed");a("#"+a(this).attr("id")+h).fadeOut(250,function(){a(this).remove()})}});if(typeof(settings.onAllComplete)=="function"){a(this).bind("uploadifyAllComplete",{action:settings.onAllComplete},function(h,i){if(h.data.action(h,i)!==false){c=[]}})}})},uploadifySettings:function(f,j,c){var g=false;a(this).each(function(){if(f=="scriptData"&&j!=null){if(c){var i=j}else{var i=a.extend(settings.scriptData,j)}var l="";for(var k in i){l+="&"+k+"="+escape(i[k])}j=l.substr(1)}g=document.getElementById(a(this).attr("id")+"Uploader").updateSettings(f,j)});if(j==null){if(f=="scriptData"){var b=unescape(g).split("&");var e=new Object();for(var d=0;d + is released under the MIT License +*/ +var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y0){for(var af=0;af0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad'}}aa.outerHTML='"+af+"";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab \ No newline at end of file diff --git a/redakcja/static/filebrowser/uploadify/uploadify.swf b/redakcja/static/filebrowser/uploadify/uploadify.swf new file mode 100644 index 00000000..0385d9e6 Binary files /dev/null and b/redakcja/static/filebrowser/uploadify/uploadify.swf differ diff --git a/redakcja/static/icons/close.png b/redakcja/static/icons/close.png new file mode 100644 index 00000000..5c08b05c Binary files /dev/null and b/redakcja/static/icons/close.png differ diff --git a/redakcja/static/icons/go-next.png b/redakcja/static/icons/go-next.png new file mode 100644 index 00000000..6ef8de76 Binary files /dev/null and b/redakcja/static/icons/go-next.png differ diff --git a/redakcja/static/icons/go-previous.png b/redakcja/static/icons/go-previous.png new file mode 100644 index 00000000..659cd90d Binary files /dev/null and b/redakcja/static/icons/go-previous.png differ diff --git a/redakcja/static/icons/zoom.png b/redakcja/static/icons/zoom.png new file mode 100644 index 00000000..6033b4d5 Binary files /dev/null and b/redakcja/static/icons/zoom.png differ diff --git a/redakcja/static/icons/zoom_in.png b/redakcja/static/icons/zoom_in.png new file mode 100644 index 00000000..c7feedc6 Binary files /dev/null and b/redakcja/static/icons/zoom_in.png differ diff --git a/redakcja/static/icons/zoom_out.png b/redakcja/static/icons/zoom_out.png new file mode 100644 index 00000000..fdd7124e Binary files /dev/null and b/redakcja/static/icons/zoom_out.png differ diff --git a/redakcja/static/img/gallery.png b/redakcja/static/img/gallery.png new file mode 100644 index 00000000..851a6784 Binary files /dev/null and b/redakcja/static/img/gallery.png differ diff --git a/redakcja/static/img/logo.png b/redakcja/static/img/logo.png new file mode 100644 index 00000000..398f45d0 Binary files /dev/null and b/redakcja/static/img/logo.png differ diff --git a/redakcja/static/img/sample_cover.png b/redakcja/static/img/sample_cover.png new file mode 100644 index 00000000..eb7e7d13 Binary files /dev/null and b/redakcja/static/img/sample_cover.png differ diff --git a/redakcja/static/img/spinner.gif b/redakcja/static/img/spinner.gif new file mode 100644 index 00000000..c69e9372 Binary files /dev/null and b/redakcja/static/img/spinner.gif differ diff --git a/redakcja/static/js/button_scripts.js b/redakcja/static/js/button_scripts.js new file mode 100644 index 00000000..0d38b004 --- /dev/null +++ b/redakcja/static/js/button_scripts.js @@ -0,0 +1,293 @@ +(function() { + var slice = Array.prototype.slice; + + function update(array, args) { + var arrayLength = array.length, length = args.length; + while (length--) array[arrayLength + length] = args[length]; + return array; + }; + + function merge(array, args) { + array = slice.call(array, 0); + return update(array, args); + }; + + Function.prototype.bind = function(context) { + if (arguments.length < 2 && typeof arguments[0] === 'undefined') { + return this; + } + var __method = this; + var args = slice.call(arguments, 1); + return function() { + var a = merge(args, arguments); + return __method.apply(context, a); + } + } + +})(); + +function nblck_each(array, body, after) { + $.each(array, function(i) { + body(this, i); + }); + + after(); +}; + +function nblck_map(array, func, after) { + var acc = []; + + nblck_each(array, function(elem, index) { + acc.push(func(elem, index)); + }, function(){ + after(acc); + }); +}; + +function ScriptletCenter() +{ + this.scriptlets = {}; + + this.scriptlets['insert_tag'] = function(context, params, done) + { + var text = this.XMLEditorSelectedText(context); + var start_tag = '<'+params.tag; + var move_cursor = false; + + for (var attr in params.attrs) { + start_tag += ' '+attr+'="' + params.attrs[attr] + '"'; + } + + start_tag += '>'; + var end_tag = ''; + + if(text.length > 0) { + // tokenize + var output = ''; + var token = ''; + for(var index=0; index < text.length; index++) + { + if (text[index].match(/\s/)) { // whitespace + token += text[index]; + } + else { // character + output += token; + if(output == token) output += start_tag; + token = ''; + output += text[index]; + } + } + + if( output[output.length-1] == '\\' ) { + output = output.substr(0, output.length-1) + end_tag + '\\'; + } else { + output += end_tag; + } + output += token; + } + else { + if(params.nocontent) { + output = "<"+params.tag +" />"; + } + else { + output = start_tag + end_tag; + move_cursor = true; + } + } + + this.XMLEditorReplaceSelectedText(context, output); + + try { + if (move_cursor) { + this.XMLEditorMoveCursorForward(context, params.tag.length+2); + } + } catch(e) {} + + done(); + }.bind(this); + + this.scriptlets['lineregexp'] = function(context, params, done) { + var self = this; + + var exprs = $.map(params.exprs, function(expr) { + var opts = "g"; + if(expr.length > 2) { + opts = expr[2]; + } return { + rx: new RegExp(expr[0], opts), + repl: expr[1] + }; + }); + + var partial = true; + var text = this.XMLEditorSelectedText(context); + if(!text) return done(); + + var changed = 0; + var lines = text.split('\n'); + + nblck_map(lines, function(line, index) { + var old_line = line; + $(exprs).each(function() { + var expr = this; + line = line.replace(expr.rx, expr.repl); + }); + + $progress.html(index); + + if(old_line != line) changed += 1; + return line; + }, function(newlines) { + if(changed > 0) { + self.XMLEditorReplaceSelectedText(context, newlines.join('\n') ); + }; + + done(); + }); + }.bind(this); + + this.scriptlets['fulltextregexp'] = function(context, params, done) { + var self = this; + + var exprs = $.map(params.exprs, function(expr) { + var opts = "mg"; + if(expr.length > 2) { + opts = expr[2]; + } + return { + rx: new RegExp(expr[0], opts), + repl: expr[1] + }; + }); + + var text = this.XMLEditorSelectedText(context); + if(!text) return done(); + var original = text; + + nblck_each(exprs, function(expr, index) { + $progress.html(600 + index); + text = text.replace(expr.rx, expr.repl); + }, function() { + if( original != text) { + self.XMLEditorReplaceSelectedText(context, text); + } + + done(); + }); + }.bind(this); + + this.scriptlets['macro'] = function(context, params, done) { + var self = this; + var i = 0; + + function next() { + if (i < params.length) { + var e = params[i]; + i = i + 1; + self.scriptlets[e[0]](context, e[1], next); + } + else { + done(); + } + }; + + next(); + }.bind(this); + + this.scriptlets['lowercase'] = function(context, params, done) + { + var text = this.XMLEditorSelectedText(context); + + if(!text) return; + + var repl = ''; + var lcase = text.toLowerCase(); + var ucase = text.toUpperCase(); + + if(lcase == text) repl = ucase; /* was lowercase */ + else if(ucase != text) repl = lcase; /* neither lower- or upper-case */ + else { /* upper case -> camel-case */ + var words = $(lcase.split(/\s/)).map(function() { + if(this.length > 0) { + return this[0].toUpperCase() + this.slice(1); + } else { + return ''; + } + }); + repl = words.join(' '); + } + + if(repl != text) this.XMLEditorReplaceSelectedText(context, repl); + + done(); + }.bind(this); + + + this.scriptlets["insert_stanza"] = function(context, params, done) { + var text = this.XMLEditorSelectedText(context); + + if(text) { + var verses = text.split('\n'); + text = ''; var buf = ''; var ebuf = ''; + var first = true; + + for(var i=0; i < verses.length; i++) { + var verse = verses[i].replace(/^\s+/, "").replace(/\s+$/, ""); + if(verse) { + text += (buf ? buf + '/\n' : '') + ebuf; + buf = (first ? '\n' : '') + verses[i]; + ebuf = ''; + first = false; + } else { + ebuf += '\n' + verses[i]; + } + } + text = text + buf + '\n' + ebuf; + this.XMLEditorReplaceSelectedText(context, text); + } + + if (!text) { + this.XMLEditorMoveCursorForward(context, params.tag.length + 2); + } + + done(); + }.bind(this); + +} + +ScriptletCenter.prototype.callInteractive = function(opts) { + $progress = $('Executing script'); + var self = this; + + $.blockUI({ + message: $progress, + + }); + + + self.scriptlets[opts.action](opts.context, opts.extra, function(){ + $.unblockUI(); // done + }); +} + +ScriptletCenter.prototype.XMLEditorSelectedText = function(editor) { + + return editor.selection(); +}; + +ScriptletCenter.prototype.XMLEditorReplaceSelectedText = function(editor, replacement) +{ + $progress.html("Replacing text"); + editor.replaceSelection(replacement); +}; + +ScriptletCenter.prototype.XMLEditorMoveCursorForward = function(panel, n) { + var pos = panel.cursorPosition(); + panel.selectLines(pos.line, pos.character + n); +}; + +var scriptletCenter; + +$(function() { + scriptletCenter = new ScriptletCenter(); +}); \ No newline at end of file diff --git a/redakcja/static/js/jquery-1.4.2.min.js b/redakcja/static/js/jquery-1.4.2.min.js new file mode 100644 index 00000000..7c243080 --- /dev/null +++ b/redakcja/static/js/jquery-1.4.2.min.js @@ -0,0 +1,154 @@ +/*! + * jQuery JavaScript Library v1.4.2 + * http://jquery.com/ + * + * Copyright 2010, John Resig + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * Copyright 2010, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * + * Date: Sat Feb 13 22:33:48 2010 -0500 + */ +(function(A,w){function ma(){if(!c.isReady){try{s.documentElement.doScroll("left")}catch(a){setTimeout(ma,1);return}c.ready()}}function Qa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,j){var i=a.length;if(typeof b==="object"){for(var o in b)X(a,o,b[o],f,e,d);return a}if(d!==w){f=!j&&f&&c.isFunction(d);for(o=0;o)[^>]*$|^#([\w-]+)$/,Ua=/^.[^:#\[\.,]*$/,Va=/\S/, +Wa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Xa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,P=navigator.userAgent,xa=false,Q=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,R=Array.prototype.slice,ya=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(a==="body"&&!b){this.context=s;this[0]=s.body;this.selector="body";this.length=1;return this}if(typeof a==="string")if((d=Ta.exec(a))&& +(d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:s;if(a=Xa.exec(a))if(c.isPlainObject(b)){a=[s.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=sa([d[1]],[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}return c.merge(this,a)}else{if(b=s.getElementById(d[2])){if(b.id!==d[2])return T.find(a);this.length=1;this[0]=b}this.context=s;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=s;a=s.getElementsByTagName(a);return c.merge(this, +a)}else return!b||b.jquery?(b||T).find(a):c(b).find(a);else if(c.isFunction(a))return T.ready(a);if(a.selector!==w){this.selector=a.selector;this.context=a.context}return c.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){var f=c();c.isArray(a)?ba.apply(f,a):c.merge(f,a);f.prevObject=this;f.context=this.context;if(b=== +"find")f.selector=this.selector+(this.selector?" ":"")+d;else if(b)f.selector=this.selector+"."+b+"("+d+")";return f},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(s,c);else Q&&Q.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(R.apply(this,arguments),"slice",R.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this, +function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,j,i,o;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b
a"; +var e=d.getElementsByTagName("*"),j=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!j)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(j.getAttribute("style")),hrefNormalized:j.getAttribute("href")==="/a",opacity:/^0.55$/.test(j.style.opacity),cssFloat:!!j.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:s.createElement("select").appendChild(s.createElement("option")).selected, +parentNode:d.removeChild(d.appendChild(s.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};b.type="text/javascript";try{b.appendChild(s.createTextNode("window."+f+"=1;"))}catch(i){}a.insertBefore(b,a.firstChild);if(A[f]){c.support.scriptEval=true;delete A[f]}try{delete b.test}catch(o){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function k(){c.support.noCloneEvent= +false;d.detachEvent("onclick",k)});d.cloneNode(true).fireEvent("onclick")}d=s.createElement("div");d.innerHTML="";a=s.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var k=s.createElement("div");k.style.width=k.style.paddingLeft="1px";s.body.appendChild(k);c.boxModel=c.support.boxModel=k.offsetWidth===2;s.body.removeChild(k).style.display="none"});a=function(k){var n= +s.createElement("div");k="on"+k;var r=k in n;if(!r){n.setAttribute(k,"return;");r=typeof n[k]==="function"}return r};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=j=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ya=0,za={};c.extend({cache:{},expando:G,noData:{embed:true,object:true, +applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var f=a[G],e=c.cache;if(!f&&typeof b==="string"&&d===w)return null;f||(f=++Ya);if(typeof b==="object"){a[G]=f;e[f]=c.extend(true,{},b)}else if(!e[f]){a[G]=f;e[f]={}}a=e[f];if(d!==w)a[b]=d;return typeof b==="string"?a[b]:a}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{if(c.support.deleteExpando)delete a[c.expando]; +else a.removeAttribute&&a.removeAttribute(c.expando);delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===w){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===w&&this.length)f=c.data(this[0],a);return f===w&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this, +a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d);return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b=== +w)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var Aa=/[\n\t]/g,ca=/\s+/,Za=/\r/g,$a=/href|src|style/,ab=/(button|input)/i,bb=/(button|input|object|select|textarea)/i, +cb=/^(a|area)$/i,Ba=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(n){var r=c(this);r.addClass(a.call(this,n,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d-1)return true;return false},val:function(a){if(a===w){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var j=b?d:0;for(d=b?d+1:e.length;j=0;else if(c.nodeName(this,"select")){var u=c.makeArray(r);c("option",this).each(function(){this.selected= +c.inArray(c(this).val(),u)>=0});if(!u.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return w;if(f&&b in c.attrFn)return c(a)[b](d);f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==w;b=f&&c.props[b]||b;if(a.nodeType===1){var j=$a.test(b);if(b in a&&f&&!j){if(e){b==="type"&&ab.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed"); +a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:bb.test(a.nodeName)||cb.test(a.nodeName)&&a.href?0:w;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText=""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&j?a.getAttribute(b,2):a.getAttribute(b);return a===null?w:a}return c.style(a,b,d)}});var O=/\.(.*)$/,db=function(a){return a.replace(/[^\w\s\.\|`]/g, +function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==A&&!a.frameElement)a=A;var e,j;if(d.handler){e=d;d=e.handler}if(!d.guid)d.guid=c.guid++;if(j=c.data(a)){var i=j.events=j.events||{},o=j.handle;if(!o)j.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,arguments):w};o.elem=a;b=b.split(" ");for(var k,n=0,r;k=b[n++];){j=e?c.extend({},e):{handler:d,data:f};if(k.indexOf(".")>-1){r=k.split("."); +k=r.shift();j.namespace=r.slice(0).sort().join(".")}else{r=[];j.namespace=""}j.type=k;j.guid=d.guid;var u=i[k],z=c.event.special[k]||{};if(!u){u=i[k]=[];if(!z.setup||z.setup.call(a,f,r,o)===false)if(a.addEventListener)a.addEventListener(k,o,false);else a.attachEvent&&a.attachEvent("on"+k,o)}if(z.add){z.add.call(a,j);if(!j.handler.guid)j.handler.guid=d.guid}u.push(j);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){var e,j=0,i,o,k,n,r,u,z=c.data(a), +C=z&&z.events;if(z&&C){if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(e in C)c.event.remove(a,e+b)}else{for(b=b.split(" ");e=b[j++];){n=e;i=e.indexOf(".")<0;o=[];if(!i){o=e.split(".");e=o.shift();k=new RegExp("(^|\\.)"+c.map(o.slice(0).sort(),db).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(r=C[e])if(d){n=c.event.special[e]||{};for(B=f||0;B=0){a.type= +e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return w;a.result=w;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d,b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(j){}if(!a.isPropagationStopped()&& +f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){f=a.target;var i,o=c.nodeName(f,"a")&&e==="click",k=c.event.special[e]||{};if((!k._default||k._default.call(d,a)===false)&&!o&&!(f&&f.nodeName&&c.noData[f.nodeName.toLowerCase()])){try{if(f[e]){if(i=f["on"+e])f["on"+e]=null;c.event.triggered=true;f[e]()}}catch(n){}if(i)f["on"+e]=i;c.event.triggered=false}}},handle:function(a){var b,d,f,e;a=arguments[0]=c.event.fix(a||A.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive; +if(!b){d=a.type.split(".");a.type=d.shift();f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}e=c.data(this,"events");d=e[a.type];if(e&&d){d=d.slice(0);e=0;for(var j=d.length;e-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},fa=function(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Fa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data", +e);if(!(f===w||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:fa,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return fa.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return fa.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a, +"_change_data",Fa(a))}},setup:function(){if(this.type==="file")return false;for(var a in ea)c.event.add(this,a+".specialChange",ea[a]);return da.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return da.test(this.nodeName)}};ea=c.event.special.change.filters}s.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this,f)}c.event.special[b]={setup:function(){this.addEventListener(a, +d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var j in d)this[b](j,f,d[j],e);return this}if(c.isFunction(f)){e=f;f=w}var i=b==="one"?c.proxy(e,function(k){c(this).unbind(k,i);return e.apply(this,arguments)}):e;if(d==="unload"&&b!=="one")this.one(d,f,e);else{j=0;for(var o=this.length;j0){y=t;break}}t=t[g]}m[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, +e=0,j=Object.prototype.toString,i=false,o=true;[0,0].sort(function(){o=false;return 0});var k=function(g,h,l,m){l=l||[];var q=h=h||s;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g||typeof g!=="string")return l;for(var p=[],v,t,y,S,H=true,M=x(h),I=g;(f.exec(""),v=f.exec(I))!==null;){I=v[3];p.push(v[1]);if(v[2]){S=v[3];break}}if(p.length>1&&r.exec(g))if(p.length===2&&n.relative[p[0]])t=ga(p[0]+p[1],h);else for(t=n.relative[p[0]]?[h]:k(p.shift(),h);p.length;){g=p.shift();if(n.relative[g])g+=p.shift(); +t=ga(g,t)}else{if(!m&&p.length>1&&h.nodeType===9&&!M&&n.match.ID.test(p[0])&&!n.match.ID.test(p[p.length-1])){v=k.find(p.shift(),h,M);h=v.expr?k.filter(v.expr,v.set)[0]:v.set[0]}if(h){v=m?{expr:p.pop(),set:z(m)}:k.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=v.expr?k.filter(v.expr,v.set):v.set;if(p.length>0)y=z(t);else H=false;for(;p.length;){var D=p.pop();v=D;if(n.relative[D])v=p.pop();else D="";if(v==null)v=h;n.relative[D](y,v,M)}}else y=[]}y||(y=t);y||k.error(D|| +g);if(j.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))l.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&l.push(t[g]);else l.push.apply(l,y);else z(y,l);if(S){k(S,q,l,m);k.uniqueSort(l)}return l};k.uniqueSort=function(g){if(B){i=o;g.sort(B);if(i)for(var h=1;h":function(g,h){var l=typeof h==="string";if(l&&!/\W/.test(h)){h=h.toLowerCase();for(var m=0,q=g.length;m=0))l||m.push(v);else if(l)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()}, +CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,l,m,q,p){h=g[1].replace(/\\/g,"");if(!p&&n.attrMap[h])g[1]=n.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,l,m,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,h);else{g=k.filter(g[3],h,l,true^q);l||m.push.apply(m, +g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,l){return!!k(l[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)}, +text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}}, +setFilters:{first:function(g,h){return h===0},last:function(g,h,l,m){return h===m.length-1},even:function(g,h){return h%2===0},odd:function(g,h){return h%2===1},lt:function(g,h,l){return hl[3]-0},nth:function(g,h,l){return l[3]-0===h},eq:function(g,h,l){return l[3]-0===h}},filter:{PSEUDO:function(g,h,l,m){var q=h[1],p=n.filters[q];if(p)return p(g,l,h,m);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h= +h[3];l=0;for(m=h.length;l=0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var l=h[1];g=n.attrHandle[l]?n.attrHandle[l](g):g[l]!=null?g[l]:g.getAttribute(l);l=g+"";var m=h[2];h=h[4];return g==null?m==="!=":m=== +"="?l===h:m==="*="?l.indexOf(h)>=0:m==="~="?(" "+l+" ").indexOf(h)>=0:!h?l&&g!==false:m==="!="?l!==h:m==="^="?l.indexOf(h)===0:m==="$="?l.substr(l.length-h.length)===h:m==="|="?l===h||l.substr(0,h.length+1)===h+"-":false},POS:function(g,h,l,m){var q=n.setFilters[h[2]];if(q)return q(g,l,h,m)}}},r=n.match.POS;for(var u in n.match){n.match[u]=new RegExp(n.match[u].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[u]=new RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[u].source.replace(/\\(\d+)/g,function(g, +h){return"\\"+(h-0+1)}))}var z=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};try{Array.prototype.slice.call(s.documentElement.childNodes,0)}catch(C){z=function(g,h){h=h||[];if(j.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var l=0,m=g.length;l";var l=s.documentElement;l.insertBefore(g,l.firstChild);if(s.getElementById(h)){n.find.ID=function(m,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(m[1]))?q.id===m[1]||typeof q.getAttributeNode!=="undefined"&& +q.getAttributeNode("id").nodeValue===m[1]?[q]:w:[]};n.filter.ID=function(m,q){var p=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&p&&p.nodeValue===q}}l.removeChild(g);l=g=null})();(function(){var g=s.createElement("div");g.appendChild(s.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(h,l){l=l.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var m=0;l[m];m++)l[m].nodeType===1&&h.push(l[m]);l=h}return l};g.innerHTML=""; +if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(h){return h.getAttribute("href",2)};g=null})();s.querySelectorAll&&function(){var g=k,h=s.createElement("div");h.innerHTML="

";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){k=function(m,q,p,v){q=q||s;if(!v&&q.nodeType===9&&!x(q))try{return z(q.querySelectorAll(m),p)}catch(t){}return g(m,q,p,v)};for(var l in g)k[l]=g[l];h=null}}(); +(function(){var g=s.createElement("div");g.innerHTML="
";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(h,l,m){if(typeof l.getElementsByClassName!=="undefined"&&!m)return l.getElementsByClassName(h[1])};g=null}}})();var E=s.compareDocumentPosition?function(g,h){return!!(g.compareDocumentPosition(h)&16)}: +function(g,h){return g!==h&&(g.contains?g.contains(h):true)},x=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},ga=function(g,h){var l=[],m="",q;for(h=h.nodeType?[h]:h;q=n.match.PSEUDO.exec(g);){m+=q[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;q=0;for(var p=h.length;q=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f0)for(var j=d;j0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,j= +{},i;if(f&&a.length){e=0;for(var o=a.length;e-1:c(f).is(e)){d.push({selector:i,elem:f});delete j[i]}}f=f.parentNode}}return d}var k=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(n,r){for(;r&&r.ownerDocument&&r!==b;){if(k?k.index(r)>-1:c(r).is(a))return r;r=r.parentNode}return null})},index:function(a){if(!a||typeof a=== +"string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),a);return this.pushStack(qa(a[0])||qa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode", +d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")? +a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);eb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e):e;if((this.length>1||gb.test(f))&&fb.test(a))e=e.reverse();return this.pushStack(e,a,R.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===w||a.nodeType!==1||!c(a).is(d));){a.nodeType=== +1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var Ja=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ka=/(<([\w:]+)[^>]*?)\/>/g,hb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,La=/<([\w:]+)/,ib=/"},F={option:[1,""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div
","
"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d= +c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==w)return this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this}, +wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})}, +prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b, +this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,f;(f=this[d])!=null;d++)if(!a||c.filter(a,[f]).length){if(!b&&f.nodeType===1){c.cleanData(f.getElementsByTagName("*"));c.cleanData([f])}f.parentNode&&f.parentNode.removeChild(f)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild); +return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Ja,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){ra(this,b);ra(this.find("*"),b.find("*"))}return b},html:function(a){if(a===w)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Ja, +""):null;else if(typeof a==="string"&&!ta.test(a)&&(c.support.leadingWhitespace||!V.test(a))&&!F[(La.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ka,Ma);try{for(var b=0,d=this.length;b0||e.cacheable||this.length>1?k.cloneNode(true):k)}o.length&&c.each(o,Qa)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var f=[];d=c(d);var e=this.length===1&&this[0].parentNode;if(e&&e.nodeType===11&&e.childNodes.length===1&&d.length===1){d[b](this[0]); +return this}else{e=0;for(var j=d.length;e0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),i);f=f.concat(i)}return this.pushStack(f,a,d.selector)}}});c.extend({clean:function(a,b,d,f){b=b||s;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||s;for(var e=[],j=0,i;(i=a[j])!=null;j++){if(typeof i==="number")i+="";if(i){if(typeof i==="string"&&!jb.test(i))i=b.createTextNode(i);else if(typeof i==="string"){i=i.replace(Ka,Ma);var o=(La.exec(i)||["", +""])[1].toLowerCase(),k=F[o]||F._default,n=k[0],r=b.createElement("div");for(r.innerHTML=k[1]+i+k[2];n--;)r=r.lastChild;if(!c.support.tbody){n=ib.test(i);o=o==="table"&&!n?r.firstChild&&r.firstChild.childNodes:k[1]===""&&!n?r.childNodes:[];for(k=o.length-1;k>=0;--k)c.nodeName(o[k],"tbody")&&!o[k].childNodes.length&&o[k].parentNode.removeChild(o[k])}!c.support.leadingWhitespace&&V.test(i)&&r.insertBefore(b.createTextNode(V.exec(i)[0]),r.firstChild);i=r.childNodes}if(i.nodeType)e.push(i);else e= +c.merge(e,i)}}if(d)for(j=0;e[j];j++)if(f&&c.nodeName(e[j],"script")&&(!e[j].type||e[j].type.toLowerCase()==="text/javascript"))f.push(e[j].parentNode?e[j].parentNode.removeChild(e[j]):e[j]);else{e[j].nodeType===1&&e.splice.apply(e,[j+1,0].concat(c.makeArray(e[j].getElementsByTagName("script"))));d.appendChild(e[j])}return e},cleanData:function(a){for(var b,d,f=c.cache,e=c.event.special,j=c.support.deleteExpando,i=0,o;(o=a[i])!=null;i++)if(d=o[c.expando]){b=f[d];if(b.events)for(var k in b.events)e[k]? +c.event.remove(o,k):Ca(o,k,b.handle);if(j)delete o[c.expando];else o.removeAttribute&&o.removeAttribute(c.expando);delete f[d]}}});var kb=/z-?index|font-?weight|opacity|zoom|line-?height/i,Na=/alpha\([^)]*\)/,Oa=/opacity=([^)]*)/,ha=/float/i,ia=/-([a-z])/ig,lb=/([A-Z])/g,mb=/^-?\d+(?:px)?$/i,nb=/^-?\d/,ob={position:"absolute",visibility:"hidden",display:"block"},pb=["Left","Right"],qb=["Top","Bottom"],rb=s.defaultView&&s.defaultView.getComputedStyle,Pa=c.support.cssFloat?"cssFloat":"styleFloat",ja= +function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===w)return c.curCSS(d,f);if(typeof e==="number"&&!kb.test(f))e+="px";c.style(d,f,e)})};c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return w;if((b==="width"||b==="height")&&parseFloat(d)<0)d=w;var f=a.style||a,e=d!==w;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter= +Na.test(a)?a.replace(Na,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Oa.exec(f.filter)[1])/100+"":""}if(ha.test(b))b=Pa;b=b.replace(ia,ja);if(e)f[b]=d;return f[b]},css:function(a,b,d,f){if(b==="width"||b==="height"){var e,j=b==="width"?pb:qb;function i(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(j,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a, +"border"+this+"Width",true))||0})}a.offsetWidth!==0?i():c.swap(a,ob,i);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&&a.currentStyle){f=Oa.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ha.test(b))b=Pa;if(!d&&e&&e[b])f=e[b];else if(rb){if(ha.test(b))b="float";b=b.replace(lb,"-$1").toLowerCase();e=a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f= +a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ia,ja);f=a.currentStyle[b]||a.currentStyle[d];if(!mb.test(f)&&nb.test(f)){b=e.left;var j=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=j}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b= +a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var sb=J(),tb=//gi,ub=/select|textarea/i,vb=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,N=/=\?(&|$)/,ka=/\?/,wb=/(\?|&)_=.*?(&|$)/,xb=/^(\w+:)?\/\/([^\/?#]+)/,yb=/%20/g,zb=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!== +"string")return zb.call(this,a);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var e=a.slice(f,a.length);a=a.slice(0,f)}f="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);f="POST"}var j=this;c.ajax({url:a,type:f,dataType:"html",data:b,complete:function(i,o){if(o==="success"||o==="notmodified")j.html(e?c("
").append(i.responseText.replace(tb,"")).find(e):i.responseText);d&&j.each(d,[i.responseText,o,i])}});return this}, +serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ub.test(this.nodeName)||vb.test(this.type))}).map(function(a,b){a=c(this).val();return a==null?null:c.isArray(a)?c.map(a,function(d){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), +function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:f})},getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:f})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href, +global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:A.XMLHttpRequest&&(A.location.protocol!=="file:"||!A.ActiveXObject)?function(){return new A.XMLHttpRequest}:function(){try{return new A.ActiveXObject("Microsoft.XMLHTTP")}catch(a){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(a){function b(){e.success&& +e.success.call(k,o,i,x);e.global&&f("ajaxSuccess",[x,e])}function d(){e.complete&&e.complete.call(k,x,i);e.global&&f("ajaxComplete",[x,e]);e.global&&!--c.active&&c.event.trigger("ajaxStop")}function f(q,p){(e.context?c(e.context):c.event).trigger(q,p)}var e=c.extend(true,{},c.ajaxSettings,a),j,i,o,k=a&&a.context||e,n=e.type.toUpperCase();if(e.data&&e.processData&&typeof e.data!=="string")e.data=c.param(e.data,e.traditional);if(e.dataType==="jsonp"){if(n==="GET")N.test(e.url)||(e.url+=(ka.test(e.url)? +"&":"?")+(e.jsonp||"callback")+"=?");else if(!e.data||!N.test(e.data))e.data=(e.data?e.data+"&":"")+(e.jsonp||"callback")+"=?";e.dataType="json"}if(e.dataType==="json"&&(e.data&&N.test(e.data)||N.test(e.url))){j=e.jsonpCallback||"jsonp"+sb++;if(e.data)e.data=(e.data+"").replace(N,"="+j+"$1");e.url=e.url.replace(N,"="+j+"$1");e.dataType="script";A[j]=A[j]||function(q){o=q;b();d();A[j]=w;try{delete A[j]}catch(p){}z&&z.removeChild(C)}}if(e.dataType==="script"&&e.cache===null)e.cache=false;if(e.cache=== +false&&n==="GET"){var r=J(),u=e.url.replace(wb,"$1_="+r+"$2");e.url=u+(u===e.url?(ka.test(e.url)?"&":"?")+"_="+r:"")}if(e.data&&n==="GET")e.url+=(ka.test(e.url)?"&":"?")+e.data;e.global&&!c.active++&&c.event.trigger("ajaxStart");r=(r=xb.exec(e.url))&&(r[1]&&r[1]!==location.protocol||r[2]!==location.host);if(e.dataType==="script"&&n==="GET"&&r){var z=s.getElementsByTagName("head")[0]||s.documentElement,C=s.createElement("script");C.src=e.url;if(e.scriptCharset)C.charset=e.scriptCharset;if(!j){var B= +false;C.onload=C.onreadystatechange=function(){if(!B&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){B=true;b();d();C.onload=C.onreadystatechange=null;z&&C.parentNode&&z.removeChild(C)}}}z.insertBefore(C,z.firstChild);return w}var E=false,x=e.xhr();if(x){e.username?x.open(n,e.url,e.async,e.username,e.password):x.open(n,e.url,e.async);try{if(e.data||a&&a.contentType)x.setRequestHeader("Content-Type",e.contentType);if(e.ifModified){c.lastModified[e.url]&&x.setRequestHeader("If-Modified-Since", +c.lastModified[e.url]);c.etag[e.url]&&x.setRequestHeader("If-None-Match",c.etag[e.url])}r||x.setRequestHeader("X-Requested-With","XMLHttpRequest");x.setRequestHeader("Accept",e.dataType&&e.accepts[e.dataType]?e.accepts[e.dataType]+", */*":e.accepts._default)}catch(ga){}if(e.beforeSend&&e.beforeSend.call(k,x,e)===false){e.global&&!--c.active&&c.event.trigger("ajaxStop");x.abort();return false}e.global&&f("ajaxSend",[x,e]);var g=x.onreadystatechange=function(q){if(!x||x.readyState===0||q==="abort"){E|| +d();E=true;if(x)x.onreadystatechange=c.noop}else if(!E&&x&&(x.readyState===4||q==="timeout")){E=true;x.onreadystatechange=c.noop;i=q==="timeout"?"timeout":!c.httpSuccess(x)?"error":e.ifModified&&c.httpNotModified(x,e.url)?"notmodified":"success";var p;if(i==="success")try{o=c.httpData(x,e.dataType,e)}catch(v){i="parsererror";p=v}if(i==="success"||i==="notmodified")j||b();else c.handleError(e,x,i,p);d();q==="timeout"&&x.abort();if(e.async)x=null}};try{var h=x.abort;x.abort=function(){x&&h.call(x); +g("abort")}}catch(l){}e.async&&e.timeout>0&&setTimeout(function(){x&&!E&&g("timeout")},e.timeout);try{x.send(n==="POST"||n==="PUT"||n==="DELETE"?e.data:null)}catch(m){c.handleError(e,x,null,m);d()}e.async||g();return x}},handleError:function(a,b,d,f){if(a.error)a.error.call(a.context||a,b,d,f);if(a.global)(a.context?c(a.context):c.event).trigger("ajaxError",[b,a,f])},active:0,httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status=== +1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(f)c.etag[b]=f;return a.status===304||a.status===0},httpData:function(a,b,d){var f=a.getResponseHeader("content-type")||"",e=b==="xml"||!b&&f.indexOf("xml")>=0;a=e?a.responseXML:a.responseText;e&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b=== +"json"||!b&&f.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a},param:function(a,b){function d(i,o){if(c.isArray(o))c.each(o,function(k,n){b||/\[\]$/.test(i)?f(i,n):d(i+"["+(typeof n==="object"||c.isArray(n)?k:"")+"]",n)});else!b&&o!=null&&typeof o==="object"?c.each(o,function(k,n){d(i+"["+k+"]",n)}):f(i,o)}function f(i,o){o=c.isFunction(o)?o():o;e[e.length]=encodeURIComponent(i)+"="+encodeURIComponent(o)}var e=[];if(b===w)b=c.ajaxSettings.traditional; +if(c.isArray(a)||a.jquery)c.each(a,function(){f(this.name,this.value)});else for(var j in a)d(j,a[j]);return e.join("&").replace(yb,"+")}});var la={},Ab=/toggle|show|hide/,Bb=/^([+-]=)?([\d+-.]+)(.*)$/,W,va=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b){if(a||a===0)return this.animate(K("show",3),a,b);else{a=0;for(b=this.length;a").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove();la[d]=f}c.data(this[a],"olddisplay",f)}}a=0;for(b=this.length;a=0;f--)if(d[f].elem===this){b&&d[f](true);d.splice(f,1)}});b||this.dequeue();return this}});c.each({slideDown:K("show",1),slideUp:K("hide",1),slideToggle:K("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,f){return this.animate(b,d,f)}});c.extend({speed:function(a,b,d){var f=a&&typeof a==="object"?a:{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};f.duration=c.fx.off?0:typeof f.duration=== +"number"?f.duration:c.fx.speeds[f.duration]||c.fx.speeds._default;f.old=f.complete;f.complete=function(){f.queue!==false&&c(this).dequeue();c.isFunction(f.old)&&f.old.call(this)};return f},easing:{linear:function(a,b,d,f){return d+f*a},swing:function(a,b,d,f){return(-Math.cos(a*Math.PI)/2+0.5)*f+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]|| +c.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style)this.elem.style.display="block"},cur:function(a){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];return(a=parseFloat(c.css(this.elem,this.prop,a)))&&a>-10000?a:parseFloat(c.curCSS(this.elem,this.prop))||0},custom:function(a,b,d){function f(j){return e.step(j)}this.startTime=J();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start; +this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now= +this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem, +e,this.options.orig[e]);this.options.complete.call(this.elem)}return false}else{e=b-this.startTime;this.state=e/this.options.duration;a=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,e,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b
"; +a.insertBefore(b,a.firstChild);d=b.firstChild;f=d.firstChild;e=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=f.offsetTop!==5;this.doesAddBorderForTableAndCells=e.offsetTop===5;f.style.position="fixed";f.style.top="20px";this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15;f.style.position=f.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==j;a.removeChild(b); +c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.curCSS(a,"marginTop",true))||0;d+=parseFloat(c.curCSS(a,"marginLeft",true))||0}return{top:b,left:d}},setOffset:function(a,b,d){if(/static/.test(c.curCSS(a,"position")))a.style.position="relative";var f=c(a),e=f.offset(),j=parseInt(c.curCSS(a,"top",true),10)||0,i=parseInt(c.curCSS(a,"left",true),10)||0;if(c.isFunction(b))b=b.call(a, +d,e);d={top:b.top-e.top+j,left:b.left-e.left+i};"using"in b?b.using.call(a,d):f.css(d)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),f=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.curCSS(a,"marginTop",true))||0;d.left-=parseFloat(c.curCSS(a,"marginLeft",true))||0;f.top+=parseFloat(c.curCSS(b[0],"borderTopWidth",true))||0;f.left+=parseFloat(c.curCSS(b[0],"borderLeftWidth",true))||0;return{top:d.top- +f.top,left:d.left-f.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||s.body;a&&!/^body|html$/i.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(f){var e=this[0],j;if(!e)return null;if(f!==w)return this.each(function(){if(j=wa(this))j.scrollTo(!a?f:c(j).scrollLeft(),a?f:c(j).scrollTop());else this[d]=f});else return(j=wa(e))?"pageXOffset"in j?j[a?"pageYOffset": +"pageXOffset"]:c.support.boxModel&&j.document.documentElement[d]||j.document.body[d]:e[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?c.css(this[0],d,false,"padding"):null};c.fn["outer"+b]=function(f){return this[0]?c.css(this[0],d,false,f?"margin":"border"):null};c.fn[d]=function(f){var e=this[0];if(!e)return f==null?null:this;if(c.isFunction(f))return this.each(function(j){var i=c(this);i[d](f.call(this,j,i[d]()))});return"scrollTo"in +e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]||e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===w?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});A.jQuery=A.$=c})(window); diff --git a/redakcja/static/js/jquery.autocomplete.js b/redakcja/static/js/jquery.autocomplete.js new file mode 100644 index 00000000..0d25ba66 --- /dev/null +++ b/redakcja/static/js/jquery.autocomplete.js @@ -0,0 +1,808 @@ +/* + * jQuery Autocomplete plugin 1.1 + * + * Copyright (c) 2009 Jörn Zaefferer + * + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + * + * Revision: $Id: jquery.autocomplete.js 15 2009-08-22 10:30:27Z joern.zaefferer $ + */ + +;(function($) { + +$.fn.extend({ + autocomplete: function(urlOrData, options) { + var isUrl = typeof urlOrData == "string"; + options = $.extend({}, $.Autocompleter.defaults, { + url: isUrl ? urlOrData : null, + data: isUrl ? null : urlOrData, + delay: isUrl ? $.Autocompleter.defaults.delay : 10, + max: options && !options.scroll ? 10 : 150 + }, options); + + // if highlight is set to false, replace it with a do-nothing function + options.highlight = options.highlight || function(value) { return value; }; + + // if the formatMatch option is not specified, then use formatItem for backwards compatibility + options.formatMatch = options.formatMatch || options.formatItem; + + return this.each(function() { + new $.Autocompleter(this, options); + }); + }, + result: function(handler) { + return this.bind("result", handler); + }, + search: function(handler) { + return this.trigger("search", [handler]); + }, + flushCache: function() { + return this.trigger("flushCache"); + }, + setOptions: function(options){ + return this.trigger("setOptions", [options]); + }, + unautocomplete: function() { + return this.trigger("unautocomplete"); + } +}); + +$.Autocompleter = function(input, options) { + + var KEY = { + UP: 38, + DOWN: 40, + DEL: 46, + TAB: 9, + RETURN: 13, + ESC: 27, + COMMA: 188, + PAGEUP: 33, + PAGEDOWN: 34, + BACKSPACE: 8 + }; + + // Create $ object for input element + var $input = $(input).attr("autocomplete", "off").addClass(options.inputClass); + + var timeout; + var previousValue = ""; + var cache = $.Autocompleter.Cache(options); + var hasFocus = 0; + var lastKeyPressCode; + var config = { + mouseDownOnSelect: false + }; + var select = $.Autocompleter.Select(options, input, selectCurrent, config); + + var blockSubmit; + + // prevent form submit in opera when selecting with return key + $.browser.opera && $(input.form).bind("submit.autocomplete", function() { + if (blockSubmit) { + blockSubmit = false; + return false; + } + }); + + // only opera doesn't trigger keydown multiple times while pressed, others don't work with keypress at all + $input.bind(($.browser.opera ? "keypress" : "keydown") + ".autocomplete", function(event) { + // a keypress means the input has focus + // avoids issue where input had focus before the autocomplete was applied + hasFocus = 1; + // track last key pressed + lastKeyPressCode = event.keyCode; + switch(event.keyCode) { + + case KEY.UP: + event.preventDefault(); + if ( select.visible() ) { + select.prev(); + } else { + onChange(0, true); + } + break; + + case KEY.DOWN: + event.preventDefault(); + if ( select.visible() ) { + select.next(); + } else { + onChange(0, true); + } + break; + + case KEY.PAGEUP: + event.preventDefault(); + if ( select.visible() ) { + select.pageUp(); + } else { + onChange(0, true); + } + break; + + case KEY.PAGEDOWN: + event.preventDefault(); + if ( select.visible() ) { + select.pageDown(); + } else { + onChange(0, true); + } + break; + + // matches also semicolon + case options.multiple && $.trim(options.multipleSeparator) == "," && KEY.COMMA: + case KEY.TAB: + case KEY.RETURN: + if( selectCurrent() ) { + // stop default to prevent a form submit, Opera needs special handling + event.preventDefault(); + blockSubmit = true; + return false; + } + break; + + case KEY.ESC: + select.hide(); + break; + + default: + clearTimeout(timeout); + timeout = setTimeout(onChange, options.delay); + break; + } + }).focus(function(){ + // track whether the field has focus, we shouldn't process any + // results if the field no longer has focus + hasFocus++; + }).blur(function() { + hasFocus = 0; + if (!config.mouseDownOnSelect) { + hideResults(); + } + }).click(function() { + // show select when clicking in a focused field + if ( hasFocus++ > 1 && !select.visible() ) { + onChange(0, true); + } + }).bind("search", function() { + // TODO why not just specifying both arguments? + var fn = (arguments.length > 1) ? arguments[1] : null; + function findValueCallback(q, data) { + var result; + if( data && data.length ) { + for (var i=0; i < data.length; i++) { + if( data[i].result.toLowerCase() == q.toLowerCase() ) { + result = data[i]; + break; + } + } + } + if( typeof fn == "function" ) fn(result); + else $input.trigger("result", result && [result.data, result.value]); + } + $.each(trimWords($input.val()), function(i, value) { + request(value, findValueCallback, findValueCallback); + }); + }).bind("flushCache", function() { + cache.flush(); + }).bind("setOptions", function() { + $.extend(options, arguments[1]); + // if we've updated the data, repopulate + if ( "data" in arguments[1] ) + cache.populate(); + }).bind("unautocomplete", function() { + select.unbind(); + $input.unbind(); + $(input.form).unbind(".autocomplete"); + }); + + + function selectCurrent() { + var selected = select.selected(); + if( !selected ) + return false; + + var v = selected.result; + previousValue = v; + + if ( options.multiple ) { + var words = trimWords($input.val()); + if ( words.length > 1 ) { + var seperator = options.multipleSeparator.length; + var cursorAt = $(input).selection().start; + var wordAt, progress = 0; + $.each(words, function(i, word) { + progress += word.length; + if (cursorAt <= progress) { + wordAt = i; + return false; + } + progress += seperator; + }); + words[wordAt] = v; + // TODO this should set the cursor to the right position, but it gets overriden somewhere + //$.Autocompleter.Selection(input, progress + seperator, progress + seperator); + v = words.join( options.multipleSeparator ); + } + v += options.multipleSeparator; + } + + $input.val(v); + hideResultsNow(); + $input.trigger("result", [selected.data, selected.value]); + return true; + } + + function onChange(crap, skipPrevCheck) { + if( lastKeyPressCode == KEY.DEL ) { + select.hide(); + return; + } + + var currentValue = $input.val(); + + if ( !skipPrevCheck && currentValue == previousValue ) + return; + + previousValue = currentValue; + + currentValue = lastWord(currentValue); + if ( currentValue.length >= options.minChars) { + $input.addClass(options.loadingClass); + if (!options.matchCase) + currentValue = currentValue.toLowerCase(); + request(currentValue, receiveData, hideResultsNow); + } else { + stopLoading(); + select.hide(); + } + }; + + function trimWords(value) { + if (!value) + return [""]; + if (!options.multiple) + return [$.trim(value)]; + return $.map(value.split(options.multipleSeparator), function(word) { + return $.trim(value).length ? $.trim(word) : null; + }); + } + + function lastWord(value) { + if ( !options.multiple ) + return value; + var words = trimWords(value); + if (words.length == 1) + return words[0]; + var cursorAt = $(input).selection().start; + if (cursorAt == value.length) { + words = trimWords(value) + } else { + words = trimWords(value.replace(value.substring(cursorAt), "")); + } + return words[words.length - 1]; + } + + // fills in the input box w/the first match (assumed to be the best match) + // q: the term entered + // sValue: the first matching result + function autoFill(q, sValue){ + // autofill in the complete box w/the first match as long as the user hasn't entered in more data + // if the last user key pressed was backspace, don't autofill + if( options.autoFill && (lastWord($input.val()).toLowerCase() == q.toLowerCase()) && lastKeyPressCode != KEY.BACKSPACE ) { + // fill in the value (keep the case the user has typed) + $input.val($input.val() + sValue.substring(lastWord(previousValue).length)); + // select the portion of the value not typed by the user (so the next character will erase) + $(input).selection(previousValue.length, previousValue.length + sValue.length); + } + }; + + function hideResults() { + clearTimeout(timeout); + timeout = setTimeout(hideResultsNow, 200); + }; + + function hideResultsNow() { + var wasVisible = select.visible(); + select.hide(); + clearTimeout(timeout); + stopLoading(); + if (options.mustMatch) { + // call search and run callback + $input.search( + function (result){ + // if no value found, clear the input box + if( !result ) { + if (options.multiple) { + var words = trimWords($input.val()).slice(0, -1); + $input.val( words.join(options.multipleSeparator) + (words.length ? options.multipleSeparator : "") ); + } + else { + $input.val( "" ); + $input.trigger("result", null); + } + } + } + ); + } + }; + + function receiveData(q, data) { + if ( data && data.length && hasFocus ) { + stopLoading(); + select.display(data, q); + autoFill(q, data[0].value); + select.show(); + } else { + hideResultsNow(); + } + }; + + function request(term, success, failure) { + if (!options.matchCase) + term = term.toLowerCase(); + var data = cache.load(term); + // recieve the cached data + if (data && data.length) { + success(term, data); + // if an AJAX url has been supplied, try loading the data now + } else if( (typeof options.url == "string") && (options.url.length > 0) ){ + + var extraParams = { + timestamp: +new Date() + }; + $.each(options.extraParams, function(key, param) { + extraParams[key] = typeof param == "function" ? param() : param; + }); + + $.ajax({ + // try to leverage ajaxQueue plugin to abort previous requests + mode: "abort", + // limit abortion to this input + port: "autocomplete" + input.name, + dataType: options.dataType, + url: options.url, + data: $.extend({ + q: lastWord(term), + limit: options.max + }, extraParams), + success: function(data) { + var parsed = options.parse && options.parse(data) || parse(data); + cache.add(term, parsed); + success(term, parsed); + } + }); + } else { + // if we have a failure, we need to empty the list -- this prevents the the [TAB] key from selecting the last successful match + select.emptyList(); + failure(term); + } + }; + + function parse(data) { + var parsed = []; + var rows = data.split("\n"); + for (var i=0; i < rows.length; i++) { + var row = $.trim(rows[i]); + if (row) { + row = row.split("|"); + parsed[parsed.length] = { + data: row, + value: row[0], + result: options.formatResult && options.formatResult(row, row[0]) || row[0] + }; + } + } + return parsed; + }; + + function stopLoading() { + $input.removeClass(options.loadingClass); + }; + +}; + +$.Autocompleter.defaults = { + inputClass: "ac_input", + resultsClass: "ac_results", + loadingClass: "ac_loading", + minChars: 1, + delay: 400, + matchCase: false, + matchSubset: true, + matchContains: false, + cacheLength: 10, + max: 100, + mustMatch: false, + extraParams: {}, + selectFirst: true, + formatItem: function(row) { return row[0]; }, + formatMatch: null, + autoFill: false, + width: 0, + multiple: false, + multipleSeparator: ", ", + highlight: function(value, term) { + return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1") + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "$1"); + }, + scroll: true, + scrollHeight: 180 +}; + +$.Autocompleter.Cache = function(options) { + + var data = {}; + var length = 0; + + function matchSubset(s, sub) { + if (!options.matchCase) + s = s.toLowerCase(); + var i = s.indexOf(sub); + if (options.matchContains == "word"){ + i = s.toLowerCase().search("\\b" + sub.toLowerCase()); + } + if (i == -1) return false; + return i == 0 || options.matchContains; + }; + + function add(q, value) { + if (length > options.cacheLength){ + flush(); + } + if (!data[q]){ + length++; + } + data[q] = value; + } + + function populate(){ + if( !options.data ) return false; + // track the matches + var stMatchSets = {}, + nullData = 0; + + // no url was specified, we need to adjust the cache length to make sure it fits the local data store + if( !options.url ) options.cacheLength = 1; + + // track all options for minChars = 0 + stMatchSets[""] = []; + + // loop through the array and create a lookup structure + for ( var i = 0, ol = options.data.length; i < ol; i++ ) { + var rawValue = options.data[i]; + // if rawValue is a string, make an array otherwise just reference the array + rawValue = (typeof rawValue == "string") ? [rawValue] : rawValue; + + var value = options.formatMatch(rawValue, i+1, options.data.length); + if ( value === false ) + continue; + + var firstChar = value.charAt(0).toLowerCase(); + // if no lookup array for this character exists, look it up now + if( !stMatchSets[firstChar] ) + stMatchSets[firstChar] = []; + + // if the match is a string + var row = { + value: value, + data: rawValue, + result: options.formatResult && options.formatResult(rawValue) || value + }; + + // push the current match into the set list + stMatchSets[firstChar].push(row); + + // keep track of minChars zero items + if ( nullData++ < options.max ) { + stMatchSets[""].push(row); + } + }; + + // add the data items to the cache + $.each(stMatchSets, function(i, value) { + // increase the cache size + options.cacheLength++; + // add to the cache + add(i, value); + }); + } + + // populate any existing data + setTimeout(populate, 25); + + function flush(){ + data = {}; + length = 0; + } + + return { + flush: flush, + add: add, + populate: populate, + load: function(q) { + if (!options.cacheLength || !length) + return null; + /* + * if dealing w/local data and matchContains than we must make sure + * to loop through all the data collections looking for matches + */ + if( !options.url && options.matchContains ){ + // track all matches + var csub = []; + // loop through all the data grids for matches + for( var k in data ){ + // don't search through the stMatchSets[""] (minChars: 0) cache + // this prevents duplicates + if( k.length > 0 ){ + var c = data[k]; + $.each(c, function(i, x) { + // if we've got a match, add it to the array + if (matchSubset(x.value, q)) { + csub.push(x); + } + }); + } + } + return csub; + } else + // if the exact item exists, use it + if (data[q]){ + return data[q]; + } else + if (options.matchSubset) { + for (var i = q.length - 1; i >= options.minChars; i--) { + var c = data[q.substr(0, i)]; + if (c) { + var csub = []; + $.each(c, function(i, x) { + if (matchSubset(x.value, q)) { + csub[csub.length] = x; + } + }); + return csub; + } + } + } + return null; + } + }; +}; + +$.Autocompleter.Select = function (options, input, select, config) { + var CLASSES = { + ACTIVE: "ac_over" + }; + + var listItems, + active = -1, + data, + term = "", + needsInit = true, + element, + list; + + // Create results + function init() { + if (!needsInit) + return; + element = $("
") + .hide() + .addClass(options.resultsClass) + .css("position", "absolute") + .appendTo(document.body); + + list = $("
    ").appendTo(element).mouseover( function(event) { + if(target(event).nodeName && target(event).nodeName.toUpperCase() == 'LI') { + active = $("li", list).removeClass(CLASSES.ACTIVE).index(target(event)); + $(target(event)).addClass(CLASSES.ACTIVE); + } + }).click(function(event) { + $(target(event)).addClass(CLASSES.ACTIVE); + select(); + // TODO provide option to avoid setting focus again after selection? useful for cleanup-on-focus + input.focus(); + return false; + }).mousedown(function() { + config.mouseDownOnSelect = true; + }).mouseup(function() { + config.mouseDownOnSelect = false; + }); + + if( options.width > 0 ) + element.css("width", options.width); + + needsInit = false; + } + + function target(event) { + var element = event.target; + while(element && element.tagName != "LI") + element = element.parentNode; + // more fun with IE, sometimes event.target is empty, just ignore it then + if(!element) + return []; + return element; + } + + function moveSelect(step) { + listItems.slice(active, active + 1).removeClass(CLASSES.ACTIVE); + movePosition(step); + var activeItem = listItems.slice(active, active + 1).addClass(CLASSES.ACTIVE); + if(options.scroll) { + var offset = 0; + listItems.slice(0, active).each(function() { + offset += this.offsetHeight; + }); + if((offset + activeItem[0].offsetHeight - list.scrollTop()) > list[0].clientHeight) { + list.scrollTop(offset + activeItem[0].offsetHeight - list.innerHeight()); + } else if(offset < list.scrollTop()) { + list.scrollTop(offset); + } + } + }; + + function movePosition(step) { + active += step; + if (active < 0) { + active = listItems.size() - 1; + } else if (active >= listItems.size()) { + active = 0; + } + } + + function limitNumberOfItems(available) { + return options.max && options.max < available + ? options.max + : available; + } + + function fillList() { + list.empty(); + var max = limitNumberOfItems(data.length); + for (var i=0; i < max; i++) { + if (!data[i]) + continue; + var formatted = options.formatItem(data[i].data, i+1, max, data[i].value, term); + if ( formatted === false ) + continue; + var li = $("
  • ").html( options.highlight(formatted, term) ).addClass(i%2 == 0 ? "ac_even" : "ac_odd").appendTo(list)[0]; + $.data(li, "ac_data", data[i]); + } + listItems = list.find("li"); + if ( options.selectFirst ) { + listItems.slice(0, 1).addClass(CLASSES.ACTIVE); + active = 0; + } + // apply bgiframe if available + if ( $.fn.bgiframe ) + list.bgiframe(); + } + + return { + display: function(d, q) { + init(); + data = d; + term = q; + fillList(); + }, + next: function() { + moveSelect(1); + }, + prev: function() { + moveSelect(-1); + }, + pageUp: function() { + if (active != 0 && active - 8 < 0) { + moveSelect( -active ); + } else { + moveSelect(-8); + } + }, + pageDown: function() { + if (active != listItems.size() - 1 && active + 8 > listItems.size()) { + moveSelect( listItems.size() - 1 - active ); + } else { + moveSelect(8); + } + }, + hide: function() { + element && element.hide(); + listItems && listItems.removeClass(CLASSES.ACTIVE); + active = -1; + }, + visible : function() { + return element && element.is(":visible"); + }, + current: function() { + return this.visible() && (listItems.filter("." + CLASSES.ACTIVE)[0] || options.selectFirst && listItems[0]); + }, + show: function() { + var offset = $(input).offset(); + element.css({ + width: typeof options.width == "string" || options.width > 0 ? options.width : $(input).width(), + top: offset.top + input.offsetHeight, + left: offset.left + }).show(); + if(options.scroll) { + list.scrollTop(0); + list.css({ + maxHeight: options.scrollHeight, + overflow: 'auto' + }); + + if($.browser.msie && typeof document.body.style.maxHeight === "undefined") { + var listHeight = 0; + listItems.each(function() { + listHeight += this.offsetHeight; + }); + var scrollbarsVisible = listHeight > options.scrollHeight; + list.css('height', scrollbarsVisible ? options.scrollHeight : listHeight ); + if (!scrollbarsVisible) { + // IE doesn't recalculate width when scrollbar disappears + listItems.width( list.width() - parseInt(listItems.css("padding-left")) - parseInt(listItems.css("padding-right")) ); + } + } + + } + }, + selected: function() { + var selected = listItems && listItems.filter("." + CLASSES.ACTIVE).removeClass(CLASSES.ACTIVE); + return selected && selected.length && $.data(selected[0], "ac_data"); + }, + emptyList: function (){ + list && list.empty(); + }, + unbind: function() { + element && element.remove(); + } + }; +}; + +$.fn.selection = function(start, end) { + if (start !== undefined) { + return this.each(function() { + if( this.createTextRange ){ + var selRange = this.createTextRange(); + if (end === undefined || start == end) { + selRange.move("character", start); + selRange.select(); + } else { + selRange.collapse(true); + selRange.moveStart("character", start); + selRange.moveEnd("character", end); + selRange.select(); + } + } else if( this.setSelectionRange ){ + this.setSelectionRange(start, end); + } else if( this.selectionStart ){ + this.selectionStart = start; + this.selectionEnd = end; + } + }); + } + var field = this[0]; + if ( field.createTextRange ) { + var range = document.selection.createRange(), + orig = field.value, + teststring = "<->", + textLength = range.text.length; + range.text = teststring; + var caretAt = field.value.indexOf(teststring); + field.value = orig; + this.selection(caretAt, caretAt + textLength); + return { + start: caretAt, + end: caretAt + textLength + } + } else if( field.selectionStart !== undefined ){ + return { + start: field.selectionStart, + end: field.selectionEnd + } + } +}; + +})(jQuery); \ No newline at end of file diff --git a/redakcja/static/js/jquery.blockui.js b/redakcja/static/js/jquery.blockui.js new file mode 100644 index 00000000..54916670 --- /dev/null +++ b/redakcja/static/js/jquery.blockui.js @@ -0,0 +1,477 @@ +/*! + * jQuery blockUI plugin + * Version 2.31 (06-JAN-2010) + * @requires jQuery v1.2.3 or later + * + * Examples at: http://malsup.com/jquery/block/ + * Copyright (c) 2007-2008 M. Alsup + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + * + * Thanks to Amir-Hossein Sobhi for some excellent contributions! + */ + +;(function($) { + +if (/1\.(0|1|2)\.(0|1|2)/.test($.fn.jquery) || /^1.1/.test($.fn.jquery)) { + alert('blockUI requires jQuery v1.2.3 or later! You are using v' + $.fn.jquery); + return; +} + +$.fn._fadeIn = $.fn.fadeIn; + +var noOp = function() {}; + +// this bit is to ensure we don't call setExpression when we shouldn't (with extra muscle to handle +// retarded userAgent strings on Vista) +var mode = document.documentMode || 0; +var setExpr = $.browser.msie && (($.browser.version < 8 && !mode) || mode < 8); +var ie6 = $.browser.msie && /MSIE 6.0/.test(navigator.userAgent) && !mode; + +// global $ methods for blocking/unblocking the entire page +$.blockUI = function(opts) { install(window, opts); }; +$.unblockUI = function(opts) { remove(window, opts); }; + +// convenience method for quick growl-like notifications (http://www.google.com/search?q=growl) +$.growlUI = function(title, message, timeout, onClose) { + var $m = $('
    '); + if (title) $m.append('

    '+title+'

    '); + if (message) $m.append('

    '+message+'

    '); + if (timeout == undefined) timeout = 3000; + $.blockUI({ + message: $m, fadeIn: 700, fadeOut: 1000, centerY: false, + timeout: timeout, showOverlay: false, + onUnblock: onClose, + css: $.blockUI.defaults.growlCSS + }); +}; + +// plugin method for blocking element content +$.fn.block = function(opts) { + return this.unblock({ fadeOut: 0 }).each(function() { + if ($.css(this,'position') == 'static') + this.style.position = 'relative'; + if ($.browser.msie) + this.style.zoom = 1; // force 'hasLayout' + install(this, opts); + }); +}; + +// plugin method for unblocking element content +$.fn.unblock = function(opts) { + return this.each(function() { + remove(this, opts); + }); +}; + +$.blockUI.version = 2.31; // 2nd generation blocking at no extra cost! + +// override these in your code to change the default behavior and style +$.blockUI.defaults = { + // message displayed when blocking (use null for no message) + message: '

    Please wait...

    ', + + title: null, // title string; only used when theme == true + draggable: true, // only used when theme == true (requires jquery-ui.js to be loaded) + + theme: false, // set to true to use with jQuery UI themes + + // styles for the message when blocking; if you wish to disable + // these and use an external stylesheet then do this in your code: + // $.blockUI.defaults.css = {}; + css: { + padding: 0, + margin: 0, + width: '30%', + top: '40%', + left: '35%', + textAlign: 'center', + color: '#000', + border: '3px solid #aaa', + backgroundColor:'#fff', + cursor: 'wait' + }, + + // minimal style set used when themes are used + themedCSS: { + width: '30%', + top: '40%', + left: '35%' + }, + + // styles for the overlay + overlayCSS: { + backgroundColor: '#000', + opacity: 0.6, + cursor: 'wait' + }, + + // styles applied when using $.growlUI + growlCSS: { + width: '350px', + top: '10px', + left: '', + right: '10px', + border: 'none', + padding: '5px', + opacity: 0.6, + cursor: 'default', + color: '#fff', + backgroundColor: '#000', + '-webkit-border-radius': '10px', + '-moz-border-radius': '10px' + }, + + // IE issues: 'about:blank' fails on HTTPS and javascript:false is s-l-o-w + // (hat tip to Jorge H. N. de Vasconcelos) + iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank', + + // force usage of iframe in non-IE browsers (handy for blocking applets) + forceIframe: false, + + // z-index for the blocking overlay + baseZ: 1000, + + // set these to true to have the message automatically centered + centerX: true, // <-- only effects element blocking (page block controlled via css above) + centerY: true, + + // allow body element to be stetched in ie6; this makes blocking look better + // on "short" pages. disable if you wish to prevent changes to the body height + allowBodyStretch: true, + + // enable if you want key and mouse events to be disabled for content that is blocked + bindEvents: true, + + // be default blockUI will supress tab navigation from leaving blocking content + // (if bindEvents is true) + constrainTabKey: true, + + // fadeIn time in millis; set to 0 to disable fadeIn on block + fadeIn: 200, + + // fadeOut time in millis; set to 0 to disable fadeOut on unblock + fadeOut: 400, + + // time in millis to wait before auto-unblocking; set to 0 to disable auto-unblock + timeout: 0, + + // disable if you don't want to show the overlay + showOverlay: true, + + // if true, focus will be placed in the first available input field when + // page blocking + focusInput: true, + + // suppresses the use of overlay styles on FF/Linux (due to performance issues with opacity) + applyPlatformOpacityRules: true, + + // callback method invoked when fadeIn has completed and blocking message is visible + onBlock: null, + + // callback method invoked when unblocking has completed; the callback is + // passed the element that has been unblocked (which is the window object for page + // blocks) and the options that were passed to the unblock call: + // onUnblock(element, options) + onUnblock: null, + + // don't ask; if you really must know: http://groups.google.com/group/jquery-en/browse_thread/thread/36640a8730503595/2f6a79a77a78e493#2f6a79a77a78e493 + quirksmodeOffsetHack: 4 +}; + +// private data and functions follow... + +var pageBlock = null; +var pageBlockEls = []; + +function install(el, opts) { + var full = (el == window); + var msg = opts && opts.message !== undefined ? opts.message : undefined; + opts = $.extend({}, $.blockUI.defaults, opts || {}); + opts.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, opts.overlayCSS || {}); + var css = $.extend({}, $.blockUI.defaults.css, opts.css || {}); + var themedCSS = $.extend({}, $.blockUI.defaults.themedCSS, opts.themedCSS || {}); + msg = msg === undefined ? opts.message : msg; + + // remove the current block (if there is one) + if (full && pageBlock) + remove(window, {fadeOut:0}); + + // if an existing element is being used as the blocking content then we capture + // its current place in the DOM (and current display style) so we can restore + // it when we unblock + if (msg && typeof msg != 'string' && (msg.parentNode || msg.jquery)) { + var node = msg.jquery ? msg[0] : msg; + var data = {}; + $(el).data('blockUI.history', data); + data.el = node; + data.parent = node.parentNode; + data.display = node.style.display; + data.position = node.style.position; + if (data.parent) + data.parent.removeChild(node); + } + + var z = opts.baseZ; + + // blockUI uses 3 layers for blocking, for simplicity they are all used on every platform; + // layer1 is the iframe layer which is used to supress bleed through of underlying content + // layer2 is the overlay layer which has opacity and a wait cursor (by default) + // layer3 is the message content that is displayed while blocking + + var lyr1 = ($.browser.msie || opts.forceIframe) + ? $('') + : $(''); + var lyr2 = $(''); + + var lyr3; + if (opts.theme && full) { + var s = ''; + lyr3 = $(s); + } + else { + lyr3 = full ? $('') + : $(''); + } + + // if we have a message, style it + if (msg) { + if (opts.theme) { + lyr3.css(themedCSS); + lyr3.addClass('ui-widget-content'); + } + else + lyr3.css(css); + } + + // style the overlay + if (!opts.applyPlatformOpacityRules || !($.browser.mozilla && /Linux/.test(navigator.platform))) + lyr2.css(opts.overlayCSS); + lyr2.css('position', full ? 'fixed' : 'absolute'); + + // make iframe layer transparent in IE + if ($.browser.msie || opts.forceIframe) + lyr1.css('opacity',0.0); + + //$([lyr1[0],lyr2[0],lyr3[0]]).appendTo(full ? 'body' : el); + var layers = [lyr1,lyr2,lyr3], $par = full ? $('body') : $(el); + $.each(layers, function() { + this.appendTo($par); + }); + + if (opts.theme && opts.draggable && $.fn.draggable) { + lyr3.draggable({ + handle: '.ui-dialog-titlebar', + cancel: 'li' + }); + } + + // ie7 must use absolute positioning in quirks mode and to account for activex issues (when scrolling) + var expr = setExpr && (!$.boxModel || $('object,embed', full ? null : el).length > 0); + if (ie6 || expr) { + // give body 100% height + if (full && opts.allowBodyStretch && $.boxModel) + $('html,body').css('height','100%'); + + // fix ie6 issue when blocked element has a border width + if ((ie6 || !$.boxModel) && !full) { + var t = sz(el,'borderTopWidth'), l = sz(el,'borderLeftWidth'); + var fixT = t ? '(0 - '+t+')' : 0; + var fixL = l ? '(0 - '+l+')' : 0; + } + + // simulate fixed position + $.each([lyr1,lyr2,lyr3], function(i,o) { + var s = o[0].style; + s.position = 'absolute'; + if (i < 2) { + full ? s.setExpression('height','Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.boxModel?0:'+opts.quirksmodeOffsetHack+') + "px"') + : s.setExpression('height','this.parentNode.offsetHeight + "px"'); + full ? s.setExpression('width','jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"') + : s.setExpression('width','this.parentNode.offsetWidth + "px"'); + if (fixL) s.setExpression('left', fixL); + if (fixT) s.setExpression('top', fixT); + } + else if (opts.centerY) { + if (full) s.setExpression('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"'); + s.marginTop = 0; + } + else if (!opts.centerY && full) { + var top = (opts.css && opts.css.top) ? parseInt(opts.css.top) : 0; + var expression = '((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + '+top+') + "px"'; + s.setExpression('top',expression); + } + }); + } + + // show the message + if (msg) { + if (opts.theme) + lyr3.find('.ui-widget-content').append(msg); + else + lyr3.append(msg); + if (msg.jquery || msg.nodeType) + $(msg).show(); + } + + if (($.browser.msie || opts.forceIframe) && opts.showOverlay) + lyr1.show(); // opacity is zero + if (opts.fadeIn) { + var cb = opts.onBlock ? opts.onBlock : noOp; + var cb1 = (opts.showOverlay && !msg) ? cb : noOp; + var cb2 = msg ? cb : noOp; + if (opts.showOverlay) + lyr2._fadeIn(opts.fadeIn, cb1); + if (msg) + lyr3._fadeIn(opts.fadeIn, cb2); + } + else { + if (opts.showOverlay) + lyr2.show(); + if (msg) + lyr3.show(); + if (opts.onBlock) + opts.onBlock(); + } + + // bind key and mouse events + bind(1, el, opts); + + if (full) { + pageBlock = lyr3[0]; + pageBlockEls = $(':input:enabled:visible',pageBlock); + if (opts.focusInput) + setTimeout(focus, 20); + } + else + center(lyr3[0], opts.centerX, opts.centerY); + + if (opts.timeout) { + // auto-unblock + var to = setTimeout(function() { + full ? $.unblockUI(opts) : $(el).unblock(opts); + }, opts.timeout); + $(el).data('blockUI.timeout', to); + } +}; + +// remove the block +function remove(el, opts) { + var full = (el == window); + var $el = $(el); + var data = $el.data('blockUI.history'); + var to = $el.data('blockUI.timeout'); + if (to) { + clearTimeout(to); + $el.removeData('blockUI.timeout'); + } + opts = $.extend({}, $.blockUI.defaults, opts || {}); + bind(0, el, opts); // unbind events + + var els; + if (full) // crazy selector to handle odd field errors in ie6/7 + els = $('body').children().filter('.blockUI').add('body > .blockUI'); + else + els = $('.blockUI', el); + + if (full) + pageBlock = pageBlockEls = null; + + if (opts.fadeOut) { + els.fadeOut(opts.fadeOut); + setTimeout(function() { reset(els,data,opts,el); }, opts.fadeOut); + } + else + reset(els, data, opts, el); +}; + +// move blocking element back into the DOM where it started +function reset(els,data,opts,el) { + els.each(function(i,o) { + // remove via DOM calls so we don't lose event handlers + if (this.parentNode) + this.parentNode.removeChild(this); + }); + + if (data && data.el) { + data.el.style.display = data.display; + data.el.style.position = data.position; + if (data.parent) + data.parent.appendChild(data.el); + $(el).removeData('blockUI.history'); + } + + if (typeof opts.onUnblock == 'function') + opts.onUnblock(el,opts); +}; + +// bind/unbind the handler +function bind(b, el, opts) { + var full = el == window, $el = $(el); + + // don't bother unbinding if there is nothing to unbind + if (!b && (full && !pageBlock || !full && !$el.data('blockUI.isBlocked'))) + return; + if (!full) + $el.data('blockUI.isBlocked', b); + + // don't bind events when overlay is not in use or if bindEvents is false + if (!opts.bindEvents || (b && !opts.showOverlay)) + return; + + // bind anchors and inputs for mouse and key events + var events = 'mousedown mouseup keydown keypress'; + b ? $(document).bind(events, opts, handler) : $(document).unbind(events, handler); + +// former impl... +// var $e = $('a,:input'); +// b ? $e.bind(events, opts, handler) : $e.unbind(events, handler); +}; + +// event handler to suppress keyboard/mouse events when blocking +function handler(e) { + // allow tab navigation (conditionally) + if (e.keyCode && e.keyCode == 9) { + if (pageBlock && e.data.constrainTabKey) { + var els = pageBlockEls; + var fwd = !e.shiftKey && e.target == els[els.length-1]; + var back = e.shiftKey && e.target == els[0]; + if (fwd || back) { + setTimeout(function(){focus(back)},10); + return false; + } + } + } + // allow events within the message content + if ($(e.target).parents('div.blockMsg').length > 0) + return true; + + // allow events for content that is not being blocked + return $(e.target).parents().children().filter('div.blockUI').length == 0; +}; + +function focus(back) { + if (!pageBlockEls) + return; + var e = pageBlockEls[back===true ? pageBlockEls.length-1 : 0]; + if (e) + e.focus(); +}; + +function center(el, x, y) { + var p = el.parentNode, s = el.style; + var l = ((p.offsetWidth - el.offsetWidth)/2) - sz(p,'borderLeftWidth'); + var t = ((p.offsetHeight - el.offsetHeight)/2) - sz(p,'borderTopWidth'); + if (x) s.left = l > 0 ? (l+'px') : '0'; + if (y) s.top = t > 0 ? (t+'px') : '0'; +}; + +function sz(el, p) { + return parseInt($.css(el,p))||0; +}; + +})(jQuery); \ No newline at end of file diff --git a/redakcja/static/js/jquery.elastic.js b/redakcja/static/js/jquery.elastic.js new file mode 100644 index 00000000..24e16f44 --- /dev/null +++ b/redakcja/static/js/jquery.elastic.js @@ -0,0 +1,6 @@ +(function(jQuery){jQuery.fn.extend({elastic:function(){var mimics=['paddingTop','paddingRight','paddingBottom','paddingLeft','fontSize','lineHeight','fontFamily','width','fontWeight'];return this.each(function(){if(this.type!='textarea'){return false;} +var $textarea=jQuery(this),$twin=jQuery('
    ').css({'position':'absolute','display':'none','word-wrap':'break-word'}),lineHeight=parseInt($textarea.css('line-height'),10)||parseInt($textarea.css('font-size'),'10'),minheight=parseInt($textarea.css('height'),10)||lineHeight*3,maxheight=parseInt($textarea.css('max-height'),10)||Number.MAX_VALUE,goalheight=0,i=0;if(maxheight<0){maxheight=Number.MAX_VALUE;} +$twin.appendTo($textarea.parent());var i=mimics.length;while(i--){$twin.css(mimics[i].toString(),$textarea.css(mimics[i].toString()));} +function setHeightAndOverflow(height,overflow){curratedHeight=Math.floor(parseInt(height,10));if($textarea.height()!=curratedHeight){$textarea.css({'height':curratedHeight+'px','overflow':overflow});}} +function update(){var textareaContent=$textarea.val().replace(/&/g,'&').replace(/ /g,' ').replace(/<|>/g,'>').replace(/\n/g,'
    ');var twinContent=$twin.html();if(textareaContent+' '!=twinContent){$twin.html(textareaContent+' ');if(Math.abs($twin.height()+lineHeight-$textarea.height())>3){var goalheight=$twin.height()+lineHeight;if(goalheight>=maxheight){setHeightAndOverflow(maxheight,'auto');}else if(goalheight<=minheight){setHeightAndOverflow(minheight,'hidden');}else{setHeightAndOverflow(goalheight,'hidden');}}}} +$textarea.css({'overflow':'hidden'});$textarea.keyup(function(){update();});$textarea.live('input paste',function(e){setTimeout(update,250);});update();});}});})(jQuery); \ No newline at end of file diff --git a/redakcja/static/js/lib/codemirror/codemirror.js b/redakcja/static/js/lib/codemirror/codemirror.js new file mode 100644 index 00000000..8c62dab9 --- /dev/null +++ b/redakcja/static/js/lib/codemirror/codemirror.js @@ -0,0 +1,295 @@ +/* CodeMirror main module + * + * Implements the CodeMirror constructor and prototype, which take care + * of initializing the editor frame, and providing the outside interface. + */ + +// The CodeMirrorConfig object is used to specify a default +// configuration. If you specify such an object before loading this +// file, the values you put into it will override the defaults given +// below. You can also assign to it after loading. +var CodeMirrorConfig = window.CodeMirrorConfig || {}; + +var CodeMirror = (function(){ + function setDefaults(object, defaults) { + for (var option in defaults) { + if (!object.hasOwnProperty(option)) + object[option] = defaults[option]; + } + } + function forEach(array, action) { + for (var i = 0; i < array.length; i++) + action(array[i]); + } + + // These default options can be overridden by passing a set of + // options to a specific CodeMirror constructor. See manual.html for + // their meaning. + setDefaults(CodeMirrorConfig, { + stylesheet: "", + path: "", + parserfile: [], + basefiles: ["util.js", "stringstream.js", "select.js", "undo.js", "editor.js", "tokenize.js"], + iframeClass: null, + passDelay: 200, + passTime: 50, + continuousScanning: false, + saveFunction: null, + onChange: null, + undoDepth: 50, + undoDelay: 800, + disableSpellcheck: true, + textWrapping: true, + readOnly: false, + width: "100%", + height: "300px", + autoMatchParens: false, + parserConfig: null, + tabMode: "indent", // or "spaces", "default", "shift" + reindentOnLoad: false, + activeTokens: null, + cursorActivity: null, + lineNumbers: false, + indentUnit: 2 + }); + + function wrapLineNumberDiv(place) { + return function(node) { + var container = document.createElement("div"), + nums = document.createElement("div"), + scroller = document.createElement("div"); + container.style.position = "relative"; + nums.style.position = "absolute"; + nums.style.height = "100%"; + if (nums.style.setExpression) { + try {nums.style.setExpression("height", "this.previousSibling.offsetHeight + 'px'");} + catch(e) {} // Seems to throw 'Not Implemented' on some IE8 versions + } + nums.style.top = "0px"; + nums.style.overflow = "hidden"; + place(container); + container.appendChild(node); + container.appendChild(nums); + scroller.className = "CodeMirror-line-numbers"; + nums.appendChild(scroller); + } + } + + function applyLineNumbers(frame) { + var win = frame.contentWindow, doc = win.document, + nums = frame.nextSibling, scroller = nums.firstChild; + + var nextNum = 1; + + function update() { + var diff = 20 + Math.max(doc.body.offsetHeight, frame.offsetHeight) - scroller.offsetHeight; + for (var n = Math.ceil(diff / 10); n > 0; n--) { + var div = document.createElement("div"); + div.appendChild(document.createTextNode(nextNum++)); + scroller.appendChild(div); + } + nums.scrollTop = doc.body.scrollTop || doc.documentElement.scrollTop || 0; + } + + update(); + win.addEventHandler(win, "scroll", update); + win.addEventHandler(win, "resize", update); + } + + function CodeMirror(place, options) { + // Backward compatibility for deprecated options. + if (options.dumbTabs) options.tabMode = "spaces"; + else if (options.normalTab) options.tabMode = "default"; + + // Use passed options, if any, to override defaults. + this.options = options = options || {}; + setDefaults(options, CodeMirrorConfig); + + var frame = this.frame = document.createElement("iframe"); + if (options.iframeClass) frame.className = options.iframeClass; + frame.frameBorder = 0; + frame.src = "javascript:false;"; + frame.style.border = "0"; + frame.style.width = options.width; + frame.style.height = options.height; + // display: block occasionally suppresses some Firefox bugs, so we + // always add it, redundant as it sounds. + frame.style.display = "block"; + + if (place.appendChild) { + var node = place; + place = function(n){node.appendChild(n);}; + } + if (options.lineNumbers) place = wrapLineNumberDiv(place); + place(frame); + + // Link back to this object, so that the editor can fetch options + // and add a reference to itself. + frame.CodeMirror = this; + this.win = frame.contentWindow; + + if (typeof options.parserfile == "string") + options.parserfile = [options.parserfile]; + if (typeof options.stylesheet == "string") + options.stylesheet = [options.stylesheet]; + + var html = [""]; + // Hack to work around a bunch of IE8-specific problems. + html.push(""); + forEach(options.stylesheet, function(file) { + html.push(""); + }); + forEach(options.basefiles.concat(options.parserfile), function(file) { + html.push(""); + }); + html.push(""); + + var doc = this.win.document; + doc.open(); + doc.write(html.join("")); + doc.close(); + } + + CodeMirror.prototype = { + init: function() { + if (this.options.initCallback) this.options.initCallback(this); + if (this.options.lineNumbers) applyLineNumbers(this.frame); + if (this.options.reindentOnLoad) this.reindent(); + }, + + getCode: function() {return this.editor.getCode();}, + setCode: function(code) {this.editor.importCode(code);}, + selection: function() {return this.editor.selectedText();}, + reindent: function() {this.editor.reindent();}, + reindentSelection: function() {this.editor.reindentSelection(null);}, + + focus: function() { + this.win.focus(); + if (this.editor.selectionSnapshot) // IE hack + this.win.select.selectCoords(this.win, this.editor.selectionSnapshot); + }, + replaceSelection: function(text) { + this.focus(); + this.editor.replaceSelection(text); + return true; + }, + replaceChars: function(text, start, end) { + this.editor.replaceChars(text, start, end); + }, + getSearchCursor: function(string, fromCursor) { + return this.editor.getSearchCursor(string, fromCursor); + }, + + undo: function() {this.editor.history.undo();}, + redo: function() {this.editor.history.redo();}, + historySize: function() {return this.editor.history.historySize();}, + clearHistory: function() {this.editor.history.clear();}, + + grabKeys: function(callback, filter) {this.editor.grabKeys(callback, filter);}, + ungrabKeys: function() {this.editor.ungrabKeys();}, + + setParser: function(name) {this.editor.setParser(name);}, + + cursorPosition: function(start) { + if (this.win.select.ie_selection) this.focus(); + return this.editor.cursorPosition(start); + }, + firstLine: function() {return this.editor.firstLine();}, + lastLine: function() {return this.editor.lastLine();}, + nextLine: function(line) {return this.editor.nextLine(line);}, + prevLine: function(line) {return this.editor.prevLine(line);}, + lineContent: function(line) {return this.editor.lineContent(line);}, + setLineContent: function(line, content) {this.editor.setLineContent(line, content);}, + insertIntoLine: function(line, position, content) {this.editor.insertIntoLine(line, position, content);}, + selectLines: function(startLine, startOffset, endLine, endOffset) { + this.win.focus(); + this.editor.selectLines(startLine, startOffset, endLine, endOffset); + }, + nthLine: function(n) { + var line = this.firstLine(); + for (; n > 1 && line !== false; n--) + line = this.nextLine(line); + return line; + }, + lineNumber: function(line) { + var num = 0; + while (line !== false) { + num++; + line = this.prevLine(line); + } + return num; + }, + + // Old number-based line interface + jumpToLine: function(n) { + this.selectLines(this.nthLine(n), 0); + this.win.focus(); + }, + currentLine: function() { + return this.lineNumber(this.cursorPosition().line); + } + }; + + CodeMirror.InvalidLineHandle = {toString: function(){return "CodeMirror.InvalidLineHandle";}}; + + CodeMirror.replace = function(element) { + if (typeof element == "string") + element = document.getElementById(element); + return function(newElement) { + element.parentNode.replaceChild(newElement, element); + }; + }; + + CodeMirror.fromTextArea = function(area, options) { + if (typeof area == "string") + area = document.getElementById(area); + + options = options || {}; + if (area.style.width && options.width == null) + options.width = area.style.width; + if (area.style.height && options.height == null) + options.height = area.style.height; + if (options.content == null) options.content = area.value; + + if (area.form) { + function updateField() { + area.value = mirror.getCode(); + } + if (typeof area.form.addEventListener == "function") + area.form.addEventListener("submit", updateField, false); + else + area.form.attachEvent("onsubmit", updateField); + } + + function insert(frame) { + if (area.nextSibling) + area.parentNode.insertBefore(frame, area.nextSibling); + else + area.parentNode.appendChild(frame); + } + + area.style.display = "none"; + var mirror = new CodeMirror(insert, options); + return mirror; + }; + + CodeMirror.isProbablySupported = function() { + // This is rather awful, but can be useful. + var match; + if (window.opera) + return Number(window.opera.version()) >= 9.52; + else if (/Apple Computers, Inc/.test(navigator.vendor) && (match = navigator.userAgent.match(/Version\/(\d+(?:\.\d+)?)\./))) + return Number(match[1]) >= 3; + else if (document.selection && window.ActiveXObject && (match = navigator.userAgent.match(/MSIE (\d+(?:\.\d*)?)\b/))) + return Number(match[1]) >= 6; + else if (match = navigator.userAgent.match(/gecko\/(\d{8})/i)) + return Number(match[1]) >= 20050901; + else if (match = navigator.userAgent.match(/AppleWebKit\/(\d+)/)) + return Number(match[1]) >= 525; + else + return null; + }; + + return CodeMirror; +})(); diff --git a/redakcja/static/js/lib/codemirror/editor.js b/redakcja/static/js/lib/codemirror/editor.js new file mode 100644 index 00000000..f5fe8417 --- /dev/null +++ b/redakcja/static/js/lib/codemirror/editor.js @@ -0,0 +1,1320 @@ +/* The Editor object manages the content of the editable frame. It + * catches events, colours nodes, and indents lines. This file also + * holds some functions for transforming arbitrary DOM structures into + * plain sequences of and
    elements + */ + +// Make sure a string does not contain two consecutive 'collapseable' +// whitespace characters. +function makeWhiteSpace(n) { + var buffer = [], nb = true; + for (; n > 0; n--) { + buffer.push((nb || n == 1) ? nbsp : " "); + nb = !nb; + } + return buffer.join(""); +} + +// Create a set of white-space characters that will not be collapsed +// by the browser, but will not break text-wrapping either. +function fixSpaces(string) { + if (string.charAt(0) == " ") string = nbsp + string.slice(1); + return string.replace(/\t/g, function(){return makeWhiteSpace(indentUnit);}) + .replace(/[ \u00a0]{2,}/g, function(s) {return makeWhiteSpace(s.length);}); +} + +function cleanText(text) { + return text.replace(/\u00a0/g, " ").replace(/\u200b/g, ""); +} + +// Create a SPAN node with the expected properties for document part +// spans. +function makePartSpan(value, doc) { + var text = value; + if (value.nodeType == 3) text = value.nodeValue; + else value = doc.createTextNode(text); + + var span = doc.createElement("SPAN"); + span.isPart = true; + span.appendChild(value); + span.currentText = text; + return span; +} + +// On webkit, when the last BR of the document does not have text +// behind it, the cursor can not be put on the line after it. This +// makes pressing enter at the end of the document occasionally do +// nothing (or at least seem to do nothing). To work around it, this +// function makes sure the document ends with a span containing a +// zero-width space character. The traverseDOM iterator filters such +// character out again, so that the parsers won't see them. This +// function is called from a few strategic places to make sure the +// zwsp is restored after the highlighting process eats it. +var webkitLastLineHack = webkit ? + function(container) { + var last = container.lastChild; + if (!last || !last.isPart || last.textContent != "\u200b") + container.appendChild(makePartSpan("\u200b", container.ownerDocument)); + } : function() {}; + +var Editor = (function(){ + // The HTML elements whose content should be suffixed by a newline + // when converting them to flat text. + var newlineElements = {"P": true, "DIV": true, "LI": true}; + + function asEditorLines(string) { + var tab = makeWhiteSpace(indentUnit); + return map(string.replace(/\t/g, tab).replace(/\u00a0/g, " ").replace(/\r\n?/g, "\n").split("\n"), fixSpaces); + } + + // Helper function for traverseDOM. Flattens an arbitrary DOM node + // into an array of textnodes and
    tags. + function simplifyDOM(root, atEnd) { + var doc = root.ownerDocument; + var result = []; + var leaving = true; + + function simplifyNode(node, top) { + if (node.nodeType == 3) { + var text = node.nodeValue = fixSpaces(node.nodeValue.replace(/[\r\u200b]/g, "").replace(/\n/g, " ")); + if (text.length) leaving = false; + result.push(node); + } + else if (node.nodeName == "BR" && node.childNodes.length == 0) { + leaving = true; + result.push(node); + } + else { + forEach(node.childNodes, simplifyNode); + if (!leaving && newlineElements.hasOwnProperty(node.nodeName)) { + leaving = true; + if (!atEnd || !top) + result.push(doc.createElement("BR")); + } + } + } + + simplifyNode(root, true); + return result; + } + + // Creates a MochiKit-style iterator that goes over a series of DOM + // nodes. The values it yields are strings, the textual content of + // the nodes. It makes sure that all nodes up to and including the + // one whose text is being yielded have been 'normalized' to be just + // and
    elements. + // See the story.html file for some short remarks about the use of + // continuation-passing style in this iterator. + function traverseDOM(start){ + function yield(value, c){cc = c; return value;} + function push(fun, arg, c){return function(){return fun(arg, c);};} + function stop(){cc = stop; throw StopIteration;}; + var cc = push(scanNode, start, stop); + var owner = start.ownerDocument; + var nodeQueue = []; + + // Create a function that can be used to insert nodes after the + // one given as argument. + function pointAt(node){ + var parent = node.parentNode; + var next = node.nextSibling; + return function(newnode) { + parent.insertBefore(newnode, next); + }; + } + var point = null; + + // Insert a normalized node at the current point. If it is a text + // node, wrap it in a , and give that span a currentText + // property -- this is used to cache the nodeValue, because + // directly accessing nodeValue is horribly slow on some browsers. + // The dirty property is used by the highlighter to determine + // which parts of the document have to be re-highlighted. + function insertPart(part){ + var text = "\n"; + if (part.nodeType == 3) { + select.snapshotChanged(); + part = makePartSpan(part, owner); + text = part.currentText; + } + part.dirty = true; + nodeQueue.push(part); + point(part); + return text; + } + + // Extract the text and newlines from a DOM node, insert them into + // the document, and yield the textual content. Used to replace + // non-normalized nodes. + function writeNode(node, c, end) { + var toYield = []; + forEach(simplifyDOM(node, end), function(part) { + toYield.push(insertPart(part)); + }); + return yield(toYield.join(""), c); + } + + // Check whether a node is a normalized element. + function partNode(node){ + if (node.isPart && node.childNodes.length == 1 && node.firstChild.nodeType == 3) { + node.currentText = node.firstChild.nodeValue; + return !/[\n\t\r]/.test(node.currentText); + } + return false; + } + + // Handle a node. Add its successor to the continuation if there + // is one, find out whether the node is normalized. If it is, + // yield its content, otherwise, normalize it (writeNode will take + // care of yielding). + function scanNode(node, c){ + if (node.nextSibling) + c = push(scanNode, node.nextSibling, c); + + if (partNode(node)){ + nodeQueue.push(node); + return yield(node.currentText, c); + } + else if (node.nodeName == "BR") { + nodeQueue.push(node); + return yield("\n", c); + } + else { + var end = !node.nextSibling; + point = pointAt(node); + removeElement(node); + return writeNode(node, c, end); + } + } + + // MochiKit iterators are objects with a next function that + // returns the next value or throws StopIteration when there are + // no more values. + return {next: function(){return cc();}, nodes: nodeQueue}; + } + + // Determine the text size of a processed node. + function nodeSize(node) { + if (node.nodeName == "BR") + return 1; + else + return node.currentText.length; + } + + // Search backwards through the top-level nodes until the next BR or + // the start of the frame. + function startOfLine(node) { + while (node && node.nodeName != "BR") node = node.previousSibling; + return node; + } + function endOfLine(node, container) { + if (!node) node = container.firstChild; + else if (node.nodeName == "BR") node = node.nextSibling; + + while (node && node.nodeName != "BR") node = node.nextSibling; + return node; + } + + function time() {return new Date().getTime();} + + // Client interface for searching the content of the editor. Create + // these by calling CodeMirror.getSearchCursor. To use, call + // findNext on the resulting object -- this returns a boolean + // indicating whether anything was found, and can be called again to + // skip to the next find. Use the select and replace methods to + // actually do something with the found locations. + function SearchCursor(editor, string, fromCursor) { + this.editor = editor; + this.history = editor.history; + this.history.commit(); + + // Are we currently at an occurrence of the search string? + this.atOccurrence = false; + // The object stores a set of nodes coming after its current + // position, so that when the current point is taken out of the + // DOM tree, we can still try to continue. + this.fallbackSize = 15; + var cursor; + // Start from the cursor when specified and a cursor can be found. + if (fromCursor && (cursor = select.cursorPos(this.editor.container))) { + this.line = cursor.node; + this.offset = cursor.offset; + } + else { + this.line = null; + this.offset = 0; + } + this.valid = !!string; + + // Create a matcher function based on the kind of string we have. + var target = string.split("\n"), self = this; + this.matches = (target.length == 1) ? + // For one-line strings, searching can be done simply by calling + // indexOf on the current line. + function() { + var match = cleanText(self.history.textAfter(self.line).slice(self.offset)).indexOf(string); + if (match > -1) + return {from: {node: self.line, offset: self.offset + match}, + to: {node: self.line, offset: self.offset + match + string.length}}; + } : + // Multi-line strings require internal iteration over lines, and + // some clunky checks to make sure the first match ends at the + // end of the line and the last match starts at the start. + function() { + var firstLine = cleanText(self.history.textAfter(self.line).slice(self.offset)); + var match = firstLine.lastIndexOf(target[0]); + if (match == -1 || match != firstLine.length - target[0].length) + return false; + var startOffset = self.offset + match; + + var line = self.history.nodeAfter(self.line); + for (var i = 1; i < target.length - 1; i++) { + if (cleanText(self.history.textAfter(line)) != target[i]) + return false; + line = self.history.nodeAfter(line); + } + + if (cleanText(self.history.textAfter(line)).indexOf(target[target.length - 1]) != 0) + return false; + + return {from: {node: self.line, offset: startOffset}, + to: {node: line, offset: target[target.length - 1].length}}; + }; + } + + SearchCursor.prototype = { + findNext: function() { + if (!this.valid) return false; + this.atOccurrence = false; + var self = this; + + // Go back to the start of the document if the current line is + // no longer in the DOM tree. + if (this.line && !this.line.parentNode) { + this.line = null; + this.offset = 0; + } + + // Set the cursor's position one character after the given + // position. + function saveAfter(pos) { + if (self.history.textAfter(pos.node).length > pos.offset) { + self.line = pos.node; + self.offset = pos.offset + 1; + } + else { + self.line = self.history.nodeAfter(pos.node); + self.offset = 0; + } + } + + while (true) { + var match = this.matches(); + // Found the search string. + if (match) { + this.atOccurrence = match; + saveAfter(match.from); + return true; + } + this.line = this.history.nodeAfter(this.line); + this.offset = 0; + // End of document. + if (!this.line) { + this.valid = false; + return false; + } + } + }, + + select: function() { + if (this.atOccurrence) { + select.setCursorPos(this.editor.container, this.atOccurrence.from, this.atOccurrence.to); + select.scrollToCursor(this.editor.container); + } + }, + + replace: function(string) { + if (this.atOccurrence) { + var end = this.editor.replaceRange(this.atOccurrence.from, this.atOccurrence.to, string); + this.line = end.node; + this.offset = end.offset; + this.atOccurrence = false; + } + } + }; + + // The Editor object is the main inside-the-iframe interface. + function Editor(options) { + this.options = options; + window.indentUnit = options.indentUnit; + this.parent = parent; + this.doc = document; + var container = this.container = this.doc.body; + this.win = window; + this.history = new History(container, options.undoDepth, options.undoDelay, + this, options.onChange); + var self = this; + + if (!Editor.Parser) + throw "No parser loaded."; + if (options.parserConfig && Editor.Parser.configure) + Editor.Parser.configure(options.parserConfig); + + if (!options.readOnly) + select.setCursorPos(container, {node: null, offset: 0}); + + this.dirty = []; + if (options.content) + this.importCode(options.content); + else // FF acts weird when the editable document is completely empty + container.appendChild(this.doc.createElement("BR")); + + if (!options.readOnly) { + if (options.continuousScanning !== false) { + this.scanner = this.documentScanner(options.passTime); + this.delayScanning(); + } + + function setEditable() { + // In IE, designMode frames can not run any scripts, so we use + // contentEditable instead. + if (document.body.contentEditable != undefined && internetExplorer) + document.body.contentEditable = "true"; + else + document.designMode = "on"; + + document.documentElement.style.borderWidth = "0"; + if (!options.textWrapping) + container.style.whiteSpace = "nowrap"; + } + + // If setting the frame editable fails, try again when the user + // focus it (happens when the frame is not visible on + // initialisation, in Firefox). + try { + setEditable(); + } + catch(e) { + var focusEvent = addEventHandler(document, "focus", function() { + focusEvent(); + setEditable(); + }, true); + } + + addEventHandler(document, "keydown", method(this, "keyDown")); + addEventHandler(document, "keypress", method(this, "keyPress")); + addEventHandler(document, "keyup", method(this, "keyUp")); + + function cursorActivity() {self.cursorActivity(false);} + addEventHandler(document.body, "mouseup", cursorActivity); + addEventHandler(document.body, "cut", cursorActivity); + + addEventHandler(document.body, "paste", function(event) { + cursorActivity(); + var text = null; + try { + var clipboardData = event.clipboardData || window.clipboardData; + if (clipboardData) text = clipboardData.getData('Text'); + } + catch(e) {} + if (text !== null) { + self.replaceSelection(text); + event.stop(); + } + }); + + addEventHandler(document.body, "beforepaste", method(this, "reroutePasteEvent")); + + if (this.options.autoMatchParens) + addEventHandler(document.body, "click", method(this, "scheduleParenBlink")); + } + else if (!options.textWrapping) { + container.style.whiteSpace = "nowrap"; + } + } + + function isSafeKey(code) { + return (code >= 16 && code <= 18) || // shift, control, alt + (code >= 33 && code <= 40); // arrows, home, end + } + + Editor.prototype = { + // Import a piece of code into the editor. + importCode: function(code) { + this.history.push(null, null, asEditorLines(code)); + this.history.reset(); + }, + + // Extract the code from the editor. + getCode: function() { + if (!this.container.firstChild) + return ""; + + var accum = []; + select.markSelection(this.win); + forEach(traverseDOM(this.container.firstChild), method(accum, "push")); + webkitLastLineHack(this.container); + select.selectMarked(); + return cleanText(accum.join("")); + }, + + checkLine: function(node) { + if (node === false || !(node == null || node.parentNode == this.container)) + throw parent.CodeMirror.InvalidLineHandle; + }, + + cursorPosition: function(start) { + if (start == null) start = true; + var pos = select.cursorPos(this.container, start); + if (pos) return {line: pos.node, character: pos.offset}; + else return {line: null, character: 0}; + }, + + firstLine: function() { + return null; + }, + + lastLine: function() { + if (this.container.lastChild) return startOfLine(this.container.lastChild); + else return null; + }, + + nextLine: function(line) { + this.checkLine(line); + var end = endOfLine(line, this.container); + return end || false; + }, + + prevLine: function(line) { + this.checkLine(line); + if (line == null) return false; + return startOfLine(line.previousSibling); + }, + + selectLines: function(startLine, startOffset, endLine, endOffset) { + this.checkLine(startLine); + var start = {node: startLine, offset: startOffset}, end = null; + if (endOffset !== undefined) { + this.checkLine(endLine); + end = {node: endLine, offset: endOffset}; + } + select.setCursorPos(this.container, start, end); + select.scrollToCursor(this.container); + }, + + lineContent: function(line) { + this.checkLine(line); + var accum = []; + for (line = line ? line.nextSibling : this.container.firstChild; + line && line.nodeName != "BR"; line = line.nextSibling) + accum.push(nodeText(line)); + return cleanText(accum.join("")); + }, + + setLineContent: function(line, content) { + this.history.commit(); + this.replaceRange({node: line, offset: 0}, + {node: line, offset: this.history.textAfter(line).length}, + content); + this.addDirtyNode(line); + this.scheduleHighlight(); + }, + + insertIntoLine: function(line, position, content) { + var before = null; + if (position == "end") { + before = endOfLine(line, this.container); + } + else { + for (var cur = line ? line.nextSibling : this.container.firstChild; cur; cur = cur.nextSibling) { + if (position == 0) { + before = cur; + break; + } + var text = (cur.innerText || cur.textContent || cur.nodeValue || ""); + if (text.length > position) { + before = cur.nextSibling; + content = text.slice(0, position) + content + text.slice(position); + removeElement(cur); + break; + } + position -= text.length; + } + } + + var lines = asEditorLines(content), doc = this.container.ownerDocument; + for (var i = 0; i < lines.length; i++) { + if (i > 0) this.container.insertBefore(doc.createElement("BR"), before); + this.container.insertBefore(makePartSpan(lines[i], doc), before); + } + this.addDirtyNode(line); + this.scheduleHighlight(); + }, + + // Retrieve the selected text. + selectedText: function() { + var h = this.history; + h.commit(); + + var start = select.cursorPos(this.container, true), + end = select.cursorPos(this.container, false); + if (!start || !end) return ""; + + if (start.node == end.node) + return h.textAfter(start.node).slice(start.offset, end.offset); + + var text = [h.textAfter(start.node).slice(start.offset)]; + for (var pos = h.nodeAfter(start.node); pos != end.node; pos = h.nodeAfter(pos)) + text.push(h.textAfter(pos)); + text.push(h.textAfter(end.node).slice(0, end.offset)); + return cleanText(text.join("\n")); + }, + + // Replace the selection with another p + // iece of text. + replaceSelection: function(text) { + this.history.commit(); + + var start = select.cursorPos(this.container, true), + end = select.cursorPos(this.container, false); + if (!start || !end) return; + + end = this.replaceRange(start, end, text); + // select.setCursorPos(this.container, end); + webkitLastLineHack(this.container); + }, + + reroutePasteEvent: function() { + if (this.capturingPaste || window.opera) return; + this.capturingPaste = true; + var te = parent.document.createElement("TEXTAREA"); + te.style.position = "absolute"; + te.style.left = "-500px"; + te.style.width = "10px"; + te.style.top = nodeTop(frameElement) + "px"; + parent.document.body.appendChild(te); + parent.focus(); + te.focus(); + + var self = this; + this.parent.setTimeout(function() { + self.capturingPaste = false; + self.win.focus(); + if (self.selectionSnapshot) // IE hack + self.win.select.selectCoords(self.win, self.selectionSnapshot); + var text = te.value; + if (text) self.replaceSelection(text); + removeElement(te); + }, 10); + }, + + replaceRange: function(from, to, text) { + var lines = asEditorLines(text); + lines[0] = this.history.textAfter(from.node).slice(0, from.offset) + lines[0]; + var lastLine = lines[lines.length - 1]; + lines[lines.length - 1] = lastLine + this.history.textAfter(to.node).slice(to.offset); + var end = this.history.nodeAfter(to.node); + this.history.push(from.node, end, lines); + return {node: this.history.nodeBefore(end), + offset: lastLine.length}; + }, + + getSearchCursor: function(string, fromCursor) { + return new SearchCursor(this, string, fromCursor); + }, + + // Re-indent the whole buffer + reindent: function() { + if (this.container.firstChild) + this.indentRegion(null, this.container.lastChild); + }, + + reindentSelection: function(direction) { + if (!select.somethingSelected(this.win)) { + this.indentAtCursor(direction); + } + else { + var start = select.selectionTopNode(this.container, true), + end = select.selectionTopNode(this.container, false); + if (start === false || end === false) return; + this.indentRegion(start, end, direction); + } + }, + + grabKeys: function(eventHandler, filter) { + this.frozen = eventHandler; + this.keyFilter = filter; + }, + ungrabKeys: function() { + this.frozen = "leave"; + this.keyFilter = null; + }, + + setParser: function(name) { + Editor.Parser = window[name]; + if (this.container.firstChild) { + forEach(this.container.childNodes, function(n) { + if (n.nodeType != 3) n.dirty = true; + }); + this.addDirtyNode(this.firstChild); + this.scheduleHighlight(); + } + }, + + // Intercept enter and tab, and assign their new functions. + keyDown: function(event) { + if (this.frozen == "leave") this.frozen = null; + if (this.frozen && (!this.keyFilter || this.keyFilter(event))) { + event.stop(); + this.frozen(event); + return; + } + + var code = event.keyCode; + // Don't scan when the user is typing. + this.delayScanning(); + // Schedule a paren-highlight event, if configured. + if (this.options.autoMatchParens) + this.scheduleParenBlink(); + + // The various checks for !altKey are there because AltGr sets both + // ctrlKey and altKey to true, and should not be recognised as + // Control. + if (code == 13) { // enter + if (event.ctrlKey && !event.altKey) { + this.reparseBuffer(); + } + else { + select.insertNewlineAtCursor(this.win); + this.indentAtCursor(); + select.scrollToCursor(this.container); + } + event.stop(); + } + else if (code == 9 && this.options.tabMode != "default") { // tab + this.handleTab(!event.ctrlKey && !event.shiftKey); + event.stop(); + } + else if (code == 32 && event.shiftKey && this.options.tabMode == "default") { // space + this.handleTab(true); + event.stop(); + } + else if (code == 36 && !event.shiftKey && !event.ctrlKey) { // home + if (this.home()) + event.stop(); + } + else if ((code == 219 || code == 221) && event.ctrlKey && !event.altKey) { // [, ] + this.blinkParens(event.shiftKey); + event.stop(); + } + else if (event.metaKey && !event.shiftKey && (code == 37 || code == 39)) { // Meta-left/right + var cursor = select.selectionTopNode(this.container); + if (cursor === false || !this.container.firstChild) return; + + if (code == 37) select.focusAfterNode(startOfLine(cursor), this.container); + else { + var end = endOfLine(cursor, this.container); + select.focusAfterNode(end ? end.previousSibling : this.container.lastChild, this.container); + } + event.stop(); + } + else if ((event.ctrlKey || event.metaKey) && !event.altKey) { + if ((event.shiftKey && code == 90) || code == 89) { // shift-Z, Y + select.scrollToNode(this.history.redo()); + event.stop(); + } + else if (code == 90 || (safari && code == 8)) { // Z, backspace + select.scrollToNode(this.history.undo()); + event.stop(); + } + else if (code == 83 && this.options.saveFunction) { // S + this.options.saveFunction(); + event.stop(); + } + } + }, + + // Check for characters that should re-indent the current line, + // and prevent Opera from handling enter and tab anyway. + keyPress: function(event) { + var electric = Editor.Parser.electricChars, self = this; + // Hack for Opera, and Firefox on OS X, in which stopping a + // keydown event does not prevent the associated keypress event + // from happening, so we have to cancel enter and tab again + // here. + if ((this.frozen && (!this.keyFilter || this.keyFilter(event.keyCode))) || + event.code == 13 || (event.code == 9 && this.options.tabMode != "default") || + (event.keyCode == 32 && event.shiftKey && this.options.tabMode == "default")) + event.stop(); + else if (electric && electric.indexOf(event.character) != -1) + this.parent.setTimeout(function(){self.indentAtCursor(null);}, 0); + else if ((event.character == "v" || event.character == "V") + && (event.ctrlKey || event.metaKey) && !event.altKey) // ctrl-V + this.reroutePasteEvent(); + }, + + // Mark the node at the cursor dirty when a non-safe key is + // released. + keyUp: function(event) { + this.cursorActivity(isSafeKey(event.keyCode)); + }, + + // Indent the line following a given
    , or null for the first + // line. If given a
    element, this must have been highlighted + // so that it has an indentation method. Returns the whitespace + // element that has been modified or created (if any). + indentLineAfter: function(start, direction) { + // whiteSpace is the whitespace span at the start of the line, + // or null if there is no such node. + var whiteSpace = start ? start.nextSibling : this.container.firstChild; + if (whiteSpace && !hasClass(whiteSpace, "whitespace")) + whiteSpace = null; + + // Sometimes the start of the line can influence the correct + // indentation, so we retrieve it. + var firstText = whiteSpace ? whiteSpace.nextSibling : (start ? start.nextSibling : this.container.firstChild); + var nextChars = (start && firstText && firstText.currentText) ? firstText.currentText : ""; + + // Ask the lexical context for the correct indentation, and + // compute how much this differs from the current indentation. + var newIndent = 0, curIndent = whiteSpace ? whiteSpace.currentText.length : 0; + if (direction != null && this.options.tabMode == "shift") + newIndent = direction ? curIndent + indentUnit : Math.max(0, curIndent - indentUnit) + else if (start) + newIndent = start.indentation(nextChars, curIndent, direction); + else if (Editor.Parser.firstIndentation) + newIndent = Editor.Parser.firstIndentation(nextChars, curIndent, direction); + var indentDiff = newIndent - curIndent; + + // If there is too much, this is just a matter of shrinking a span. + if (indentDiff < 0) { + if (newIndent == 0) { + if (firstText) select.snapshotMove(whiteSpace.firstChild, firstText.firstChild, 0); + removeElement(whiteSpace); + whiteSpace = null; + } + else { + select.snapshotMove(whiteSpace.firstChild, whiteSpace.firstChild, indentDiff, true); + whiteSpace.currentText = makeWhiteSpace(newIndent); + whiteSpace.firstChild.nodeValue = whiteSpace.currentText; + } + } + // Not enough... + else if (indentDiff > 0) { + // If there is whitespace, we grow it. + if (whiteSpace) { + whiteSpace.currentText = makeWhiteSpace(newIndent); + whiteSpace.firstChild.nodeValue = whiteSpace.currentText; + } + // Otherwise, we have to add a new whitespace node. + else { + whiteSpace = makePartSpan(makeWhiteSpace(newIndent), this.doc); + whiteSpace.className = "whitespace"; + if (start) insertAfter(whiteSpace, start); + else this.container.insertBefore(whiteSpace, this.container.firstChild); + } + if (firstText) select.snapshotMove(firstText.firstChild, whiteSpace.firstChild, curIndent, false, true); + } + if (indentDiff != 0) this.addDirtyNode(start); + return whiteSpace; + }, + + // Re-highlight the selected part of the document. + highlightAtCursor: function() { + var pos = select.selectionTopNode(this.container, true); + var to = select.selectionTopNode(this.container, false); + if (pos === false || to === false) return; + + select.markSelection(this.win); + if (this.highlight(pos, endOfLine(to, this.container), true, 20) === false) + return false; + select.selectMarked(); + return true; + }, + + // When tab is pressed with text selected, the whole selection is + // re-indented, when nothing is selected, the line with the cursor + // is re-indented. + handleTab: function(direction) { + if (this.options.tabMode == "spaces") + select.insertTabAtCursor(this.win); + else + this.reindentSelection(direction); + }, + + home: function() { + var cur = select.selectionTopNode(this.container, true), start = cur; + if (cur === false || !(!cur || cur.isPart || cur.nodeName == "BR") || !this.container.firstChild) + return false; + + while (cur && cur.nodeName != "BR") cur = cur.previousSibling; + var next = cur ? cur.nextSibling : this.container.firstChild; + if (next && next != start && next.isPart && hasClass(next, "whitespace")) + select.focusAfterNode(next, this.container); + else + select.focusAfterNode(cur, this.container); + + select.scrollToCursor(this.container); + return true; + }, + + // Delay (or initiate) the next paren blink event. + scheduleParenBlink: function() { + if (this.parenEvent) this.parent.clearTimeout(this.parenEvent); + var self = this; + this.parenEvent = this.parent.setTimeout(function(){self.blinkParens();}, 300); + }, + + // Take the token before the cursor. If it contains a character in + // '()[]{}', search for the matching paren/brace/bracket, and + // highlight them in green for a moment, or red if no proper match + // was found. + blinkParens: function(jump) { + if (!window.select) return; + // Clear the event property. + if (this.parenEvent) this.parent.clearTimeout(this.parenEvent); + this.parenEvent = null; + + // Extract a 'paren' from a piece of text. + function paren(node) { + if (node.currentText) { + var match = node.currentText.match(/^[\s\u00a0]*([\(\)\[\]{}])[\s\u00a0]*$/); + return match && match[1]; + } + } + // Determine the direction a paren is facing. + function forward(ch) { + return /[\(\[\{]/.test(ch); + } + + var ch, self = this, cursor = select.selectionTopNode(this.container, true); + if (!cursor || !this.highlightAtCursor()) return; + cursor = select.selectionTopNode(this.container, true); + if (!(cursor && ((ch = paren(cursor)) || (cursor = cursor.nextSibling) && (ch = paren(cursor))))) + return; + // We only look for tokens with the same className. + var className = cursor.className, dir = forward(ch), match = matching[ch]; + + // Since parts of the document might not have been properly + // highlighted, and it is hard to know in advance which part we + // have to scan, we just try, and when we find dirty nodes we + // abort, parse them, and re-try. + function tryFindMatch() { + var stack = [], ch, ok = true;; + for (var runner = cursor; runner; runner = dir ? runner.nextSibling : runner.previousSibling) { + if (runner.className == className && runner.nodeName == "SPAN" && (ch = paren(runner))) { + if (forward(ch) == dir) + stack.push(ch); + else if (!stack.length) + ok = false; + else if (stack.pop() != matching[ch]) + ok = false; + if (!stack.length) break; + } + else if (runner.dirty || runner.nodeName != "SPAN" && runner.nodeName != "BR") { + return {node: runner, status: "dirty"}; + } + } + return {node: runner, status: runner && ok}; + } + // Temporarily give the relevant nodes a colour. + function blink(node, ok) { + node.style.fontWeight = "bold"; + node.style.color = ok ? "#8F8" : "#F88"; + self.parent.setTimeout(function() {node.style.fontWeight = ""; node.style.color = "";}, 500); + } + + while (true) { + var found = tryFindMatch(); + if (found.status == "dirty") { + this.highlight(found.node, endOfLine(found.node)); + // Needed because in some corner cases a highlight does not + // reach a node. + found.node.dirty = false; + continue; + } + else { + blink(cursor, found.status); + if (found.node) { + blink(found.node, found.status); + if (jump) select.focusAfterNode(found.node.previousSibling, this.container); + } + break; + } + } + }, + + // Adjust the amount of whitespace at the start of the line that + // the cursor is on so that it is indented properly. + indentAtCursor: function(direction) { + if (!this.container.firstChild) return; + // The line has to have up-to-date lexical information, so we + // highlight it first. + if (!this.highlightAtCursor()) return; + var cursor = select.selectionTopNode(this.container, false); + // If we couldn't determine the place of the cursor, + // there's nothing to indent. + if (cursor === false) + return; + var lineStart = startOfLine(cursor); + var whiteSpace = this.indentLineAfter(lineStart, direction); + if (cursor == lineStart && whiteSpace) + cursor = whiteSpace; + // This means the indentation has probably messed up the cursor. + if (cursor == whiteSpace) + select.focusAfterNode(cursor, this.container); + }, + + // Indent all lines whose start falls inside of the current + // selection. + indentRegion: function(start, end, direction) { + var current = (start = startOfLine(start)), before = start && startOfLine(start.previousSibling); + if (end.nodeName != "BR") end = endOfLine(end, this.container); + + do { + var next = endOfLine(current, this.container); + if (current) this.highlight(before, next, true); + this.indentLineAfter(current, direction); + before = current; + current = next; + } while (current != end); + select.setCursorPos(this.container, {node: start, offset: 0}, {node: end, offset: 0}); + }, + + // Find the node that the cursor is in, mark it as dirty, and make + // sure a highlight pass is scheduled. + cursorActivity: function(safe) { + if (internetExplorer) { + this.container.createTextRange().execCommand("unlink"); + this.selectionSnapshot = select.selectionCoords(this.win); + } + + var activity = this.options.cursorActivity; + if (!safe || activity) { + var cursor = select.selectionTopNode(this.container, false); + if (cursor === false || !this.container.firstChild) return; + cursor = cursor || this.container.firstChild; + if (activity) activity(cursor); + if (!safe) { + this.scheduleHighlight(); + this.addDirtyNode(cursor); + } + } + }, + + reparseBuffer: function() { + forEach(this.container.childNodes, function(node) {node.dirty = true;}); + if (this.container.firstChild) + this.addDirtyNode(this.container.firstChild); + }, + + // Add a node to the set of dirty nodes, if it isn't already in + // there. + addDirtyNode: function(node) { + node = node || this.container.firstChild; + if (!node) return; + + for (var i = 0; i < this.dirty.length; i++) + if (this.dirty[i] == node) return; + + if (node.nodeType != 3) + node.dirty = true; + this.dirty.push(node); + }, + + // Cause a highlight pass to happen in options.passDelay + // milliseconds. Clear the existing timeout, if one exists. This + // way, the passes do not happen while the user is typing, and + // should as unobtrusive as possible. + scheduleHighlight: function() { + // Timeouts are routed through the parent window, because on + // some browsers designMode windows do not fire timeouts. + var self = this; + this.parent.clearTimeout(this.highlightTimeout); + this.highlightTimeout = this.parent.setTimeout(function(){self.highlightDirty();}, this.options.passDelay); + }, + + // Fetch one dirty node, and remove it from the dirty set. + getDirtyNode: function() { + while (this.dirty.length > 0) { + var found = this.dirty.pop(); + // IE8 sometimes throws an unexplainable 'invalid argument' + // exception for found.parentNode + try { + // If the node has been coloured in the meantime, or is no + // longer in the document, it should not be returned. + while (found && found.parentNode != this.container) + found = found.parentNode + if (found && (found.dirty || found.nodeType == 3)) + return found; + } catch (e) {} + } + return null; + }, + + // Pick dirty nodes, and highlight them, until options.passTime + // milliseconds have gone by. The highlight method will continue + // to next lines as long as it finds dirty nodes. It returns + // information about the place where it stopped. If there are + // dirty nodes left after this function has spent all its lines, + // it shedules another highlight to finish the job. + highlightDirty: function(force) { + // Prevent FF from raising an error when it is firing timeouts + // on a page that's no longer loaded. + if (!window.select) return; + + if (!this.options.readOnly) select.markSelection(this.win); + var start, endTime = force ? null : time() + this.options.passTime; + while ((time() < endTime || force) && (start = this.getDirtyNode())) { + var result = this.highlight(start, endTime); + if (result && result.node && result.dirty) + this.addDirtyNode(result.node); + } + if (!this.options.readOnly) select.selectMarked(); + if (start) this.scheduleHighlight(); + return this.dirty.length == 0; + }, + + // Creates a function that, when called through a timeout, will + // continuously re-parse the document. + documentScanner: function(passTime) { + var self = this, pos = null; + return function() { + // FF timeout weirdness workaround. + if (!window.select) return; + // If the current node is no longer in the document... oh + // well, we start over. + if (pos && pos.parentNode != self.container) + pos = null; + select.markSelection(self.win); + var result = self.highlight(pos, time() + passTime, true); + select.selectMarked(); + var newPos = result ? (result.node && result.node.nextSibling) : null; + pos = (pos == newPos) ? null : newPos; + self.delayScanning(); + }; + }, + + // Starts the continuous scanning process for this document after + // a given interval. + delayScanning: function() { + if (this.scanner) { + this.parent.clearTimeout(this.documentScan); + this.documentScan = this.parent.setTimeout(this.scanner, this.options.continuousScanning); + } + }, + + // The function that does the actual highlighting/colouring (with + // help from the parser and the DOM normalizer). Its interface is + // rather overcomplicated, because it is used in different + // situations: ensuring that a certain line is highlighted, or + // highlighting up to X milliseconds starting from a certain + // point. The 'from' argument gives the node at which it should + // start. If this is null, it will start at the beginning of the + // document. When a timestamp is given with the 'target' argument, + // it will stop highlighting at that time. If this argument holds + // a DOM node, it will highlight until it reaches that node. If at + // any time it comes across two 'clean' lines (no dirty nodes), it + // will stop, except when 'cleanLines' is true. maxBacktrack is + // the maximum number of lines to backtrack to find an existing + // parser instance. This is used to give up in situations where a + // highlight would take too long and freeze the browser interface. + highlight: function(from, target, cleanLines, maxBacktrack){ + var container = this.container, self = this, active = this.options.activeTokens; + var endTime = (typeof target == "number" ? target : null); + + if (!container.firstChild) + return; + // Backtrack to the first node before from that has a partial + // parse stored. + while (from && (!from.parserFromHere || from.dirty)) { + if (maxBacktrack != null && from.nodeName == "BR" && (--maxBacktrack) < 0) + return false; + from = from.previousSibling; + } + // If we are at the end of the document, do nothing. + if (from && !from.nextSibling) + return; + + // Check whether a part ( node) and the corresponding token + // match. + function correctPart(token, part){ + return !part.reduced && part.currentText == token.value && part.className == token.style; + } + // Shorten the text associated with a part by chopping off + // characters from the front. Note that only the currentText + // property gets changed. For efficiency reasons, we leave the + // nodeValue alone -- we set the reduced flag to indicate that + // this part must be replaced. + function shortenPart(part, minus){ + part.currentText = part.currentText.substring(minus); + part.reduced = true; + } + // Create a part corresponding to a given token. + function tokenPart(token){ + var part = makePartSpan(token.value, self.doc); + part.className = token.style; + return part; + } + + function maybeTouch(node) { + if (node) { + var old = node.oldNextSibling; + if (lineDirty || old === undefined || node.nextSibling != old) + self.history.touch(node); + node.oldNextSibling = node.nextSibling; + } + else { + var old = self.container.oldFirstChild; + if (lineDirty || old === undefined || self.container.firstChild != old) + self.history.touch(null); + self.container.oldFirstChild = self.container.firstChild; + } + } + + // Get the token stream. If from is null, we start with a new + // parser from the start of the frame, otherwise a partial parse + // is resumed. + var traversal = traverseDOM(from ? from.nextSibling : container.firstChild), + stream = stringStream(traversal), + parsed = from ? from.parserFromHere(stream) : Editor.Parser.make(stream); + + // parts is an interface to make it possible to 'delay' fetching + // the next DOM node until we are completely done with the one + // before it. This is necessary because often the next node is + // not yet available when we want to proceed past the current + // one. + var parts = { + current: null, + // Fetch current node. + get: function(){ + if (!this.current) + this.current = traversal.nodes.shift(); + return this.current; + }, + // Advance to the next part (do not fetch it yet). + next: function(){ + this.current = null; + }, + // Remove the current part from the DOM tree, and move to the + // next. + remove: function(){ + container.removeChild(this.get()); + this.current = null; + }, + // Advance to the next part that is not empty, discarding empty + // parts. + getNonEmpty: function(){ + var part = this.get(); + // Allow empty nodes when they are alone on a line, needed + // for the FF cursor bug workaround (see select.js, + // insertNewlineAtCursor). + while (part && part.nodeName == "SPAN" && part.currentText == "") { + var old = part; + this.remove(); + part = this.get(); + // Adjust selection information, if any. See select.js for details. + select.snapshotMove(old.firstChild, part && (part.firstChild || part), 0); + } + return part; + } + }; + + var lineDirty = false, prevLineDirty = true, lineNodes = 0; + + // This forEach loops over the tokens from the parsed stream, and + // at the same time uses the parts object to proceed through the + // corresponding DOM nodes. + forEach(parsed, function(token){ + var part = parts.getNonEmpty(); + + if (token.value == "\n"){ + // The idea of the two streams actually staying synchronized + // is such a long shot that we explicitly check. + if (part.nodeName != "BR") + throw "Parser out of sync. Expected BR."; + + if (part.dirty || !part.indentation) lineDirty = true; + maybeTouch(from); + from = part; + + // Every
    gets a copy of the parser state and a lexical + // context assigned to it. The first is used to be able to + // later resume parsing from this point, the second is used + // for indentation. + part.parserFromHere = parsed.copy(); + part.indentation = token.indentation; + part.dirty = false; + + // If the target argument wasn't an integer, go at least + // until that node. + if (endTime == null && part == target) throw StopIteration; + + // A clean line with more than one node means we are done. + // Throwing a StopIteration is the way to break out of a + // MochiKit forEach loop. + if ((endTime != null && time() >= endTime) || (!lineDirty && !prevLineDirty && lineNodes > 1 && !cleanLines)) + throw StopIteration; + prevLineDirty = lineDirty; lineDirty = false; lineNodes = 0; + parts.next(); + } + else { + if (part.nodeName != "SPAN") + throw "Parser out of sync. Expected SPAN."; + if (part.dirty) + lineDirty = true; + lineNodes++; + + // If the part matches the token, we can leave it alone. + if (correctPart(token, part)){ + part.dirty = false; + parts.next(); + } + // Otherwise, we have to fix it. + else { + lineDirty = true; + // Insert the correct part. + var newPart = tokenPart(token); + container.insertBefore(newPart, part); + if (active) active(newPart, token, self); + var tokensize = token.value.length; + var offset = 0; + // Eat up parts until the text for this token has been + // removed, adjusting the stored selection info (see + // select.js) in the process. + while (tokensize > 0) { + part = parts.get(); + var partsize = part.currentText.length; + select.snapshotReplaceNode(part.firstChild, newPart.firstChild, tokensize, offset); + if (partsize > tokensize){ + shortenPart(part, tokensize); + tokensize = 0; + } + else { + tokensize -= partsize; + offset += partsize; + parts.remove(); + } + } + } + } + }); + maybeTouch(from); + webkitLastLineHack(this.container); + + // The function returns some status information that is used by + // hightlightDirty to determine whether and where it has to + // continue. + return {node: parts.getNonEmpty(), + dirty: lineDirty}; + } + }; + + return Editor; +})(); + +addEventHandler(window, "load", function() { + var CodeMirror = window.frameElement.CodeMirror; + CodeMirror.editor = new Editor(CodeMirror.options); + this.parent.setTimeout(method(CodeMirror, "init"), 0); +}); diff --git a/redakcja/static/js/lib/codemirror/parsexml.js b/redakcja/static/js/lib/codemirror/parsexml.js new file mode 100644 index 00000000..87fbf0c0 --- /dev/null +++ b/redakcja/static/js/lib/codemirror/parsexml.js @@ -0,0 +1,292 @@ +/* This file defines an XML parser, with a few kludges to make it + * useable for HTML. autoSelfClosers defines a set of tag names that + * are expected to not have a closing tag, and doNotIndent specifies + * the tags inside of which no indentation should happen (see Config + * object). These can be disabled by passing the editor an object like + * {useHTMLKludges: false} as parserConfig option. + */ + +var XMLParser = Editor.Parser = (function() { + var Kludges = { + autoSelfClosers: {"br": true, "img": true, "hr": true, "link": true, "input": true, + "meta": true, "col": true, "frame": true, "base": true, "area": true}, + doNotIndent: {"pre": true, "!cdata": true} + }; + var NoKludges = {autoSelfClosers: {}, doNotIndent: {"!cdata": true}}; + var UseKludges = Kludges; + var alignCDATA = false; + + // Simple stateful tokenizer for XML documents. Returns a + // MochiKit-style iterator, with a state property that contains a + // function encapsulating the current state. See tokenize.js. + var tokenizeXML = (function() { + function inText(source, setState) { + var ch = source.next(); + if (ch == "<") { + if (source.equals("!")) { + source.next(); + if (source.equals("[")) { + if (source.lookAhead("[CDATA[", true)) { + setState(inBlock("xml-cdata", "]]>")); + return null; + } + else { + return "xml-text"; + } + } + else if (source.lookAhead("--", true)) { + setState(inBlock("xml-comment", "-->")); + return null; + } + else { + return "xml-text"; + } + } + else if (source.equals("?")) { + source.next(); + source.nextWhileMatches(/[\w\._\-]/); + setState(inBlock("xml-processing", "?>")); + return "xml-processing"; + } + else { + if (source.equals("/")) source.next(); + setState(inTag); + return "xml-punctuation"; + } + } + else if (ch == "&") { + while (!source.endOfLine()) { + if (source.next() == ";") + break; + } + return "xml-entity"; + } + else { + source.nextWhileMatches(/[^&<\n]/); + return "xml-text"; + } + } + + function inTag(source, setState) { + var ch = source.next(); + if (ch == ">") { + setState(inText); + return "xml-punctuation"; + } + else if (/[?\/]/.test(ch) && source.equals(">")) { + source.next(); + setState(inText); + return "xml-punctuation"; + } + else if (ch == "=") { + return "xml-punctuation"; + } + else if (/[\'\"]/.test(ch)) { + setState(inAttribute(ch)); + return null; + } + else { + source.nextWhileMatches(/[^\s\u00a0=<>\"\'\/?]/); + return "xml-name"; + } + } + + function inAttribute(quote) { + return function(source, setState) { + while (!source.endOfLine()) { + if (source.next() == quote) { + setState(inTag); + break; + } + } + return "xml-attribute"; + }; + } + + function inBlock(style, terminator) { + return function(source, setState) { + while (!source.endOfLine()) { + if (source.lookAhead(terminator, true)) { + setState(inText); + break; + } + source.next(); + } + return style; + }; + } + + return function(source, startState) { + return tokenizer(source, startState || inText); + }; + })(); + + // The parser. The structure of this function largely follows that of + // parseJavaScript in parsejavascript.js (there is actually a bit more + // shared code than I'd like), but it is quite a bit simpler. + function parseXML(source) { + var tokens = tokenizeXML(source); + var cc = [base]; + var tokenNr = 0, indented = 0; + var currentTag = null, context = null; + var consume, marked; + + function push(fs) { + for (var i = fs.length - 1; i >= 0; i--) + cc.push(fs[i]); + } + function cont() { + push(arguments); + consume = true; + } + function pass() { + push(arguments); + consume = false; + } + + function mark(style) { + marked = style; + } + function expect(text) { + return function(style, content) { + if (content == text) cont(); + else mark("xml-error") || cont(arguments.callee); + }; + } + + function pushContext(tagname, startOfLine) { + var noIndent = UseKludges.doNotIndent.hasOwnProperty(tagname) || (context && context.noIndent); + context = {prev: context, name: tagname, indent: indented, startOfLine: startOfLine, noIndent: noIndent}; + } + function popContext() { + context = context.prev; + } + function computeIndentation(baseContext) { + return function(nextChars, current) { + var context = baseContext; + if (context && context.noIndent) + return current; + if (alignCDATA && /")); + else if (style == "xml-cdata") { + if (!context || context.name != "!cdata") pushContext("!cdata"); + if (/\]\]>$/.test(content)) popContext(); + cont(); + } + else if (harmlessTokens.hasOwnProperty(style)) cont(); + else mark("xml-error") || cont(); + } + function tagname(style, content) { + if (style == "xml-name") { + currentTag = content.toLowerCase(); + mark("xml-tagname"); + cont(); + } + else { + currentTag = null; + pass(); + } + } + function closetagname(style, content) { + if (style == "xml-name" && context && content.toLowerCase() == context.name) { + popContext(); + mark("xml-tagname"); + } + else { + mark("xml-error"); + } + cont(); + } + function endtag(startOfLine) { + return function(style, content) { + if (content == "/>" || (content == ">" && UseKludges.autoSelfClosers.hasOwnProperty(currentTag))) cont(); + else if (content == ">") pushContext(currentTag, startOfLine) || cont(); + else mark("xml-error") || cont(arguments.callee); + }; + } + function attributes(style) { + if (style == "xml-name") mark("xml-attname") || cont(attribute, attributes); + else pass(); + } + function attribute(style, content) { + if (content == "=") cont(value); + else if (content == ">" || content == "/>") pass(endtag); + else pass(); + } + function value(style) { + if (style == "xml-attribute") cont(value); + else pass(); + } + + return { + indentation: function() {return indented;}, + + next: function(){ + var token = tokens.next(); + if (token.style == "whitespace" && tokenNr == 0) + indented = token.value.length; + else + tokenNr++; + if (token.content == "\n") { + indented = tokenNr = 0; + token.indentation = computeIndentation(context); + } + + if (token.style == "whitespace" || token.type == "xml-comment") + return token; + + while(true){ + consume = marked = false; + cc.pop()(token.style, token.content); + if (consume){ + if (marked) + token.style = marked; + return token; + } + } + }, + + copy: function(){ + var _cc = cc.concat([]), _tokenState = tokens.state, _context = context; + var parser = this; + + return function(input){ + cc = _cc.concat([]); + tokenNr = indented = 0; + context = _context; + tokens = tokenizeXML(input, _tokenState); + return parser; + }; + } + }; + } + + return { + make: parseXML, + electricChars: "/", + configure: function(config) { + if (config.useHTMLKludges != null) + UseKludges = config.useHTMLKludges ? Kludges : NoKludges; + if (config.alignCDATA) + alignCDATA = config.alignCDATA; + } + }; +})(); diff --git a/redakcja/static/js/lib/codemirror/select.js b/redakcja/static/js/lib/codemirror/select.js new file mode 100644 index 00000000..d513ba5f --- /dev/null +++ b/redakcja/static/js/lib/codemirror/select.js @@ -0,0 +1,619 @@ +/* Functionality for finding, storing, and restoring selections + * + * This does not provide a generic API, just the minimal functionality + * required by the CodeMirror system. + */ + +// Namespace object. +var select = {}; + +(function() { + select.ie_selection = document.selection && document.selection.createRangeCollection; + + // Find the 'top-level' (defined as 'a direct child of the node + // passed as the top argument') node that the given node is + // contained in. Return null if the given node is not inside the top + // node. + function topLevelNodeAt(node, top) { + while (node && node.parentNode != top) + node = node.parentNode; + return node; + } + + // Find the top-level node that contains the node before this one. + function topLevelNodeBefore(node, top) { + while (!node.previousSibling && node.parentNode != top) + node = node.parentNode; + return topLevelNodeAt(node.previousSibling, top); + } + + var fourSpaces = "\u00a0\u00a0\u00a0\u00a0"; + + select.scrollToNode = function(element) { + if (!element) return; + var doc = element.ownerDocument, body = doc.body, + win = (doc.defaultView || doc.parentWindow), + html = doc.documentElement, + atEnd = !element.nextSibling || !element.nextSibling.nextSibling + || !element.nextSibling.nextSibling.nextSibling; + // In Opera (and recent Webkit versions), BR elements *always* + // have a scrollTop property of zero. + var compensateHack = 0; + while (element && !element.offsetTop) { + compensateHack++; + element = element.previousSibling; + } + // atEnd is another kludge for these browsers -- if the cursor is + // at the end of the document, and the node doesn't have an + // offset, just scroll to the end. + if (compensateHack == 0) atEnd = false; + + var y = compensateHack * (element ? element.offsetHeight : 0), x = 0, pos = element; + while (pos && pos.offsetParent) { + y += pos.offsetTop; + // Don't count X offset for
    nodes + if (pos.nodeName != "BR") + x += pos.offsetLeft; + pos = pos.offsetParent; + } + + var scroll_x = body.scrollLeft || html.scrollLeft || 0, + scroll_y = body.scrollTop || html.scrollTop || 0, + screen_x = x - scroll_x, screen_y = y - scroll_y, scroll = false; + + if (screen_x < 0 || screen_x > (win.innerWidth || html.clientWidth || 0)) { + scroll_x = x; + scroll = true; + } + if (screen_y < 0 || atEnd || screen_y > (win.innerHeight || html.clientHeight || 0) - 50) { + scroll_y = atEnd ? 1e10 : y; + scroll = true; + } + if (scroll) win.scrollTo(scroll_x, scroll_y); + }; + + select.scrollToCursor = function(container) { + select.scrollToNode(select.selectionTopNode(container, true) || container.firstChild); + }; + + // Used to prevent restoring a selection when we do not need to. + var currentSelection = null; + + select.snapshotChanged = function() { + if (currentSelection) currentSelection.changed = true; + }; + + // This is called by the code in editor.js whenever it is replacing + // a text node. The function sees whether the given oldNode is part + // of the current selection, and updates this selection if it is. + // Because nodes are often only partially replaced, the length of + // the part that gets replaced has to be taken into account -- the + // selection might stay in the oldNode if the newNode is smaller + // than the selection's offset. The offset argument is needed in + // case the selection does move to the new object, and the given + // length is not the whole length of the new node (part of it might + // have been used to replace another node). + select.snapshotReplaceNode = function(from, to, length, offset) { + if (!currentSelection) return; + + function replace(point) { + if (from == point.node) { + currentSelection.changed = true; + if (length && point.offset > length) { + point.offset -= length; + } + else { + point.node = to; + point.offset += (offset || 0); + } + } + } + replace(currentSelection.start); + replace(currentSelection.end); + }; + + select.snapshotMove = function(from, to, distance, relative, ifAtStart) { + if (!currentSelection) return; + + function move(point) { + if (from == point.node && (!ifAtStart || point.offset == 0)) { + currentSelection.changed = true; + point.node = to; + if (relative) point.offset = Math.max(0, point.offset + distance); + else point.offset = distance; + } + } + move(currentSelection.start); + move(currentSelection.end); + }; + + // Most functions are defined in two ways, one for the IE selection + // model, one for the W3C one. + if (select.ie_selection) { + function selectionNode(win, start) { + var range = win.document.selection.createRange(); + range.collapse(start); + + function nodeAfter(node) { + var found = null; + while (!found && node) { + found = node.nextSibling; + node = node.parentNode; + } + return nodeAtStartOf(found); + } + + function nodeAtStartOf(node) { + while (node && node.firstChild) node = node.firstChild; + return {node: node, offset: 0}; + } + + var containing = range.parentElement(); + if (!isAncestor(win.document.body, containing)) return null; + if (!containing.firstChild) return nodeAtStartOf(containing); + + var working = range.duplicate(); + working.moveToElementText(containing); + working.collapse(true); + for (var cur = containing.firstChild; cur; cur = cur.nextSibling) { + if (cur.nodeType == 3) { + var size = cur.nodeValue.length; + working.move("character", size); + } + else { + working.moveToElementText(cur); + working.collapse(false); + } + + var dir = range.compareEndPoints("StartToStart", working); + if (dir == 0) return nodeAfter(cur); + if (dir == 1) continue; + if (cur.nodeType != 3) return nodeAtStartOf(cur); + + working.setEndPoint("StartToEnd", range); + return {node: cur, offset: size - working.text.length}; + } + return nodeAfter(containing); + } + + select.markSelection = function(win) { + currentSelection = null; + var sel = win.document.selection; + if (!sel) return; + var start = selectionNode(win, true), + end = selectionNode(win, false); + if (!start || !end) return; + currentSelection = {start: start, end: end, window: win, changed: false}; + }; + + select.selectMarked = function() { + if (!currentSelection || !currentSelection.changed) return; + var win = currentSelection.window, doc = win.document; + + function makeRange(point) { + var range = doc.body.createTextRange(), + node = point.node; + if (!node) { + range.moveToElementText(currentSelection.window.document.body); + range.collapse(false); + } + else if (node.nodeType == 3) { + range.moveToElementText(node.parentNode); + var offset = point.offset; + while (node.previousSibling) { + node = node.previousSibling; + offset += (node.innerText || "").length; + } + range.move("character", offset); + } + else { + range.moveToElementText(node); + range.collapse(true); + } + return range; + } + + var start = makeRange(currentSelection.start), end = makeRange(currentSelection.end); + start.setEndPoint("StartToEnd", end); + start.select(); + }; + + // Get the top-level node that one end of the cursor is inside or + // after. Note that this returns false for 'no cursor', and null + // for 'start of document'. + select.selectionTopNode = function(container, start) { + var selection = container.ownerDocument.selection; + if (!selection) return false; + + var range = selection.createRange(), range2 = range.duplicate(); + range.collapse(start); + var around = range.parentElement(); + if (around && isAncestor(container, around)) { + // Only use this node if the selection is not at its start. + range2.moveToElementText(around); + if (range.compareEndPoints("StartToStart", range2) == 1) + return topLevelNodeAt(around, container); + } + + // Move the start of a range to the start of a node, + // compensating for the fact that you can't call + // moveToElementText with text nodes. + function moveToNodeStart(range, node) { + if (node.nodeType == 3) { + var count = 0, cur = node.previousSibling; + while (cur && cur.nodeType == 3) { + count += cur.nodeValue.length; + cur = cur.previousSibling; + } + if (cur) { + try{range.moveToElementText(cur);} + catch(e){} + range.collapse(false); + } + else range.moveToElementText(node.parentNode); + if (count) range.move("character", count); + } + else range.moveToElementText(node); + } + + // Do a binary search through the container object, comparing + // the start of each node to the selection + var start = 0, end = container.childNodes.length - 1; + while (start < end) { + var middle = Math.ceil((end + start) / 2), node = container.childNodes[middle]; + if (!node) return false; // Don't ask. IE6 manages this sometimes. + moveToNodeStart(range2, node); + if (range.compareEndPoints("StartToStart", range2) == 1) + start = middle; + else + end = middle - 1; + } + return container.childNodes[start] || null; + }; + + // Place the cursor after this.start. This is only useful when + // manually moving the cursor instead of restoring it to its old + // position. + select.focusAfterNode = function(node, container) { + var range = container.ownerDocument.body.createTextRange(); + range.moveToElementText(node || container); + range.collapse(!node); + range.select(); + }; + + select.somethingSelected = function(win) { + var sel = win.document.selection; + return sel && (sel.createRange().text != ""); + }; + + function insertAtCursor(window, html) { + var selection = window.document.selection; + if (selection) { + var range = selection.createRange(); + range.pasteHTML(html); + range.collapse(false); + range.select(); + } + } + + // Used to normalize the effect of the enter key, since browsers + // do widely different things when pressing enter in designMode. + select.insertNewlineAtCursor = function(window) { + insertAtCursor(window, "
    "); + }; + + select.insertTabAtCursor = function(window) { + insertAtCursor(window, fourSpaces); + }; + + // Get the BR node at the start of the line on which the cursor + // currently is, and the offset into the line. Returns null as + // node if cursor is on first line. + select.cursorPos = function(container, start) { + var selection = container.ownerDocument.selection; + if (!selection) return null; + + var topNode = select.selectionTopNode(container, start); + while (topNode && topNode.nodeName != "BR") + topNode = topNode.previousSibling; + + var range = selection.createRange(), range2 = range.duplicate(); + range.collapse(start); + if (topNode) { + range2.moveToElementText(topNode); + range2.collapse(false); + } + else { + // When nothing is selected, we can get all kinds of funky errors here. + try { range2.moveToElementText(container); } + catch (e) { return null; } + range2.collapse(true); + } + range.setEndPoint("StartToStart", range2); + + return {node: topNode, offset: range.text.length}; + }; + + select.setCursorPos = function(container, from, to) { + function rangeAt(pos) { + var range = container.ownerDocument.body.createTextRange(); + if (!pos.node) { + range.moveToElementText(container); + range.collapse(true); + } + else { + range.moveToElementText(pos.node); + range.collapse(false); + } + range.move("character", pos.offset); + return range; + } + + var range = rangeAt(from); + if (to && to != from) + range.setEndPoint("EndToEnd", rangeAt(to)); + range.select(); + } + + // Some hacks for storing and re-storing the selection when the editor loses and regains focus. + select.selectionCoords = function (win) { + var selection = win.document.selection; + if (!selection) return null; + var start = selection.createRange(), end = start.duplicate(); + start.collapse(true); + end.collapse(false); + + var body = win.document.body; + return {start: {x: start.boundingLeft + body.scrollLeft - 1, + y: start.boundingTop + body.scrollTop}, + end: {x: end.boundingLeft + body.scrollLeft - 1, + y: end.boundingTop + body.scrollTop}}; + }; + + // Restore a stored selection. + select.selectCoords = function(win, coords) { + if (!coords) return; + + var range1 = win.document.body.createTextRange(), range2 = range1.duplicate(); + // This can fail for various hard-to-handle reasons. + try { + range1.moveToPoint(coords.start.x, coords.start.y); + range2.moveToPoint(coords.end.x, coords.end.y); + range1.setEndPoint("EndToStart", range2); + range1.select(); + } catch(e) {} + }; + } + // W3C model + else { + // Store start and end nodes, and offsets within these, and refer + // back to the selection object from those nodes, so that this + // object can be updated when the nodes are replaced before the + // selection is restored. + select.markSelection = function (win) { + var selection = win.getSelection(); + if (!selection || selection.rangeCount == 0) + return (currentSelection = null); + var range = selection.getRangeAt(0); + + currentSelection = { + start: {node: range.startContainer, offset: range.startOffset}, + end: {node: range.endContainer, offset: range.endOffset}, + window: win, + changed: false + }; + + // We want the nodes right at the cursor, not one of their + // ancestors with a suitable offset. This goes down the DOM tree + // until a 'leaf' is reached (or is it *up* the DOM tree?). + function normalize(point){ + while (point.node.nodeType != 3 && point.node.nodeName != "BR") { + var newNode = point.node.childNodes[point.offset] || point.node.nextSibling; + point.offset = 0; + while (!newNode && point.node.parentNode) { + point.node = point.node.parentNode; + newNode = point.node.nextSibling; + } + point.node = newNode; + if (!newNode) + break; + } + } + + normalize(currentSelection.start); + normalize(currentSelection.end); + }; + + select.selectMarked = function () { + if (!currentSelection || !currentSelection.changed) return; + var win = currentSelection.window, range = win.document.createRange(); + + function setPoint(point, which) { + if (point.node) { + // Some magic to generalize the setting of the start and end + // of a range. + if (point.offset == 0) + range["set" + which + "Before"](point.node); + else + range["set" + which](point.node, point.offset); + } + else { + range.setStartAfter(win.document.body.lastChild || win.document.body); + } + } + + setPoint(currentSelection.end, "End"); + setPoint(currentSelection.start, "Start"); + selectRange(range, win); + }; + + // Helper for selecting a range object. + function selectRange(range, window) { + var selection = window.getSelection(); + selection.removeAllRanges(); + selection.addRange(range); + }; + function selectionRange(window) { + var selection = window.getSelection(); + if (!selection || selection.rangeCount == 0) + return false; + else + return selection.getRangeAt(0); + } + + // Finding the top-level node at the cursor in the W3C is, as you + // can see, quite an involved process. + select.selectionTopNode = function(container, start) { + var range = selectionRange(container.ownerDocument.defaultView); + if (!range) return false; + + var node = start ? range.startContainer : range.endContainer; + var offset = start ? range.startOffset : range.endOffset; + // Work around (yet another) bug in Opera's selection model. + if (window.opera && !start && range.endContainer == container && range.endOffset == range.startOffset + 1 && + container.childNodes[range.startOffset] && container.childNodes[range.startOffset].nodeName == "BR") + offset--; + + // For text nodes, we look at the node itself if the cursor is + // inside, or at the node before it if the cursor is at the + // start. + if (node.nodeType == 3){ + if (offset > 0) + return topLevelNodeAt(node, container); + else + return topLevelNodeBefore(node, container); + } + // Occasionally, browsers will return the HTML node as + // selection. If the offset is 0, we take the start of the frame + // ('after null'), otherwise, we take the last node. + else if (node.nodeName == "HTML") { + return (offset == 1 ? null : container.lastChild); + } + // If the given node is our 'container', we just look up the + // correct node by using the offset. + else if (node == container) { + return (offset == 0) ? null : node.childNodes[offset - 1]; + } + // In any other case, we have a regular node. If the cursor is + // at the end of the node, we use the node itself, if it is at + // the start, we use the node before it, and in any other + // case, we look up the child before the cursor and use that. + else { + if (offset == node.childNodes.length) + return topLevelNodeAt(node, container); + else if (offset == 0) + return topLevelNodeBefore(node, container); + else + return topLevelNodeAt(node.childNodes[offset - 1], container); + } + }; + + select.focusAfterNode = function(node, container) { + var win = container.ownerDocument.defaultView, + range = win.document.createRange(); + range.setStartBefore(container.firstChild || container); + // In Opera, setting the end of a range at the end of a line + // (before a BR) will cause the cursor to appear on the next + // line, so we set the end inside of the start node when + // possible. + if (node && !node.firstChild) + range.setEndAfter(node); + else if (node) + range.setEnd(node, node.childNodes.length); + else + range.setEndBefore(container.firstChild || container); + range.collapse(false); + selectRange(range, win); + }; + + select.somethingSelected = function(win) { + var range = selectionRange(win); + return range && !range.collapsed; + }; + + function insertNodeAtCursor(window, node) { + var range = selectionRange(window); + if (!range) return; + + range.deleteContents(); + range.insertNode(node); + webkitLastLineHack(window.document.body); + range = window.document.createRange(); + range.selectNode(node); + range.collapse(false); + selectRange(range, window); + } + + select.insertNewlineAtCursor = function(window) { + insertNodeAtCursor(window, window.document.createElement("BR")); + }; + + select.insertTabAtCursor = function(window) { + insertNodeAtCursor(window, window.document.createTextNode(fourSpaces)); + }; + + select.cursorPos = function(container, start) { + var range = selectionRange(window); + if (!range) return; + + var topNode = select.selectionTopNode(container, start); + while (topNode && topNode.nodeName != "BR") + topNode = topNode.previousSibling; + + range = range.cloneRange(); + range.collapse(start); + if (topNode) + range.setStartAfter(topNode); + else + range.setStartBefore(container); + return {node: topNode, offset: range.toString().length}; + }; + + select.setCursorPos = function(container, from, to) { + var win = container.ownerDocument.defaultView, + range = win.document.createRange(); + + function setPoint(node, offset, side) { + if (!node) + node = container.firstChild; + else + node = node.nextSibling; + + if (!node) + return; + + if (offset == 0) { + range["set" + side + "Before"](node); + return true; + } + + var backlog = [] + function decompose(node) { + if (node.nodeType == 3) + backlog.push(node); + else + forEach(node.childNodes, decompose); + } + while (true) { + while (node && !backlog.length) { + decompose(node); + node = node.nextSibling; + } + var cur = backlog.shift(); + if (!cur) return false; + + var length = cur.nodeValue.length; + if (length >= offset) { + range["set" + side](cur, offset); + return true; + } + offset -= length; + } + } + + to = to || from; + if (setPoint(to.node, to.offset, "End") && setPoint(from.node, from.offset, "Start")) + selectRange(range, win); + }; + } +})(); diff --git a/redakcja/static/js/lib/codemirror/stringstream.js b/redakcja/static/js/lib/codemirror/stringstream.js new file mode 100644 index 00000000..8c1c0422 --- /dev/null +++ b/redakcja/static/js/lib/codemirror/stringstream.js @@ -0,0 +1,140 @@ +/* String streams are the things fed to parsers (which can feed them + * to a tokenizer if they want). They provide peek and next methods + * for looking at the current character (next 'consumes' this + * character, peek does not), and a get method for retrieving all the + * text that was consumed since the last time get was called. + * + * An easy mistake to make is to let a StopIteration exception finish + * the token stream while there are still characters pending in the + * string stream (hitting the end of the buffer while parsing a + * token). To make it easier to detect such errors, the stringstreams + * throw an exception when this happens. + */ + +// Make a stringstream stream out of an iterator that returns strings. +// This is applied to the result of traverseDOM (see codemirror.js), +// and the resulting stream is fed to the parser. +window.stringStream = function(source){ + // String that's currently being iterated over. + var current = ""; + // Position in that string. + var pos = 0; + // Accumulator for strings that have been iterated over but not + // get()-ed yet. + var accum = ""; + // Make sure there are more characters ready, or throw + // StopIteration. + function ensureChars() { + while (pos == current.length) { + accum += current; + current = ""; // In case source.next() throws + pos = 0; + try {current = source.next();} + catch (e) { + if (e != StopIteration) throw e; + else return false; + } + } + return true; + } + + return { + // Return the next character in the stream. + peek: function() { + if (!ensureChars()) return null; + return current.charAt(pos); + }, + // Get the next character, throw StopIteration if at end, check + // for unused content. + next: function() { + if (!ensureChars()) { + if (accum.length > 0) + throw "End of stringstream reached without emptying buffer ('" + accum + "')."; + else + throw StopIteration; + } + return current.charAt(pos++); + }, + // Return the characters iterated over since the last call to + // .get(). + get: function() { + var temp = accum; + accum = ""; + if (pos > 0){ + temp += current.slice(0, pos); + current = current.slice(pos); + pos = 0; + } + return temp; + }, + // Push a string back into the stream. + push: function(str) { + current = current.slice(0, pos) + str + current.slice(pos); + }, + lookAhead: function(str, consume, skipSpaces, caseInsensitive) { + function cased(str) {return caseInsensitive ? str.toLowerCase() : str;} + str = cased(str); + var found = false; + + var _accum = accum, _pos = pos; + if (skipSpaces) this.nextWhileMatches(/[\s\u00a0]/); + + while (true) { + var end = pos + str.length, left = current.length - pos; + if (end <= current.length) { + found = str == cased(current.slice(pos, end)); + pos = end; + break; + } + else if (str.slice(0, left) == cased(current.slice(pos))) { + accum += current; current = ""; + try {current = source.next();} + catch (e) {break;} + pos = 0; + str = str.slice(left); + } + else { + break; + } + } + + if (!(found && consume)) { + current = accum.slice(_accum.length) + current; + pos = _pos; + accum = _accum; + } + + return found; + }, + + // Utils built on top of the above + more: function() { + return this.peek() !== null; + }, + applies: function(test) { + var next = this.peek(); + return (next !== null && test(next)); + }, + nextWhile: function(test) { + var next; + while ((next = this.peek()) !== null && test(next)) + this.next(); + }, + matches: function(re) { + var next = this.peek(); + return (next !== null && re.test(next)); + }, + nextWhileMatches: function(re) { + var next; + while ((next = this.peek()) !== null && re.test(next)) + this.next(); + }, + equals: function(ch) { + return ch === this.peek(); + }, + endOfLine: function() { + var next = this.peek(); + return next == null || next == "\n"; + } + }; +}; diff --git a/redakcja/static/js/lib/codemirror/tokenize.js b/redakcja/static/js/lib/codemirror/tokenize.js new file mode 100644 index 00000000..b0c9545f --- /dev/null +++ b/redakcja/static/js/lib/codemirror/tokenize.js @@ -0,0 +1,57 @@ +// A framework for simple tokenizers. Takes care of newlines and +// white-space, and of getting the text from the source stream into +// the token object. A state is a function of two arguments -- a +// string stream and a setState function. The second can be used to +// change the tokenizer's state, and can be ignored for stateless +// tokenizers. This function should advance the stream over a token +// and return a string or object containing information about the next +// token, or null to pass and have the (new) state be called to finish +// the token. When a string is given, it is wrapped in a {style, type} +// object. In the resulting object, the characters consumed are stored +// under the content property. Any whitespace following them is also +// automatically consumed, and added to the value property. (Thus, +// content is the actual meaningful part of the token, while value +// contains all the text it spans.) + +function tokenizer(source, state) { + // Newlines are always a separate token. + function isWhiteSpace(ch) { + // The messy regexp is because IE's regexp matcher is of the + // opinion that non-breaking spaces are no whitespace. + return ch != "\n" && /^[\s\u00a0]*$/.test(ch); + } + + var tokenizer = { + state: state, + + take: function(type) { + if (typeof(type) == "string") + type = {style: type, type: type}; + + type.content = (type.content || "") + source.get(); + if (!/\n$/.test(type.content)) + source.nextWhile(isWhiteSpace); + type.value = type.content + source.get(); + return type; + }, + + next: function () { + if (!source.more()) throw StopIteration; + + var type; + if (source.equals("\n")) { + source.next(); + return this.take("whitespace"); + } + + if (source.applies(isWhiteSpace)) + type = "whitespace"; + else + while (!type) + type = this.state(source, function(s) {tokenizer.state = s;}); + + return this.take(type); + } + }; + return tokenizer; +} diff --git a/redakcja/static/js/lib/codemirror/undo.js b/redakcja/static/js/lib/codemirror/undo.js new file mode 100644 index 00000000..5f717a9e --- /dev/null +++ b/redakcja/static/js/lib/codemirror/undo.js @@ -0,0 +1,403 @@ +/** + * Storage and control for undo information within a CodeMirror + * editor. 'Why on earth is such a complicated mess required for + * that?', I hear you ask. The goal, in implementing this, was to make + * the complexity of storing and reverting undo information depend + * only on the size of the edited or restored content, not on the size + * of the whole document. This makes it necessary to use a kind of + * 'diff' system, which, when applied to a DOM tree, causes some + * complexity and hackery. + * + * In short, the editor 'touches' BR elements as it parses them, and + * the History stores these. When nothing is touched in commitDelay + * milliseconds, the changes are committed: It goes over all touched + * nodes, throws out the ones that did not change since last commit or + * are no longer in the document, and assembles the rest into zero or + * more 'chains' -- arrays of adjacent lines. Links back to these + * chains are added to the BR nodes, while the chain that previously + * spanned these nodes is added to the undo history. Undoing a change + * means taking such a chain off the undo history, restoring its + * content (text is saved per line) and linking it back into the + * document. + */ + +// A history object needs to know about the DOM container holding the +// document, the maximum amount of undo levels it should store, the +// delay (of no input) after which it commits a set of changes, and, +// unfortunately, the 'parent' window -- a window that is not in +// designMode, and on which setTimeout works in every browser. +function History(container, maxDepth, commitDelay, editor, onChange) { + this.container = container; + this.maxDepth = maxDepth; this.commitDelay = commitDelay; + this.editor = editor; this.parent = editor.parent; + this.onChange = onChange; + // This line object represents the initial, empty editor. + var initial = {text: "", from: null, to: null}; + // As the borders between lines are represented by BR elements, the + // start of the first line and the end of the last one are + // represented by null. Since you can not store any properties + // (links to line objects) in null, these properties are used in + // those cases. + this.first = initial; this.last = initial; + // Similarly, a 'historyTouched' property is added to the BR in + // front of lines that have already been touched, and 'firstTouched' + // is used for the first line. + this.firstTouched = false; + // History is the set of committed changes, touched is the set of + // nodes touched since the last commit. + this.history = []; this.redoHistory = []; this.touched = []; +} + +History.prototype = { + // Schedule a commit (if no other touches come in for commitDelay + // milliseconds). + scheduleCommit: function() { + var self = this; + this.parent.clearTimeout(this.commitTimeout); + this.commitTimeout = this.parent.setTimeout(function(){self.tryCommit();}, this.commitDelay); + }, + + // Mark a node as touched. Null is a valid argument. + touch: function(node) { + this.setTouched(node); + this.scheduleCommit(); + }, + + // Undo the last change. + undo: function() { + // Make sure pending changes have been committed. + this.commit(); + + if (this.history.length) { + // Take the top diff from the history, apply it, and store its + // shadow in the redo history. + var item = this.history.pop(); + this.redoHistory.push(this.updateTo(item, "applyChain")); + if (this.onChange) this.onChange(); + return this.chainNode(item); + } + }, + + // Redo the last undone change. + redo: function() { + this.commit(); + if (this.redoHistory.length) { + // The inverse of undo, basically. + var item = this.redoHistory.pop(); + this.addUndoLevel(this.updateTo(item, "applyChain")); + if (this.onChange) this.onChange(); + return this.chainNode(item); + } + }, + + clear: function() { + this.history = []; + this.redoHistory = []; + }, + + // Ask for the size of the un/redo histories. + historySize: function() { + return {undo: this.history.length, redo: this.redoHistory.length}; + }, + + // Push a changeset into the document. + push: function(from, to, lines) { + var chain = []; + for (var i = 0; i < lines.length; i++) { + var end = (i == lines.length - 1) ? to : this.container.ownerDocument.createElement("BR"); + chain.push({from: from, to: end, text: cleanText(lines[i])}); + from = end; + } + this.pushChains([chain], from == null && to == null); + }, + + pushChains: function(chains, doNotHighlight) { + this.commit(doNotHighlight); + this.addUndoLevel(this.updateTo(chains, "applyChain")); + this.redoHistory = []; + }, + + // Retrieve a DOM node from a chain (for scrolling to it after undo/redo). + chainNode: function(chains) { + for (var i = 0; i < chains.length; i++) { + var start = chains[i][0], node = start && (start.from || start.to); + if (node) return node; + } + }, + + // Clear the undo history, make the current document the start + // position. + reset: function() { + this.history = []; this.redoHistory = []; + }, + + textAfter: function(br) { + return this.after(br).text; + }, + + nodeAfter: function(br) { + return this.after(br).to; + }, + + nodeBefore: function(br) { + return this.before(br).from; + }, + + // Commit unless there are pending dirty nodes. + tryCommit: function() { + if (!window.History) return; // Stop when frame has been unloaded + if (this.editor.highlightDirty()) this.commit(true); + else this.scheduleCommit(); + }, + + // Check whether the touched nodes hold any changes, if so, commit + // them. + commit: function(doNotHighlight) { + this.parent.clearTimeout(this.commitTimeout); + // Make sure there are no pending dirty nodes. + if (!doNotHighlight) this.editor.highlightDirty(true); + // Build set of chains. + var chains = this.touchedChains(), self = this; + + if (chains.length) { + this.addUndoLevel(this.updateTo(chains, "linkChain")); + this.redoHistory = []; + if (this.onChange) this.onChange(); + } + }, + + // [ end of public interface ] + + // Update the document with a given set of chains, return its + // shadow. updateFunc should be "applyChain" or "linkChain". In the + // second case, the chains are taken to correspond the the current + // document, and only the state of the line data is updated. In the + // first case, the content of the chains is also pushed iinto the + // document. + updateTo: function(chains, updateFunc) { + var shadows = [], dirty = []; + for (var i = 0; i < chains.length; i++) { + shadows.push(this.shadowChain(chains[i])); + dirty.push(this[updateFunc](chains[i])); + } + if (updateFunc == "applyChain") + this.notifyDirty(dirty); + return shadows; + }, + + // Notify the editor that some nodes have changed. + notifyDirty: function(nodes) { + forEach(nodes, method(this.editor, "addDirtyNode")) + this.editor.scheduleHighlight(); + }, + + // Link a chain into the DOM nodes (or the first/last links for null + // nodes). + linkChain: function(chain) { + for (var i = 0; i < chain.length; i++) { + var line = chain[i]; + if (line.from) line.from.historyAfter = line; + else this.first = line; + if (line.to) line.to.historyBefore = line; + else this.last = line; + } + }, + + // Get the line object after/before a given node. + after: function(node) { + return node ? node.historyAfter : this.first; + }, + before: function(node) { + return node ? node.historyBefore : this.last; + }, + + // Mark a node as touched if it has not already been marked. + setTouched: function(node) { + if (node) { + if (!node.historyTouched) { + this.touched.push(node); + node.historyTouched = true; + } + } + else { + this.firstTouched = true; + } + }, + + // Store a new set of undo info, throw away info if there is more of + // it than allowed. + addUndoLevel: function(diffs) { + this.history.push(diffs); + if (this.history.length > this.maxDepth) + this.history.shift(); + }, + + // Build chains from a set of touched nodes. + touchedChains: function() { + var self = this; + + // The temp system is a crummy hack to speed up determining + // whether a (currently touched) node has a line object associated + // with it. nullTemp is used to store the object for the first + // line, other nodes get it stored in their historyTemp property. + var nullTemp = null; + function temp(node) {return node ? node.historyTemp : nullTemp;} + function setTemp(node, line) { + if (node) node.historyTemp = line; + else nullTemp = line; + } + + function buildLine(node) { + var text = []; + for (var cur = node ? node.nextSibling : self.container.firstChild; + cur && cur.nodeName != "BR"; cur = cur.nextSibling) + if (cur.currentText) text.push(cur.currentText); + return {from: node, to: cur, text: cleanText(text.join(""))}; + } + + // Filter out unchanged lines and nodes that are no longer in the + // document. Build up line objects for remaining nodes. + var lines = []; + if (self.firstTouched) self.touched.push(null); + forEach(self.touched, function(node) { + if (node && node.parentNode != self.container) return; + + if (node) node.historyTouched = false; + else self.firstTouched = false; + + var line = buildLine(node), shadow = self.after(node); + if (!shadow || shadow.text != line.text || shadow.to != line.to) { + lines.push(line); + setTemp(node, line); + } + }); + + // Get the BR element after/before the given node. + function nextBR(node, dir) { + var link = dir + "Sibling", search = node[link]; + while (search && search.nodeName != "BR") + search = search[link]; + return search; + } + + // Assemble line objects into chains by scanning the DOM tree + // around them. + var chains = []; self.touched = []; + forEach(lines, function(line) { + // Note that this makes the loop skip line objects that have + // been pulled into chains by lines before them. + if (!temp(line.from)) return; + + var chain = [], curNode = line.from, safe = true; + // Put any line objects (referred to by temp info) before this + // one on the front of the array. + while (true) { + var curLine = temp(curNode); + if (!curLine) { + if (safe) break; + else curLine = buildLine(curNode); + } + chain.unshift(curLine); + setTemp(curNode, null); + if (!curNode) break; + safe = self.after(curNode); + curNode = nextBR(curNode, "previous"); + } + curNode = line.to; safe = self.before(line.from); + // Add lines after this one at end of array. + while (true) { + if (!curNode) break; + var curLine = temp(curNode); + if (!curLine) { + if (safe) break; + else curLine = buildLine(curNode); + } + chain.push(curLine); + setTemp(curNode, null); + safe = self.before(curNode); + curNode = nextBR(curNode, "next"); + } + chains.push(chain); + }); + + return chains; + }, + + // Find the 'shadow' of a given chain by following the links in the + // DOM nodes at its start and end. + shadowChain: function(chain) { + var shadows = [], next = this.after(chain[0].from), end = chain[chain.length - 1].to; + while (true) { + shadows.push(next); + var nextNode = next.to; + if (!nextNode || nextNode == end) + break; + else + next = nextNode.historyAfter || this.before(end); + // (The this.before(end) is a hack -- FF sometimes removes + // properties from BR nodes, in which case the best we can hope + // for is to not break.) + } + return shadows; + }, + + // Update the DOM tree to contain the lines specified in a given + // chain, link this chain into the DOM nodes. + applyChain: function(chain) { + // Some attempt is made to prevent the cursor from jumping + // randomly when an undo or redo happens. It still behaves a bit + // strange sometimes. + var cursor = select.cursorPos(this.container, false), self = this; + + // Remove all nodes in the DOM tree between from and to (null for + // start/end of container). + function removeRange(from, to) { + var pos = from ? from.nextSibling : self.container.firstChild; + while (pos != to) { + var temp = pos.nextSibling; + removeElement(pos); + pos = temp; + } + } + + var start = chain[0].from, end = chain[chain.length - 1].to; + // Clear the space where this change has to be made. + removeRange(start, end); + + // Insert the content specified by the chain into the DOM tree. + for (var i = 0; i < chain.length; i++) { + var line = chain[i]; + // The start and end of the space are already correct, but BR + // tags inside it have to be put back. + if (i > 0) + self.container.insertBefore(line.from, end); + + // Add the text. + var node = makePartSpan(fixSpaces(line.text), this.container.ownerDocument); + self.container.insertBefore(node, end); + // See if the cursor was on this line. Put it back, adjusting + // for changed line length, if it was. + if (cursor && cursor.node == line.from) { + var cursordiff = 0; + var prev = this.after(line.from); + if (prev && i == chain.length - 1) { + // Only adjust if the cursor is after the unchanged part of + // the line. + for (var match = 0; match < cursor.offset && + line.text.charAt(match) == prev.text.charAt(match); match++); + if (cursor.offset > match) + cursordiff = line.text.length - prev.text.length; + } + select.setCursorPos(this.container, {node: line.from, offset: Math.max(0, cursor.offset + cursordiff)}); + } + // Cursor was in removed line, this is last new line. + else if (cursor && (i == chain.length - 1) && cursor.node && cursor.node.parentNode != this.container) { + select.setCursorPos(this.container, {node: line.from, offset: line.text.length}); + } + } + + // Anchor the chain in the DOM tree. + this.linkChain(chain); + return start; + } +}; diff --git a/redakcja/static/js/lib/codemirror/util.js b/redakcja/static/js/lib/codemirror/util.js new file mode 100644 index 00000000..796025ee --- /dev/null +++ b/redakcja/static/js/lib/codemirror/util.js @@ -0,0 +1,125 @@ +/* A few useful utility functions. */ + +var internetExplorer = document.selection && window.ActiveXObject && /MSIE/.test(navigator.userAgent); +var webkit = /AppleWebKit/.test(navigator.userAgent); +var safari = /Apple Computers, Inc/.test(navigator.vendor); + +// Capture a method on an object. +function method(obj, name) { + return function() {obj[name].apply(obj, arguments);}; +} + +// The value used to signal the end of a sequence in iterators. +var StopIteration = {toString: function() {return "StopIteration"}}; + +// Apply a function to each element in a sequence. +function forEach(iter, f) { + if (iter.next) { + try {while (true) f(iter.next());} + catch (e) {if (e != StopIteration) throw e;} + } + else { + for (var i = 0; i < iter.length; i++) + f(iter[i]); + } +} + +// Map a function over a sequence, producing an array of results. +function map(iter, f) { + var accum = []; + forEach(iter, function(val) {accum.push(f(val));}); + return accum; +} + +// Create a predicate function that tests a string againsts a given +// regular expression. No longer used but might be used by 3rd party +// parsers. +function matcher(regexp){ + return function(value){return regexp.test(value);}; +} + +// Test whether a DOM node has a certain CSS class. Much faster than +// the MochiKit equivalent, for some reason. +function hasClass(element, className){ + var classes = element.className; + return classes && new RegExp("(^| )" + className + "($| )").test(classes); +} + +// Insert a DOM node after another node. +function insertAfter(newNode, oldNode) { + var parent = oldNode.parentNode; + parent.insertBefore(newNode, oldNode.nextSibling); + return newNode; +} + +function removeElement(node) { + if (node.parentNode) + node.parentNode.removeChild(node); +} + +function clearElement(node) { + while (node.firstChild) + node.removeChild(node.firstChild); +} + +// Check whether a node is contained in another one. +function isAncestor(node, child) { + while (child = child.parentNode) { + if (node == child) + return true; + } + return false; +} + +// The non-breaking space character. +var nbsp = "\u00a0"; +var matching = {"{": "}", "[": "]", "(": ")", + "}": "{", "]": "[", ")": "("}; + +// Standardize a few unportable event properties. +function normalizeEvent(event) { + if (!event.stopPropagation) { + event.stopPropagation = function() {this.cancelBubble = true;}; + event.preventDefault = function() {this.returnValue = false;}; + } + if (!event.stop) { + event.stop = function() { + this.stopPropagation(); + this.preventDefault(); + }; + } + + if (event.type == "keypress") { + event.code = (event.charCode == null) ? event.keyCode : event.charCode; + event.character = String.fromCharCode(event.code); + } + return event; +} + +// Portably register event handlers. +function addEventHandler(node, type, handler, removeFunc) { + function wrapHandler(event) { + handler(normalizeEvent(event || window.event)); + } + if (typeof node.addEventListener == "function") { + node.addEventListener(type, wrapHandler, false); + if (removeFunc) return function() {node.removeEventListener(type, wrapHandler, false);}; + } + else { + node.attachEvent("on" + type, wrapHandler); + if (removeFunc) return function() {node.detachEvent("on" + type, wrapHandler);}; + } +} + +function nodeText(node) { + return node.textContent || node.innerText || node.nodeValue || ""; +} + +function nodeTop(node) { + var top = 0; + while (node.offsetParent) { + top += node.offsetTop; + node = node.offsetParent; + } + return top; +} diff --git a/redakcja/static/js/slugify.js b/redakcja/static/js/slugify.js new file mode 100644 index 00000000..9e17ba70 --- /dev/null +++ b/redakcja/static/js/slugify.js @@ -0,0 +1,126 @@ +(function() { + var ALL_DOWNCODE_MAPS = new Array() + + ALL_DOWNCODE_MAPS[0] = { + // LATIN_MAP + 'À': 'A', 'Á': 'A', 'Â': 'A', 'Ã': 'A', 'Ä': 'A', 'Å': 'A', 'Æ': 'AE', 'Ç': + 'C', 'È': 'E', 'É': 'E', 'Ê': 'E', 'Ë': 'E', 'Ì': 'I', 'Í': 'I', 'Î': 'I', + 'Ï': 'I', 'Ð': 'D', 'Ñ': 'N', 'Ò': 'O', 'Ó': 'O', 'Ô': 'O', 'Õ': 'O', 'Ö': + 'O', 'Ő': 'O', 'Ø': 'O', 'Ù': 'U', 'Ú': 'U', 'Û': 'U', 'Ü': 'U', 'Ű': 'U', + 'Ý': 'Y', 'Þ': 'TH', 'ß': 'ss', 'à':'a', 'á':'a', 'â': 'a', 'ã': 'a', 'ä': + 'a', 'å': 'a', 'æ': 'ae', 'ç': 'c', 'è': 'e', 'é': 'e', 'ê': 'e', 'ë': 'e', + 'ì': 'i', 'í': 'i', 'î': 'i', 'ï': 'i', 'ð': 'd', 'ñ': 'n', 'ò': 'o', 'ó': + 'o', 'ô': 'o', 'õ': 'o', 'ö': 'o', 'ő': 'o', 'ø': 'o', 'ù': 'u', 'ú': 'u', + 'û': 'u', 'ü': 'u', 'ű': 'u', 'ý': 'y', 'þ': 'th', 'ÿ': 'y' + } + ALL_DOWNCODE_MAPS[1] = { + // LATIN_SYMBOLS_MAP + '©':'(c)' + } + ALL_DOWNCODE_MAPS[2] = { + // GREEK_MAP + 'α':'a', 'β':'b', 'γ':'g', 'δ':'d', 'ε':'e', 'ζ':'z', 'η':'h', 'θ':'8', + 'ι':'i', 'κ':'k', 'λ':'l', 'μ':'m', 'ν':'n', 'ξ':'3', 'ο':'o', 'π':'p', + 'ρ':'r', 'σ':'s', 'τ':'t', 'υ':'y', 'φ':'f', 'χ':'x', 'ψ':'ps', 'ω':'w', + 'ά':'a', 'έ':'e', 'ί':'i', 'ό':'o', 'ύ':'y', 'ή':'h', 'ώ':'w', 'ς':'s', + 'ϊ':'i', 'ΰ':'y', 'ϋ':'y', 'ΐ':'i', + 'Α':'A', 'Β':'B', 'Γ':'G', 'Δ':'D', 'Ε':'E', 'Ζ':'Z', 'Η':'H', 'Θ':'8', + 'Ι':'I', 'Κ':'K', 'Λ':'L', 'Μ':'M', 'Ν':'N', 'Ξ':'3', 'Ο':'O', 'Π':'P', + 'Ρ':'R', 'Σ':'S', 'Τ':'T', 'Υ':'Y', 'Φ':'F', 'Χ':'X', 'Ψ':'PS', 'Ω':'W', + 'Ά':'A', 'Έ':'E', 'Ί':'I', 'Ό':'O', 'Ύ':'Y', 'Ή':'H', 'Ώ':'W', 'Ϊ':'I', + 'Ϋ':'Y' + } + ALL_DOWNCODE_MAPS[3] = { + // TURKISH_MAP + 'ş':'s', 'Ş':'S', 'ı':'i', 'İ':'I', 'ç':'c', 'Ç':'C', 'ü':'u', 'Ü':'U', + 'ö':'o', 'Ö':'O', 'ğ':'g', 'Ğ':'G' + } + ALL_DOWNCODE_MAPS[4] = { + // RUSSIAN_MAP + 'а':'a', 'б':'b', 'в':'v', 'г':'g', 'д':'d', 'е':'e', 'ё':'yo', 'ж':'zh', + 'з':'z', 'и':'i', 'й':'j', 'к':'k', 'л':'l', 'м':'m', 'н':'n', 'о':'o', + 'п':'p', 'р':'r', 'с':'s', 'т':'t', 'у':'u', 'ф':'f', 'х':'h', 'ц':'c', + 'ч':'ch', 'ш':'sh', 'щ':'sh', 'ъ':'', 'ы':'y', 'ь':'', 'э':'e', 'ю':'yu', + 'я':'ya', + 'А':'A', 'Б':'B', 'В':'V', 'Г':'G', 'Д':'D', 'Е':'E', 'Ё':'Yo', 'Ж':'Zh', + 'З':'Z', 'И':'I', 'Й':'J', 'К':'K', 'Л':'L', 'М':'M', 'Н':'N', 'О':'O', + 'П':'P', 'Р':'R', 'С':'S', 'Т':'T', 'У':'U', 'Ф':'F', 'Х':'H', 'Ц':'C', + 'Ч':'Ch', 'Ш':'Sh', 'Щ':'Sh', 'Ъ':'', 'Ы':'Y', 'Ь':'', 'Э':'E', 'Ю':'Yu', + 'Я':'Ya' + } + ALL_DOWNCODE_MAPS[5] = { + // UKRAINIAN_MAP + 'Є':'Ye', 'І':'I', 'Ї':'Yi', 'Ґ':'G', 'є':'ye', 'і':'i', 'ї':'yi', 'ґ':'g' + } + ALL_DOWNCODE_MAPS[6] = { + // CZECH_MAP + 'č':'c', 'ď':'d', 'ě':'e', 'ň': 'n', 'ř':'r', 'š':'s', 'ť':'t', 'ů':'u', + 'ž':'z', 'Č':'C', 'Ď':'D', 'Ě':'E', 'Ň': 'N', 'Ř':'R', 'Š':'S', 'Ť':'T', + 'Ů':'U', 'Ž':'Z' + } + + ALL_DOWNCODE_MAPS[7] = { + // POLISH_MAP + 'ą':'a', 'ć':'c', 'ę':'e', 'ł':'l', 'ń':'n', 'ó':'o', 'ś':'s', 'ź':'z', + 'ż':'z', 'Ą':'A', 'Ć':'C', 'Ę':'e', 'Ł':'L', 'Ń':'N', 'Ó':'o', 'Ś':'S', + 'Ź':'Z', 'Ż':'Z' + } + + ALL_DOWNCODE_MAPS[8] = { + // LATVIAN_MAP + 'ā':'a', 'č':'c', 'ē':'e', 'ģ':'g', 'ī':'i', 'ķ':'k', 'ļ':'l', 'ņ':'n', + 'š':'s', 'ū':'u', 'ž':'z', 'Ā':'A', 'Č':'C', 'Ē':'E', 'Ģ':'G', 'Ī':'i', + 'Ķ':'k', 'Ļ':'L', 'Ņ':'N', 'Š':'S', 'Ū':'u', 'Ž':'Z' + } + + var Downcoder = new Object(); + + Downcoder.Initialize = function() { + if (Downcoder.map) // already made + return ; + Downcoder.map ={} + Downcoder.chars = ''; + for(var i in ALL_DOWNCODE_MAPS) { + var lookup = ALL_DOWNCODE_MAPS[i] + for (var c in lookup) { + Downcoder.map[c] = lookup[c]; + Downcoder.chars += c; + } + } + Downcoder.regex = new RegExp('[' + Downcoder.chars + ']|[^' + Downcoder.chars + ']+','g'); + } + + downcode = function(slug) { + Downcoder.Initialize(); + var downcoded ="" + var pieces = slug.match(Downcoder.regex); + if(pieces) { + for (var i = 0 ; i < pieces.length ; i++) { + if (pieces[i].length == 1) { + var mapped = Downcoder.map[pieces[i]]; + if (mapped != null) { + downcoded+=mapped; + continue; + } + } + downcoded+=pieces[i]; + } + } else { + downcoded = slug; + } + return downcoded; + } + + slugify = function(s) { + s = downcode(s); + // if downcode doesn't hit, the char will be stripped here + s = s.replace(/[^-\w\s]/g, ''); // remove unneeded chars + s = s.replace(/^\s+|\s+$/g, ''); // trim leading/trailing spaces + s = s.replace(/[-\s]+/g, '-'); // convert spaces to hyphens + s = s.toLowerCase(); // convert to lowercase + + return s; + } +})(); + + diff --git a/redakcja/static/js/wiki/base.js b/redakcja/static/js/wiki/base.js new file mode 100644 index 00000000..523ad96e --- /dev/null +++ b/redakcja/static/js/wiki/base.js @@ -0,0 +1,338 @@ +(function($) +{ + var noop = function() { }; + + $.wiki = { + perspectives: {}, + cls: {}, + state: { + "version": 1, + "perspectives": { + "ScanGalleryPerspective": { + "show": true, + "page": 1 + }, + "CodeMirrorPerspective": {} + /* + "VisualPerspective": {}, + "HistoryPerspective": {}, + "SummaryPerspective": {} + */ + } + } + }; + + $.wiki.loadConfig = function() { + if(!window.localStorage) + return; + + try { + var value = window.localStorage.getItem(CurrentDocument.id) || "{}"; + var config = JSON.parse(value); + + if (config.version == $.wiki.state.version) { + $.wiki.state.perspectives = $.extend($.wiki.state.perspectives, config.perspectives); + } + } catch(e) { + console.log("Failed to load config, using default."); + } + + console.log("Loaded:", $.wiki.state, $.wiki.state.version); + }; + + $(window).bind('unload', function() { + if(window.localStorage) + window.localStorage.setItem(CurrentDocument.id, JSON.stringify($.wiki.state)); + }) + + + $.wiki.activePerspective = function() { + return this.perspectives[$("#tabs li.active").attr('id')]; + }; + + $.wiki.exitContext = function() { + var ap = this.activePerspective(); + if(ap) ap.onExit(); + return ap; + }; + + $.wiki.enterContext = function(ap) { + if(ap) ap.onEnter(); + }; + + $.wiki.isDirty = function() { + var ap = this.activePerspective(); + return (!!CurrentDocument && CurrentDocument.has_local_changes) || ap.dirty(); + }; + + $.wiki.newTab = function(doc, title, klass) { + var base_id = 'id' + Math.floor(Math.random()* 5000000000); + var id = (''+klass)+'_' + base_id; + var $tab = $('
  • ' + + title + '
  • '); + var $view = $('
    '); + + this.perspectives[id] = new $.wiki[klass]({ + doc: doc, + id: id, + base_id: base_id, + }); + + $('#tabs').append($tab); + $view.hide().appendTo('#editor'); + return { + tab: $tab[0], + view: $view[0], + }; + }; + + $.wiki.initTab = function(options) { + var klass = $(options.tab).attr('data-ui-jsclass'); + + return new $.wiki[klass]({ + doc: options.doc, + id: $(options.tab).attr('id'), + callback: function() { + $.wiki.perspectives[this.perspective_id] = this; + if(options.callback) + options.callback.call(this); + } + }); + }; + + $.wiki.perspectiveForTab = function(tab) { // element or id + return this.perspectives[ $(tab).attr('id')]; + } + + $.wiki.switchToTab = function(tab){ + var self = this; + var $tab = $(tab); + + if($tab.length != 1) + $tab = $(DEFAULT_PERSPECTIVE); + + var $old = $('#tabs li').filter('.active'); + + $old.each(function(){ + $(this).removeClass('active'); + self.perspectives[$(this).attr('id')].onExit(); + $('#' + $(this).attr('data-ui-related')).hide(); + }); + + /* show new */ + $tab.addClass('active'); + $('#' + $tab.attr('data-ui-related')).show(); + + console.log($tab); + console.log($.wiki.perspectives); + + $.wiki.perspectives[$tab.attr('id')].onEnter(); + }; + + /* + * Basic perspective. + */ + $.wiki.Perspective = function(options) { + if(!options) return; + + this.doc = options.doc; + if (options.id) { + this.perspective_id = options.id; + } + else { + this.perspective_id = ''; + } + + if(options.callback) + options.callback.call(this); + }; + + $.wiki.Perspective.prototype.config = function() { + return $.wiki.state.perspectives[this.perspective_id]; + } + + $.wiki.Perspective.prototype.toString = function() { + return this.perspective_id; + }; + + $.wiki.Perspective.prototype.dirty = function() { + return true; + }; + + $.wiki.Perspective.prototype.onEnter = function () { + // called when perspective in initialized + if (!this.noupdate_hash_onenter) { + document.location.hash = '#' + this.perspective_id; + } + }; + + $.wiki.Perspective.prototype.onExit = function () { + // called when user switches to another perspective + if (!this.noupdate_hash_onenter) { + document.location.hash = ''; + } + }; + + $.wiki.Perspective.prototype.destroy = function() { + // pass + }; + + $.wiki.Perspective.prototype.freezeState = function () { + // free UI state (don't store data here) + }; + + $.wiki.Perspective.prototype.unfreezeState = function (frozenState) { + // restore UI state + }; + + /* + * Stub rendering (used in generating history) + */ + $.wiki.renderStub = function(params) + { + params = $.extend({ 'filters': {} }, params); + var $elem = params.stub.clone(); + $elem.removeClass('row-stub'); + params.container.append($elem); + + $('*[data-stub-value]', $elem).each(function() { + var $this = $(this); + var field = $this.attr('data-stub-value'); + + var value = params.data[field]; + + if(params.filters[field]) + value = params.filters[field](value); + + if(value === null || value === undefined) return; + + if(!$this.attr('data-stub-target')) { + $this.text(value); + } + else { + $this.attr($this.attr('data-stub-target'), value); + $this.removeAttr('data-stub-target'); + $this.removeAttr('data-stub-value'); + } + }); + + $elem.show(); + return $elem; + }; + + /* + * Dialogs + */ + function GenericDialog(element) { + if(!element) return; + + var self = this; + + self.$elem = $(element); + + if(!self.$elem.attr('data-ui-initialized')) { + console.log("Initializing dialog", this); + self.initialize(); + self.$elem.attr('data-ui-initialized', true); + } + + self.show(); + }; + + GenericDialog.prototype = { + + /* + * Steps to follow when the dialog in first loaded on page. + */ + initialize: function(){ + var self = this; + + /* bind buttons */ + $('button[data-ui-action]', self.$elem).click(function(event) { + event.preventDefault(); + + var action = $(this).attr('data-ui-action'); + console.log("Button pressed, action: ", action); + + try { + self[action + "Action"].call(self); + } catch(e) { + console.log("Action failed:", e); + // always hide on cancel + if(action == 'cancel') + self.hide(); + } + }); + }, + + /* + * Prepare dialog for user. Clear any unnessary data. + */ + show: function() { + $.blockUI({ + message: this.$elem, + css: { + 'top': '25%', + 'left': '25%', + 'width': '50%' + } + }); + }, + + hide: function(){ + $.unblockUI(); + }, + + cancelAction: function() { + this.hide(); + }, + + doneAction: function() { + this.hide(); + }, + + clearForm: function() { + $("*[data-ui-error-for]", this.$elem).text(''); + }, + + reportErrors: function(errors) { + var global = $("*[data-ui-error-for='__all__']", this.$elem); + var unassigned = []; + + for (var field_name in errors) + { + var span = $("*[data-ui-error-for='"+field_name+"']", this.$elem); + + if(!span.length) { + unassigned.push(field_name); + continue; + } + + span.text(errors[field_name].join(' ')); + } + + if(unassigned.length > 0) + global.text( global.text() + 'W formularzu wystąpiły błędy'); + } + }; + + $.wiki.cls.GenericDialog = GenericDialog; + + $.wiki.showDialog = function(selector, options) { + var elem = $(selector); + + if(elem.length != 1) { + console.log("Failed to show dialog:", selector, elem); + return false; + } + + try { + var klass = elem.attr('data-ui-jsclass'); + return new $.wiki.cls[klass](elem, options); + } catch(e) { + console.log("Failed to show dialog", selector, klass, e); + return false; + } + }; + +})(jQuery); diff --git a/redakcja/static/js/wiki/dialog_addtag.js b/redakcja/static/js/wiki/dialog_addtag.js new file mode 100644 index 00000000..1a90ccf6 --- /dev/null +++ b/redakcja/static/js/wiki/dialog_addtag.js @@ -0,0 +1,61 @@ +/* + * Dialog for saving document to the server + * + */ +(function($){ + + function AddTagDialog(element, options){ + if (!options.revision && options.revision != 0) + throw "AddTagDialog needs a revision number."; + + this.ctx = $.wiki.exitContext(); + this.clearForm(); + + /* fill out hidden fields */ + this.$form = $('form', element); + + $("input[name='addtag-id']", this.$form).val(CurrentDocument.id); + $("input[name='addtag-revision']", this.$form).val(options.revision); + + $.wiki.cls.GenericDialog.call(this, element); + }; + + AddTagDialog.prototype = $.extend(new $.wiki.cls.GenericDialog(), { + cancelAction: function(){ + $.wiki.enterContext(this.ctx); + this.hide(); + }, + + saveAction: function(){ + var self = this; + + self.$elem.block({ + message: "Dodawanie tagu", + fadeIn: 0, + }); + + CurrentDocument.setTag({ + form: self.$form, + success: function(doc, changed, info){ + self.$elem.block({ + message: info, + timeout: 2000, + fadeOut: 0, + onUnblock: function(){ + self.hide(); + $.wiki.enterContext(self.ctx); + } + }); + }, + failure: function(doc, info){ + console.log("Failure", info); + self.reportErrors(info); + self.$elem.unblock(); + } + }); + } + }); + + /* make it global */ + $.wiki.cls.AddTagDialog = AddTagDialog; +})(jQuery); diff --git a/redakcja/static/js/wiki/dialog_save.js b/redakcja/static/js/wiki/dialog_save.js new file mode 100644 index 00000000..916f3260 --- /dev/null +++ b/redakcja/static/js/wiki/dialog_save.js @@ -0,0 +1,64 @@ +/* + * Dialog for saving document to the server + * + */ +(function($) { + + function SaveDialog(element) { + this.ctx = $.wiki.exitContext(); + this.clearForm(); + + /* fill out hidden fields */ + this.$form = $('form', element); + + $("input[name='textsave-id']", this.$form).val(CurrentDocument.id); + $("input[name='textsave-parent_revision']", this.$form).val(CurrentDocument.revision); + + $.wiki.cls.GenericDialog.call(this, element); + }; + + SaveDialog.prototype = new $.wiki.cls.GenericDialog(); + + SaveDialog.prototype.cancelAction = function() { + $.wiki.enterContext(this.ctx); + this.hide(); + }; + + SaveDialog.prototype.saveAction = function() { + var self = this; + + self.$elem.block({ + message: "Zapisywanie...", + fadeIn: 0, + }); + + try { + + CurrentDocument.save({ + form: self.$form, + success: function(doc, changed, info){ + self.$elem.block({ + message: info, + timeout: 2000, + fadeOut: 0, + onUnblock: function() { + self.hide(); + $.wiki.enterContext(self.ctx); + } + }); + }, + failure: function(doc, info) { + console.log("Failure", info); + self.reportErrors(info); + self.$elem.unblock(); + } + }); + } catch(e) { + console.log('Exception:', e) + self.$elem.unblock(); + } + }; /* end of save dialog */ + + /* make it global */ + $.wiki.cls.SaveDialog = SaveDialog; +})(jQuery); diff --git a/redakcja/static/js/wiki/loader.js b/redakcja/static/js/wiki/loader.js new file mode 100644 index 00000000..a4414027 --- /dev/null +++ b/redakcja/static/js/wiki/loader.js @@ -0,0 +1,146 @@ +if (!window.console) { + window.console = { + log: function(){ + } + } +} + +var DEFAULT_PERSPECTIVE = "#SummaryPerspective"; + +THEMES = [ + 'Alkohol', 'Ambicja', 'Anioł', 'Antysemityzm', 'Arkadia', 'Artysta', 'Bezdomność', 'Bezpieczeństwo', 'Bieda', 'Bijatyka', 'Błazen', 'Błądzenie', 'Błoto', 'Bogactwo', 'Bóg', 'Brat', 'Bunt', 'Buntownik', 'Burza', 'Car', 'Carpe diem', 'Ciemność', 'Cień', 'Cisza', 'Chciwość', 'Chleb', 'Chłop', 'Choroba', 'Chrystus', 'Chrzest', 'Ciało', 'Cierpienie', 'Cmentarz', 'Cnota', 'Córka', 'Cud', 'Czarownika', 'Czary', 'Czas', 'Czyn', 'Czyściec', 'Dama', 'Danse macabre', 'Deszcz', 'Diabeł', 'Dobro', 'Dom', 'Dorosłość', 'Drzewo', 'Duch', 'Dusza', 'Duma', 'Dworek', 'Dworzanin', 'Dwór', 'Dzieciństwo', 'Dziecko', 'Dziedzictwo', 'Dziewictwo', 'Dźwięk', 'Egzorcyzm', 'Elita', 'Emigrant', 'Fałsz', 'Filozof', 'Fircyk', 'Flirt', 'Głupiec', 'Głupota', 'Głód', 'Gospodarz', 'Gospodyni', 'Gość', 'Gotycyzm', 'Góra', 'Gra', 'Grób', 'Grzech', 'Grzeczność', 'Gwiazda', 'Handel', 'Hańba', 'Historia', 'Honor', 'Idealista', 'Imię', 'Interes', 'Jabłka', 'Jedzenie', 'Jesień', 'Kaleka', 'Kara', 'Karczma', 'Klęska', 'Kłamstwo', 'Kłótnia', 'Kobieta', 'Kobieta demoniczna', 'Kobieta "upadła"', 'Kochanek', 'Kochanek romantyczny', 'Kolonializm', 'Kondycja ludzka', 'Konflikt', 'Konflikt wewnętrzny', 'Koniec świata', 'Koń', 'Korzyść', 'Kot', 'Kradzież', 'Krew', 'Król', 'Krzywda', 'Ksiądz', 'Książka', 'Księżyc', 'Kuchnia', 'Kuszenie', 'Kwiaty', 'Labirynt', 'Las', 'Lato', 'Lekarz', 'Lenistwo', 'List', 'Liberat', 'Los', 'Lud', 'Lustro', 'Łzy', 'Małżeństwo', 'Marzenie', 'Maska', 'Maszyna', 'Matka', 'Matka Boska', 'Mądrość', 'Mąż', 'Melancholia', 'Mędrzec', 'Mężczyzna', 'Miasto', 'Mieszczanin', 'Miłosierdzie', 'Miłość', 'Miłość niespełniona', 'Miłość platoniczna', 'Miłość romantyczna', 'Miłość silniejsza niż śmierć', 'Miłość spełniona', 'Miłość tragiczna', 'Mizoginia', 'Młodość', 'Moda', 'Modlitwa', 'Morderstwo', 'Morze', 'Motyl', 'Mucha', 'Muzyka', 'Narodziny', 'Naród', 'Natura', 'Nauczyciel', 'Nauczycielka', 'Nauka', 'Niebezpieczeństwo', 'Niedziela', 'Niemiec', 'Nienawiść', 'Nieśmiertelność', 'Niewola', 'Noc', 'Nuda', 'Obcy', 'Obłok', 'Obowiązek', 'Obraz świata', 'Obrzędy', 'Obyczaje', 'Obywatel', 'Odrodzenie przez grób', 'Odwaga', 'Ofiara', 'Ogień', 'Ogród', 'Ojciec', 'Ojczyzna', 'Oko', 'Okręt', 'Okrucieństwo', 'Omen', 'Opieka', 'Organizm', 'Otchłań', 'Pająk', 'Pamięć', 'Pan', 'Panna młoda', 'Państwo', 'Patriota', 'Piekło', 'Pielgrzym', 'Pieniądz', 'Pies', 'Piętno', 'Pijaństwo', 'Piwnica', 'Plotka', 'Pobożność', 'Pocałunek', 'Pochlebstwo', 'Poeta', 'Poetka', 'Poezja', 'Podróż', 'Podstęp', 'Pogrzeb', 'Pojedynek', 'Pokora', 'Pokusa', 'Polak', 'Polityka', 'Polowanie', 'Polska', 'Portret', 'Porwanie', 'Poświęcenie', 'Potwór', 'Powstanie', 'Powstaniec', 'Pozory', 'Pozycja społeczna', 'Pożar', 'Pożądanie', 'Praca', 'Praca u podstaw', 'Praca organiczna', 'Prawda', 'Prawnik', 'Prometeusz', 'Proroctwo', 'Prorok', 'Próżność', 'Przebranie', 'Przeczucie', 'Przedmurze chrześcijaństwa', 'Przekleństwo', 'Przekupstwo', 'Przemiana', 'Przemijanie', 'Przemoc', 'Przestrzeń', 'Przyjaźń', 'Przyroda nieożywiona', 'Przysięga', 'Przywódca', 'Ptak', 'Pustynia', 'Pycha', 'Raj', 'Realista', 'Religia', 'Rewolucja', 'Robak', 'Robotnik', 'Rodzina', 'Rosja', 'Rosjanin', 'Rośliny', 'Rozczarowanie', 'Rozpacz', 'Rozstanie', 'Rozum', 'Ruiny', 'Rycerz', 'Rzeka', 'Salon', 'Samobójstwo', 'Samolubstwo', 'Samotnik', 'Samotność', 'Sarmata', 'Sąsiad', 'Sąd', 'Sąd Ostateczny', 'Sen', 'Serce', 'Sędzia', 'Sielanka', 'Sierota', 'Siła', 'Siostra', 'Sława', 'Słońce', 'Słowo', 'Sługa', 'Służalczość', 'Skąpiec', 'Sobowtór', 'Społecznik', 'Spowiedź', 'Sprawiedliwość', 'Starość', 'Strach', 'Strój', 'Stworzenie', 'Sumienie', 'Swaty', 'Syberia', 'Syn', 'Syn marnotrawny', 'Syzyf', 'Szaleniec', 'Szaleństwo', 'Szantaż', 'Szatan', 'Szczęście', 'Szkoła', 'Szlachcic', 'Szpieg', 'Sztuka', 'Ślub', 'Śmiech', 'Śmierć', 'Śmierć bohaterska', 'Śpiew', 'Światło', 'Świętoszek', 'Święty', 'Świt', 'Tajemnica', 'Taniec', 'Tchórzostwo', 'Teatr', 'Testament', 'Tęsknota', 'Theatrum mundi', 'Tłum', 'Trucizna', 'Trup', 'Twórczość', 'Uczeń', 'Uczta', 'Uroda', 'Umiarkowanie', 'Upadek', 'Upiór', 'Urzędnik', 'Vanitas', 'Walka', 'Walka klas', 'Wampir', 'Warszawa', 'Wąż', 'Wdowa', 'Wdowiec', 'Wesele', 'Wiatr', 'Wierność', 'Wierzenia', 'Wieś', 'Wiedza', 'Wieża Babel', 'Więzienie', 'Więzień', 'Wina', 'Wino', 'Wiosna', 'Wizja', 'Władza', 'Własność', 'Woda', 'Wojna', 'Wojna pokoleń', 'Wolność', 'Wróg', 'Wspomnienia', 'Współpraca', 'Wygnanie', 'Wyrzuty sumienia', 'Wyspa', 'Wzrok', 'Zabawa', 'Zabobony', 'Zamek', 'Zaręczyny', 'Zaświaty', 'Zazdrość', 'Zbawienie', 'Zbrodnia', 'Zbrodniarz', 'Zdrada', 'Zdrowie', 'Zemsta', 'Zesłaniec', 'Ziarno', 'Ziemia', 'Zima', 'Zło', 'Złodziej', 'Złoty wiek', 'Zmartwychwstanie', 'Zwątpienie', 'Zwierzęta', 'Zwycięstwo', 'Żałoba', 'Żebrak', 'Żołnierz', 'Żona', 'Życie jako wędrówka', 'Życie snem', 'Żyd', 'Żywioły', 'Oświadczyny' +]; + +$(function() +{ + var tabs = $('ol#tabs li'); + var gallery = null; + CurrentDocument = new $.wikiapi.WikiDocument("document-meta"); + + $.blockUI.defaults.baseZ = 10000; + + function initialize() + { + gallery = new $.wiki.ScanGalleryPerspective({ + doc: CurrentDocument, id: "ScanGalleryPerspective" + }); + + $(document).keydown(function(event) { + console.log("Received key:", event); + }); + + /* The save button */ + $('#save-button').click(function(event){ + event.preventDefault(); + $.wiki.showDialog('#save_dialog'); + }); + + $('.editor').hide(); + + /* + * TABS + */ + $('#tabs li').live('click', function(event, callback) { + $.wiki.switchToTab(this); + }); + + $('#tabs li > .tabclose').live('click', function(event, callback) { + var $tab = $(this).parent(); + + if($tab.is('.active')) + $.wiki.switchToTab(DEFAULT_PERSPECTIVE); + + var p = $.wiki.perspectiveForTab($tab); + p.destroy(); + + return false; + }); + + + $(window).resize(function(){ + $('iframe').height($(window).height() - $('#tabs').outerHeight() - $('#source-editor .toolbar').outerHeight()); + }); + + $(window).resize(); + + $('.vsplitbar').toggle( + function() { + $.wiki.state.perspectives.ScanGalleryPerspective.show = true; + $('#side-gallery').show(); + $('.vsplitbar').css('right', 480).addClass('.active'); + $('#editor .editor').css('right', 510); + $(window).resize(); + gallery.onEnter(); + }, + function() { + $.wiki.state.perspectives.ScanGalleryPerspective.show = false; + $('#side-gallery').hide(); + $('.vsplitbar').css('right', 0).removeClass('active'); + $('#editor .editor').css('right', 30); + $(window).resize(); + gallery.onExit(); + } + ); + + if($.wiki.state.perspectives.ScanGalleryPerspective.show) + $('.vsplitbar').trigger('click'); + + window.onbeforeunload = function(e) { + if($.wiki.isDirty()) { + e.returnValue = "Na stronie mogą być nie zapisane zmiany."; + return "Na stronie mogą być nie zapisane zmiany."; + }; + }; + + console.log("Fetching document's text"); + + $(document).bind('wlapi_document_changed', function(event, doc) { + try { + $('#document-revision').text(doc.revision); + } catch(e) { + console.log("Failed handler", e); + } + }); + + CurrentDocument.fetch({ + success: function(){ + console.log("Fetch success"); + $('#loading-overlay').fadeOut(); + var active_tab = document.location.hash || DEFAULT_PERSPECTIVE; + + if(active_tab == "#ScanGalleryPerspective") + active_tab = DEFAULT_PERSPECTIVE; + + console.log("Initial tab is:", active_tab) + $.wiki.switchToTab(active_tab); + }, + failure: function() { + $('#loading-overlay').fadeOut(); + alert("FAILURE"); + } + }); + }; /* end of initialize() */ + + + /* Load configuration */ + $.wiki.loadConfig(); + + var initAll = function(a, f) { + if (a.length == 0) return f(); + + $.wiki.initTab({ + tab: a.pop(), + doc: CurrentDocument, + callback: function(){ + initAll(a, f); + } + }); + }; + + + /* + * Initialize all perspectives + */ + initAll( $.makeArray($('ol#tabs li')), initialize); + console.log(location.hash); +}); diff --git a/redakcja/static/js/wiki/loader_readonly.js b/redakcja/static/js/wiki/loader_readonly.js new file mode 100644 index 00000000..c22e9d7a --- /dev/null +++ b/redakcja/static/js/wiki/loader_readonly.js @@ -0,0 +1,92 @@ +if (!window.console) { + window.console = { + log: function(){ + } + } +} + + +DEFAULT_PERSPECTIVE = "#VisualPerspective"; + +$(function() +{ + var tabs = $('ol#tabs li'); + var gallery = null; + + CurrentDocument = new $.wikiapi.WikiDocument("document-meta"); + $.blockUI.defaults.baseZ = 10000; + + function initialize() + { + $('.editor').hide(); + + /* + * TABS + */ + $('#tabs li').live('click', function(event, callback) { + $.wiki.switchToTab(this); + }); + + $('#tabs li > .tabclose').live('click', function(event, callback) { + var $tab = $(this).parent(); + + if($tab.is('.active')) + $.wiki.switchToTab(DEFAULT_PERSPECTIVE); + + var p = $.wiki.perspectiveForTab($tab); + p.destroy(); + return false; + }); + + $(window).resize(function(){ + $('iframe').height($(window).height() - $('#tabs').outerHeight() - $('#source-editor .toolbar').outerHeight()); + }); + + $(document).bind('wlapi_document_changed', function(event, doc) { + try { + $('#document-revision').text(doc.revision); + } catch(e) { + console.log("Failed handler", e); + } + }); + + CurrentDocument.fetch({ + success: function(){ + console.log("Fetch success"); + $('#loading-overlay').fadeOut(); + var active_tab = document.location.hash || DEFAULT_PERSPECTIVE; + + $(window).resize(); + + console.log("Initial tab is:", active_tab) + $.wiki.switchToTab(active_tab); + }, + failure: function() { + $('#loading-overlay').fadeOut(); + alert("FAILURE"); + } + }); + }; /* end of initialize() */ + + /* Load configuration */ + $.wiki.loadConfig(); + + var initAll = function(a, f) { + if (a.length == 0) return f(); + + $.wiki.initTab({ + tab: a.pop(), + doc: CurrentDocument, + callback: function(){ + initAll(a, f); + } + }); + }; + + + /* + * Initialize all perspectives + */ + initAll( $.makeArray($('ol#tabs li')), initialize); + console.log(location.hash); +}); \ No newline at end of file diff --git a/redakcja/static/js/wiki/view_column_diff.js b/redakcja/static/js/wiki/view_column_diff.js new file mode 100644 index 00000000..a212f813 --- /dev/null +++ b/redakcja/static/js/wiki/view_column_diff.js @@ -0,0 +1,34 @@ +(function($){ + + function DiffPerspective(options) { + var old_callback = options.callback || function() {}; + var self = this; + + options.callback = function(){ + self.base_id = options.base_id; + old_callback.call(this); + }; + + $.wiki.Perspective.call(this, options); + }; + + DiffPerspective.prototype = new $.wiki.Perspective(); + + DiffPerspective.prototype.freezeState = function(){ + // must + }; + + DiffPerspective.prototype.destroy = function() { + $('#' + this.base_id).remove(); + $('#' + this.perspective_id).remove(); + }; + + DiffPerspective.prototype.onEnter = function(success, failure){ + $.wiki.Perspective.prototype.onEnter.call(this); + console.log("Entered diff view"); + }; + + $.wiki.DiffPerspective = DiffPerspective; + +})(jQuery); + diff --git a/redakcja/static/js/wiki/view_editor_source.js b/redakcja/static/js/wiki/view_editor_source.js new file mode 100644 index 00000000..a0a2e69a --- /dev/null +++ b/redakcja/static/js/wiki/view_editor_source.js @@ -0,0 +1,124 @@ +/* COMMENT */ +(function($) { + + function CodeMirrorPerspective(options) + { + var old_callback = options.callback; + options.callback = function(){ + var self = this; + + this.codemirror = CodeMirror.fromTextArea('codemirror_placeholder', { + parserfile: 'parsexml.js', + path: STATIC_URL + "js/lib/codemirror/", + stylesheet: STATIC_URL + "css/xmlcolors_15032010.css", + parserConfig: { + useHTMLKludges: false + }, + iframeClass: 'xml-iframe', + textWrapping: true, + lineNumbers: true, + width: "100%", + tabMode: 'spaces', + indentUnit: 0, + readOnly: CurrentDocument.readonly || false, + initCallback: function(){ + + self.codemirror.grabKeys(function(event) { + if (event.button) { + $(event.button).trigger('click'); + event.button = null; + } + }, function(event) { + /* CM reports characters 2 times - as event and as code */ + if((typeof event) != "object") + return false; + + if(!event.altKey) + return false; + + var c = String.fromCharCode(event.keyCode).toLowerCase(); + var button = $("#source-editor button[data-ui-accesskey='"+c+"']"); + if(button.length == 0) + return false; + + /* it doesn't matter which button we pick - all do the same */ + event.button = button[0]; + return true; + }); + + $('#source-editor .toolbar button').click(function(event){ + event.preventDefault(); + var params = eval("(" + $(this).attr('data-ui-action-params') + ")"); + scriptletCenter.callInteractive({ + action: $(this).attr('data-ui-action'), + context: self.codemirror, + extra: params + }); + }); + + $('.toolbar select').change(function(event){ + var slug = $(this).val(); + + $('.toolbar-buttons-container').hide().filter('[data-group=' + slug + ']').show(); + $(window).resize(); + }); + + $('.toolbar-buttons-container').hide(); + $('.toolbar select').change(); + + console.log("Initialized CodeMirror"); + + // textarea is no longer needed + $('codemirror_placeholder').remove(); + + old_callback.call(self); + } + }); + }; + + $.wiki.Perspective.call(this, options); + }; + + + CodeMirrorPerspective.prototype = new $.wiki.Perspective(); + + CodeMirrorPerspective.prototype.freezeState = function() { + this.config().position = this.codemirror.win.scrollY || 0; + }; + + CodeMirrorPerspective.prototype.unfreezeState = function () { + this.codemirror.win.scroll(0, this.config().position || 0); + }; + + CodeMirrorPerspective.prototype.onEnter = function(success, failure) { + $.wiki.Perspective.prototype.onEnter.call(this); + + console.log('Entering', this.doc); + this.codemirror.setCode(this.doc.text); + + /* fix line numbers bar */ + var $nums = $('.CodeMirror-line-numbers'); + var barWidth = $nums.width(); + + $(this.codemirror.frame.contentDocument.body).css('padding-left', barWidth); + // $nums.css('left', -barWidth); + + $(window).resize(); + this.unfreezeState(this._uistate); + + if(success) success(); + } + + CodeMirrorPerspective.prototype.onExit = function(success, failure) { + this.freezeState(); + + $.wiki.Perspective.prototype.onExit.call(this); + console.log('Exiting', this.doc); + this.doc.setText(this.codemirror.getCode()); + + if(success) success(); + } + + $.wiki.CodeMirrorPerspective = CodeMirrorPerspective; + +})(jQuery); diff --git a/redakcja/static/js/wiki/view_editor_wysiwyg.js b/redakcja/static/js/wiki/view_editor_wysiwyg.js new file mode 100644 index 00000000..2ae1a8dd --- /dev/null +++ b/redakcja/static/js/wiki/view_editor_wysiwyg.js @@ -0,0 +1,425 @@ +(function($){ + + /* Show theme to the user */ + function selectTheme(themeId){ + var selection = window.getSelection(); + selection.removeAllRanges(); + + var range = document.createRange(); + var s = $(".motyw[theme-class='" + themeId + "']")[0]; + var e = $(".end[theme-class='" + themeId + "']")[0]; + + if (s && e) { + range.setStartAfter(s); + range.setEndBefore(e); + selection.addRange(range); + } + }; + + /* Verify insertion port for annotation or theme */ + function verifyTagInsertPoint(node){ + if (node.nodeType == 3) { // Text Node + node = node.parentNode; + } + + if (node.nodeType != 1) { + return false; + } + + node = $(node); + var xtype = node.attr('x-node'); + + if (!xtype || (xtype.search(':') >= 0) || + xtype == 'motyw' || + xtype == 'begin' || + xtype == 'end') { + return false; + } + + // don't allow themes inside annotations + if (node.is('*[x-annotation-box] *')) + return false; + + return true; + } + + /* Convert HTML frament to plaintext */ + var ANNOT_ALLOWED = ['wyroznienie', 'slowo_obce', 'osoba']; + + function html2plainText(fragment){ + var text = ""; + + $(fragment.childNodes).each(function(){ + if (this.nodeType == 3) // textNode + text += this.nodeValue; + else + if (this.nodeType == 1 && + $.inArray($(this).attr('x-node'), ANNOT_ALLOWED) != -1) { + text += html2plainText(this); + } + }); + + return text; + } + + + /* Insert annotation using current selection */ + function addAnnotation(){ + var selection = window.getSelection(); + var n = selection.rangeCount; + + if (n == 0) { + window.alert("Nie zaznaczono żadnego obszaru"); + return false; + } + + // for now allow only 1 range + if (n > 1) { + window.alert("Zaznacz jeden obszar"); + return false; + } + + // remember the selected range + var range = selection.getRangeAt(0); + + if (!verifyTagInsertPoint(range.endContainer)) { + window.alert("Nie można wstawić w to miejsce przypisu."); + return false; + } + + // BUG #273 - selected text can contain themes, which should be omited from + // defining term + var text = html2plainText(range.cloneContents()); + + var tag = $(''); + range.collapse(false); + range.insertNode(tag[0]); + + xml2html({ + xml: '' + text + ' --- ', + success: function(text){ + var t = $(text); + tag.replaceWith(t); + openForEdit(t); + }, + error: function(){ + tag.remove(); + alert('Błąd przy dodawaniu przypisu:' + errors); + } + }) + } + + + /* Insert theme using current selection */ + + function addTheme(){ + var selection = window.getSelection(); + var n = selection.rangeCount; + + if (n == 0) { + window.alert("Nie zaznaczono żadnego obszaru"); + return false; + } + + // for now allow only 1 range + if (n > 1) { + window.alert("Zaznacz jeden obszar."); + return false; + } + + + // remember the selected range + var range = selection.getRangeAt(0); + + + if ($(range.startContainer).is('.html-editarea') || + $(range.endContainer).is('.html-editarea')) { + window.alert("Motywy można oznaczać tylko na tekście nie otwartym do edycji. \n Zamknij edytowany fragment i spróbuj ponownie."); + return false; + } + + // verify if the start/end points make even sense - + // they must be inside a x-node (otherwise they will be discarded) + // and the x-node must be a main text + if (!verifyTagInsertPoint(range.startContainer)) { + window.alert("Motyw nie może się zaczynać w tym miejscu."); + return false; + } + + if (!verifyTagInsertPoint(range.endContainer)) { + window.alert("Motyw nie może się kończyć w tym miejscu."); + return false; + } + + var date = (new Date()).getTime(); + var random = Math.floor(4000000000 * Math.random()); + var id = ('' + date) + '-' + ('' + random); + + var spoint = document.createRange(); + var epoint = document.createRange(); + + spoint.setStart(range.startContainer, range.startOffset); + epoint.setStart(range.endContainer, range.endOffset); + + var mtag, btag, etag, errors; + + // insert theme-ref + + xml2html({ + xml: '', + success: function(text){ + etag = $(''); + epoint.insertNode(etag[0]); + etag.replaceWith(text); + xml2html({ + xml: '', + success: function(text){ + mtag = $(''); + spoint.insertNode(mtag[0]); + mtag.replaceWith(text); + xml2html({ + xml: '', + success: function(text){ + btag = $(''); + spoint.insertNode(btag[0]) + btag.replaceWith(text); + selection.removeAllRanges(); + openForEdit($('.motyw[theme-class=' + id + ']')); + } + }); + } + }); + } + }); + } + + /* open edition window for selected fragment */ + function openForEdit($origin){ + var $box = null + + // annotations overlay their sub box - not their own box // + if ($origin.is(".annotation-inline-box")) { + $box = $("*[x-annotation-box]", $origin); + } + else { + $box = $origin; + } + + var x = $box[0].offsetLeft; + var y = $box[0].offsetTop; + var w = $box.outerWidth(); + var h = $box.innerHeight(); + + if ($origin.is(".annotation-inline-box")) { + w = Math.max(w, 400); + h = Math.max(h, 60); + } + + // start edition on this node + var $overlay = $('
    ').css({ + position: 'absolute', + height: h, + left: x, + top: y, + width: w + }).appendTo($box[0].offsetParent || $box.parent()).show(); + + if ($origin.is('.motyw')) { + $('textarea', $overlay).autocomplete(THEMES, { + autoFill: true, + multiple: true, + selectFirst: true + }); + } + + if ($origin.is('.motyw')) { + $('.delete-button', $overlay).click(function(){ + if (window.confirm("Czy jesteś pewien, że chcesz usunąć ten motyw ?")) { + $('[theme-class=' + $origin.attr('theme-class') + ']').remove(); + $overlay.remove(); + $(document).unbind('click.blur-overlay'); + return false; + }; + }); + } + else { + $('.delete-button', $overlay).hide(); + } + + + var serializer = new XMLSerializer(); + + html2text({ + element: $box[0], + stripOuter: true, + success: function(text){ + $('textarea', $overlay).val($.trim(text)); + + setTimeout(function(){ + $('textarea', $overlay).elastic().focus(); + }, 50); + + function save(argument){ + var nodeName = $box.attr('x-node') || 'pe'; + var insertedText = $('textarea', $overlay).val(); + + if ($origin.is('.motyw')) { + insertedText = insertedText.replace(/,\s*$/, ''); + } + + xml2html({ + xml: '<' + nodeName + '>' + insertedText + '', + success: function(element){ + $origin.html($(element).html()); + $overlay.remove(); + }, + error: function(text){ + $overlay.remove(); + alert('Błąd! ' + text); + } + }) + } + + $('.accept-button', $overlay).click(function(){ + save(); + }); + + $(document).bind('click.blur-overlay', function(event){ + if ($(event.target).parents('.html-editarea').length > 0) { + return; + } + save(); + + $(document).unbind('click.blur-overlay'); + }); + + }, + error: function(text){ + alert('Błąd! ' + text); + } + }); + } + + function VisualPerspective(options){ + + var old_callback = options.callback; + + options.callback = function(){ + var element = $("#html-view"); + var button = $(''); + + if (!CurrentDocument.readonly) { + $('#html-view').bind('mousemove', function(event){ + var editable = $(event.target).closest('*[x-editable]'); + $('.active', element).not(editable).removeClass('active').children('.edit-button').remove(); + + if (!editable.hasClass('active')) { + editable.addClass('active').append(button); + } + if (editable.is('.annotation-inline-box')) { + $('*[x-annotation-box]', editable).css({ + position: 'absolute', + left: event.clientX - editable.offset().left + 5, + top: event.clientY - editable.offset().top + 5 + }).show(); + } + else { + $('*[x-annotation-box]').hide(); + } + }); + + $('#insert-annotation-button').click(function(){ + addAnnotation(); + return false; + }); + + $('#insert-theme-button').click(function(){ + addTheme(); + return false; + }); + + $('.edit-button').live('click', function(event){ + event.preventDefault(); + openForEdit($(this).parent()); + }); + + } + + $('.motyw').live('click', function(){ + selectTheme($(this).attr('theme-class')); + }); + + old_callback.call(this); + }; + + $.wiki.Perspective.call(this, options); + }; + + VisualPerspective.prototype = new $.wiki.Perspective(); + + VisualPerspective.prototype.freezeState = function(){ + + }; + + VisualPerspective.prototype.onEnter = function(success, failure){ + $.wiki.Perspective.prototype.onEnter.call(this); + + $.blockUI({ + message: 'Uaktualnianie widoku...' + }); + + function _finalize(callback){ + $.unblockUI(); + if (callback) + callback(); + } + + xml2html({ + xml: this.doc.text, + success: function(element){ + $('#html-view').html(element); + _finalize(success); + }, + error: function(text){ + var message = $('
    ');
    +                message.text(text);
    +                $('#html-view').html('

    Wystąpił błąd:

    ' +
    +                message.html() +
    +                '
    '); + _finalize(failure); + } + }); + }; + + VisualPerspective.prototype.onExit = function(success, failure){ + var self = this; + + $.blockUI({ + message: 'Zapisywanie widoku...' + }); + + function _finalize(callback){ + $.unblockUI(); + if (callback) + callback(); + } + + if ($('#html-view .error').length > 0) + return _finalize(failure); + + html2text({ + element: $('#html-view div').get(0), + success: function(text){ + self.doc.setText(text); + _finalize(success); + }, + error: function(text){ + $('#source-editor').html('

    Wystąpił błąd:

    ' + text + '
    '); + _finalize(failure); + } + }); + }; + + $.wiki.VisualPerspective = VisualPerspective; + +})(jQuery); diff --git a/redakcja/static/js/wiki/view_gallery.js b/redakcja/static/js/wiki/view_gallery.js new file mode 100644 index 00000000..aa39e15f --- /dev/null +++ b/redakcja/static/js/wiki/view_gallery.js @@ -0,0 +1,251 @@ +(function($){ + + function normalizeNumber(pageNumber, pageCount){ + // Numer strony musi być pomiędzy 1 a najwyższym numerem + var pageNumber = parseInt(pageNumber, 10); + + if (!pageNumber || + pageNumber == NaN || + pageNumber == Infinity || + pageNumber == -Infinity || + pageNumber < 1) + return 1; + + if (pageNumber > pageCount) + return pageCount; + + return pageNumber; + } + + function bounds(galleryWidth, galleryHeight, imageWidth, imageHeight){ + return { + maxX: 0, + maxY: 0, + minX: galleryWidth - imageWidth, + minY: galleryHeight - imageHeight + } + }; + + function normalizePosition(x, y, galleryWidth, galleryHeight, imageWidth, imageHeight){ + var b = bounds(galleryWidth, galleryHeight, imageWidth, imageHeight); + return { + x: Math.min(b.maxX, Math.max(b.minX, x)), + y: Math.min(b.maxY, Math.max(b.minY, y)) + } + }; + + function fixImageSize(){ + + } + + /* + * Perspective + */ + function ScanGalleryPerspective(options){ + var old_callback = options.callback || function() { }; + + this.noupdate_hash_onenter = true; + + options.callback = function(){ + var self = this; + + this.dimensions = {}; + this.zoomFactor = 1; + this.$element = $("#side-gallery"); + this.$numberInput = $('.page-number', this.$element); + + // ... + var origin = {}; + var imageOrigin = {}; + + this.$image = $('.gallery-image img', this.$element).attr('unselectable', 'on'); + + // button handlers + this.$numberInput.change(function(event){ + event.preventDefault(); + self.setPage($(this).val()); + }); + + $('.previous-page', this.$element).click(function(){ + self.setPage(parseInt(self.$numberInput.val(),10) - 1); + }); + + $('.next-page', this.$element).click(function(){ + self.setPage(parseInt(self.$numberInput.val(),10) + 1); + }); + + $('.zoom-in', this.$element).click(function(){ + self.alterZoom(0.2); + }); + + $('.zoom-out', this.$element).click(function(){ + self.alterZoom((-0.2)); + }); + + $(window).resize(function(){ + self.dimensions.galleryWidth = self.$image.parent().width(); + self.dimensions.galleryHeight = self.$image.parent().height(); + }); + + $('.gallery-image img', this.$element).load(function(){ + console.log("Image loaded.") + self._resizeImage(); + }).bind('mousedown', function() { + self.imageMoveStart.apply(self, arguments); + }); + + + + old_callback.call(this); + }; + + $.wiki.Perspective.call(this, options); + }; + + ScanGalleryPerspective.prototype = new $.wiki.Perspective(); + + ScanGalleryPerspective.prototype._resizeImage = function(){ + var $img = this.$image; + + $img.css({ + width: null, + height: null + }); + + this.dimensions = { + width: $img.width() * this.zoomFactor, + height: $img.height() * this.zoomFactor, + originWidth: $img.width(), + originHeight: $img.height(), + galleryWidth: $img.parent().width(), + galleryHeight: $img.parent().height() + }; + + if (!(this.dimensions.width && this.dimensions.height)) { + setTimeout(function(){ + $img.load(); + }, 100); + } + + var position = normalizePosition($img.position().left, $img.position().top, this.dimensions.galleryWidth, this.dimensions.galleryHeight, this.dimensions.width, this.dimensions.height); + + $img.css({ + left: position.x, + top: position.y, + width: $img.width() * this.zoomFactor, + height: $img.height() * this.zoomFactor + }); + }; + + ScanGalleryPerspective.prototype.setPage = function(newPage){ + newPage = normalizeNumber(newPage, this.doc.galleryImages.length); + this.$numberInput.val(newPage); + this.config().page = newPage; + $('.gallery-image img', this.$element).attr('src', this.doc.galleryImages[newPage - 1]); + }; + + ScanGalleryPerspective.prototype.alterZoom = function(delta){ + var zoomFactor = this.zoomFactor + delta; + if (zoomFactor < 0.2) + zoomFactor = 0.2; + if (zoomFactor > 2) + zoomFactor = 2; + this.setZoom(zoomFactor); + }; + + ScanGalleryPerspective.prototype.setZoom = function(factor){ + this.zoomFactor = factor; + + this.dimensions.width = this.dimensions.originWidth * this.zoomFactor; + this.dimensions.height = this.dimensions.originHeight * this.zoomFactor; + + // var position = normalizePosition(this.$image.position().left, this.$image.position().top, this.dimensions.galleryWidth, this.dimensions.galleryHeight, this.dimensions.width, this.dimensions.height); + + this._resizeImage(); + /* this.$image.css({ + width: this.dimensions.width, + height: this.dimensions.height, + left: position.x, + top: position.y + });*/ + }; + + /* + * Movement + */ + ScanGalleryPerspective.prototype.imageMoved = function(event){ + event.preventDefault(); + + // origin is where the drag started + // imageOrigin is where the drag started on the image + + var newX = event.clientX - this.origin.x + this.imageOrigin.left; + var newY = event.clientY - this.origin.y + this.imageOrigin.top; + + var position = normalizePosition(newX, newY, this.dimensions.galleryWidth, this.dimensions.galleryHeight, this.dimensions.width, this.dimensions.height); + + this.$image.css({ + left: position.x, + top: position.y, + }); + + return false; + }; + + ScanGalleryPerspective.prototype.imageMoveStart = function(event){ + event.preventDefault(); + + var self = this; + + this.origin = { + x: event.clientX, + y: event.clientY + }; + + this.imageOrigin = self.$image.position(); + $(document).bind('mousemove.gallery', function(){ + self.imageMoved.apply(self, arguments); + }).bind('mouseup.gallery', function() { + self.imageMoveStop.apply(self, arguments); + }); + + return false; + }; + + ScanGalleryPerspective.prototype.imageMoveStop = function(event){ + $(document).unbind('mousemove.gallery').unbind('mouseup.gallery'); + }; + + /* + * Loading gallery + */ + ScanGalleryPerspective.prototype.onEnter = function(success, failure){ + var self = this; + + $.wiki.Perspective.prototype.onEnter.call(this); + + this.doc.refreshGallery({ + success: function(doc, data){ + self.$image.show(); + console.log("gconfig:", self.config().page ); + self.setPage( self.config().page ); + + $('.error_message', self.$element).hide(); + if(success) success(); + }, + failure: function(doc, message){ + self.$image.hide(); + $('.error_message', self.$element).show().html(message); + if(failure) failure(); + } + }); + + }; + + ScanGalleryPerspective.prototype.onExit = function(success, failure) { + + }; + + $.wiki.ScanGalleryPerspective = ScanGalleryPerspective; + +})(jQuery); \ No newline at end of file diff --git a/redakcja/static/js/wiki/view_history.js b/redakcja/static/js/wiki/view_history.js new file mode 100644 index 00000000..b4a9dd8a --- /dev/null +++ b/redakcja/static/js/wiki/view_history.js @@ -0,0 +1,158 @@ +(function($){ + + function HistoryPerspective(options) { + var old_callback = options.callback || function() {}; + + options.callback = function() { + var self = this; + + // first time page is rendered + $('#make-diff-button').click(function() { + self.makeDiff(); + }); + + $('#tag-changeset-button').click(function() { + self.showTagForm(); + }); + + $('#open-preview-button').click(function(event) { + var selected = $('#changes-list .entry.selected'); + + if (selected.length != 1) { + window.alert("Wybierz dokładnie *jedną* wersję."); + return; + } + + var version = parseInt($("*[data-stub-value='version']", selected[0]).text()); + window.open($(this).attr('data-basehref') + "?revision=" + version); + + event.preventDefault(); + }); + + $('#changes-list .entry').live('click', function(){ + var $this = $(this); + if ($this.hasClass('selected')) + return $this.removeClass('selected'); + + if ($("#changes-list .entry.selected").length < 2) + return $this.addClass('selected'); + }); + + $('#changes-list span.tag').live('click', function(event){ + return false; + }); + + old_callback.call(this); + } + + $.wiki.Perspective.call(this, options); + }; + + HistoryPerspective.prototype = new $.wiki.Perspective(); + + HistoryPerspective.prototype.freezeState = function(){ + // must + }; + + HistoryPerspective.prototype.onEnter = function(success, failure){ + $.wiki.Perspective.prototype.onEnter.call(this); + + $.blockUI({ + message: 'Odświeżanie historii...' + }); + + function _finalize(s){ + $.unblockUI(); + + if (s) { + if (success) + success(); + } + else { + if (failure) + failure(); + } + } + + function _failure(doc, message){ + $('#history-view .message-box').html('Nie udało się odświeżyć historii:' + message).show(); + _finalize(false); + }; + + function _success(doc, data){ + $('#history-view .message-box').hide(); + var changes_list = $('#changes-list'); + var $stub = $('#history-view .row-stub'); + changes_list.html(''); + + var tags = $('select#id_addtag-tag option'); + + $.each(data, function(){ + $.wiki.renderStub({ + container: changes_list, + stub: $stub, + data: this, + filters: { + tag: function(value) { + return tags.filter("*[value='"+value+"']").text(); + } + } + }); + }); + + _finalize(true); + }; + + return this.doc.fetchHistory({ + success: _success, + failure: _failure + }); + }; + + HistoryPerspective.prototype.showTagForm = function(){ + var selected = $('#changes-list .entry.selected'); + + if (selected.length != 1) { + window.alert("Musisz zaznaczyć dokładnie jedną wersję."); + return; + } + + var version = parseInt($("*[data-stub-value='version']", selected[0]).text()); + $.wiki.showDialog('#add_tag_dialog', {'revision': version}); + }; + + HistoryPerspective.prototype.makeDiff = function() { + var changelist = $('#changes-list'); + var selected = $('.entry.selected', changelist); + + if (selected.length != 2) { + window.alert("Musisz zaznaczyć dokładnie dwie wersje do porównania."); + return; + } + + $.blockUI({ + message: 'Wczytywanie porównania...' + }); + + var rev_from = $("*[data-stub-value='version']", selected[1]).text(); + var rev_to = $("*[data-stub-value='version']", selected[0]).text(); + + return this.doc.fetchDiff({ + from: rev_from, + to: rev_to, + success: function(doc, data){ + var result = $.wiki.newTab(doc, ''+rev_from +' -> ' + rev_to, 'DiffPerspective'); + + $(result.view).html(data); + $.wiki.switchToTab(result.tab); + $.unblockUI(); + }, + failure: function(doc){ + $.unblockUI(); + } + }); + }; + + $.wiki.HistoryPerspective = HistoryPerspective; + +})(jQuery); diff --git a/redakcja/static/js/wiki/view_summary.js b/redakcja/static/js/wiki/view_summary.js new file mode 100644 index 00000000..811096dd --- /dev/null +++ b/redakcja/static/js/wiki/view_summary.js @@ -0,0 +1,45 @@ +(function($){ + + function SummaryPerspective(options) { + var old_callback = options.callback; + var self = this; + + options.callback = function(){ + $('#publish_button').click(function() { + $.blockUI({message: "Oczekiwanie na odpowiedź serwera..."}); + self.doc.publish({ + success: function(doc, data) { + $.blockUI({message: "Udało się.", timeout: 2000}); + }, + failure: function(doc, message) { + $.blockUI({ + message: message, + timeout: 5000 + }); + } + + }); + }); + + old_callback.call(this); + }; + + $.wiki.Perspective.call(this, options); + }; + + SummaryPerspective.prototype = new $.wiki.Perspective(); + + SummaryPerspective.prototype.freezeState = function(){ + // must + }; + + SummaryPerspective.prototype.onEnter = function(success, failure){ + $.wiki.Perspective.prototype.onEnter.call(this); + + console.log("Entered summery view"); + }; + + $.wiki.SummaryPerspective = SummaryPerspective; + +})(jQuery); + diff --git a/redakcja/static/js/wiki/wikiapi.js b/redakcja/static/js/wiki/wikiapi.js new file mode 100644 index 00000000..27ab97e2 --- /dev/null +++ b/redakcja/static/js/wiki/wikiapi.js @@ -0,0 +1,316 @@ +(function($) { + $.wikiapi = {}; + var noop = function() { + }; + var noops = { + success: noop, + failure: noop + }; + /* + * Return absolute reverse path of given named view. + * (at least he have it hard-coded in one place) + * + * TODO: think of a way, not to hard-code it here ;) + * + */ + function reverse() { + var vname = arguments[0]; + var base_path = "/documents"; + + if (vname == "ajax_document_text") { + var path = "/" + arguments[1] + "/text"; + + if (arguments[2] !== undefined) + path += "/" + arguments[2]; + + return base_path + path; + } + + if (vname == "ajax_document_history") { + + return base_path + "/" + arguments[1] + "/history"; + } + + if (vname == "ajax_document_gallery") { + + return base_path + "/gallery/" + arguments[1]; + } + + if (vname == "ajax_document_diff") + return base_path + "/" + arguments[1] + "/diff"; + + if (vname == "ajax_document_addtag") + return base_path + "/" + arguments[1] + "/tags"; + + if (vname == "ajax_publish") + return base_path + "/" + arguments[1] + "/publish"; + + console.log("Couldn't reverse match:", vname); + return "/404.html"; + }; + + /* + * Document Abstraction + */ + function WikiDocument(element_id) { + var meta = $('#' + element_id); + this.id = meta.attr('data-document-name'); + + this.revision = $("*[data-key='revision']", meta).text(); + this.readonly = !!$("*[data-key='readonly']", meta).text(); + + this.galleryLink = $("*[data-key='gallery']", meta).text(); + this.galleryImages = []; + this.text = null; + this.has_local_changes = false; + this._lock = -1; + this._context_lock = -1; + this._lock_count = 0; + }; + + WikiDocument.prototype.triggerDocumentChanged = function() { + $(document).trigger('wlapi_document_changed', this); + }; + /* + * Fetch text of this document. + */ + WikiDocument.prototype.fetch = function(params) { + params = $.extend({}, noops, params); + var self = this; + $.ajax({ + method: "GET", + url: reverse("ajax_document_text", self.id), + data: {"revision": self.revision}, + dataType: 'json', + success: function(data) { + var changed = false; + + if (self.text === null || self.revision !== data.revision) { + self.text = data.text; + self.revision = data.revision; + self.gallery = data.gallery; + changed = true; + self.triggerDocumentChanged(); + }; + + self.has_local_changes = false; + params['success'](self, changed); + }, + error: function() { + params['failure'](self, "Nie udało się wczytać treści dokumentu."); + } + }); + }; + /* + * Fetch history of this document. + * + * from - First revision to fetch (default = 0) + * upto - Last revision to fetch (default = tip) + * + */ + WikiDocument.prototype.fetchHistory = function(params) { + /* this doesn't modify anything, so no locks */ + params = $.extend({}, noops, params); + var self = this; + $.ajax({ + method: "GET", + url: reverse("ajax_document_history", self.id), + dataType: 'json', + data: { + "from": params['from'], + "upto": params['upto'] + }, + success: function(data) { + params['success'](self, data); + }, + error: function() { + params['failure'](self, "Nie udało się wczytać historii dokumentu."); + } + }); + }; + WikiDocument.prototype.fetchDiff = function(params) { + /* this doesn't modify anything, so no locks */ + var self = this; + params = $.extend({ + 'from': self.revision, + 'to': self.revision + }, noops, params); + $.ajax({ + method: "GET", + url: reverse("ajax_document_diff", self.id), + dataType: 'html', + data: { + "from": params['from'], + "to": params['to'] + }, + success: function(data) { + params['success'](self, data); + }, + error: function() { + params['failure'](self, "Nie udało się wczytać porównania wersji."); + } + }); + }; + + /* + * Fetch gallery + */ + WikiDocument.prototype.refreshGallery = function(params) { + params = $.extend({}, noops, params); + var self = this; + $.ajax({ + method: "GET", + url: reverse("ajax_document_gallery", self.galleryLink), + dataType: 'json', + // data: {}, + success: function(data) { + self.galleryImages = data; + params['success'](self, data); + }, + error: function() { + self.galleryImages = []; + params['failure'](self, "

    Nie udało się wczytać gallerii pod nazwą: '" + self.galleryLink + "'.

    "); + } + }); + }; + + /* + * Set document's text + */ + WikiDocument.prototype.setText = function(text) { + this.text = text; + this.has_local_changes = true; + }; + + /* + * Set document's gallery link + */ + WikiDocument.prototype.setGalleryLink = function(gallery) { + this.galleryLink = gallery; + this.has_local_changes = true; + }; + + /* + * Save text back to the server + */ + WikiDocument.prototype.save = function(params) { + params = $.extend({}, noops, params); + var self = this; + + if (!self.has_local_changes) { + console.log("Abort: no changes."); + return params['success'](self, false, "Nie ma zmian do zapisania."); + }; + + // Serialize form to dictionary + var data = {}; + $.each(params['form'].serializeArray(), function() { + data[this.name] = this.value; + }); + + var metaComment = '\n' + + data['textsave-text'] = metaComment + self.text; + + $.ajax({ + url: reverse("ajax_document_text", self.id), + type: "POST", + dataType: "json", + data: data, + success: function(data) { + var changed = false; + + if (data.text) { + self.text = data.text; + self.revision = data.revision; + self.gallery = data.gallery; + changed = true; + self.triggerDocumentChanged(); + }; + + params['success'](self, changed, ((changed && "Udało się zapisać :)") || "Twoja wersja i serwera jest identyczna")); + }, + error: function(xhr) { + try { + params['failure'](self, $.parseJSON(xhr.responseText)); + } + catch (e) { + params['failure'](self, { + "__message": "

    Nie udało się zapisać - błąd serwera.

    " + }); + }; + + } + }); + }; /* end of save() */ + + WikiDocument.prototype.publish = function(params) { + params = $.extend({}, noops, params); + var self = this; + $.ajax({ + url: reverse("ajax_publish", self.id), + type: "POST", + dataType: "json", + success: function(data) { + params.success(self, data); + }, + error: function(xhr) { + if (xhr.status == 403 || xhr.status == 401) { + params.failure(self, "Nie masz uprawnień lub nie jesteś zalogowany."); + } + else { + try { + params.failure(self, xhr.responseText); + } + catch (e) { + params.failure(self, "Nie udało się - błąd serwera."); + }; + }; + + } + }); + }; + WikiDocument.prototype.setTag = function(params) { + params = $.extend({}, noops, params); + var self = this; + var data = { + "addtag-id": self.id, + }; + + /* unpack form */ + $.each(params.form.serializeArray(), function() { + data[this.name] = this.value; + }); + + $.ajax({ + url: reverse("ajax_document_addtag", self.id), + type: "POST", + dataType: "json", + data: data, + success: function(data) { + params.success(self, data.message); + }, + error: function(xhr) { + if (xhr.status == 403 || xhr.status == 401) { + params.failure(self, { + "__all__": ["Nie masz uprawnień lub nie jesteś zalogowany."] + }); + } + else { + try { + params.failure(self, $.parseJSON(xhr.responseText)); + } + catch (e) { + params.failure(self, { + "__all__": ["Nie udało się - błąd serwera."] + }); + }; + }; + } + }); + }; + + $.wikiapi.WikiDocument = WikiDocument; +})(jQuery); diff --git a/redakcja/static/js/wiki/xslt.js b/redakcja/static/js/wiki/xslt.js new file mode 100644 index 00000000..dda12a16 --- /dev/null +++ b/redakcja/static/js/wiki/xslt.js @@ -0,0 +1,378 @@ +/* + * + * XSLT STUFF + * + */ +function createXSLT(xsl) { + var p = new XSLTProcessor(); + p.importStylesheet(xsl); + return p; +} + +var xml2htmlStylesheet = null; + +// Wykonuje block z załadowanymi arkuszami stylów +function withStylesheets(code_block, onError) +{ + if (!xml2htmlStylesheet) { + $.blockUI({message: 'Ładowanie arkuszy stylów...'}); + $.ajax({ + url: STATIC_URL + 'xsl/wl2html_client.xsl', + dataType: 'xml', + success: function(data) { + xml2htmlStylesheet = createXSLT(data); + $.unblockUI(); + code_block(); + + }, + error: onError + }) + } + else { + code_block(); + } +} + + +function xml2html(options) { + withStylesheets(function() { + var xml = options.xml.replace(/\/\s+/g, '
    '); + var parser = new DOMParser(); + var serializer = new XMLSerializer(); + var doc = parser.parseFromString(xml, 'text/xml'); + var error = $('parsererror', doc); + + if (error.length == 0) { + doc = xml2htmlStylesheet.transformToFragment(doc, document); + console.log(doc.firstChild); + + if(doc.firstChild === null) { + options.error("Błąd w przetwarzaniu XML."); + return; + } + + error = $('parsererror', doc); + } + + if (error.length > 0 && options.error) { + options.error(error.text()); + } else { + options.success(doc.firstChild); + } + }, function() { options.error && options.error('Nie udało się załadować XSLT'); }); +} + +/* USEFULL CONSTANTS */ +const ELEMENT_NODE = 1; +const ATTRIBUTE_NODE = 2; +const TEXT_NODE = 3; +const CDATA_SECTION_NODE = 4; +const ENTITY_REFERENCE_NODE = 5; +const ENTITY_NODE = 6; +const PROCESSING_INSTRUCTION_NODE = 7; +const COMMENT_NODE = 8; +const DOCUMENT_NODE = 9; +const DOCUMENT_TYPE_NODE = 10; +const DOCUMENT_FRAGMENT_NODE = 11; +const NOTATION_NODE = 12; +const XATTR_RE = /^x-attr-name-(.*)$/; + +const ELEM_START = 1; +const ELEM_END = 2; +const NS_END = 3; + +const NAMESPACES = { + // namespaces not listed here will be assigned random names + "http://www.w3.org/1999/02/22-rdf-syntax-ns#": "rdf", + "http://purl.org/dc/elements/1.1/": "dc", + "http://www.w3.org/XML/1998/namespace": "xml" +}; + +/* + * PADDING for pretty-printing + */ +const PADDING = { + dramat_wierszowany_l: 4, + dramat_wierszowany_lp: 4, + dramat_wspolczesny: 4, + wywiad: 4, + opowiadanie: 4, + powiesc: 4, + liryka_l: 4, + liryka_lp: 4, + naglowek_czesc: 4, + naglowek_akt: 4, + naglowek_rozdzial: 4, + naglowek_osoba: 4, + lista_osob: 4, + + akap: 3, + akap_cd: 3, + akap_dialog: 3, + strofa: 3, + motto: 3, + miejsce_czas: 3, + + autor_utworu: 2, + nazwa_utworu: 2, + dzielo_nadrzedne: 2, + + didaskalia: 2, + motto_podpis: 2, + naglowek_listy: 2, + kwestia: 1, + lista_osoba: 1, + + "podpis": 1, + "wers": 0, + "wers_cd": 0, + "wers_akap": 0, + "wers_wciety": 0, + + "rdf:RDF": 3, + "rdf:Description": 1, +}; + +function getPadding(name) { + + if(name.match(/^dc:.*$/)) + return -1; + + if(PADDING[name]) + return PADDING[name]; + + return 0; +} + +function HTMLSerializer() { + // empty constructor +} + + + +HTMLSerializer.prototype._prepare = function() { + this.stack = []; + + // XML namespace is implicit + this.nsMap = {"http://www.w3.org/XML/1998/namespace": "xml"}; + + this.result = ""; + this.nsCounter = 1; +} + +HTMLSerializer.prototype._pushElement = function(element) { + this.stack.push({ + "type": ELEM_START, + "node": element + }); +} + +HTMLSerializer.prototype._pushChildren = function(element) { + for(var i = element.childNodes.length-1; i >= 0; i--) + this._pushElement(element.childNodes.item(i)); +} + +HTMLSerializer.prototype._pushTagEnd = function(tagName) { + this.stack.push({ + "type": ELEM_END, + "tagName": tagName + }); +} + +HTMLSerializer.prototype._verseBefore = function(node) { + var prev = node.previousSibling; + + while((prev !== null) && (prev.nodeType != ELEMENT_NODE)) { + prev = prev.previousSibling; + } + + return (prev !== null) && prev.hasAttribute('x-verse'); +} + +HTMLSerializer.prototype.serialize = function(rootElement, stripOuter) +{ + var self = this; + self._prepare(); + + if(!stripOuter) + self._pushElement(rootElement); + else + self._pushChildren(rootElement); + + while(self.stack.length > 0) { + var token = self.stack.pop(); + + if(token.type === ELEM_END) { + self.result += ""; + for(var padding = getPadding(token.tagName); padding > 0; padding--) { + self.result += "\n"; + } + continue; + }; + + if(token.type === NS_END) { + self._unassignNamespace(token.namespace); + continue; + } + + + switch(token.node.nodeType) { + case ELEMENT_NODE: + if(token.node.hasAttribute('x-pass-thru')) { + self._pushChildren(token.node); + break; + } + + if(!token.node.hasAttribute('x-node')) + break; + + var xnode = token.node.getAttribute('x-node'); + + if(xnode === 'wers') { + /* push children */ + if(self._verseBefore(token.node)) + self.result += '/\n'; + self._pushChildren(token.node); + break; + }; + + if(xnode === 'out-of-flow-text') { + self._pushChildren(token.node); + break; + } + + if(token.node.hasAttribute('x-verse') && self._verseBefore(token.node)) { + self.result += '/\n'; + }; + + self._serializeElement(token.node); + break; + case TEXT_NODE: + self.result += token.node.nodeValue; + break; + }; + }; + + return this.result; +} + +/* + * TODO: this doesn't support prefix redefinitions + */ +HTMLSerializer.prototype._unassignNamespace = function(nsData) { + this.nsMap[nsData.uri] = undefined; +}; + +HTMLSerializer.prototype._assignNamespace = function(uri) { + if(uri === null) { + // default namespace + return ({"prefix": "", "uri": "", "fresh": false}); + } + + if(this.nsMap[uri] === undefined) { + // this prefix hasn't been defined yet in current context + var prefix = NAMESPACES[uri]; + + if (prefix === undefined) { // not predefined + prefix = "ns" + this.nsCounter; + this.nsCounter += 1; + } + + this.nsMap[uri] = prefix; + return ({ + "prefix": prefix, + "uri": uri, + "fresh": true + }); + } + + return ({"prefix": this.nsMap[uri], "uri": uri, "fresh": false}); +}; + +HTMLSerializer.prototype._join = function(prefix, name) { + if(!!prefix) + return prefix + ":" + name; + return name; +}; + +HTMLSerializer.prototype._rjoin = function(prefix, name) { + if(!!name) + return prefix + ":" + name; + return prefix; +}; + +HTMLSerializer.prototype._serializeElement = function(node) { + var self = this; + + var ns = node.getAttribute('x-ns'); + var nsPrefix = null; + var newNamespaces = []; + + var nsData = self._assignNamespace(node.getAttribute('x-ns')); + + if(nsData.fresh) { + newNamespaces.push(nsData); + self.stack.push({ + "type": NS_END, + "namespace": nsData + }); + } + + var tagName = self._join(nsData.prefix, node.getAttribute('x-node')); + + /* retrieve attributes */ + var attributeIDs = []; + for (var i = 0; i < node.attributes.length; i++) { + var attr = node.attributes.item(i); + + // check if name starts with "x-attr-name" + var m = attr.name.match(XATTR_RE); + if (m !== null) + attributeIDs.push(m[1]); + }; + + /* print out */ + if (getPadding(tagName)) + self.result += '\n'; + + self.result += '<' + tagName; + + $.each(attributeIDs, function() { + var nsData = self._assignNamespace(node.getAttribute('x-attr-ns-'+this)); + + if(nsData.fresh) { + newNamespaces.push(nsData); + self.stack.push({ + "type": NS_END, + "namespace": nsData + }); + }; + + self.result += ' ' + self._join(nsData.prefix, node.getAttribute('x-attr-name-'+this)); + self.result += '="'+node.getAttribute('x-attr-value-'+this) +'"'; + }); + + /* print new namespace declarations */ + $.each(newNamespaces, function() { + self.result += " " + self._rjoin("xmlns", this.prefix); + self.result += '="' + this.uri + '"'; + }); + + if (node.childNodes.length > 0) { + self.result += ">"; + self._pushTagEnd(tagName); + self._pushChildren(node); + } + else { + self.result += "/>"; + }; +}; + +function html2text(params) { + try { + var s = new HTMLSerializer(); + params.success( s.serialize(params.element, params.stripOuter) ); + } catch(e) { + params.error("Nie udało się zserializować tekstu:" + e) + } +} \ No newline at end of file diff --git a/redakcja/static/xsl/wl2html_client.xsl b/redakcja/static/xsl/wl2html_client.xsl new file mode 100644 index 00000000..6dd50806 --- /dev/null +++ b/redakcja/static/xsl/wl2html_client.xsl @@ -0,0 +1,810 @@ + + + + + + + + + + + + + + + + +
    + + + + +
    +
    + + + + + + + +
    + + + + +
    +
    + + + +
    + + + + +
    +
    + + + +
    + + + + +
    +
    + + + +
    + + + + +
    +
    + + + + + + +

    + + + + + +

    +
    + + + + +

    + + + + + +

    +
    + + + + +

    + + + + + +

    +
    + + + + +

    + + + + + +

    +
    + + + + + +
    + + + + +
    +
    + + + + +
    + + + + +
    +
    + + + + +
    +
    + + + + +
    + + + +
    +
    + + + + + + + + + + +

    + + + + + +

    +
    + + + + + + + + +
    + + + + +
    +
    + + + +

    + + + + + +

    +
    + + + +

    + + + + + +

    +
    + + + + +

    + + + + + +

    +
    + + + + + + + +

    + + + + + +

    +
    + + + + +

    + + + + + +

    +
    + + + + +

    + + + + + +

    +
    + + + + + +

    + + + + + +

    +
    + + + +

    + + + + + +

    +
    + + + + + +

    + + + + + +

    +
    + + + +

    + + + + + +

    +
    + + + + + +
    + + + + +
    +
    + + + +
    + + + + +
    +
    + + + +
    + + + + +
    +
    + + + +
    + + + + +
    +
    + + + +
    + + + + +
    +
    + + + +
    + + + + +
    +
    + + + + + +

    + + + + + +

    +
    + + + +

    + + + + + +

    +
    + + + +

    + + + + + +

    +
    + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + +

    + + + +

    +
    + + + + + + +
    +
    + + + + +

    + + + + +

    + +
    + + / + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    +
    + + + +
    +
    + + + +
    +
    + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    \ No newline at end of file diff --git a/redakcja/templates/404.html b/redakcja/templates/404.html new file mode 100644 index 00000000..72d18758 --- /dev/null +++ b/redakcja/templates/404.html @@ -0,0 +1,69 @@ + + + + + Platforma Redakcyjna + + + +
    +

    + + + Nie odnaleziono strony

    +

    Strona o podanym przez ciebie adresie:

    +
    {{request.build_absolute_uri}}
    +

    nie instnieje.

    +
      +
    • Sprawdź, czy adres nie zawiera literówek, np: + bog_mnie_oposcil, zamiast bog_mnie_opuscil. +
    • +
    • + Upewnij się, że dokument do którego chcesz się dostać jest na + liście utworów. +
    • +
    +

    Jeśli nadal nie jesteś w stanie odszukać dokumentu, skontaktuj się + z administratorem.

    + + +
    +
+ + diff --git a/redakcja/templates/500.html b/redakcja/templates/500.html new file mode 100644 index 00000000..1774b5af --- /dev/null +++ b/redakcja/templates/500.html @@ -0,0 +1,56 @@ + + + + + Platforma Redakcyjna + + + +
+

+ + + Błąd po stronie serwera.

+

Niestety nasz serwer WWW nie był w stanie dostarczyć Ci strony o którą prosiłeś.

+

Serdecznie przepraszamy.

+

Administrator został już powiadomiony o błędzie, ale jeśli chciałbyś + przekazać nam więcej informacji na temat błędu, napisz nasz adres.

+
+
+ + diff --git a/redakcja/templates/503.html b/redakcja/templates/503.html new file mode 100644 index 00000000..7f852762 --- /dev/null +++ b/redakcja/templates/503.html @@ -0,0 +1,56 @@ + + + + + Platforma Redakcyjna + + + +
+

+ + + Serwis tymczasowo niedostępny

+

Platfroma redakcyjna serwisu wolnelektury.pl jest + tymczasowo niedostępna z powodu prac administracyjnych. +

+

Prosimy o wyrozumiałość i ponowne odwiedziny.

+
+
+ + diff --git a/redakcja/templates/admin/index.html b/redakcja/templates/admin/index.html new file mode 100644 index 00000000..45de219d --- /dev/null +++ b/redakcja/templates/admin/index.html @@ -0,0 +1,83 @@ +{% extends "admin/base_site.html" %} +{% load i18n %} + +{% block extrastyle %}{{ block.super }}{% endblock %} + +{% block coltype %}colMS{% endblock %} + +{% block bodyclass %}dashboard{% endblock %} + +{% block breadcrumbs %}{% endblock %} + +{% block content %} +
+ +{% if app_list %} + + {% include "filebrowser/append.html" %} + + {% for app in app_list %} +
+ + + {% for model in app.models %} + + {% if model.perms.change %} + + {% else %} + + {% endif %} + + {% if model.perms.add %} + + {% else %} + + {% endif %} + + {% if model.perms.change %} + + {% else %} + + {% endif %} + + {% endfor %} +
{% blocktrans with app.name as name %}{{ name }}{% endblocktrans %}
{{ model.name }}{{ model.name }}{% trans 'Add' %} {% trans 'Change' %} 
+
+ {% endfor %} +{% else %} +

{% trans "You don't have permission to edit anything." %}

+{% endif %} +
+{% endblock %} + +{% block sidebar %} + +{% endblock %} diff --git a/redakcja/templates/base.html b/redakcja/templates/base.html new file mode 100644 index 00000000..ac728d06 --- /dev/null +++ b/redakcja/templates/base.html @@ -0,0 +1,17 @@ + + + + + {% block title %}Platforma Redakcyjna{% block subtitle %}{% endblock subtitle %}{% endblock title%} + {% block extrahead %} + {% endblock %} + + +
+
{% block maincontent %} {% endblock %}
+
+ + {% block extrabody %}{% endblock %} + + diff --git a/redakcja/templates/registration/head_login.html b/redakcja/templates/registration/head_login.html new file mode 100644 index 00000000..f051213a --- /dev/null +++ b/redakcja/templates/registration/head_login.html @@ -0,0 +1,11 @@ +{% load i18n %} + +{% if user.is_authenticated %} +{{ user.username }} | +{% trans "Log Out" %} +{% else %} +{% url login as login_url %} +{% ifnotequal login_url request.path %} + {% trans "Log In" %} +{% endifnotequal %} +{% endif %} diff --git a/redakcja/templates/registration/login.html b/redakcja/templates/registration/login.html new file mode 100644 index 00000000..e4b0897c --- /dev/null +++ b/redakcja/templates/registration/login.html @@ -0,0 +1,15 @@ +{% extends "base.html" %} + +{% block subtitle %} - Logowanie {% endblock subtitle %} + +{% block maincontent %} + +
+
+{{ form.as_p }} +

+ +
+
+ +{% endblock maincontent %} diff --git a/redakcja/urls.py b/redakcja/urls.py new file mode 100644 index 00000000..904ad447 --- /dev/null +++ b/redakcja/urls.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- + +from django.conf.urls.defaults import * +from django.contrib import admin +from django.conf import settings + +admin.autodiscover() + +urlpatterns = patterns('', + # Auth + url(r'^accounts/login/$', 'django_cas.views.login', name='login'), + url(r'^accounts/logout/$', 'django_cas.views.logout', name='logout'), + + # Admin panel + (r'^admin/filebrowser/', include('filebrowser.urls')), + url(r'^admin/doc/', include('django.contrib.admindocs.urls')), + (r'^admin/', include(admin.site.urls)), + + # Static files (should be served by Apache) + url(r'^%s(?P.+)$' % settings.MEDIA_URL[1:], 'django.views.static.serve', + {'document_root': settings.MEDIA_ROOT, 'show_indexes': True}), + url(r'^%s(?P.+)$' % settings.ADMIN_MEDIA_PREFIX[1:], 'django.views.static.serve', + {'document_root': settings.MEDIA_ROOT, 'show_indexes': True}), + url(r'^%s(?P.+)$' % settings.STATIC_URL[1:], 'django.views.static.serve', + {'document_root': settings.STATIC_ROOT, 'show_indexes': True}), + + url(r'^$', 'django.views.generic.simple.redirect_to', {'url': '/documents/'}), + url(r'^documents/', include('wiki.urls')), +) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..d247c761 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,20 @@ +## Python libraries +lxml>=2.2 +mercurial>=1.3.1 +PyYAML>=3.0 +PIL>=1.1 + +## Book conversion library +git+git://github.com/fnp/librarian.git@master#egg=librarian + +## Django +Django>=1.1.1,<1.2 +sorl-thumbnail>=3.2 +django-maintenancemode>=0.9 + +# migrations +south>=0.6 + +## Debugging utils, uncomment this if you want tests +# django-nose>=0.0.3 +# django-debug-toolbar>=0.8 \ No newline at end of file diff --git a/setup.py b/setup.py deleted file mode 100644 index 199329ec..00000000 --- a/setup.py +++ /dev/null @@ -1,109 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -import os -from distutils.core import setup - -RESOURCE_PATHS = ('templates', 'static', 'media', 'locale', 'config') - - -def is_package(path): - return os.path.isdir(path) \ - and os.path.isfile(os.path.join(path, '__init__.py')) - - -def find_packages(path, base=""): - """ Find all packages in path """ - packages = {} - for item in os.listdir(path): - dir = os.path.join(path, item) - if is_package(dir): - if base: - module_name = "%(base)s.%(item)s" % vars() - else: - module_name = item - packages[module_name] = dir - packages.update(find_packages(dir, module_name)) - return packages - - -def files_from(*paths, **kwargs): - base = kwargs.pop('base') - - def generator(): - for path in paths: - path = os.path.join(base, path) - if not os.path.isdir(path) or is_package(path): - continue - - for dir, _, files in os.walk(path): - for file in files: - yield os.path.relpath(os.path.join(dir, file), base) - - return list(generator()) - - -def django_setup(project, apps=[], apps_dir='apps', package_dir={}, packages=[], package_data={}, **kwargs): - - # directories - extra_dirs = dict((app, os.path.join(apps_dir, app)) for app in apps) - extra_dirs[project] = project - package_dir.update(extra_dirs) - - # applications - packages.extend(apps) - # with all subpackages - for app in apps: - packages.extend(find_packages(os.path.join(apps_dir, app), base=app)) - # and the project - packages.append(project) - - # extra data - extra_data = {} - for app in apps: - extra_data[app] = files_from(*RESOURCE_PATHS, base=os.path.join(apps_dir, app)) - extra_data[project] = files_from(*RESOURCE_PATHS, base=project) - package_data.update(extra_data) - - return setup( - package_dir=package_dir, - packages=packages, - package_data=package_data, **kwargs) - - -# -# The real stuff :) -# -django_setup( - name='fnp-redakcja', - version='1.1', - description='IDE for developing books.', - author="Fundacja Nowoczesna Polska", - author_email='fundacja@nowoczesnapolska.org.pl', - license="GNU Affero General Public License 3", - maintainer='Łukasz Rekucki', - maintainer_email='lrekucki@gmail.com', - url='http://github.com/fnp/redakcja', - package_dir={'': 'lib'}, - py_modules=[ - 'wlapi', - 'vstorage', - ], - scripts=[ - 'scripts/crop.py', - 'scripts/imgconv.py', - ], - # django applications - project='platforma', - apps_dir='apps', - apps=[ - 'compress', - 'django_cas', - 'filebrowser', - 'toolbar', - 'wiki', - ], - requires=[ - "librarian (>=1.3)", - "Django (>=1.1.1,<1.2)", - ])