diff --git a/FlaskHandlerExamples.py b/FlaskHandlerExamples.py deleted file mode 100644 index d045579..0000000 --- a/FlaskHandlerExamples.py +++ /dev/null @@ -1,79 +0,0 @@ -@app.route('/loadconfig' , methods=['GET']) -def loadconfig(): - user=None - mode='text' - try: - user = request.args.get('userId') - mode = request.args.get('mode') - except HTTPException as err: - print("http error: {0}".format(err)) - except: - print('some error', sys.exc_info()[0]) - cfg=Dashboard(userId=user) - resp = make_response(json.dumps({'plugs':cfg.plugs.listAsText()})) - resp.headers['Content-type'] = 'application/json; charset=utf-8' - return resp - -@app.route('/loadPlugin' , methods=['GET']) -def loadPlugin(): - try: - plname = request.args.get('plugin') - params = request.args.get('parameters') - ClassType = getattr(Plugin, plname) - p = ClassType(params) - resp = make_response(json.dumps({'plugin':p.asHtml()})) - except HTTPException as err: - print("http error: {0}".format(err)) - resp = make_response(json.dumps({'plugin':err})) - except: - print('some error', sys.exc_info()[0]) - resp = make_response(json.dumps({'plugin':'System error loading plugin'})) - resp.headers['Content-type'] = 'application/json; charset=utf-8' - return resp - -@app.route('/saveplugs' , methods=['POST']) -def saveplugs(): - user=request.form['userId'] - mode=request.form['mode'] - plugs=request.form['plugs'] - cfg=Dashboard(userId=user) - cfg.updatePlugs(plugs) - cfg.save() - resp = make_response(json.dumps({'plugs':cfg.plugs.listAsText()})) - resp.headers['Content-type'] = 'application/json; charset=utf-8' - return resp - -@app.route('/json', methods=['GET']) -def myjson(): - user=request.form['userId'] - resp = make_response(json.dumps({'plugs':'user'})) - resp.headers['Content-type'] = 'application/json; charset=utf-8' - return resp - -@app.route('/upload', methods=['GET']) -def upload(): - resp = make_response('function upload') - resp.headers['Content-type'] = 'text/plain; charset=utf-8' - if request.method == 'GET': - try: - f = request.args.get('user') - print(f) - except HTTPException as err: - print("http error: {0}".format(err)) - except: - print('some error', sys.exc_info()[0]) - return resp - -@app.route('/echo' , methods=['GET']) -def echo(): - text=None - try: - text = request.args.get('text') - except HTTPException as err: - print("http error: {0}".format(err)) - except: - print('some error', sys.exc_info()[0]) - resp = make_response(text) - resp.headers['Content-type'] = 'text/plain; charset=utf-8' - return resp - diff --git a/README.md b/README.md index 1e8f357..c07c637 100644 --- a/README.md +++ b/README.md @@ -138,5 +138,3 @@ The rewrite removes the immediately exploitable SQL interpolation and browser-co - rate-limit state is local to one host. Use a strong unique password made only of Base64-compatible characters, bind Waitress to localhost, and expose it only through an authenticated HTTPS reverse proxy. Set stable provisioning and Flask secrets before deployment. - -The old `Services.py`, `SecretServices.py`, and ad-hoc root-level scripts are retained as historical migration references. Do not run them against production data without reviewing them first. diff --git a/SecretServices.py b/SecretServices.py deleted file mode 100644 index f18c470..0000000 --- a/SecretServices.py +++ /dev/null @@ -1,315 +0,0 @@ -#################### -# -# file is replaced by FlowerServices.py -# -1= # intentional python syntax error -# -##################### - -from Crypto.Cipher import AES -from Crypto.Hash import MD5 -import base64 -from Log import Log -from Config import * -import pymysql as mdb - -#encryption stuff -SECRET='HSPh1O5vc6YY2Xt8jUxlTp' -BLOCK_SIZE = 32 -PADDING='_' -# one-liner to sufficiently pad the text to be encrypted -pad = lambda s: s + (BLOCK_SIZE - len(s) % BLOCK_SIZE) * PADDING - -def md5(message): - hash = MD5.new() - hash.update(message.encode('utf-8')) - return hash.hexdigest() - - -class Flower(): - - def __init__(self, user, pwd): - self.db = 'Flowers' - self.db_username = user + '_' - self.db_password = md5(pwd) - - self.customer_table = self.db_username - self.cipher = AES.new(pad(SECRET + pwd)) - - def encode(self, s): - return str(base64.b64encode(self.cipher.encrypt(pad(s))).decode("utf-8")) - - def decode(self, e): - return str(self.cipher.decrypt(base64.b64decode(e)).decode("utf-8")).rstrip(PADDING) - - def add(self, organization, myname, myid, secret, deleted=0, timestamp=None): - ''' POST a new flower - ''' - if len(organization)>MINFIELDLEN and len(myid)>MINFIELDLEN and len(secret)>MINFIELDLEN: - sql = "INSERT INTO {} (organization ,myID ,myName ,mySecret, deleted) VALUES ('{}', '{}', '{}', '{}', {})".format(self.customer_table, organization, self.encode(myid), self.encode(myname), self.encode(secret), deleted) - if timestamp is not None: - sql = "INSERT INTO {} (organization ,myID ,myName ,mySecret, deleted, dateCreated) VALUES ('{}', '{}', '{}', '{}', {}, '{}')".format(self.customer_table, organization, self.encode(myid), self.encode(myname), self.encode(secret), deleted, timestamp) - result, data = self.do_db_commit(sql) - Log.debug(result) - if result==1: - return {'organization': organization, 'dateCreated': 'STORED', 'myID': myid, 'myName': myname,'mySecret': secret} - return {'organization': organization, 'dateCreated': 'FAILED', 'myID': myid, 'myName': myname,'mySecret': secret} - - - def all(self, isdeleted=0): - ''' GET flowers list - ''' - #sql = "SELECT organization, myID, myName, dateCreated FROM %s " % (self.customer_table) - sql = """ - select uniqueflowers.organization, uniqueflowers.myID, uniqueflowers.dateCreated from {0} as uniqueflowers - inner join ( - select organization, max(dateCreated) as lastCreated from {0} group by organization order by dateCreated DESC) allflowers - on allflowers.organization=uniqueflowers.organization and lastCreated=uniqueflowers.dateCreated where uniqueflowers.deleted={1} - """.format(self.customer_table, isdeleted) - result, data = self.do_db_allrows(sql) - #Log.debug(sql_result) - all_flowers=[] - if result==1: - for row in data: - all_flowers.append({'organization': str(row[0]), 'myID': self.decode(row[1]), 'dateCreated': str(row[2])}) - return all_flowers - - - - def one(self, organization, datetimestamp ): - ''' flower for user, org and datetime - ''' - result = -1 - secret = ':-(' - sql = "SELECT mySecret, myID, myName FROM %s where organization='%s' and dateCreated='%s' order by dateCreated DESC limit 1" % (self.customer_table, organization, datetimestamp) - result, data = self.do_db_1row(sql) - if result == 1: - return {'organization': organization, 'dateCreated': datetimestamp, 'myID': self.decode(data[1]), 'myName': self.decode(data[2]),'mySecret': self.decode(data[0])} - return {'organization': organization, 'dateCreated': datetimestamp, 'myID': '', 'myName': '','mySecret': '-- Not found --'} - - - def deactivate(self, organization, datetimestamp ): - ''' flower for user, org and datetime - ''' - result = -1 - secret = ':-(' - sql = "update {} set deleted=1 where organization='{}' and dateCreated='{}' ".format(self.customer_table, organization, datetimestamp) - result, data = self.do_db_commit(sql) - if result == 1: - secret = '- DELETED -' - return {'organization': organization, 'dateCreated': datetimestamp, 'myID': '', 'myName': '','mySecret': secret} - - def empty(self): - ''' empty flower - ''' - return {'organization': '', 'dateCreated': '', 'myID': '', 'myName': '','mySecret': ''} - - - def numberOfEntries(self): - ''' GET login info, check if its valid - ''' - sql = "SELECT count(*) FROM {};".format(self.customer_table) - result, data = self.do_db_1row(sql) - if result == 1: - return(data[0]) - return -1 - - - def update_pwd(self, new_pwd): - newcipher = AES.new(pad(SECRET + new_pwd)) - - def new_encode(s): - return str(base64.b64encode(newcipher.encrypt(pad(s))).decode("utf-8")) - - end_result = "ERROR updating hushes\n" - sql = """ - select myID, myName, mySecret, organization, dateCreated from {0}""".format(self.customer_table) - result, data = self.do_db_allrows(sql) - # Log.debug(sql_result) - if result == 1: - # convert all hushes - sql = "" - for row in data: - sql += "update {} set myID='{}', myName='{}', mySecret='{}' where organization='{}' and dateCreated='{}';\n".\ - format(self.customer_table, - new_encode(self.decode(row[0])), - new_encode(self.decode(row[1])), - new_encode(self.decode(row[2])),row[3], row[4]) - - result, data = self.do_db_commit(sql) - if result == 1: - end_result = "ERROR updating user-password\n" - # update the password of the user - sql = "SET PASSWORD FOR '{}'@'localhost' = PASSWORD('{}'); ".format(self.db_username, md5(new_pwd)) - result, data = self.do_db_commit(sql) - if result == 1: - end_result = "SUCCESSFULLY updated, now login again\n" - return end_result - - - def do_db_commit(self, sql): - Log.debug('INSc: '+sql) - result = 0 - data = '' - con = None - try: - con = mdb.connect(host='localhost', passwd=self.db_password, user=self.db_username, db=self.db); - cur = con.cursor() - if ";\n" in sql: - for s in sql.split(";\n"): - if len(s)>1: - cur.execute(s) - else: - cur.execute(sql) - cur.close() - con.commit() - result = 1 - except mdb.Error as e: - m = "Error %d: %s" % (e.args[0],e.args[1]) - data = {'message': m} - Log.debug(m) - result = -1 - finally: - if con: - con.close() - return result, data - - - def do_db_1row(self, sql): - Log.debug('1row sql: '+sql) - result = 0 - con = None - try: - con = mdb.connect(host='localhost', passwd=self.db_password, user=self.db_username, db=self.db); - cur = con.cursor() - cur.execute(sql) - data = cur.fetchone() - if data: - result = 1 - except mdb.Error as e: - m = "Error %d: %s" % (e.args[0],e.args[1]) - data = {'message': m} - Log.debug(m) - result = -1 - finally: - if con: - con.close() - return result, data - - def do_db_allrows(self, sql): - Log.debug('all rows sql: '+sql) - result = 0 - con = None - try: - con = mdb.connect(host='localhost', passwd=self.db_password, user=self.db_username, db=self.db); - cur = con.cursor() - cur.execute(sql) - data = cur.fetchall() - if data: - result = 1 - except mdb.Error as e: - m = "Error %d: %s" % (e.args[0],e.args[1]) - data = {'message': m} - Log.debug(m) - result = -1 - finally: - if con: - con.close() - return result, data - - -class SuperFlower(Flower): - - def __init__(self, customer, pwd): - super().__init__(customer, pwd) - self.customer_name = customer + '_' - self.customer_pwd = pwd - - self.db_username = 'flower' - self.db_password = md5('flower') - - def createNewTable(self): - # create new table and user - sql = """ - CREATE TABLE `{}` ( - `organization` varchar(80) NOT NULL, - `myID` varchar(129) NOT NULL, - `myName` varchar(129) NOT NULL, - `mySecret` varchar(65) NOT NULL, - `dateCreated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `deleted` int(11) DEFAULT '0', - PRIMARY KEY (`organization`,`dateCreated`) - ) ENGINE=InnoDB DEFAULT CHARSET=latin1;""".format(self.customer_table) - result, data = self.do_db_1row(sql) - if result < 0: - Log.info("SQL ERROR:") - Log.info(data) - return 0 - - sql = """create user {}@localhost identified by '{}';""".format(self.customer_name, md5(self.customer_pwd)) - result, data = self.do_db_1row(sql) - if result < 0: - Log.info("SQL ERROR:") - Log.info(data) - return 0 - - sql = """grant select,update,insert on Flowers.{} to {}@localhost;""".format(self.customer_table, self.customer_name) - result, data = self.do_db_1row(sql) - if result < 0: - Log.info("SQL ERROR:") - Log.info(data) - return 0 - - self.flush_privs() - - return 1 - - def flush_privs(self): - sql = """flush privileges;""" - result, data = self.do_db_1row(sql) - if result < 0: - Log.info("SQL ERROR:") - Log.info(data) - return 0 - return 1 - - def migrate(self, old_customer_name): - OLDSECRET = 'HSPh1O5vc6YY2Xt8jUxlTpd*DZsjMMAH' - OLDCIPHER = AES.new(OLDSECRET) - old_DecodeAES = lambda e: str(OLDCIPHER.decrypt(base64.b64decode(e)).decode("utf-8")).rstrip(PADDING) - - def sql_datetime(datetime_type): - return datetime_type.strftime("%Y-%m-%d %H:%M:%S") - - end_result = "ERROR creting new table\n" - if self.createNewTable(): - - - end_result = "ERROR updating hushes\n" - sql = """ - select myID, myName, mySecret, organization, dateCreated, deleted from {0}""".format(old_customer_name) - # 0 1 2 3 4 5 - result, data = self.do_db_allrows(sql) - # Log.debug(sql_result) - if result == 1: - # convert all hushes - sql = "" - for row in data: - #sql += "insert {} set organization='{}', myID='{}', myName='{}', mySecret='{}', deleted={}, dateCreated='{}' where organization='{}' and dateCreated='{}';\n". \ - sql += "INSERT INTO {} (organization ,myID ,myName ,mySecret, deleted, dateCreated) VALUES ('{}', '{}', '{}', '{}', {}, '{}') ;\n".\ - format(self.customer_table, - row[3], - self.encode(row[0]), - self.encode(row[1]), - self.encode(old_DecodeAES(row[2])), - row[5], - sql_datetime(row[4])) - result, data = self.do_db_commit(sql) - if result == 1: - end_result = "SUCCESSFULLY updated, now login again\n" - return end_result - - - -if __name__ == '__main__': - print("this is a library, sorry dude") diff --git a/Services.py b/Services.py deleted file mode 100644 index 5f347a3..0000000 --- a/Services.py +++ /dev/null @@ -1,272 +0,0 @@ -#################### -# -# file is replaced by SecretServices.py -# -1= # intentional python syntax error -# -#################### - - -from Crypto.Cipher import AES -from Crypto.Hash import MD5 -import base64 -import os, time, re, sys -from Log import Log -from Config import * -import json -import pymysql as mdb -import datetime -import hashlib - - - -#encryption stuff -SECRET='HSPh1O5vc6YY2Xt8jUxlTpd*DZsjMMAH' -BLOCK_SIZE = 32 -PADDING='_' -# one-liner to sufficiently pad the text to be encrypted -pad = lambda s: s + (BLOCK_SIZE - len(s) % BLOCK_SIZE) * PADDING -# one-liners to encrypt/encode and decrypt/decode a string -# encrypt with AES, encode with base64 -CIPHER = AES.new(SECRET) -EncodeAES = lambda s: str(base64.b64encode(CIPHER.encrypt(pad(s))).decode("utf-8")) -DecodeAES = lambda e: str(CIPHER.decrypt(base64.b64decode(e)).decode("utf-8")).rstrip(PADDING) - -def md5(message): - hash = MD5.new() - hash.update(message.encode('utf-8')) - return hash.hexdigest() - - - -class Flower(): - - def __init__(self, user, pwd): - self.database = 'Flowers' - self.table = user - self.username = user - self.password = md5(pwd) - - - def add(self, organization, myname, myid, secret): - ''' POST a new flower - ''' - if len(organization)>MINFIELDLEN and len(myid)>MINFIELDLEN and len(secret)>MINFIELDLEN: - sql = "INSERT INTO {} (organization ,myID ,myName ,mySecret, deleted) VALUES ('{}', '{}', '{}', '{}', 0)".format(self.table, organization, myid, myname, EncodeAES(secret)) - result, data = self.do_db_commit(sql) - Log.debug(result) - if result==1: - return {'organization': organization, 'dateCreated': 'STORED', 'myID': myid, 'myName': myname,'mySecret': secret} - return {'organization': organization, 'dateCreated': 'FAILED', 'myID': myid, 'myName': myname,'mySecret': secret} - - - def all(self, isdeleted=0): - ''' GET flowers list - ''' - #sql = "SELECT organization, myID, myName, dateCreated FROM %s " % (self.table) - sql = """ - select uniqueflowers.organization, uniqueflowers.myID, uniqueflowers.dateCreated from {0} as uniqueflowers - inner join ( - select organization, max(dateCreated) as lastCreated from {0} group by organization order by dateCreated DESC) allflowers - on allflowers.organization=uniqueflowers.organization and lastCreated=uniqueflowers.dateCreated where uniqueflowers.deleted={1} - """.format(self.table, isdeleted) - result, data = self.do_db_allrows(sql) - #Log.debug(sql_result) - all_flowers=[] - if result==1: - for row in data: - all_flowers.append({'organization': str(row[0]), 'myID': str(row[1]), 'dateCreated': str(row[2])}) - return all_flowers - - - - def one(self, organization, datetimestamp ): - ''' flower for user, org and datetime - ''' - result = -1 - secret = ':-(' - sql = "SELECT mySecret, myID, myName FROM %s where organization='%s' and dateCreated='%s' order by dateCreated DESC limit 1" % (self.table, organization, datetimestamp) - result, data = self.do_db_1row(sql) - if result == 1: - secret = DecodeAES(data[0]) - return {'organization': organization, 'dateCreated': datetimestamp, 'myID': data[1], 'myName': data[2],'mySecret': secret} - - def deactivate(self, organization, datetimestamp ): - ''' flower for user, org and datetime - ''' - result = -1 - secret = ':-(' - sql = "update %s set deleted=1 where organization='%s' and dateCreated='%s' " % (self.table, organization, datetimestamp) - result, data = self.do_db_commit(sql) - if result == 1: - secret = '- DELETED -' - return {'organization': organization, 'dateCreated': datetimestamp, 'myID': '', 'myName': '','mySecret': secret} - - def empty(self): - ''' empty flower - ''' - return {'organization': '', 'dateCreated': '', 'myID': '', 'myName': '','mySecret': ''} - - - - - - - - - def numberOfEntries(self): - ''' GET login info, check if its valid - ''' - sql = "SELECT count(*) FROM {};".format(self.table) - result, data = self.do_db_1row(sql) - if result == 1: - return(data[0]) - return -1 - - def do_db_commit(self, sql): - Log.debug('INSc: '+sql) - result = 0 - data = '' - con = None - try: - con = mdb.connect(host='localhost', passwd=self.password, user=self.username, db=self.database); - cur = con.cursor() - cur.execute(sql) - con.commit() - cur.close() - result = 1 - except mdb.Error as e: - m = "Error %d: %s" % (e.args[0],e.args[1]) - data = {'message': m} - Log.debug(m) - result = -1 - finally: - if con: - con.close() - return result, data - - - def do_db_1row(self, sql): - Log.debug('1row sql: '+sql) - result = 0 - con = None - try: - con = mdb.connect(host='localhost', passwd=self.password, user=self.username, db=self.database); - cur = con.cursor() - cur.execute(sql) - data = cur.fetchone() - if data: - result = 1 - except mdb.Error as e: - m = "Error %d: %s" % (e.args[0],e.args[1]) - data = {'message': m} - Log.debug(m) - result = -1 - finally: - if con: - con.close() - return result, data - - def do_db_allrows(self, sql): - Log.debug('all rows sql: '+sql) - result = 0 - con = None - try: - con = mdb.connect(host='localhost', passwd=self.password, user=self.username, db=self.database); - cur = con.cursor() - cur.execute(sql) - data = cur.fetchall() - if data: - result = 1 - except mdb.Error as e: - m = "Error %d: %s" % (e.args[0],e.args[1]) - data = {'message': m} - Log.debug(m) - result = -1 - finally: - if con: - con.close() - return result, data - - -class SuperFlower(Flower): - - def __init__(self, user, pwd): - self.database = 'Flowers' - self.table = user - self.table_hush = pwd - self.username = 'flower' - self.password = md5('flower') - - def createNewTable(self): - # create new table and user - sql = """ - CREATE TABLE `{0}` ( - `organization` varchar(50) NOT NULL, - `myID` varchar(50) NOT NULL, - `myName` varchar(50) NOT NULL, - `mySecret` varchar(50) NOT NULL, - `dateCreated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `deleted` int(11) DEFAULT '0', - PRIMARY KEY (`organization`,`dateCreated`) - ) ENGINE=InnoDB DEFAULT CHARSET=latin1;""".format(self.table) - result, data = self.do_db_1row(sql) - if result < 0: - Log.info("SQL ERROR:") - Log.info(data) - return 0 - - sql = """create user {0}@localhost identified by '{1}';""".format(self.table, md5(self.table_hush)) - result, data = self.do_db_1row(sql) - if result < 0: - Log.info("SQL ERROR:") - Log.info(data) - return 0 - - sql = """grant select,update,insert on Flowers.{0} to {0}@localhost;""".format(self.table) - result, data = self.do_db_1row(sql) - if result < 0: - Log.info("SQL ERROR:") - Log.info(data) - return 0 - - sql = """flush privileges;""" - result, data = self.do_db_1row(sql) - if result < 0: - Log.info("SQL ERROR:") - Log.info(data) - return 0 - - return 1 - - - def re_hush(self, new_hush): - - - end_result = "Starting Rehush\n" - sql = """ - select mySecret, organization, dateCreated from {0}""".format(self.table) - result, data = self.do_db_allrows(sql) - # Log.debug(sql_result) - if result == 1: - # convert all hushes - sql = "" - for row in data: - old_hush = DecodeAES(row[0]) - sql += "update {} set mySecret='{}' where organization='{}' and dateCreated='{}';\n".format(self.table, md5(old_hush), row[1], row[2]) - result, data = self.do_db_commit(sql) - if result == 1: - end_result = "Finished Rehush\n" - end_result = "Starting update user password\n" - # update the password of the user - sql = "SET PASSWORD FOR '{}'@'localhost' = PASSWORD(md5(secret));\n".format(self.table) - sql += "flush privileges;" - result, data = self.do_db_commit(sql) - if result == 1: - end_result = "Finished update user password\n" - - - - -if __name__ == '__main__': - print("this is a library, sorry dude") diff --git a/__pycache__/AccessControl.cpython-313.pyc b/__pycache__/AccessControl.cpython-313.pyc deleted file mode 100644 index b4c14bf..0000000 Binary files a/__pycache__/AccessControl.cpython-313.pyc and /dev/null differ diff --git a/__pycache__/Config.cpython-313.pyc b/__pycache__/Config.cpython-313.pyc deleted file mode 100644 index 26e3018..0000000 Binary files a/__pycache__/Config.cpython-313.pyc and /dev/null differ diff --git a/__pycache__/FlowerServices.cpython-313.pyc b/__pycache__/FlowerServices.cpython-313.pyc deleted file mode 100644 index d9e7a2b..0000000 Binary files a/__pycache__/FlowerServices.cpython-313.pyc and /dev/null differ diff --git a/__pycache__/Log.cpython-313.pyc b/__pycache__/Log.cpython-313.pyc deleted file mode 100644 index cd1d186..0000000 Binary files a/__pycache__/Log.cpython-313.pyc and /dev/null differ diff --git a/__pycache__/flower_vase.cpython-313.pyc b/__pycache__/flower_vase.cpython-313.pyc deleted file mode 100644 index 7e135f3..0000000 Binary files a/__pycache__/flower_vase.cpython-313.pyc and /dev/null differ diff --git a/__pycache__/flowers.cpython-313.pyc b/__pycache__/flowers.cpython-313.pyc deleted file mode 100644 index 818c1c3..0000000 Binary files a/__pycache__/flowers.cpython-313.pyc and /dev/null differ diff --git a/apache.conf b/apache.conf deleted file mode 100644 index 5d2793d..0000000 --- a/apache.conf +++ /dev/null @@ -1,9 +0,0 @@ - WSGIDaemonProcess flowers user=www-data group=www-data threads=5 - WSGIScriptAlias /flowers /usr/share/projects/Flowers/flowers.wsgi - - - WSGIProcessGroup flowers - WSGIApplicationGroup %{GLOBAL} - Order deny,allow - Allow from all - diff --git a/client/Daisy.py b/client/Daisy.py deleted file mode 100644 index 9fceb62..0000000 --- a/client/Daisy.py +++ /dev/null @@ -1,17 +0,0 @@ - - -import kivy -kivy.require('1.0.6') # replace with your current kivy version ! - -from kivy.app import App -from kivy.uix.label import Label - - -class MyApp(App): - - def build(self): - return Label(text='Hello world') - - -if __name__ == '__main__': - MyApp().run() \ No newline at end of file diff --git a/client/test b/client/test deleted file mode 100644 index 7609ebe..0000000 --- a/client/test +++ /dev/null @@ -1,7 +0,0 @@ -import requests - -r = requests.post('http://0.0.0.0:8080/app', data = {'name':'piet', 'password': 'piet', 'action': 'list'}) -#r = requests.post('http://0.0.0.0:8080/app', data = {'name':'ignace', 'password': 'white', 'action': 'one', 'dateCreated': '2018-05-30 21:18:00', 'organization': 'https://mijntele2.tele2.nl/'}) -#r = requests.post('http://0.0.0.0:8080/app', data = {'name':'ignace', 'password': 'white', 'action': 'save'}) -#r = requests.post('http://0.0.0.0:8080/app', data = {'name':'ignace', 'password': 'white', 'action': 'list'}) -# print(r.text) \ No newline at end of file diff --git a/dumpl.py b/dumpl.py deleted file mode 100644 index 6368300..0000000 --- a/dumpl.py +++ /dev/null @@ -1,54 +0,0 @@ -# from flask import Flask -from Config import * -import sys -import datetime -from SecretServices import Flower,SuperFlower -from AccessControl import Access -import json -# from flask import Flask, request, session, g, redirect, url_for, abort, render_template, flash, json, make_response -# from werkzeug.exceptions import HTTPException - - -newuser = 'ignace' -newhush = 'black' - -# login db with generic user -# f = SuperFlower(newuser, newhush) -# if f.createNewTable(): - # login as new user - # u = Flower(newuser, newhush) -# add one line -#u.add('Demo organisation', 'Demo name', 'Demo login', 'Demo hush') -# read one line - -#create user -# login db with generic user -# f = SuperFlower(newuser, newhush) -# if f.createNewTable(): -# # login as new user -# u = Flower(newuser, newhush) -# # add one line -# u.add('Demo organisation', 'Demo name', 'Demo login', 'Demo hush') - - - - -# retrieve all flowers -# u = Flower(newuser, newhush) -# flowers=u.all() -# print(flowers) - - -# retrieve one flowers -# u = Flower(newuser, newhush) -# flower=u.one('ah', '2003-03-17 17:30:27') -# print(flower) - - -# dump all flowers with pwds -u = Flower(newuser, newhush) -flowers=u.all() -for f in flowers: - flower = u.one(f['organization'], f['dateCreated']) - print('"{}","{}","{}","{}","{}",'.format(flower['organization'],flower['dateCreated'],flower['myID'],flower['myName'],flower['mySecret'])) - diff --git a/flower_vase.py b/flower_vase.py index 907509e..a71ca37 100644 --- a/flower_vase.py +++ b/flower_vase.py @@ -122,7 +122,7 @@ def _vault_from_session() -> Flower | None: return None -def _login_page(name="Welcome back", password="Enter your vault password", status=200): +def _login_page(name="Welcome back", password="Enter your bouquet password", status=200): return render_template( "index.html", name_suggestion=name, pwd_suggestion=password ), status @@ -145,7 +145,7 @@ def application(): "list.html", flowers=vault.all(), filter=selected_filter ) except StorageError: - flash("The vault database could not complete that request.", "error") + flash("The bouquet database could not complete that request.", "error") return redirect(url_for("flower_vase.index")) access = Access() @@ -207,7 +207,7 @@ def application(): if action == "rehush": return render_template("rehush.html") except StorageError: - flash("The vault database could not complete that request.", "error") + flash("The bouquet database could not complete that request.", "error") return redirect(url_for("flower_vase.index")) abort(400, description="Unknown action") @@ -254,10 +254,10 @@ def create(): Flower(username, password).add( "Demo organisation", "Demo name", "Demo login", "Demo secret" ) - flash("Your vault is ready. Sign in to continue.", "success") + flash("Your bouquet is ready. Sign in to continue.", "success") return redirect(url_for("flower_vase.index")) return render_template( - "create.html", message="The vault could not be created. Check the server log." + "create.html", message="The bouquet could not be created. Check the server log." ), 500 diff --git a/import.py b/import.py deleted file mode 100644 index b1f1921..0000000 --- a/import.py +++ /dev/null @@ -1,28 +0,0 @@ -from Config import * -import sys -import datetime -from FlowerServices import Flower,SuperFlower -from AccessControl import Access - -file1 = open('pins.csv', 'r') -Lines = file1.readlines() - -newuser = 'janine' -newhush = 'demaat196' - -# create user in the db. -f = SuperFlower(newuser, newhush) -if f.createNewTable(): - # login as new user - u = Flower(newuser, newhush) - - count = 0 - # Strips the newline character - for line in Lines: - count += 1 - line=line.strip() - print(line) - (org, date, id, name, pwd) = line.split('","',5) - org = org[1:] - pwd = pwd[:-2] - u.add(org, name, id, pwd, 0, date) diff --git a/static/Clouds.jpg b/static/Clouds.jpg deleted file mode 100644 index 26048b9..0000000 Binary files a/static/Clouds.jpg and /dev/null differ diff --git a/static/Edit-icon.png b/static/Edit-icon.png deleted file mode 100644 index 5ba7e60..0000000 Binary files a/static/Edit-icon.png and /dev/null differ diff --git a/static/MochiKit/Async.js b/static/MochiKit/Async.js deleted file mode 100644 index 6c5da15..0000000 --- a/static/MochiKit/Async.js +++ /dev/null @@ -1,682 +0,0 @@ -/*** - -MochiKit.Async 1.4.2 - -See for documentation, downloads, license, etc. - -(c) 2005 Bob Ippolito. All rights Reserved. - -***/ - -MochiKit.Base._deps('Async', ['Base']); - -MochiKit.Async.NAME = "MochiKit.Async"; -MochiKit.Async.VERSION = "1.4.2"; -MochiKit.Async.__repr__ = function () { - return "[" + this.NAME + " " + this.VERSION + "]"; -}; -MochiKit.Async.toString = function () { - return this.__repr__(); -}; - -/** @id MochiKit.Async.Deferred */ -MochiKit.Async.Deferred = function (/* optional */ canceller) { - this.chain = []; - this.id = this._nextId(); - this.fired = -1; - this.paused = 0; - this.results = [null, null]; - this.canceller = canceller; - this.silentlyCancelled = false; - this.chained = false; -}; - -MochiKit.Async.Deferred.prototype = { - /** @id MochiKit.Async.Deferred.prototype.repr */ - repr: function () { - var state; - if (this.fired == -1) { - state = 'unfired'; - } else if (this.fired === 0) { - state = 'success'; - } else { - state = 'error'; - } - return 'Deferred(' + this.id + ', ' + state + ')'; - }, - - toString: MochiKit.Base.forwardCall("repr"), - - _nextId: MochiKit.Base.counter(), - - /** @id MochiKit.Async.Deferred.prototype.cancel */ - cancel: function () { - var self = MochiKit.Async; - if (this.fired == -1) { - if (this.canceller) { - this.canceller(this); - } else { - this.silentlyCancelled = true; - } - if (this.fired == -1) { - this.errback(new self.CancelledError(this)); - } - } else if ((this.fired === 0) && (this.results[0] instanceof self.Deferred)) { - this.results[0].cancel(); - } - }, - - _resback: function (res) { - /*** - - The primitive that means either callback or errback - - ***/ - this.fired = ((res instanceof Error) ? 1 : 0); - this.results[this.fired] = res; - this._fire(); - }, - - _check: function () { - if (this.fired != -1) { - if (!this.silentlyCancelled) { - throw new MochiKit.Async.AlreadyCalledError(this); - } - this.silentlyCancelled = false; - return; - } - }, - - /** @id MochiKit.Async.Deferred.prototype.callback */ - callback: function (res) { - this._check(); - if (res instanceof MochiKit.Async.Deferred) { - throw new Error("Deferred instances can only be chained if they are the result of a callback"); - } - this._resback(res); - }, - - /** @id MochiKit.Async.Deferred.prototype.errback */ - errback: function (res) { - this._check(); - var self = MochiKit.Async; - if (res instanceof self.Deferred) { - throw new Error("Deferred instances can only be chained if they are the result of a callback"); - } - if (!(res instanceof Error)) { - res = new self.GenericError(res); - } - this._resback(res); - }, - - /** @id MochiKit.Async.Deferred.prototype.addBoth */ - addBoth: function (fn) { - if (arguments.length > 1) { - fn = MochiKit.Base.partial.apply(null, arguments); - } - return this.addCallbacks(fn, fn); - }, - - /** @id MochiKit.Async.Deferred.prototype.addCallback */ - addCallback: function (fn) { - if (arguments.length > 1) { - fn = MochiKit.Base.partial.apply(null, arguments); - } - return this.addCallbacks(fn, null); - }, - - /** @id MochiKit.Async.Deferred.prototype.addErrback */ - addErrback: function (fn) { - if (arguments.length > 1) { - fn = MochiKit.Base.partial.apply(null, arguments); - } - return this.addCallbacks(null, fn); - }, - - /** @id MochiKit.Async.Deferred.prototype.addCallbacks */ - addCallbacks: function (cb, eb) { - if (this.chained) { - throw new Error("Chained Deferreds can not be re-used"); - } - this.chain.push([cb, eb]); - if (this.fired >= 0) { - this._fire(); - } - return this; - }, - - _fire: function () { - /*** - - Used internally to exhaust the callback sequence when a result - is available. - - ***/ - var chain = this.chain; - var fired = this.fired; - var res = this.results[fired]; - var self = this; - var cb = null; - while (chain.length > 0 && this.paused === 0) { - // Array - var pair = chain.shift(); - var f = pair[fired]; - if (f === null) { - continue; - } - try { - res = f(res); - fired = ((res instanceof Error) ? 1 : 0); - if (res instanceof MochiKit.Async.Deferred) { - cb = function (res) { - self._resback(res); - self.paused--; - if ((self.paused === 0) && (self.fired >= 0)) { - self._fire(); - } - }; - this.paused++; - } - } catch (err) { - fired = 1; - if (!(err instanceof Error)) { - err = new MochiKit.Async.GenericError(err); - } - res = err; - } - } - this.fired = fired; - this.results[fired] = res; - if (cb && this.paused) { - // this is for "tail recursion" in case the dependent deferred - // is already fired - res.addBoth(cb); - res.chained = true; - } - } -}; - -MochiKit.Base.update(MochiKit.Async, { - /** @id MochiKit.Async.evalJSONRequest */ - evalJSONRequest: function (req) { - return MochiKit.Base.evalJSON(req.responseText); - }, - - /** @id MochiKit.Async.succeed */ - succeed: function (/* optional */result) { - var d = new MochiKit.Async.Deferred(); - d.callback.apply(d, arguments); - return d; - }, - - /** @id MochiKit.Async.fail */ - fail: function (/* optional */result) { - var d = new MochiKit.Async.Deferred(); - d.errback.apply(d, arguments); - return d; - }, - - /** @id MochiKit.Async.getXMLHttpRequest */ - getXMLHttpRequest: function () { - var self = arguments.callee; - if (!self.XMLHttpRequest) { - var tryThese = [ - function () { return new XMLHttpRequest(); }, - function () { return new ActiveXObject('Msxml2.XMLHTTP'); }, - function () { return new ActiveXObject('Microsoft.XMLHTTP'); }, - function () { return new ActiveXObject('Msxml2.XMLHTTP.4.0'); }, - function () { - throw new MochiKit.Async.BrowserComplianceError("Browser does not support XMLHttpRequest"); - } - ]; - for (var i = 0; i < tryThese.length; i++) { - var func = tryThese[i]; - try { - self.XMLHttpRequest = func; - return func(); - } catch (e) { - // pass - } - } - } - return self.XMLHttpRequest(); - }, - - _xhr_onreadystatechange: function (d) { - // MochiKit.Logging.logDebug('this.readyState', this.readyState); - var m = MochiKit.Base; - if (this.readyState == 4) { - // IE SUCKS - try { - this.onreadystatechange = null; - } catch (e) { - try { - this.onreadystatechange = m.noop; - } catch (e) { - } - } - var status = null; - try { - status = this.status; - if (!status && m.isNotEmpty(this.responseText)) { - // 0 or undefined seems to mean cached or local - status = 304; - } - } catch (e) { - // pass - // MochiKit.Logging.logDebug('error getting status?', repr(items(e))); - } - // 200 is OK, 201 is CREATED, 204 is NO CONTENT - // 304 is NOT MODIFIED, 1223 is apparently a bug in IE - if (status == 200 || status == 201 || status == 204 || - status == 304 || status == 1223) { - d.callback(this); - } else { - var err = new MochiKit.Async.XMLHttpRequestError(this, "Request failed"); - if (err.number) { - // XXX: This seems to happen on page change - d.errback(err); - } else { - // XXX: this seems to happen when the server is unreachable - d.errback(err); - } - } - } - }, - - _xhr_canceller: function (req) { - // IE SUCKS - try { - req.onreadystatechange = null; - } catch (e) { - try { - req.onreadystatechange = MochiKit.Base.noop; - } catch (e) { - } - } - req.abort(); - }, - - - /** @id MochiKit.Async.sendXMLHttpRequest */ - sendXMLHttpRequest: function (req, /* optional */ sendContent) { - if (typeof(sendContent) == "undefined" || sendContent === null) { - sendContent = ""; - } - - var m = MochiKit.Base; - var self = MochiKit.Async; - var d = new self.Deferred(m.partial(self._xhr_canceller, req)); - - try { - req.onreadystatechange = m.bind(self._xhr_onreadystatechange, - req, d); - req.send(sendContent); - } catch (e) { - try { - req.onreadystatechange = null; - } catch (ignore) { - // pass - } - d.errback(e); - } - - return d; - - }, - - /** @id MochiKit.Async.doXHR */ - doXHR: function (url, opts) { - /* - Work around a Firefox bug by dealing with XHR during - the next event loop iteration. Maybe it's this one: - https://bugzilla.mozilla.org/show_bug.cgi?id=249843 - */ - var self = MochiKit.Async; - return self.callLater(0, self._doXHR, url, opts); - }, - - _doXHR: function (url, opts) { - var m = MochiKit.Base; - opts = m.update({ - method: 'GET', - sendContent: '' - /* - queryString: undefined, - username: undefined, - password: undefined, - headers: undefined, - mimeType: undefined - */ - }, opts); - var self = MochiKit.Async; - var req = self.getXMLHttpRequest(); - if (opts.queryString) { - var qs = m.queryString(opts.queryString); - if (qs) { - url += "?" + qs; - } - } - // Safari will send undefined:undefined, so we have to check. - // We can't use apply, since the function is native. - if ('username' in opts) { - req.open(opts.method, url, true, opts.username, opts.password); - } else { - req.open(opts.method, url, true); - } - if (req.overrideMimeType && opts.mimeType) { - req.overrideMimeType(opts.mimeType); - } - req.setRequestHeader("X-Requested-With", "XMLHttpRequest"); - if (opts.headers) { - var headers = opts.headers; - if (!m.isArrayLike(headers)) { - headers = m.items(headers); - } - for (var i = 0; i < headers.length; i++) { - var header = headers[i]; - var name = header[0]; - var value = header[1]; - req.setRequestHeader(name, value); - } - } - return self.sendXMLHttpRequest(req, opts.sendContent); - }, - - _buildURL: function (url/*, ...*/) { - if (arguments.length > 1) { - var m = MochiKit.Base; - var qs = m.queryString.apply(null, m.extend(null, arguments, 1)); - if (qs) { - return url + "?" + qs; - } - } - return url; - }, - - /** @id MochiKit.Async.doSimpleXMLHttpRequest */ - doSimpleXMLHttpRequest: function (url/*, ...*/) { - var self = MochiKit.Async; - url = self._buildURL.apply(self, arguments); - return self.doXHR(url); - }, - - /** @id MochiKit.Async.loadJSONDoc */ - loadJSONDoc: function (url/*, ...*/) { - var self = MochiKit.Async; - url = self._buildURL.apply(self, arguments); - var d = self.doXHR(url, { - 'mimeType': 'text/plain', - 'headers': [['Accept', 'application/json']] - }); - d = d.addCallback(self.evalJSONRequest); - return d; - }, - - /** @id MochiKit.Async.wait */ - wait: function (seconds, /* optional */value) { - var d = new MochiKit.Async.Deferred(); - var m = MochiKit.Base; - if (typeof(value) != 'undefined') { - d.addCallback(function () { return value; }); - } - var timeout = setTimeout( - m.bind("callback", d), - Math.floor(seconds * 1000)); - d.canceller = function () { - try { - clearTimeout(timeout); - } catch (e) { - // pass - } - }; - return d; - }, - - /** @id MochiKit.Async.callLater */ - callLater: function (seconds, func) { - var m = MochiKit.Base; - var pfunc = m.partial.apply(m, m.extend(null, arguments, 1)); - return MochiKit.Async.wait(seconds).addCallback( - function (res) { return pfunc(); } - ); - } -}); - - -/** @id MochiKit.Async.DeferredLock */ -MochiKit.Async.DeferredLock = function () { - this.waiting = []; - this.locked = false; - this.id = this._nextId(); -}; - -MochiKit.Async.DeferredLock.prototype = { - __class__: MochiKit.Async.DeferredLock, - /** @id MochiKit.Async.DeferredLock.prototype.acquire */ - acquire: function () { - var d = new MochiKit.Async.Deferred(); - if (this.locked) { - this.waiting.push(d); - } else { - this.locked = true; - d.callback(this); - } - return d; - }, - /** @id MochiKit.Async.DeferredLock.prototype.release */ - release: function () { - if (!this.locked) { - throw TypeError("Tried to release an unlocked DeferredLock"); - } - this.locked = false; - if (this.waiting.length > 0) { - this.locked = true; - this.waiting.shift().callback(this); - } - }, - _nextId: MochiKit.Base.counter(), - repr: function () { - var state; - if (this.locked) { - state = 'locked, ' + this.waiting.length + ' waiting'; - } else { - state = 'unlocked'; - } - return 'DeferredLock(' + this.id + ', ' + state + ')'; - }, - toString: MochiKit.Base.forwardCall("repr") - -}; - -/** @id MochiKit.Async.DeferredList */ -MochiKit.Async.DeferredList = function (list, /* optional */fireOnOneCallback, fireOnOneErrback, consumeErrors, canceller) { - - // call parent constructor - MochiKit.Async.Deferred.apply(this, [canceller]); - - this.list = list; - var resultList = []; - this.resultList = resultList; - - this.finishedCount = 0; - this.fireOnOneCallback = fireOnOneCallback; - this.fireOnOneErrback = fireOnOneErrback; - this.consumeErrors = consumeErrors; - - var cb = MochiKit.Base.bind(this._cbDeferred, this); - for (var i = 0; i < list.length; i++) { - var d = list[i]; - resultList.push(undefined); - d.addCallback(cb, i, true); - d.addErrback(cb, i, false); - } - - if (list.length === 0 && !fireOnOneCallback) { - this.callback(this.resultList); - } - -}; - -MochiKit.Async.DeferredList.prototype = new MochiKit.Async.Deferred(); - -MochiKit.Async.DeferredList.prototype._cbDeferred = function (index, succeeded, result) { - this.resultList[index] = [succeeded, result]; - this.finishedCount += 1; - if (this.fired == -1) { - if (succeeded && this.fireOnOneCallback) { - this.callback([index, result]); - } else if (!succeeded && this.fireOnOneErrback) { - this.errback(result); - } else if (this.finishedCount == this.list.length) { - this.callback(this.resultList); - } - } - if (!succeeded && this.consumeErrors) { - result = null; - } - return result; -}; - -/** @id MochiKit.Async.gatherResults */ -MochiKit.Async.gatherResults = function (deferredList) { - var d = new MochiKit.Async.DeferredList(deferredList, false, true, false); - d.addCallback(function (results) { - var ret = []; - for (var i = 0; i < results.length; i++) { - ret.push(results[i][1]); - } - return ret; - }); - return d; -}; - -/** @id MochiKit.Async.maybeDeferred */ -MochiKit.Async.maybeDeferred = function (func) { - var self = MochiKit.Async; - var result; - try { - var r = func.apply(null, MochiKit.Base.extend([], arguments, 1)); - if (r instanceof self.Deferred) { - result = r; - } else if (r instanceof Error) { - result = self.fail(r); - } else { - result = self.succeed(r); - } - } catch (e) { - result = self.fail(e); - } - return result; -}; - - -MochiKit.Async.EXPORT = [ - "AlreadyCalledError", - "CancelledError", - "BrowserComplianceError", - "GenericError", - "XMLHttpRequestError", - "Deferred", - "succeed", - "fail", - "getXMLHttpRequest", - "doSimpleXMLHttpRequest", - "loadJSONDoc", - "wait", - "callLater", - "sendXMLHttpRequest", - "DeferredLock", - "DeferredList", - "gatherResults", - "maybeDeferred", - "doXHR" -]; - -MochiKit.Async.EXPORT_OK = [ - "evalJSONRequest" -]; - -MochiKit.Async.__new__ = function () { - var m = MochiKit.Base; - var ne = m.partial(m._newNamedError, this); - - ne("AlreadyCalledError", - /** @id MochiKit.Async.AlreadyCalledError */ - function (deferred) { - /*** - - Raised by the Deferred if callback or errback happens - after it was already fired. - - ***/ - this.deferred = deferred; - } - ); - - ne("CancelledError", - /** @id MochiKit.Async.CancelledError */ - function (deferred) { - /*** - - Raised by the Deferred cancellation mechanism. - - ***/ - this.deferred = deferred; - } - ); - - ne("BrowserComplianceError", - /** @id MochiKit.Async.BrowserComplianceError */ - function (msg) { - /*** - - Raised when the JavaScript runtime is not capable of performing - the given function. Technically, this should really never be - raised because a non-conforming JavaScript runtime probably - isn't going to support exceptions in the first place. - - ***/ - this.message = msg; - } - ); - - ne("GenericError", - /** @id MochiKit.Async.GenericError */ - function (msg) { - this.message = msg; - } - ); - - ne("XMLHttpRequestError", - /** @id MochiKit.Async.XMLHttpRequestError */ - function (req, msg) { - /*** - - Raised when an XMLHttpRequest does not complete for any reason. - - ***/ - this.req = req; - this.message = msg; - try { - // Strange but true that this can raise in some cases. - this.number = req.status; - } catch (e) { - // pass - } - } - ); - - - this.EXPORT_TAGS = { - ":common": this.EXPORT, - ":all": m.concat(this.EXPORT, this.EXPORT_OK) - }; - - m.nameFunctions(this); - -}; - -MochiKit.Async.__new__(); - -MochiKit.Base._exportSymbols(this, MochiKit.Async); diff --git a/static/MochiKit/Base.js b/static/MochiKit/Base.js deleted file mode 100644 index f3343f2..0000000 --- a/static/MochiKit/Base.js +++ /dev/null @@ -1,1489 +0,0 @@ -/*** - -MochiKit.Base 1.4.2 - -See for documentation, downloads, license, etc. - -(c) 2005 Bob Ippolito. All rights Reserved. - -***/ - -if (typeof(dojo) != 'undefined') { - dojo.provide("MochiKit.Base"); -} -if (typeof(MochiKit) == 'undefined') { - MochiKit = {}; -} -if (typeof(MochiKit.Base) == 'undefined') { - MochiKit.Base = {}; -} -if (typeof(MochiKit.__export__) == "undefined") { - MochiKit.__export__ = (MochiKit.__compat__ || - (typeof(JSAN) == 'undefined' && typeof(dojo) == 'undefined') - ); -} - -MochiKit.Base.VERSION = "1.4.2"; -MochiKit.Base.NAME = "MochiKit.Base"; -/** @id MochiKit.Base.update */ -MochiKit.Base.update = function (self, obj/*, ... */) { - if (self === null || self === undefined) { - self = {}; - } - for (var i = 1; i < arguments.length; i++) { - var o = arguments[i]; - if (typeof(o) != 'undefined' && o !== null) { - for (var k in o) { - self[k] = o[k]; - } - } - } - return self; -}; - -MochiKit.Base.update(MochiKit.Base, { - __repr__: function () { - return "[" + this.NAME + " " + this.VERSION + "]"; - }, - - toString: function () { - return this.__repr__(); - }, - - /** @id MochiKit.Base.camelize */ - camelize: function (selector) { - /* from dojo.style.toCamelCase */ - var arr = selector.split('-'); - var cc = arr[0]; - for (var i = 1; i < arr.length; i++) { - cc += arr[i].charAt(0).toUpperCase() + arr[i].substring(1); - } - return cc; - }, - - /** @id MochiKit.Base.counter */ - counter: function (n/* = 1 */) { - if (arguments.length === 0) { - n = 1; - } - return function () { - return n++; - }; - }, - - /** @id MochiKit.Base.clone */ - clone: function (obj) { - var me = arguments.callee; - if (arguments.length == 1) { - me.prototype = obj; - return new me(); - } - }, - - _deps: function(module, deps) { - if (!(module in MochiKit)) { - MochiKit[module] = {}; - } - - if (typeof(dojo) != 'undefined') { - dojo.provide('MochiKit.' + module); - } - for (var i = 0; i < deps.length; i++) { - if (typeof(dojo) != 'undefined') { - dojo.require('MochiKit.' + deps[i]); - } - if (typeof(JSAN) != 'undefined') { - JSAN.use('MochiKit.' + deps[i], []); - } - if (!(deps[i] in MochiKit)) { - throw 'MochiKit.' + module + ' depends on MochiKit.' + deps[i] + '!' - } - } - }, - - _flattenArray: function (res, lst) { - for (var i = 0; i < lst.length; i++) { - var o = lst[i]; - if (o instanceof Array) { - arguments.callee(res, o); - } else { - res.push(o); - } - } - return res; - }, - - /** @id MochiKit.Base.flattenArray */ - flattenArray: function (lst) { - return MochiKit.Base._flattenArray([], lst); - }, - - /** @id MochiKit.Base.flattenArguments */ - flattenArguments: function (lst/* ...*/) { - var res = []; - var m = MochiKit.Base; - var args = m.extend(null, arguments); - while (args.length) { - var o = args.shift(); - if (o && typeof(o) == "object" && typeof(o.length) == "number") { - for (var i = o.length - 1; i >= 0; i--) { - args.unshift(o[i]); - } - } else { - res.push(o); - } - } - return res; - }, - - /** @id MochiKit.Base.extend */ - extend: function (self, obj, /* optional */skip) { - // Extend an array with an array-like object starting - // from the skip index - if (!skip) { - skip = 0; - } - if (obj) { - // allow iterable fall-through, but skip the full isArrayLike - // check for speed, this is called often. - var l = obj.length; - if (typeof(l) != 'number' /* !isArrayLike(obj) */) { - if (typeof(MochiKit.Iter) != "undefined") { - obj = MochiKit.Iter.list(obj); - l = obj.length; - } else { - throw new TypeError("Argument not an array-like and MochiKit.Iter not present"); - } - } - if (!self) { - self = []; - } - for (var i = skip; i < l; i++) { - self.push(obj[i]); - } - } - // This mutates, but it's convenient to return because - // it's often used like a constructor when turning some - // ghetto array-like to a real array - return self; - }, - - - /** @id MochiKit.Base.updatetree */ - updatetree: function (self, obj/*, ...*/) { - if (self === null || self === undefined) { - self = {}; - } - for (var i = 1; i < arguments.length; i++) { - var o = arguments[i]; - if (typeof(o) != 'undefined' && o !== null) { - for (var k in o) { - var v = o[k]; - if (typeof(self[k]) == 'object' && typeof(v) == 'object') { - arguments.callee(self[k], v); - } else { - self[k] = v; - } - } - } - } - return self; - }, - - /** @id MochiKit.Base.setdefault */ - setdefault: function (self, obj/*, ...*/) { - if (self === null || self === undefined) { - self = {}; - } - for (var i = 1; i < arguments.length; i++) { - var o = arguments[i]; - for (var k in o) { - if (!(k in self)) { - self[k] = o[k]; - } - } - } - return self; - }, - - /** @id MochiKit.Base.keys */ - keys: function (obj) { - var rval = []; - for (var prop in obj) { - rval.push(prop); - } - return rval; - }, - - /** @id MochiKit.Base.values */ - values: function (obj) { - var rval = []; - for (var prop in obj) { - rval.push(obj[prop]); - } - return rval; - }, - - /** @id MochiKit.Base.items */ - items: function (obj) { - var rval = []; - var e; - for (var prop in obj) { - var v; - try { - v = obj[prop]; - } catch (e) { - continue; - } - rval.push([prop, v]); - } - return rval; - }, - - - _newNamedError: function (module, name, func) { - func.prototype = new MochiKit.Base.NamedError(module.NAME + "." + name); - module[name] = func; - }, - - - /** @id MochiKit.Base.operator */ - operator: { - // unary logic operators - /** @id MochiKit.Base.truth */ - truth: function (a) { return !!a; }, - /** @id MochiKit.Base.lognot */ - lognot: function (a) { return !a; }, - /** @id MochiKit.Base.identity */ - identity: function (a) { return a; }, - - // bitwise unary operators - /** @id MochiKit.Base.not */ - not: function (a) { return ~a; }, - /** @id MochiKit.Base.neg */ - neg: function (a) { return -a; }, - - // binary operators - /** @id MochiKit.Base.add */ - add: function (a, b) { return a + b; }, - /** @id MochiKit.Base.sub */ - sub: function (a, b) { return a - b; }, - /** @id MochiKit.Base.div */ - div: function (a, b) { return a / b; }, - /** @id MochiKit.Base.mod */ - mod: function (a, b) { return a % b; }, - /** @id MochiKit.Base.mul */ - mul: function (a, b) { return a * b; }, - - // bitwise binary operators - /** @id MochiKit.Base.and */ - and: function (a, b) { return a & b; }, - /** @id MochiKit.Base.or */ - or: function (a, b) { return a | b; }, - /** @id MochiKit.Base.xor */ - xor: function (a, b) { return a ^ b; }, - /** @id MochiKit.Base.lshift */ - lshift: function (a, b) { return a << b; }, - /** @id MochiKit.Base.rshift */ - rshift: function (a, b) { return a >> b; }, - /** @id MochiKit.Base.zrshift */ - zrshift: function (a, b) { return a >>> b; }, - - // near-worthless built-in comparators - /** @id MochiKit.Base.eq */ - eq: function (a, b) { return a == b; }, - /** @id MochiKit.Base.ne */ - ne: function (a, b) { return a != b; }, - /** @id MochiKit.Base.gt */ - gt: function (a, b) { return a > b; }, - /** @id MochiKit.Base.ge */ - ge: function (a, b) { return a >= b; }, - /** @id MochiKit.Base.lt */ - lt: function (a, b) { return a < b; }, - /** @id MochiKit.Base.le */ - le: function (a, b) { return a <= b; }, - - // strict built-in comparators - seq: function (a, b) { return a === b; }, - sne: function (a, b) { return a !== b; }, - - // compare comparators - /** @id MochiKit.Base.ceq */ - ceq: function (a, b) { return MochiKit.Base.compare(a, b) === 0; }, - /** @id MochiKit.Base.cne */ - cne: function (a, b) { return MochiKit.Base.compare(a, b) !== 0; }, - /** @id MochiKit.Base.cgt */ - cgt: function (a, b) { return MochiKit.Base.compare(a, b) == 1; }, - /** @id MochiKit.Base.cge */ - cge: function (a, b) { return MochiKit.Base.compare(a, b) != -1; }, - /** @id MochiKit.Base.clt */ - clt: function (a, b) { return MochiKit.Base.compare(a, b) == -1; }, - /** @id MochiKit.Base.cle */ - cle: function (a, b) { return MochiKit.Base.compare(a, b) != 1; }, - - // binary logical operators - /** @id MochiKit.Base.logand */ - logand: function (a, b) { return a && b; }, - /** @id MochiKit.Base.logor */ - logor: function (a, b) { return a || b; }, - /** @id MochiKit.Base.contains */ - contains: function (a, b) { return b in a; } - }, - - /** @id MochiKit.Base.forwardCall */ - forwardCall: function (func) { - return function () { - return this[func].apply(this, arguments); - }; - }, - - /** @id MochiKit.Base.itemgetter */ - itemgetter: function (func) { - return function (arg) { - return arg[func]; - }; - }, - - /** @id MochiKit.Base.typeMatcher */ - typeMatcher: function (/* typ */) { - var types = {}; - for (var i = 0; i < arguments.length; i++) { - var typ = arguments[i]; - types[typ] = typ; - } - return function () { - for (var i = 0; i < arguments.length; i++) { - if (!(typeof(arguments[i]) in types)) { - return false; - } - } - return true; - }; - }, - - /** @id MochiKit.Base.isNull */ - isNull: function (/* ... */) { - for (var i = 0; i < arguments.length; i++) { - if (arguments[i] !== null) { - return false; - } - } - return true; - }, - - /** @id MochiKit.Base.isUndefinedOrNull */ - isUndefinedOrNull: function (/* ... */) { - for (var i = 0; i < arguments.length; i++) { - var o = arguments[i]; - if (!(typeof(o) == 'undefined' || o === null)) { - return false; - } - } - return true; - }, - - /** @id MochiKit.Base.isEmpty */ - isEmpty: function (obj) { - return !MochiKit.Base.isNotEmpty.apply(this, arguments); - }, - - /** @id MochiKit.Base.isNotEmpty */ - isNotEmpty: function (obj) { - for (var i = 0; i < arguments.length; i++) { - var o = arguments[i]; - if (!(o && o.length)) { - return false; - } - } - return true; - }, - - /** @id MochiKit.Base.isArrayLike */ - isArrayLike: function () { - for (var i = 0; i < arguments.length; i++) { - var o = arguments[i]; - var typ = typeof(o); - if ( - (typ != 'object' && !(typ == 'function' && typeof(o.item) == 'function')) || - o === null || - typeof(o.length) != 'number' || - o.nodeType === 3 || - o.nodeType === 4 - ) { - return false; - } - } - return true; - }, - - /** @id MochiKit.Base.isDateLike */ - isDateLike: function () { - for (var i = 0; i < arguments.length; i++) { - var o = arguments[i]; - if (typeof(o) != "object" || o === null - || typeof(o.getTime) != 'function') { - return false; - } - } - return true; - }, - - - /** @id MochiKit.Base.xmap */ - xmap: function (fn/*, obj... */) { - if (fn === null) { - return MochiKit.Base.extend(null, arguments, 1); - } - var rval = []; - for (var i = 1; i < arguments.length; i++) { - rval.push(fn(arguments[i])); - } - return rval; - }, - - /** @id MochiKit.Base.map */ - map: function (fn, lst/*, lst... */) { - var m = MochiKit.Base; - var itr = MochiKit.Iter; - var isArrayLike = m.isArrayLike; - if (arguments.length <= 2) { - // allow an iterable to be passed - if (!isArrayLike(lst)) { - if (itr) { - // fast path for map(null, iterable) - lst = itr.list(lst); - if (fn === null) { - return lst; - } - } else { - throw new TypeError("Argument not an array-like and MochiKit.Iter not present"); - } - } - // fast path for map(null, lst) - if (fn === null) { - return m.extend(null, lst); - } - // disabled fast path for map(fn, lst) - /* - if (false && typeof(Array.prototype.map) == 'function') { - // Mozilla fast-path - return Array.prototype.map.call(lst, fn); - } - */ - var rval = []; - for (var i = 0; i < lst.length; i++) { - rval.push(fn(lst[i])); - } - return rval; - } else { - // default for map(null, ...) is zip(...) - if (fn === null) { - fn = Array; - } - var length = null; - for (i = 1; i < arguments.length; i++) { - // allow iterables to be passed - if (!isArrayLike(arguments[i])) { - if (itr) { - return itr.list(itr.imap.apply(null, arguments)); - } else { - throw new TypeError("Argument not an array-like and MochiKit.Iter not present"); - } - } - // find the minimum length - var l = arguments[i].length; - if (length === null || length > l) { - length = l; - } - } - rval = []; - for (i = 0; i < length; i++) { - var args = []; - for (var j = 1; j < arguments.length; j++) { - args.push(arguments[j][i]); - } - rval.push(fn.apply(this, args)); - } - return rval; - } - }, - - /** @id MochiKit.Base.xfilter */ - xfilter: function (fn/*, obj... */) { - var rval = []; - if (fn === null) { - fn = MochiKit.Base.operator.truth; - } - for (var i = 1; i < arguments.length; i++) { - var o = arguments[i]; - if (fn(o)) { - rval.push(o); - } - } - return rval; - }, - - /** @id MochiKit.Base.filter */ - filter: function (fn, lst, self) { - var rval = []; - // allow an iterable to be passed - var m = MochiKit.Base; - if (!m.isArrayLike(lst)) { - if (MochiKit.Iter) { - lst = MochiKit.Iter.list(lst); - } else { - throw new TypeError("Argument not an array-like and MochiKit.Iter not present"); - } - } - if (fn === null) { - fn = m.operator.truth; - } - if (typeof(Array.prototype.filter) == 'function') { - // Mozilla fast-path - return Array.prototype.filter.call(lst, fn, self); - } else if (typeof(self) == 'undefined' || self === null) { - for (var i = 0; i < lst.length; i++) { - var o = lst[i]; - if (fn(o)) { - rval.push(o); - } - } - } else { - for (i = 0; i < lst.length; i++) { - o = lst[i]; - if (fn.call(self, o)) { - rval.push(o); - } - } - } - return rval; - }, - - - _wrapDumbFunction: function (func) { - return function () { - // fast path! - switch (arguments.length) { - case 0: return func(); - case 1: return func(arguments[0]); - case 2: return func(arguments[0], arguments[1]); - case 3: return func(arguments[0], arguments[1], arguments[2]); - } - var args = []; - for (var i = 0; i < arguments.length; i++) { - args.push("arguments[" + i + "]"); - } - return eval("(func(" + args.join(",") + "))"); - }; - }, - - /** @id MochiKit.Base.methodcaller */ - methodcaller: function (func/*, args... */) { - var args = MochiKit.Base.extend(null, arguments, 1); - if (typeof(func) == "function") { - return function (obj) { - return func.apply(obj, args); - }; - } else { - return function (obj) { - return obj[func].apply(obj, args); - }; - } - }, - - /** @id MochiKit.Base.method */ - method: function (self, func) { - var m = MochiKit.Base; - return m.bind.apply(this, m.extend([func, self], arguments, 2)); - }, - - /** @id MochiKit.Base.compose */ - compose: function (f1, f2/*, f3, ... fN */) { - var fnlist = []; - var m = MochiKit.Base; - if (arguments.length === 0) { - throw new TypeError("compose() requires at least one argument"); - } - for (var i = 0; i < arguments.length; i++) { - var fn = arguments[i]; - if (typeof(fn) != "function") { - throw new TypeError(m.repr(fn) + " is not a function"); - } - fnlist.push(fn); - } - return function () { - var args = arguments; - for (var i = fnlist.length - 1; i >= 0; i--) { - args = [fnlist[i].apply(this, args)]; - } - return args[0]; - }; - }, - - /** @id MochiKit.Base.bind */ - bind: function (func, self/* args... */) { - if (typeof(func) == "string") { - func = self[func]; - } - var im_func = func.im_func; - var im_preargs = func.im_preargs; - var im_self = func.im_self; - var m = MochiKit.Base; - if (typeof(func) == "function" && typeof(func.apply) == "undefined") { - // this is for cases where JavaScript sucks ass and gives you a - // really dumb built-in function like alert() that doesn't have - // an apply - func = m._wrapDumbFunction(func); - } - if (typeof(im_func) != 'function') { - im_func = func; - } - if (typeof(self) != 'undefined') { - im_self = self; - } - if (typeof(im_preargs) == 'undefined') { - im_preargs = []; - } else { - im_preargs = im_preargs.slice(); - } - m.extend(im_preargs, arguments, 2); - var newfunc = function () { - var args = arguments; - var me = arguments.callee; - if (me.im_preargs.length > 0) { - args = m.concat(me.im_preargs, args); - } - var self = me.im_self; - if (!self) { - self = this; - } - return me.im_func.apply(self, args); - }; - newfunc.im_self = im_self; - newfunc.im_func = im_func; - newfunc.im_preargs = im_preargs; - return newfunc; - }, - - /** @id MochiKit.Base.bindLate */ - bindLate: function (func, self/* args... */) { - var m = MochiKit.Base; - if (typeof(func) != "string") { - return m.bind.apply(this, arguments); - } - var im_preargs = m.extend([], arguments, 2); - var newfunc = function () { - var args = arguments; - var me = arguments.callee; - if (me.im_preargs.length > 0) { - args = m.concat(me.im_preargs, args); - } - var self = me.im_self; - if (!self) { - self = this; - } - return self[me.im_func].apply(self, args); - }; - newfunc.im_self = self; - newfunc.im_func = func; - newfunc.im_preargs = im_preargs; - return newfunc; - }, - - /** @id MochiKit.Base.bindMethods */ - bindMethods: function (self) { - var bind = MochiKit.Base.bind; - for (var k in self) { - var func = self[k]; - if (typeof(func) == 'function') { - self[k] = bind(func, self); - } - } - }, - - /** @id MochiKit.Base.registerComparator */ - registerComparator: function (name, check, comparator, /* optional */ override) { - MochiKit.Base.comparatorRegistry.register(name, check, comparator, override); - }, - - _primitives: {'boolean': true, 'string': true, 'number': true}, - - /** @id MochiKit.Base.compare */ - compare: function (a, b) { - if (a == b) { - return 0; - } - var aIsNull = (typeof(a) == 'undefined' || a === null); - var bIsNull = (typeof(b) == 'undefined' || b === null); - if (aIsNull && bIsNull) { - return 0; - } else if (aIsNull) { - return -1; - } else if (bIsNull) { - return 1; - } - var m = MochiKit.Base; - // bool, number, string have meaningful comparisons - var prim = m._primitives; - if (!(typeof(a) in prim && typeof(b) in prim)) { - try { - return m.comparatorRegistry.match(a, b); - } catch (e) { - if (e != m.NotFound) { - throw e; - } - } - } - if (a < b) { - return -1; - } else if (a > b) { - return 1; - } - // These types can't be compared - var repr = m.repr; - throw new TypeError(repr(a) + " and " + repr(b) + " can not be compared"); - }, - - /** @id MochiKit.Base.compareDateLike */ - compareDateLike: function (a, b) { - return MochiKit.Base.compare(a.getTime(), b.getTime()); - }, - - /** @id MochiKit.Base.compareArrayLike */ - compareArrayLike: function (a, b) { - var compare = MochiKit.Base.compare; - var count = a.length; - var rval = 0; - if (count > b.length) { - rval = 1; - count = b.length; - } else if (count < b.length) { - rval = -1; - } - for (var i = 0; i < count; i++) { - var cmp = compare(a[i], b[i]); - if (cmp) { - return cmp; - } - } - return rval; - }, - - /** @id MochiKit.Base.registerRepr */ - registerRepr: function (name, check, wrap, /* optional */override) { - MochiKit.Base.reprRegistry.register(name, check, wrap, override); - }, - - /** @id MochiKit.Base.repr */ - repr: function (o) { - if (typeof(o) == "undefined") { - return "undefined"; - } else if (o === null) { - return "null"; - } - try { - if (typeof(o.__repr__) == 'function') { - return o.__repr__(); - } else if (typeof(o.repr) == 'function' && o.repr != arguments.callee) { - return o.repr(); - } - return MochiKit.Base.reprRegistry.match(o); - } catch (e) { - if (typeof(o.NAME) == 'string' && ( - o.toString == Function.prototype.toString || - o.toString == Object.prototype.toString - )) { - return o.NAME; - } - } - try { - var ostring = (o + ""); - } catch (e) { - return "[" + typeof(o) + "]"; - } - if (typeof(o) == "function") { - ostring = ostring.replace(/^\s+/, "").replace(/\s+/g, " "); - ostring = ostring.replace(/,(\S)/, ", $1"); - var idx = ostring.indexOf("{"); - if (idx != -1) { - ostring = ostring.substr(0, idx) + "{...}"; - } - } - return ostring; - }, - - /** @id MochiKit.Base.reprArrayLike */ - reprArrayLike: function (o) { - var m = MochiKit.Base; - return "[" + m.map(m.repr, o).join(", ") + "]"; - }, - - /** @id MochiKit.Base.reprString */ - reprString: function (o) { - return ('"' + o.replace(/(["\\])/g, '\\$1') + '"' - ).replace(/[\f]/g, "\\f" - ).replace(/[\b]/g, "\\b" - ).replace(/[\n]/g, "\\n" - ).replace(/[\t]/g, "\\t" - ).replace(/[\v]/g, "\\v" - ).replace(/[\r]/g, "\\r"); - }, - - /** @id MochiKit.Base.reprNumber */ - reprNumber: function (o) { - return o + ""; - }, - - /** @id MochiKit.Base.registerJSON */ - registerJSON: function (name, check, wrap, /* optional */override) { - MochiKit.Base.jsonRegistry.register(name, check, wrap, override); - }, - - - /** @id MochiKit.Base.evalJSON */ - evalJSON: function () { - return eval("(" + MochiKit.Base._filterJSON(arguments[0]) + ")"); - }, - - _filterJSON: function (s) { - var m = s.match(/^\s*\/\*(.*)\*\/\s*$/); - if (m) { - return m[1]; - } - return s; - }, - - /** @id MochiKit.Base.serializeJSON */ - serializeJSON: function (o) { - var objtype = typeof(o); - if (objtype == "number" || objtype == "boolean") { - return o + ""; - } else if (o === null) { - return "null"; - } else if (objtype == "string") { - var res = ""; - for (var i = 0; i < o.length; i++) { - var c = o.charAt(i); - if (c == '\"') { - res += '\\"'; - } else if (c == '\\') { - res += '\\\\'; - } else if (c == '\b') { - res += '\\b'; - } else if (c == '\f') { - res += '\\f'; - } else if (c == '\n') { - res += '\\n'; - } else if (c == '\r') { - res += '\\r'; - } else if (c == '\t') { - res += '\\t'; - } else if (o.charCodeAt(i) <= 0x1F) { - var hex = o.charCodeAt(i).toString(16); - if (hex.length < 2) { - hex = '0' + hex; - } - res += '\\u00' + hex.toUpperCase(); - } else { - res += c; - } - } - return '"' + res + '"'; - } - // recurse - var me = arguments.callee; - // short-circuit for objects that support "json" serialization - // if they return "self" then just pass-through... - var newObj; - if (typeof(o.__json__) == "function") { - newObj = o.__json__(); - if (o !== newObj) { - return me(newObj); - } - } - if (typeof(o.json) == "function") { - newObj = o.json(); - if (o !== newObj) { - return me(newObj); - } - } - // array - if (objtype != "function" && typeof(o.length) == "number") { - var res = []; - for (var i = 0; i < o.length; i++) { - var val = me(o[i]); - if (typeof(val) != "string") { - // skip non-serializable values - continue; - } - res.push(val); - } - return "[" + res.join(", ") + "]"; - } - // look in the registry - var m = MochiKit.Base; - try { - newObj = m.jsonRegistry.match(o); - if (o !== newObj) { - return me(newObj); - } - } catch (e) { - if (e != m.NotFound) { - // something really bad happened - throw e; - } - } - // undefined is outside of the spec - if (objtype == "undefined") { - throw new TypeError("undefined can not be serialized as JSON"); - } - // it's a function with no adapter, bad - if (objtype == "function") { - return null; - } - // generic object code path - res = []; - for (var k in o) { - var useKey; - if (typeof(k) == "number") { - useKey = '"' + k + '"'; - } else if (typeof(k) == "string") { - useKey = me(k); - } else { - // skip non-string or number keys - continue; - } - val = me(o[k]); - if (typeof(val) != "string") { - // skip non-serializable values - continue; - } - res.push(useKey + ":" + val); - } - return "{" + res.join(", ") + "}"; - }, - - - /** @id MochiKit.Base.objEqual */ - objEqual: function (a, b) { - return (MochiKit.Base.compare(a, b) === 0); - }, - - /** @id MochiKit.Base.arrayEqual */ - arrayEqual: function (self, arr) { - if (self.length != arr.length) { - return false; - } - return (MochiKit.Base.compare(self, arr) === 0); - }, - - /** @id MochiKit.Base.concat */ - concat: function (/* lst... */) { - var rval = []; - var extend = MochiKit.Base.extend; - for (var i = 0; i < arguments.length; i++) { - extend(rval, arguments[i]); - } - return rval; - }, - - /** @id MochiKit.Base.keyComparator */ - keyComparator: function (key/* ... */) { - // fast-path for single key comparisons - var m = MochiKit.Base; - var compare = m.compare; - if (arguments.length == 1) { - return function (a, b) { - return compare(a[key], b[key]); - }; - } - var compareKeys = m.extend(null, arguments); - return function (a, b) { - var rval = 0; - // keep comparing until something is inequal or we run out of - // keys to compare - for (var i = 0; (rval === 0) && (i < compareKeys.length); i++) { - var key = compareKeys[i]; - rval = compare(a[key], b[key]); - } - return rval; - }; - }, - - /** @id MochiKit.Base.reverseKeyComparator */ - reverseKeyComparator: function (key) { - var comparator = MochiKit.Base.keyComparator.apply(this, arguments); - return function (a, b) { - return comparator(b, a); - }; - }, - - /** @id MochiKit.Base.partial */ - partial: function (func) { - var m = MochiKit.Base; - return m.bind.apply(this, m.extend([func, undefined], arguments, 1)); - }, - - /** @id MochiKit.Base.listMinMax */ - listMinMax: function (which, lst) { - if (lst.length === 0) { - return null; - } - var cur = lst[0]; - var compare = MochiKit.Base.compare; - for (var i = 1; i < lst.length; i++) { - var o = lst[i]; - if (compare(o, cur) == which) { - cur = o; - } - } - return cur; - }, - - /** @id MochiKit.Base.objMax */ - objMax: function (/* obj... */) { - return MochiKit.Base.listMinMax(1, arguments); - }, - - /** @id MochiKit.Base.objMin */ - objMin: function (/* obj... */) { - return MochiKit.Base.listMinMax(-1, arguments); - }, - - /** @id MochiKit.Base.findIdentical */ - findIdentical: function (lst, value, start/* = 0 */, /* optional */end) { - if (typeof(end) == "undefined" || end === null) { - end = lst.length; - } - if (typeof(start) == "undefined" || start === null) { - start = 0; - } - for (var i = start; i < end; i++) { - if (lst[i] === value) { - return i; - } - } - return -1; - }, - - /** @id MochiKit.Base.mean */ - mean: function(/* lst... */) { - /* http://www.nist.gov/dads/HTML/mean.html */ - var sum = 0; - - var m = MochiKit.Base; - var args = m.extend(null, arguments); - var count = args.length; - - while (args.length) { - var o = args.shift(); - if (o && typeof(o) == "object" && typeof(o.length) == "number") { - count += o.length - 1; - for (var i = o.length - 1; i >= 0; i--) { - sum += o[i]; - } - } else { - sum += o; - } - } - - if (count <= 0) { - throw new TypeError('mean() requires at least one argument'); - } - - return sum/count; - }, - - /** @id MochiKit.Base.median */ - median: function(/* lst... */) { - /* http://www.nist.gov/dads/HTML/median.html */ - var data = MochiKit.Base.flattenArguments(arguments); - if (data.length === 0) { - throw new TypeError('median() requires at least one argument'); - } - data.sort(compare); - if (data.length % 2 == 0) { - var upper = data.length / 2; - return (data[upper] + data[upper - 1]) / 2; - } else { - return data[(data.length - 1) / 2]; - } - }, - - /** @id MochiKit.Base.findValue */ - findValue: function (lst, value, start/* = 0 */, /* optional */end) { - if (typeof(end) == "undefined" || end === null) { - end = lst.length; - } - if (typeof(start) == "undefined" || start === null) { - start = 0; - } - var cmp = MochiKit.Base.compare; - for (var i = start; i < end; i++) { - if (cmp(lst[i], value) === 0) { - return i; - } - } - return -1; - }, - - /** @id MochiKit.Base.nodeWalk */ - nodeWalk: function (node, visitor) { - var nodes = [node]; - var extend = MochiKit.Base.extend; - while (nodes.length) { - var res = visitor(nodes.shift()); - if (res) { - extend(nodes, res); - } - } - }, - - - /** @id MochiKit.Base.nameFunctions */ - nameFunctions: function (namespace) { - var base = namespace.NAME; - if (typeof(base) == 'undefined') { - base = ''; - } else { - base = base + '.'; - } - for (var name in namespace) { - var o = namespace[name]; - if (typeof(o) == 'function' && typeof(o.NAME) == 'undefined') { - try { - o.NAME = base + name; - } catch (e) { - // pass - } - } - } - }, - - - /** @id MochiKit.Base.queryString */ - queryString: function (names, values) { - // check to see if names is a string or a DOM element, and if - // MochiKit.DOM is available. If so, drop it like it's a form - // Ugliest conditional in MochiKit? Probably! - if (typeof(MochiKit.DOM) != "undefined" && arguments.length == 1 - && (typeof(names) == "string" || ( - typeof(names.nodeType) != "undefined" && names.nodeType > 0 - )) - ) { - var kv = MochiKit.DOM.formContents(names); - names = kv[0]; - values = kv[1]; - } else if (arguments.length == 1) { - // Allow the return value of formContents to be passed directly - if (typeof(names.length) == "number" && names.length == 2) { - return arguments.callee(names[0], names[1]); - } - var o = names; - names = []; - values = []; - for (var k in o) { - var v = o[k]; - if (typeof(v) == "function") { - continue; - } else if (MochiKit.Base.isArrayLike(v)){ - for (var i = 0; i < v.length; i++) { - names.push(k); - values.push(v[i]); - } - } else { - names.push(k); - values.push(v); - } - } - } - var rval = []; - var len = Math.min(names.length, values.length); - var urlEncode = MochiKit.Base.urlEncode; - for (var i = 0; i < len; i++) { - v = values[i]; - if (typeof(v) != 'undefined' && v !== null) { - rval.push(urlEncode(names[i]) + "=" + urlEncode(v)); - } - } - return rval.join("&"); - }, - - - /** @id MochiKit.Base.parseQueryString */ - parseQueryString: function (encodedString, useArrays) { - // strip a leading '?' from the encoded string - var qstr = (encodedString.charAt(0) == "?") - ? encodedString.substring(1) - : encodedString; - var pairs = qstr.replace(/\+/g, "%20").split(/\&\;|\&\#38\;|\&|\&/); - var o = {}; - var decode; - if (typeof(decodeURIComponent) != "undefined") { - decode = decodeURIComponent; - } else { - decode = unescape; - } - if (useArrays) { - for (var i = 0; i < pairs.length; i++) { - var pair = pairs[i].split("="); - var name = decode(pair.shift()); - if (!name) { - continue; - } - var arr = o[name]; - if (!(arr instanceof Array)) { - arr = []; - o[name] = arr; - } - arr.push(decode(pair.join("="))); - } - } else { - for (i = 0; i < pairs.length; i++) { - pair = pairs[i].split("="); - var name = pair.shift(); - if (!name) { - continue; - } - o[decode(name)] = decode(pair.join("=")); - } - } - return o; - } -}); - -/** @id MochiKit.Base.AdapterRegistry */ -MochiKit.Base.AdapterRegistry = function () { - this.pairs = []; -}; - -MochiKit.Base.AdapterRegistry.prototype = { - /** @id MochiKit.Base.AdapterRegistry.prototype.register */ - register: function (name, check, wrap, /* optional */ override) { - if (override) { - this.pairs.unshift([name, check, wrap]); - } else { - this.pairs.push([name, check, wrap]); - } - }, - - /** @id MochiKit.Base.AdapterRegistry.prototype.match */ - match: function (/* ... */) { - for (var i = 0; i < this.pairs.length; i++) { - var pair = this.pairs[i]; - if (pair[1].apply(this, arguments)) { - return pair[2].apply(this, arguments); - } - } - throw MochiKit.Base.NotFound; - }, - - /** @id MochiKit.Base.AdapterRegistry.prototype.unregister */ - unregister: function (name) { - for (var i = 0; i < this.pairs.length; i++) { - var pair = this.pairs[i]; - if (pair[0] == name) { - this.pairs.splice(i, 1); - return true; - } - } - return false; - } -}; - - -MochiKit.Base.EXPORT = [ - "flattenArray", - "noop", - "camelize", - "counter", - "clone", - "extend", - "update", - "updatetree", - "setdefault", - "keys", - "values", - "items", - "NamedError", - "operator", - "forwardCall", - "itemgetter", - "typeMatcher", - "isCallable", - "isUndefined", - "isUndefinedOrNull", - "isNull", - "isEmpty", - "isNotEmpty", - "isArrayLike", - "isDateLike", - "xmap", - "map", - "xfilter", - "filter", - "methodcaller", - "compose", - "bind", - "bindLate", - "bindMethods", - "NotFound", - "AdapterRegistry", - "registerComparator", - "compare", - "registerRepr", - "repr", - "objEqual", - "arrayEqual", - "concat", - "keyComparator", - "reverseKeyComparator", - "partial", - "merge", - "listMinMax", - "listMax", - "listMin", - "objMax", - "objMin", - "nodeWalk", - "zip", - "urlEncode", - "queryString", - "serializeJSON", - "registerJSON", - "evalJSON", - "parseQueryString", - "findValue", - "findIdentical", - "flattenArguments", - "method", - "average", - "mean", - "median" -]; - -MochiKit.Base.EXPORT_OK = [ - "nameFunctions", - "comparatorRegistry", - "reprRegistry", - "jsonRegistry", - "compareDateLike", - "compareArrayLike", - "reprArrayLike", - "reprString", - "reprNumber" -]; - -MochiKit.Base._exportSymbols = function (globals, module) { - if (!MochiKit.__export__) { - return; - } - var all = module.EXPORT_TAGS[":all"]; - for (var i = 0; i < all.length; i++) { - globals[all[i]] = module[all[i]]; - } -}; - -MochiKit.Base.__new__ = function () { - // A singleton raised when no suitable adapter is found - var m = this; - - // convenience - /** @id MochiKit.Base.noop */ - m.noop = m.operator.identity; - - // Backwards compat - m.forward = m.forwardCall; - m.find = m.findValue; - - if (typeof(encodeURIComponent) != "undefined") { - /** @id MochiKit.Base.urlEncode */ - m.urlEncode = function (unencoded) { - return encodeURIComponent(unencoded).replace(/\'/g, '%27'); - }; - } else { - m.urlEncode = function (unencoded) { - return escape(unencoded - ).replace(/\+/g, '%2B' - ).replace(/\"/g,'%22' - ).rval.replace(/\'/g, '%27'); - }; - } - - /** @id MochiKit.Base.NamedError */ - m.NamedError = function (name) { - this.message = name; - this.name = name; - }; - m.NamedError.prototype = new Error(); - m.update(m.NamedError.prototype, { - repr: function () { - if (this.message && this.message != this.name) { - return this.name + "(" + m.repr(this.message) + ")"; - } else { - return this.name + "()"; - } - }, - toString: m.forwardCall("repr") - }); - - /** @id MochiKit.Base.NotFound */ - m.NotFound = new m.NamedError("MochiKit.Base.NotFound"); - - - /** @id MochiKit.Base.listMax */ - m.listMax = m.partial(m.listMinMax, 1); - /** @id MochiKit.Base.listMin */ - m.listMin = m.partial(m.listMinMax, -1); - - /** @id MochiKit.Base.isCallable */ - m.isCallable = m.typeMatcher('function'); - /** @id MochiKit.Base.isUndefined */ - m.isUndefined = m.typeMatcher('undefined'); - - /** @id MochiKit.Base.merge */ - m.merge = m.partial(m.update, null); - /** @id MochiKit.Base.zip */ - m.zip = m.partial(m.map, null); - - /** @id MochiKit.Base.average */ - m.average = m.mean; - - /** @id MochiKit.Base.comparatorRegistry */ - m.comparatorRegistry = new m.AdapterRegistry(); - m.registerComparator("dateLike", m.isDateLike, m.compareDateLike); - m.registerComparator("arrayLike", m.isArrayLike, m.compareArrayLike); - - /** @id MochiKit.Base.reprRegistry */ - m.reprRegistry = new m.AdapterRegistry(); - m.registerRepr("arrayLike", m.isArrayLike, m.reprArrayLike); - m.registerRepr("string", m.typeMatcher("string"), m.reprString); - m.registerRepr("numbers", m.typeMatcher("number", "boolean"), m.reprNumber); - - /** @id MochiKit.Base.jsonRegistry */ - m.jsonRegistry = new m.AdapterRegistry(); - - var all = m.concat(m.EXPORT, m.EXPORT_OK); - m.EXPORT_TAGS = { - ":common": m.concat(m.EXPORT_OK), - ":all": all - }; - - m.nameFunctions(this); - -}; - -MochiKit.Base.__new__(); - -// -// XXX: Internet Explorer blows -// -if (MochiKit.__export__) { - compare = MochiKit.Base.compare; - compose = MochiKit.Base.compose; - serializeJSON = MochiKit.Base.serializeJSON; - mean = MochiKit.Base.mean; - median = MochiKit.Base.median; -} - -MochiKit.Base._exportSymbols(this, MochiKit.Base); diff --git a/static/MochiKit/Color.js b/static/MochiKit/Color.js deleted file mode 100644 index a0d5bd8..0000000 --- a/static/MochiKit/Color.js +++ /dev/null @@ -1,863 +0,0 @@ -/*** - -MochiKit.Color 1.4.2 - -See for documentation, downloads, license, etc. - -(c) 2005 Bob Ippolito and others. All rights Reserved. - -***/ - -MochiKit.Base._deps('Color', ['Base', 'DOM', 'Style']); - -MochiKit.Color.NAME = "MochiKit.Color"; -MochiKit.Color.VERSION = "1.4.2"; - -MochiKit.Color.__repr__ = function () { - return "[" + this.NAME + " " + this.VERSION + "]"; -}; - -MochiKit.Color.toString = function () { - return this.__repr__(); -}; - - -/** @id MochiKit.Color.Color */ -MochiKit.Color.Color = function (red, green, blue, alpha) { - if (typeof(alpha) == 'undefined' || alpha === null) { - alpha = 1.0; - } - this.rgb = { - r: red, - g: green, - b: blue, - a: alpha - }; -}; - - -// Prototype methods - -MochiKit.Color.Color.prototype = { - - __class__: MochiKit.Color.Color, - - /** @id MochiKit.Color.Color.prototype.colorWithAlpha */ - colorWithAlpha: function (alpha) { - var rgb = this.rgb; - var m = MochiKit.Color; - return m.Color.fromRGB(rgb.r, rgb.g, rgb.b, alpha); - }, - - /** @id MochiKit.Color.Color.prototype.colorWithHue */ - colorWithHue: function (hue) { - // get an HSL model, and set the new hue... - var hsl = this.asHSL(); - hsl.h = hue; - var m = MochiKit.Color; - // convert back to RGB... - return m.Color.fromHSL(hsl); - }, - - /** @id MochiKit.Color.Color.prototype.colorWithSaturation */ - colorWithSaturation: function (saturation) { - // get an HSL model, and set the new hue... - var hsl = this.asHSL(); - hsl.s = saturation; - var m = MochiKit.Color; - // convert back to RGB... - return m.Color.fromHSL(hsl); - }, - - /** @id MochiKit.Color.Color.prototype.colorWithLightness */ - colorWithLightness: function (lightness) { - // get an HSL model, and set the new hue... - var hsl = this.asHSL(); - hsl.l = lightness; - var m = MochiKit.Color; - // convert back to RGB... - return m.Color.fromHSL(hsl); - }, - - /** @id MochiKit.Color.Color.prototype.darkerColorWithLevel */ - darkerColorWithLevel: function (level) { - var hsl = this.asHSL(); - hsl.l = Math.max(hsl.l - level, 0); - var m = MochiKit.Color; - return m.Color.fromHSL(hsl); - }, - - /** @id MochiKit.Color.Color.prototype.lighterColorWithLevel */ - lighterColorWithLevel: function (level) { - var hsl = this.asHSL(); - hsl.l = Math.min(hsl.l + level, 1); - var m = MochiKit.Color; - return m.Color.fromHSL(hsl); - }, - - /** @id MochiKit.Color.Color.prototype.blendedColor */ - blendedColor: function (other, /* optional */ fraction) { - if (typeof(fraction) == 'undefined' || fraction === null) { - fraction = 0.5; - } - var sf = 1.0 - fraction; - var s = this.rgb; - var d = other.rgb; - var df = fraction; - return MochiKit.Color.Color.fromRGB( - (s.r * sf) + (d.r * df), - (s.g * sf) + (d.g * df), - (s.b * sf) + (d.b * df), - (s.a * sf) + (d.a * df) - ); - }, - - /** @id MochiKit.Color.Color.prototype.compareRGB */ - compareRGB: function (other) { - var a = this.asRGB(); - var b = other.asRGB(); - return MochiKit.Base.compare( - [a.r, a.g, a.b, a.a], - [b.r, b.g, b.b, b.a] - ); - }, - - /** @id MochiKit.Color.Color.prototype.isLight */ - isLight: function () { - return this.asHSL().b > 0.5; - }, - - /** @id MochiKit.Color.Color.prototype.isDark */ - isDark: function () { - return (!this.isLight()); - }, - - /** @id MochiKit.Color.Color.prototype.toHSLString */ - toHSLString: function () { - var c = this.asHSL(); - var ccc = MochiKit.Color.clampColorComponent; - var rval = this._hslString; - if (!rval) { - var mid = ( - ccc(c.h, 360).toFixed(0) - + "," + ccc(c.s, 100).toPrecision(4) + "%" - + "," + ccc(c.l, 100).toPrecision(4) + "%" - ); - var a = c.a; - if (a >= 1) { - a = 1; - rval = "hsl(" + mid + ")"; - } else { - if (a <= 0) { - a = 0; - } - rval = "hsla(" + mid + "," + a + ")"; - } - this._hslString = rval; - } - return rval; - }, - - /** @id MochiKit.Color.Color.prototype.toRGBString */ - toRGBString: function () { - var c = this.rgb; - var ccc = MochiKit.Color.clampColorComponent; - var rval = this._rgbString; - if (!rval) { - var mid = ( - ccc(c.r, 255).toFixed(0) - + "," + ccc(c.g, 255).toFixed(0) - + "," + ccc(c.b, 255).toFixed(0) - ); - if (c.a != 1) { - rval = "rgba(" + mid + "," + c.a + ")"; - } else { - rval = "rgb(" + mid + ")"; - } - this._rgbString = rval; - } - return rval; - }, - - /** @id MochiKit.Color.Color.prototype.asRGB */ - asRGB: function () { - return MochiKit.Base.clone(this.rgb); - }, - - /** @id MochiKit.Color.Color.prototype.toHexString */ - toHexString: function () { - var m = MochiKit.Color; - var c = this.rgb; - var ccc = MochiKit.Color.clampColorComponent; - var rval = this._hexString; - if (!rval) { - rval = ("#" + - m.toColorPart(ccc(c.r, 255)) + - m.toColorPart(ccc(c.g, 255)) + - m.toColorPart(ccc(c.b, 255)) - ); - this._hexString = rval; - } - return rval; - }, - - /** @id MochiKit.Color.Color.prototype.asHSV */ - asHSV: function () { - var hsv = this.hsv; - var c = this.rgb; - if (typeof(hsv) == 'undefined' || hsv === null) { - hsv = MochiKit.Color.rgbToHSV(this.rgb); - this.hsv = hsv; - } - return MochiKit.Base.clone(hsv); - }, - - /** @id MochiKit.Color.Color.prototype.asHSL */ - asHSL: function () { - var hsl = this.hsl; - var c = this.rgb; - if (typeof(hsl) == 'undefined' || hsl === null) { - hsl = MochiKit.Color.rgbToHSL(this.rgb); - this.hsl = hsl; - } - return MochiKit.Base.clone(hsl); - }, - - /** @id MochiKit.Color.Color.prototype.toString */ - toString: function () { - return this.toRGBString(); - }, - - /** @id MochiKit.Color.Color.prototype.repr */ - repr: function () { - var c = this.rgb; - var col = [c.r, c.g, c.b, c.a]; - return this.__class__.NAME + "(" + col.join(", ") + ")"; - } - -}; - -// Constructor methods - -MochiKit.Base.update(MochiKit.Color.Color, { - /** @id MochiKit.Color.Color.fromRGB */ - fromRGB: function (red, green, blue, alpha) { - // designated initializer - var Color = MochiKit.Color.Color; - if (arguments.length == 1) { - var rgb = red; - red = rgb.r; - green = rgb.g; - blue = rgb.b; - if (typeof(rgb.a) == 'undefined') { - alpha = undefined; - } else { - alpha = rgb.a; - } - } - return new Color(red, green, blue, alpha); - }, - - /** @id MochiKit.Color.Color.fromHSL */ - fromHSL: function (hue, saturation, lightness, alpha) { - var m = MochiKit.Color; - return m.Color.fromRGB(m.hslToRGB.apply(m, arguments)); - }, - - /** @id MochiKit.Color.Color.fromHSV */ - fromHSV: function (hue, saturation, value, alpha) { - var m = MochiKit.Color; - return m.Color.fromRGB(m.hsvToRGB.apply(m, arguments)); - }, - - /** @id MochiKit.Color.Color.fromName */ - fromName: function (name) { - var Color = MochiKit.Color.Color; - // Opera 9 seems to "quote" named colors(?!) - if (name.charAt(0) == '"') { - name = name.substr(1, name.length - 2); - } - var htmlColor = Color._namedColors[name.toLowerCase()]; - if (typeof(htmlColor) == 'string') { - return Color.fromHexString(htmlColor); - } else if (name == "transparent") { - return Color.transparentColor(); - } - return null; - }, - - /** @id MochiKit.Color.Color.fromString */ - fromString: function (colorString) { - var self = MochiKit.Color.Color; - var three = colorString.substr(0, 3); - if (three == "rgb") { - return self.fromRGBString(colorString); - } else if (three == "hsl") { - return self.fromHSLString(colorString); - } else if (colorString.charAt(0) == "#") { - return self.fromHexString(colorString); - } - return self.fromName(colorString); - }, - - - /** @id MochiKit.Color.Color.fromHexString */ - fromHexString: function (hexCode) { - if (hexCode.charAt(0) == '#') { - hexCode = hexCode.substring(1); - } - var components = []; - var i, hex; - if (hexCode.length == 3) { - for (i = 0; i < 3; i++) { - hex = hexCode.substr(i, 1); - components.push(parseInt(hex + hex, 16) / 255.0); - } - } else { - for (i = 0; i < 6; i += 2) { - hex = hexCode.substr(i, 2); - components.push(parseInt(hex, 16) / 255.0); - } - } - var Color = MochiKit.Color.Color; - return Color.fromRGB.apply(Color, components); - }, - - - _fromColorString: function (pre, method, scales, colorCode) { - // parses either HSL or RGB - if (colorCode.indexOf(pre) === 0) { - colorCode = colorCode.substring(colorCode.indexOf("(", 3) + 1, colorCode.length - 1); - } - var colorChunks = colorCode.split(/\s*,\s*/); - var colorFloats = []; - for (var i = 0; i < colorChunks.length; i++) { - var c = colorChunks[i]; - var val; - var three = c.substring(c.length - 3); - if (c.charAt(c.length - 1) == '%') { - val = 0.01 * parseFloat(c.substring(0, c.length - 1)); - } else if (three == "deg") { - val = parseFloat(c) / 360.0; - } else if (three == "rad") { - val = parseFloat(c) / (Math.PI * 2); - } else { - val = scales[i] * parseFloat(c); - } - colorFloats.push(val); - } - return this[method].apply(this, colorFloats); - }, - - /** @id MochiKit.Color.Color.fromComputedStyle */ - fromComputedStyle: function (elem, style) { - var d = MochiKit.DOM; - var cls = MochiKit.Color.Color; - for (elem = d.getElement(elem); elem; elem = elem.parentNode) { - var actualColor = MochiKit.Style.getStyle.apply(d, arguments); - if (!actualColor) { - continue; - } - var color = cls.fromString(actualColor); - if (!color) { - break; - } - if (color.asRGB().a > 0) { - return color; - } - } - return null; - }, - - /** @id MochiKit.Color.Color.fromBackground */ - fromBackground: function (elem) { - var cls = MochiKit.Color.Color; - return cls.fromComputedStyle( - elem, "backgroundColor", "background-color") || cls.whiteColor(); - }, - - /** @id MochiKit.Color.Color.fromText */ - fromText: function (elem) { - var cls = MochiKit.Color.Color; - return cls.fromComputedStyle( - elem, "color", "color") || cls.blackColor(); - }, - - /** @id MochiKit.Color.Color.namedColors */ - namedColors: function () { - return MochiKit.Base.clone(MochiKit.Color.Color._namedColors); - } -}); - - -// Module level functions - -MochiKit.Base.update(MochiKit.Color, { - /** @id MochiKit.Color.clampColorComponent */ - clampColorComponent: function (v, scale) { - v *= scale; - if (v < 0) { - return 0; - } else if (v > scale) { - return scale; - } else { - return v; - } - }, - - _hslValue: function (n1, n2, hue) { - if (hue > 6.0) { - hue -= 6.0; - } else if (hue < 0.0) { - hue += 6.0; - } - var val; - if (hue < 1.0) { - val = n1 + (n2 - n1) * hue; - } else if (hue < 3.0) { - val = n2; - } else if (hue < 4.0) { - val = n1 + (n2 - n1) * (4.0 - hue); - } else { - val = n1; - } - return val; - }, - - /** @id MochiKit.Color.hsvToRGB */ - hsvToRGB: function (hue, saturation, value, alpha) { - if (arguments.length == 1) { - var hsv = hue; - hue = hsv.h; - saturation = hsv.s; - value = hsv.v; - alpha = hsv.a; - } - var red; - var green; - var blue; - if (saturation === 0) { - red = value; - green = value; - blue = value; - } else { - var i = Math.floor(hue * 6); - var f = (hue * 6) - i; - var p = value * (1 - saturation); - var q = value * (1 - (saturation * f)); - var t = value * (1 - (saturation * (1 - f))); - switch (i) { - case 1: red = q; green = value; blue = p; break; - case 2: red = p; green = value; blue = t; break; - case 3: red = p; green = q; blue = value; break; - case 4: red = t; green = p; blue = value; break; - case 5: red = value; green = p; blue = q; break; - case 6: // fall through - case 0: red = value; green = t; blue = p; break; - } - } - return { - r: red, - g: green, - b: blue, - a: alpha - }; - }, - - /** @id MochiKit.Color.hslToRGB */ - hslToRGB: function (hue, saturation, lightness, alpha) { - if (arguments.length == 1) { - var hsl = hue; - hue = hsl.h; - saturation = hsl.s; - lightness = hsl.l; - alpha = hsl.a; - } - var red; - var green; - var blue; - if (saturation === 0) { - red = lightness; - green = lightness; - blue = lightness; - } else { - var m2; - if (lightness <= 0.5) { - m2 = lightness * (1.0 + saturation); - } else { - m2 = lightness + saturation - (lightness * saturation); - } - var m1 = (2.0 * lightness) - m2; - var f = MochiKit.Color._hslValue; - var h6 = hue * 6.0; - red = f(m1, m2, h6 + 2); - green = f(m1, m2, h6); - blue = f(m1, m2, h6 - 2); - } - return { - r: red, - g: green, - b: blue, - a: alpha - }; - }, - - /** @id MochiKit.Color.rgbToHSV */ - rgbToHSV: function (red, green, blue, alpha) { - if (arguments.length == 1) { - var rgb = red; - red = rgb.r; - green = rgb.g; - blue = rgb.b; - alpha = rgb.a; - } - var max = Math.max(Math.max(red, green), blue); - var min = Math.min(Math.min(red, green), blue); - var hue; - var saturation; - var value = max; - if (min == max) { - hue = 0; - saturation = 0; - } else { - var delta = (max - min); - saturation = delta / max; - - if (red == max) { - hue = (green - blue) / delta; - } else if (green == max) { - hue = 2 + ((blue - red) / delta); - } else { - hue = 4 + ((red - green) / delta); - } - hue /= 6; - if (hue < 0) { - hue += 1; - } - if (hue > 1) { - hue -= 1; - } - } - return { - h: hue, - s: saturation, - v: value, - a: alpha - }; - }, - - /** @id MochiKit.Color.rgbToHSL */ - rgbToHSL: function (red, green, blue, alpha) { - if (arguments.length == 1) { - var rgb = red; - red = rgb.r; - green = rgb.g; - blue = rgb.b; - alpha = rgb.a; - } - var max = Math.max(red, Math.max(green, blue)); - var min = Math.min(red, Math.min(green, blue)); - var hue; - var saturation; - var lightness = (max + min) / 2.0; - var delta = max - min; - if (delta === 0) { - hue = 0; - saturation = 0; - } else { - if (lightness <= 0.5) { - saturation = delta / (max + min); - } else { - saturation = delta / (2 - max - min); - } - if (red == max) { - hue = (green - blue) / delta; - } else if (green == max) { - hue = 2 + ((blue - red) / delta); - } else { - hue = 4 + ((red - green) / delta); - } - hue /= 6; - if (hue < 0) { - hue += 1; - } - if (hue > 1) { - hue -= 1; - } - - } - return { - h: hue, - s: saturation, - l: lightness, - a: alpha - }; - }, - - /** @id MochiKit.Color.toColorPart */ - toColorPart: function (num) { - num = Math.round(num); - var digits = num.toString(16); - if (num < 16) { - return '0' + digits; - } - return digits; - }, - - __new__: function () { - var m = MochiKit.Base; - /** @id MochiKit.Color.fromRGBString */ - this.Color.fromRGBString = m.bind( - this.Color._fromColorString, this.Color, "rgb", "fromRGB", - [1.0/255.0, 1.0/255.0, 1.0/255.0, 1] - ); - /** @id MochiKit.Color.fromHSLString */ - this.Color.fromHSLString = m.bind( - this.Color._fromColorString, this.Color, "hsl", "fromHSL", - [1.0/360.0, 0.01, 0.01, 1] - ); - - var third = 1.0 / 3.0; - /** @id MochiKit.Color.colors */ - var colors = { - // NSColor colors plus transparent - /** @id MochiKit.Color.blackColor */ - black: [0, 0, 0], - /** @id MochiKit.Color.blueColor */ - blue: [0, 0, 1], - /** @id MochiKit.Color.brownColor */ - brown: [0.6, 0.4, 0.2], - /** @id MochiKit.Color.cyanColor */ - cyan: [0, 1, 1], - /** @id MochiKit.Color.darkGrayColor */ - darkGray: [third, third, third], - /** @id MochiKit.Color.grayColor */ - gray: [0.5, 0.5, 0.5], - /** @id MochiKit.Color.greenColor */ - green: [0, 1, 0], - /** @id MochiKit.Color.lightGrayColor */ - lightGray: [2 * third, 2 * third, 2 * third], - /** @id MochiKit.Color.magentaColor */ - magenta: [1, 0, 1], - /** @id MochiKit.Color.orangeColor */ - orange: [1, 0.5, 0], - /** @id MochiKit.Color.purpleColor */ - purple: [0.5, 0, 0.5], - /** @id MochiKit.Color.redColor */ - red: [1, 0, 0], - /** @id MochiKit.Color.transparentColor */ - transparent: [0, 0, 0, 0], - /** @id MochiKit.Color.whiteColor */ - white: [1, 1, 1], - /** @id MochiKit.Color.yellowColor */ - yellow: [1, 1, 0] - }; - - var makeColor = function (name, r, g, b, a) { - var rval = this.fromRGB(r, g, b, a); - this[name] = function () { return rval; }; - return rval; - }; - - for (var k in colors) { - var name = k + "Color"; - var bindArgs = m.concat( - [makeColor, this.Color, name], - colors[k] - ); - this.Color[name] = m.bind.apply(null, bindArgs); - } - - var isColor = function () { - for (var i = 0; i < arguments.length; i++) { - if (!(arguments[i] instanceof MochiKit.Color.Color)) { - return false; - } - } - return true; - }; - - var compareColor = function (a, b) { - return a.compareRGB(b); - }; - - m.nameFunctions(this); - - m.registerComparator(this.Color.NAME, isColor, compareColor); - - this.EXPORT_TAGS = { - ":common": this.EXPORT, - ":all": m.concat(this.EXPORT, this.EXPORT_OK) - }; - - } -}); - -MochiKit.Color.EXPORT = [ - "Color" -]; - -MochiKit.Color.EXPORT_OK = [ - "clampColorComponent", - "rgbToHSL", - "hslToRGB", - "rgbToHSV", - "hsvToRGB", - "toColorPart" -]; - -MochiKit.Color.__new__(); - -MochiKit.Base._exportSymbols(this, MochiKit.Color); - -// Full table of css3 X11 colors - -MochiKit.Color.Color._namedColors = { - aliceblue: "#f0f8ff", - antiquewhite: "#faebd7", - aqua: "#00ffff", - aquamarine: "#7fffd4", - azure: "#f0ffff", - beige: "#f5f5dc", - bisque: "#ffe4c4", - black: "#000000", - blanchedalmond: "#ffebcd", - blue: "#0000ff", - blueviolet: "#8a2be2", - brown: "#a52a2a", - burlywood: "#deb887", - cadetblue: "#5f9ea0", - chartreuse: "#7fff00", - chocolate: "#d2691e", - coral: "#ff7f50", - cornflowerblue: "#6495ed", - cornsilk: "#fff8dc", - crimson: "#dc143c", - cyan: "#00ffff", - darkblue: "#00008b", - darkcyan: "#008b8b", - darkgoldenrod: "#b8860b", - darkgray: "#a9a9a9", - darkgreen: "#006400", - darkgrey: "#a9a9a9", - darkkhaki: "#bdb76b", - darkmagenta: "#8b008b", - darkolivegreen: "#556b2f", - darkorange: "#ff8c00", - darkorchid: "#9932cc", - darkred: "#8b0000", - darksalmon: "#e9967a", - darkseagreen: "#8fbc8f", - darkslateblue: "#483d8b", - darkslategray: "#2f4f4f", - darkslategrey: "#2f4f4f", - darkturquoise: "#00ced1", - darkviolet: "#9400d3", - deeppink: "#ff1493", - deepskyblue: "#00bfff", - dimgray: "#696969", - dimgrey: "#696969", - dodgerblue: "#1e90ff", - firebrick: "#b22222", - floralwhite: "#fffaf0", - forestgreen: "#228b22", - fuchsia: "#ff00ff", - gainsboro: "#dcdcdc", - ghostwhite: "#f8f8ff", - gold: "#ffd700", - goldenrod: "#daa520", - gray: "#808080", - green: "#008000", - greenyellow: "#adff2f", - grey: "#808080", - honeydew: "#f0fff0", - hotpink: "#ff69b4", - indianred: "#cd5c5c", - indigo: "#4b0082", - ivory: "#fffff0", - khaki: "#f0e68c", - lavender: "#e6e6fa", - lavenderblush: "#fff0f5", - lawngreen: "#7cfc00", - lemonchiffon: "#fffacd", - lightblue: "#add8e6", - lightcoral: "#f08080", - lightcyan: "#e0ffff", - lightgoldenrodyellow: "#fafad2", - lightgray: "#d3d3d3", - lightgreen: "#90ee90", - lightgrey: "#d3d3d3", - lightpink: "#ffb6c1", - lightsalmon: "#ffa07a", - lightseagreen: "#20b2aa", - lightskyblue: "#87cefa", - lightslategray: "#778899", - lightslategrey: "#778899", - lightsteelblue: "#b0c4de", - lightyellow: "#ffffe0", - lime: "#00ff00", - limegreen: "#32cd32", - linen: "#faf0e6", - magenta: "#ff00ff", - maroon: "#800000", - mediumaquamarine: "#66cdaa", - mediumblue: "#0000cd", - mediumorchid: "#ba55d3", - mediumpurple: "#9370db", - mediumseagreen: "#3cb371", - mediumslateblue: "#7b68ee", - mediumspringgreen: "#00fa9a", - mediumturquoise: "#48d1cc", - mediumvioletred: "#c71585", - midnightblue: "#191970", - mintcream: "#f5fffa", - mistyrose: "#ffe4e1", - moccasin: "#ffe4b5", - navajowhite: "#ffdead", - navy: "#000080", - oldlace: "#fdf5e6", - olive: "#808000", - olivedrab: "#6b8e23", - orange: "#ffa500", - orangered: "#ff4500", - orchid: "#da70d6", - palegoldenrod: "#eee8aa", - palegreen: "#98fb98", - paleturquoise: "#afeeee", - palevioletred: "#db7093", - papayawhip: "#ffefd5", - peachpuff: "#ffdab9", - peru: "#cd853f", - pink: "#ffc0cb", - plum: "#dda0dd", - powderblue: "#b0e0e6", - purple: "#800080", - red: "#ff0000", - rosybrown: "#bc8f8f", - royalblue: "#4169e1", - saddlebrown: "#8b4513", - salmon: "#fa8072", - sandybrown: "#f4a460", - seagreen: "#2e8b57", - seashell: "#fff5ee", - sienna: "#a0522d", - silver: "#c0c0c0", - skyblue: "#87ceeb", - slateblue: "#6a5acd", - slategray: "#708090", - slategrey: "#708090", - snow: "#fffafa", - springgreen: "#00ff7f", - steelblue: "#4682b4", - tan: "#d2b48c", - teal: "#008080", - thistle: "#d8bfd8", - tomato: "#ff6347", - turquoise: "#40e0d0", - violet: "#ee82ee", - wheat: "#f5deb3", - white: "#ffffff", - whitesmoke: "#f5f5f5", - yellow: "#ffff00", - yellowgreen: "#9acd32" -}; diff --git a/static/MochiKit/DOM.js b/static/MochiKit/DOM.js deleted file mode 100644 index 82cbaf2..0000000 --- a/static/MochiKit/DOM.js +++ /dev/null @@ -1,1256 +0,0 @@ -/*** - -MochiKit.DOM 1.4.2 - -See for documentation, downloads, license, etc. - -(c) 2005 Bob Ippolito. All rights Reserved. - -***/ - -MochiKit.Base._deps('DOM', ['Base']); - -MochiKit.DOM.NAME = "MochiKit.DOM"; -MochiKit.DOM.VERSION = "1.4.2"; -MochiKit.DOM.__repr__ = function () { - return "[" + this.NAME + " " + this.VERSION + "]"; -}; -MochiKit.DOM.toString = function () { - return this.__repr__(); -}; - -MochiKit.DOM.EXPORT = [ - "removeEmptyTextNodes", - "formContents", - "currentWindow", - "currentDocument", - "withWindow", - "withDocument", - "registerDOMConverter", - "coerceToDOM", - "createDOM", - "createDOMFunc", - "isChildNode", - "getNodeAttribute", - "removeNodeAttribute", - "setNodeAttribute", - "updateNodeAttributes", - "appendChildNodes", - "insertSiblingNodesAfter", - "insertSiblingNodesBefore", - "replaceChildNodes", - "removeElement", - "swapDOM", - "BUTTON", - "TT", - "PRE", - "H1", - "H2", - "H3", - "H4", - "H5", - "H6", - "BR", - "CANVAS", - "HR", - "LABEL", - "TEXTAREA", - "FORM", - "STRONG", - "SELECT", - "OPTION", - "OPTGROUP", - "LEGEND", - "FIELDSET", - "P", - "UL", - "OL", - "LI", - "DL", - "DT", - "DD", - "TD", - "TR", - "THEAD", - "TBODY", - "TFOOT", - "TABLE", - "TH", - "INPUT", - "SPAN", - "A", - "DIV", - "IMG", - "getElement", - "$", - "getElementsByTagAndClassName", - "addToCallStack", - "addLoadEvent", - "focusOnLoad", - "setElementClass", - "toggleElementClass", - "addElementClass", - "removeElementClass", - "swapElementClass", - "hasElementClass", - "computedStyle", // deprecated in 1.4 - "escapeHTML", - "toHTML", - "emitHTML", - "scrapeText", - "getFirstParentByTagAndClassName", - "getFirstElementByTagAndClassName" -]; - -MochiKit.DOM.EXPORT_OK = [ - "domConverters" -]; - -MochiKit.DOM.DEPRECATED = [ - /** @id MochiKit.DOM.computedStyle */ - ['computedStyle', 'MochiKit.Style.getStyle', '1.4'], - /** @id MochiKit.DOM.elementDimensions */ - ['elementDimensions', 'MochiKit.Style.getElementDimensions', '1.4'], - /** @id MochiKit.DOM.elementPosition */ - ['elementPosition', 'MochiKit.Style.getElementPosition', '1.4'], - /** @id MochiKit.DOM.getViewportDimensions */ - ['getViewportDimensions', 'MochiKit.Style.getViewportDimensions', '1.4'], - /** @id MochiKit.DOM.hideElement */ - ['hideElement', 'MochiKit.Style.hideElement', '1.4'], - /** @id MochiKit.DOM.makeClipping */ - ['makeClipping', 'MochiKit.Style.makeClipping', '1.4.1'], - /** @id MochiKit.DOM.makePositioned */ - ['makePositioned', 'MochiKit.Style.makePositioned', '1.4.1'], - /** @id MochiKit.DOM.setElementDimensions */ - ['setElementDimensions', 'MochiKit.Style.setElementDimensions', '1.4'], - /** @id MochiKit.DOM.setElementPosition */ - ['setElementPosition', 'MochiKit.Style.setElementPosition', '1.4'], - /** @id MochiKit.DOM.setDisplayForElement */ - ['setDisplayForElement', 'MochiKit.Style.setDisplayForElement', '1.4'], - /** @id MochiKit.DOM.setOpacity */ - ['setOpacity', 'MochiKit.Style.setOpacity', '1.4'], - /** @id MochiKit.DOM.showElement */ - ['showElement', 'MochiKit.Style.showElement', '1.4'], - /** @id MochiKit.DOM.undoClipping */ - ['undoClipping', 'MochiKit.Style.undoClipping', '1.4.1'], - /** @id MochiKit.DOM.undoPositioned */ - ['undoPositioned', 'MochiKit.Style.undoPositioned', '1.4.1'], - /** @id MochiKit.DOM.Coordinates */ - ['Coordinates', 'MochiKit.Style.Coordinates', '1.4'], // FIXME: broken - /** @id MochiKit.DOM.Dimensions */ - ['Dimensions', 'MochiKit.Style.Dimensions', '1.4'] // FIXME: broken -]; - -MochiKit.Base.update(MochiKit.DOM, { - - /** @id MochiKit.DOM.currentWindow */ - currentWindow: function () { - return MochiKit.DOM._window; - }, - - /** @id MochiKit.DOM.currentDocument */ - currentDocument: function () { - return MochiKit.DOM._document; - }, - - /** @id MochiKit.DOM.withWindow */ - withWindow: function (win, func) { - var self = MochiKit.DOM; - var oldDoc = self._document; - var oldWin = self._window; - var rval; - try { - self._window = win; - self._document = win.document; - rval = func(); - } catch (e) { - self._window = oldWin; - self._document = oldDoc; - throw e; - } - self._window = oldWin; - self._document = oldDoc; - return rval; - }, - - /** @id MochiKit.DOM.formContents */ - formContents: function (elem/* = document.body */) { - var names = []; - var values = []; - var m = MochiKit.Base; - var self = MochiKit.DOM; - if (typeof(elem) == "undefined" || elem === null) { - elem = self._document.body; - } else { - elem = self.getElement(elem); - } - m.nodeWalk(elem, function (elem) { - var name = elem.name; - if (m.isNotEmpty(name)) { - var tagName = elem.tagName.toUpperCase(); - if (tagName === "INPUT" - && (elem.type == "radio" || elem.type == "checkbox") - && !elem.checked - ) { - return null; - } - if (tagName === "SELECT") { - if (elem.type == "select-one") { - if (elem.selectedIndex >= 0) { - var opt = elem.options[elem.selectedIndex]; - var v = opt.value; - if (!v) { - var h = opt.outerHTML; - // internet explorer sure does suck. - if (h && !h.match(/^[^>]+\svalue\s*=/i)) { - v = opt.text; - } - } - names.push(name); - values.push(v); - return null; - } - // no form elements? - names.push(name); - values.push(""); - return null; - } else { - var opts = elem.options; - if (!opts.length) { - names.push(name); - values.push(""); - return null; - } - for (var i = 0; i < opts.length; i++) { - var opt = opts[i]; - if (!opt.selected) { - continue; - } - var v = opt.value; - if (!v) { - var h = opt.outerHTML; - // internet explorer sure does suck. - if (h && !h.match(/^[^>]+\svalue\s*=/i)) { - v = opt.text; - } - } - names.push(name); - values.push(v); - } - return null; - } - } - if (tagName === "FORM" || tagName === "P" || tagName === "SPAN" - || tagName === "DIV" - ) { - return elem.childNodes; - } - names.push(name); - values.push(elem.value || ''); - return null; - } - return elem.childNodes; - }); - return [names, values]; - }, - - /** @id MochiKit.DOM.withDocument */ - withDocument: function (doc, func) { - var self = MochiKit.DOM; - var oldDoc = self._document; - var rval; - try { - self._document = doc; - rval = func(); - } catch (e) { - self._document = oldDoc; - throw e; - } - self._document = oldDoc; - return rval; - }, - - /** @id MochiKit.DOM.registerDOMConverter */ - registerDOMConverter: function (name, check, wrap, /* optional */override) { - MochiKit.DOM.domConverters.register(name, check, wrap, override); - }, - - /** @id MochiKit.DOM.coerceToDOM */ - coerceToDOM: function (node, ctx) { - var m = MochiKit.Base; - var im = MochiKit.Iter; - var self = MochiKit.DOM; - if (im) { - var iter = im.iter; - var repeat = im.repeat; - } - var map = m.map; - var domConverters = self.domConverters; - var coerceToDOM = arguments.callee; - var NotFound = m.NotFound; - while (true) { - if (typeof(node) == 'undefined' || node === null) { - return null; - } - // this is a safari childNodes object, avoiding crashes w/ attr - // lookup - if (typeof(node) == "function" && - typeof(node.length) == "number" && - !(node instanceof Function)) { - node = im ? im.list(node) : m.extend(null, node); - } - if (typeof(node.nodeType) != 'undefined' && node.nodeType > 0) { - return node; - } - if (typeof(node) == 'number' || typeof(node) == 'boolean') { - node = node.toString(); - // FALL THROUGH - } - if (typeof(node) == 'string') { - return self._document.createTextNode(node); - } - if (typeof(node.__dom__) == 'function') { - node = node.__dom__(ctx); - continue; - } - if (typeof(node.dom) == 'function') { - node = node.dom(ctx); - continue; - } - if (typeof(node) == 'function') { - node = node.apply(ctx, [ctx]); - continue; - } - - if (im) { - // iterable - var iterNodes = null; - try { - iterNodes = iter(node); - } catch (e) { - // pass - } - if (iterNodes) { - return map(coerceToDOM, iterNodes, repeat(ctx)); - } - } else if (m.isArrayLike(node)) { - var func = function (n) { return coerceToDOM(n, ctx); }; - return map(func, node); - } - - // adapter - try { - node = domConverters.match(node, ctx); - continue; - } catch (e) { - if (e != NotFound) { - throw e; - } - } - - // fallback - return self._document.createTextNode(node.toString()); - } - // mozilla warnings aren't too bright - return undefined; - }, - - /** @id MochiKit.DOM.isChildNode */ - isChildNode: function (node, maybeparent) { - var self = MochiKit.DOM; - if (typeof(node) == "string") { - node = self.getElement(node); - } - if (typeof(maybeparent) == "string") { - maybeparent = self.getElement(maybeparent); - } - if (typeof(node) == 'undefined' || node === null) { - return false; - } - while (node != null && node !== self._document) { - if (node === maybeparent) { - return true; - } - node = node.parentNode; - } - return false; - }, - - /** @id MochiKit.DOM.setNodeAttribute */ - setNodeAttribute: function (node, attr, value) { - var o = {}; - o[attr] = value; - try { - return MochiKit.DOM.updateNodeAttributes(node, o); - } catch (e) { - // pass - } - return null; - }, - - /** @id MochiKit.DOM.getNodeAttribute */ - getNodeAttribute: function (node, attr) { - var self = MochiKit.DOM; - var rename = self.attributeArray.renames[attr]; - var ignoreValue = self.attributeArray.ignoreAttr[attr]; - node = self.getElement(node); - try { - if (rename) { - return node[rename]; - } - var value = node.getAttribute(attr); - if (value != ignoreValue) { - return value; - } - } catch (e) { - // pass - } - return null; - }, - - /** @id MochiKit.DOM.removeNodeAttribute */ - removeNodeAttribute: function (node, attr) { - var self = MochiKit.DOM; - var rename = self.attributeArray.renames[attr]; - node = self.getElement(node); - try { - if (rename) { - return node[rename]; - } - return node.removeAttribute(attr); - } catch (e) { - // pass - } - return null; - }, - - /** @id MochiKit.DOM.updateNodeAttributes */ - updateNodeAttributes: function (node, attrs) { - var elem = node; - var self = MochiKit.DOM; - if (typeof(node) == 'string') { - elem = self.getElement(node); - } - if (attrs) { - var updatetree = MochiKit.Base.updatetree; - if (self.attributeArray.compliant) { - // not IE, good. - for (var k in attrs) { - var v = attrs[k]; - if (typeof(v) == 'object' && typeof(elem[k]) == 'object') { - if (k == "style" && MochiKit.Style) { - MochiKit.Style.setStyle(elem, v); - } else { - updatetree(elem[k], v); - } - } else if (k.substring(0, 2) == "on") { - if (typeof(v) == "string") { - v = new Function(v); - } - elem[k] = v; - } else { - elem.setAttribute(k, v); - } - if (typeof(elem[k]) == "string" && elem[k] != v) { - // Also set property for weird attributes (see #302) - elem[k] = v; - } - } - } else { - // IE is insane in the membrane - var renames = self.attributeArray.renames; - for (var k in attrs) { - v = attrs[k]; - var renamed = renames[k]; - if (k == "style" && typeof(v) == "string") { - elem.style.cssText = v; - } else if (typeof(renamed) == "string") { - elem[renamed] = v; - } else if (typeof(elem[k]) == 'object' - && typeof(v) == 'object') { - if (k == "style" && MochiKit.Style) { - MochiKit.Style.setStyle(elem, v); - } else { - updatetree(elem[k], v); - } - } else if (k.substring(0, 2) == "on") { - if (typeof(v) == "string") { - v = new Function(v); - } - elem[k] = v; - } else { - elem.setAttribute(k, v); - } - if (typeof(elem[k]) == "string" && elem[k] != v) { - // Also set property for weird attributes (see #302) - elem[k] = v; - } - } - } - } - return elem; - }, - - /** @id MochiKit.DOM.appendChildNodes */ - appendChildNodes: function (node/*, nodes...*/) { - var elem = node; - var self = MochiKit.DOM; - if (typeof(node) == 'string') { - elem = self.getElement(node); - } - var nodeStack = [ - self.coerceToDOM( - MochiKit.Base.extend(null, arguments, 1), - elem - ) - ]; - var concat = MochiKit.Base.concat; - while (nodeStack.length) { - var n = nodeStack.shift(); - if (typeof(n) == 'undefined' || n === null) { - // pass - } else if (typeof(n.nodeType) == 'number') { - elem.appendChild(n); - } else { - nodeStack = concat(n, nodeStack); - } - } - return elem; - }, - - - /** @id MochiKit.DOM.insertSiblingNodesBefore */ - insertSiblingNodesBefore: function (node/*, nodes...*/) { - var elem = node; - var self = MochiKit.DOM; - if (typeof(node) == 'string') { - elem = self.getElement(node); - } - var nodeStack = [ - self.coerceToDOM( - MochiKit.Base.extend(null, arguments, 1), - elem - ) - ]; - var parentnode = elem.parentNode; - var concat = MochiKit.Base.concat; - while (nodeStack.length) { - var n = nodeStack.shift(); - if (typeof(n) == 'undefined' || n === null) { - // pass - } else if (typeof(n.nodeType) == 'number') { - parentnode.insertBefore(n, elem); - } else { - nodeStack = concat(n, nodeStack); - } - } - return parentnode; - }, - - /** @id MochiKit.DOM.insertSiblingNodesAfter */ - insertSiblingNodesAfter: function (node/*, nodes...*/) { - var elem = node; - var self = MochiKit.DOM; - - if (typeof(node) == 'string') { - elem = self.getElement(node); - } - var nodeStack = [ - self.coerceToDOM( - MochiKit.Base.extend(null, arguments, 1), - elem - ) - ]; - - if (elem.nextSibling) { - return self.insertSiblingNodesBefore(elem.nextSibling, nodeStack); - } - else { - return self.appendChildNodes(elem.parentNode, nodeStack); - } - }, - - /** @id MochiKit.DOM.replaceChildNodes */ - replaceChildNodes: function (node/*, nodes...*/) { - var elem = node; - var self = MochiKit.DOM; - if (typeof(node) == 'string') { - elem = self.getElement(node); - arguments[0] = elem; - } - var child; - while ((child = elem.firstChild)) { - elem.removeChild(child); - } - if (arguments.length < 2) { - return elem; - } else { - return self.appendChildNodes.apply(this, arguments); - } - }, - - /** @id MochiKit.DOM.createDOM */ - createDOM: function (name, attrs/*, nodes... */) { - var elem; - var self = MochiKit.DOM; - var m = MochiKit.Base; - if (typeof(attrs) == "string" || typeof(attrs) == "number") { - var args = m.extend([name, null], arguments, 1); - return arguments.callee.apply(this, args); - } - if (typeof(name) == 'string') { - // Internet Explorer is dumb - var xhtml = self._xhtml; - if (attrs && !self.attributeArray.compliant) { - // http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/name_2.asp - var contents = ""; - if ('name' in attrs) { - contents += ' name="' + self.escapeHTML(attrs.name) + '"'; - } - if (name == 'input' && 'type' in attrs) { - contents += ' type="' + self.escapeHTML(attrs.type) + '"'; - } - if (contents) { - name = "<" + name + contents + ">"; - xhtml = false; - } - } - var d = self._document; - if (xhtml && d === document) { - elem = d.createElementNS("http://www.w3.org/1999/xhtml", name); - } else { - elem = d.createElement(name); - } - } else { - elem = name; - } - if (attrs) { - self.updateNodeAttributes(elem, attrs); - } - if (arguments.length <= 2) { - return elem; - } else { - var args = m.extend([elem], arguments, 2); - return self.appendChildNodes.apply(this, args); - } - }, - - /** @id MochiKit.DOM.createDOMFunc */ - createDOMFunc: function (/* tag, attrs, *nodes */) { - var m = MochiKit.Base; - return m.partial.apply( - this, - m.extend([MochiKit.DOM.createDOM], arguments) - ); - }, - - /** @id MochiKit.DOM.removeElement */ - removeElement: function (elem) { - var self = MochiKit.DOM; - var e = self.coerceToDOM(self.getElement(elem)); - e.parentNode.removeChild(e); - return e; - }, - - /** @id MochiKit.DOM.swapDOM */ - swapDOM: function (dest, src) { - var self = MochiKit.DOM; - dest = self.getElement(dest); - var parent = dest.parentNode; - if (src) { - src = self.coerceToDOM(self.getElement(src), parent); - parent.replaceChild(src, dest); - } else { - parent.removeChild(dest); - } - return src; - }, - - /** @id MochiKit.DOM.getElement */ - getElement: function (id) { - var self = MochiKit.DOM; - if (arguments.length == 1) { - return ((typeof(id) == "string") ? - self._document.getElementById(id) : id); - } else { - return MochiKit.Base.map(self.getElement, arguments); - } - }, - - /** @id MochiKit.DOM.getElementsByTagAndClassName */ - getElementsByTagAndClassName: function (tagName, className, - /* optional */parent) { - var self = MochiKit.DOM; - if (typeof(tagName) == 'undefined' || tagName === null) { - tagName = '*'; - } - if (typeof(parent) == 'undefined' || parent === null) { - parent = self._document; - } - parent = self.getElement(parent); - if (parent == null) { - return []; - } - var children = (parent.getElementsByTagName(tagName) - || self._document.all); - if (typeof(className) == 'undefined' || className === null) { - return MochiKit.Base.extend(null, children); - } - - var elements = []; - for (var i = 0; i < children.length; i++) { - var child = children[i]; - var cls = child.className; - if (typeof(cls) != "string") { - cls = child.getAttribute("class"); - } - if (typeof(cls) == "string") { - var classNames = cls.split(' '); - for (var j = 0; j < classNames.length; j++) { - if (classNames[j] == className) { - elements.push(child); - break; - } - } - } - } - - return elements; - }, - - _newCallStack: function (path, once) { - var rval = function () { - var callStack = arguments.callee.callStack; - for (var i = 0; i < callStack.length; i++) { - if (callStack[i].apply(this, arguments) === false) { - break; - } - } - if (once) { - try { - this[path] = null; - } catch (e) { - // pass - } - } - }; - rval.callStack = []; - return rval; - }, - - /** @id MochiKit.DOM.addToCallStack */ - addToCallStack: function (target, path, func, once) { - var self = MochiKit.DOM; - var existing = target[path]; - var regfunc = existing; - if (!(typeof(existing) == 'function' - && typeof(existing.callStack) == "object" - && existing.callStack !== null)) { - regfunc = self._newCallStack(path, once); - if (typeof(existing) == 'function') { - regfunc.callStack.push(existing); - } - target[path] = regfunc; - } - regfunc.callStack.push(func); - }, - - /** @id MochiKit.DOM.addLoadEvent */ - addLoadEvent: function (func) { - var self = MochiKit.DOM; - self.addToCallStack(self._window, "onload", func, true); - - }, - - /** @id MochiKit.DOM.focusOnLoad */ - focusOnLoad: function (element) { - var self = MochiKit.DOM; - self.addLoadEvent(function () { - element = self.getElement(element); - if (element) { - element.focus(); - } - }); - }, - - /** @id MochiKit.DOM.setElementClass */ - setElementClass: function (element, className) { - var self = MochiKit.DOM; - var obj = self.getElement(element); - if (self.attributeArray.compliant) { - obj.setAttribute("class", className); - } else { - obj.setAttribute("className", className); - } - }, - - /** @id MochiKit.DOM.toggleElementClass */ - toggleElementClass: function (className/*, element... */) { - var self = MochiKit.DOM; - for (var i = 1; i < arguments.length; i++) { - var obj = self.getElement(arguments[i]); - if (!self.addElementClass(obj, className)) { - self.removeElementClass(obj, className); - } - } - }, - - /** @id MochiKit.DOM.addElementClass */ - addElementClass: function (element, className) { - var self = MochiKit.DOM; - var obj = self.getElement(element); - var cls = obj.className; - if (typeof(cls) != "string") { - cls = obj.getAttribute("class"); - } - // trivial case, no className yet - if (typeof(cls) != "string" || cls.length === 0) { - self.setElementClass(obj, className); - return true; - } - // the other trivial case, already set as the only class - if (cls == className) { - return false; - } - var classes = cls.split(" "); - for (var i = 0; i < classes.length; i++) { - // already present - if (classes[i] == className) { - return false; - } - } - // append class - self.setElementClass(obj, cls + " " + className); - return true; - }, - - /** @id MochiKit.DOM.removeElementClass */ - removeElementClass: function (element, className) { - var self = MochiKit.DOM; - var obj = self.getElement(element); - var cls = obj.className; - if (typeof(cls) != "string") { - cls = obj.getAttribute("class"); - } - // trivial case, no className yet - if (typeof(cls) != "string" || cls.length === 0) { - return false; - } - // other trivial case, set only to className - if (cls == className) { - self.setElementClass(obj, ""); - return true; - } - var classes = cls.split(" "); - for (var i = 0; i < classes.length; i++) { - // already present - if (classes[i] == className) { - // only check sane case where the class is used once - classes.splice(i, 1); - self.setElementClass(obj, classes.join(" ")); - return true; - } - } - // not found - return false; - }, - - /** @id MochiKit.DOM.swapElementClass */ - swapElementClass: function (element, fromClass, toClass) { - var obj = MochiKit.DOM.getElement(element); - var res = MochiKit.DOM.removeElementClass(obj, fromClass); - if (res) { - MochiKit.DOM.addElementClass(obj, toClass); - } - return res; - }, - - /** @id MochiKit.DOM.hasElementClass */ - hasElementClass: function (element, className/*...*/) { - var obj = MochiKit.DOM.getElement(element); - if (obj == null) { - return false; - } - var cls = obj.className; - if (typeof(cls) != "string") { - cls = obj.getAttribute("class"); - } - if (typeof(cls) != "string") { - return false; - } - var classes = cls.split(" "); - for (var i = 1; i < arguments.length; i++) { - var good = false; - for (var j = 0; j < classes.length; j++) { - if (classes[j] == arguments[i]) { - good = true; - break; - } - } - if (!good) { - return false; - } - } - return true; - }, - - /** @id MochiKit.DOM.escapeHTML */ - escapeHTML: function (s) { - return s.replace(/&/g, "&" - ).replace(/"/g, """ - ).replace(//g, ">"); - }, - - /** @id MochiKit.DOM.toHTML */ - toHTML: function (dom) { - return MochiKit.DOM.emitHTML(dom).join(""); - }, - - /** @id MochiKit.DOM.emitHTML */ - emitHTML: function (dom, /* optional */lst) { - if (typeof(lst) == 'undefined' || lst === null) { - lst = []; - } - // queue is the call stack, we're doing this non-recursively - var queue = [dom]; - var self = MochiKit.DOM; - var escapeHTML = self.escapeHTML; - var attributeArray = self.attributeArray; - while (queue.length) { - dom = queue.pop(); - if (typeof(dom) == 'string') { - lst.push(dom); - } else if (dom.nodeType == 1) { - // we're not using higher order stuff here - // because safari has heisenbugs.. argh. - // - // I think it might have something to do with - // garbage collection and function calls. - lst.push('<' + dom.tagName.toLowerCase()); - var attributes = []; - var domAttr = attributeArray(dom); - for (var i = 0; i < domAttr.length; i++) { - var a = domAttr[i]; - attributes.push([ - " ", - a.name, - '="', - escapeHTML(a.value), - '"' - ]); - } - attributes.sort(); - for (i = 0; i < attributes.length; i++) { - var attrs = attributes[i]; - for (var j = 0; j < attrs.length; j++) { - lst.push(attrs[j]); - } - } - if (dom.hasChildNodes()) { - lst.push(">"); - // queue is the FILO call stack, so we put the close tag - // on first - queue.push(""); - var cnodes = dom.childNodes; - for (i = cnodes.length - 1; i >= 0; i--) { - queue.push(cnodes[i]); - } - } else { - lst.push('/>'); - } - } else if (dom.nodeType == 3) { - lst.push(escapeHTML(dom.nodeValue)); - } - } - return lst; - }, - - /** @id MochiKit.DOM.scrapeText */ - scrapeText: function (node, /* optional */asArray) { - var rval = []; - (function (node) { - var cn = node.childNodes; - if (cn) { - for (var i = 0; i < cn.length; i++) { - arguments.callee.call(this, cn[i]); - } - } - var nodeValue = node.nodeValue; - if (typeof(nodeValue) == 'string') { - rval.push(nodeValue); - } - })(MochiKit.DOM.getElement(node)); - if (asArray) { - return rval; - } else { - return rval.join(""); - } - }, - - /** @id MochiKit.DOM.removeEmptyTextNodes */ - removeEmptyTextNodes: function (element) { - element = MochiKit.DOM.getElement(element); - for (var i = 0; i < element.childNodes.length; i++) { - var node = element.childNodes[i]; - if (node.nodeType == 3 && !/\S/.test(node.nodeValue)) { - node.parentNode.removeChild(node); - } - } - }, - - /** @id MochiKit.DOM.getFirstElementByTagAndClassName */ - getFirstElementByTagAndClassName: function (tagName, className, - /* optional */parent) { - var self = MochiKit.DOM; - if (typeof(tagName) == 'undefined' || tagName === null) { - tagName = '*'; - } - if (typeof(parent) == 'undefined' || parent === null) { - parent = self._document; - } - parent = self.getElement(parent); - if (parent == null) { - return null; - } - var children = (parent.getElementsByTagName(tagName) - || self._document.all); - if (children.length <= 0) { - return null; - } else if (typeof(className) == 'undefined' || className === null) { - return children[0]; - } - - for (var i = 0; i < children.length; i++) { - var child = children[i]; - var cls = child.className; - if (typeof(cls) != "string") { - cls = child.getAttribute("class"); - } - if (typeof(cls) == "string") { - var classNames = cls.split(' '); - for (var j = 0; j < classNames.length; j++) { - if (classNames[j] == className) { - return child; - } - } - } - } - return null; - }, - - /** @id MochiKit.DOM.getFirstParentByTagAndClassName */ - getFirstParentByTagAndClassName: function (elem, tagName, className) { - var self = MochiKit.DOM; - elem = self.getElement(elem); - if (typeof(tagName) == 'undefined' || tagName === null) { - tagName = '*'; - } else { - tagName = tagName.toUpperCase(); - } - if (typeof(className) == 'undefined' || className === null) { - className = null; - } - if (elem) { - elem = elem.parentNode; - } - while (elem && elem.tagName) { - var curTagName = elem.tagName.toUpperCase(); - if ((tagName === '*' || tagName == curTagName) && - (className === null || self.hasElementClass(elem, className))) { - return elem; - } - elem = elem.parentNode; - } - return null; - }, - - __new__: function (win) { - - var m = MochiKit.Base; - if (typeof(document) != "undefined") { - this._document = document; - var kXULNSURI = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; - this._xhtml = (document.documentElement && - document.createElementNS && - document.documentElement.namespaceURI === kXULNSURI); - } else if (MochiKit.MockDOM) { - this._document = MochiKit.MockDOM.document; - } - this._window = win; - - this.domConverters = new m.AdapterRegistry(); - - var __tmpElement = this._document.createElement("span"); - var attributeArray; - if (__tmpElement && __tmpElement.attributes && - __tmpElement.attributes.length > 0) { - // for braindead browsers (IE) that insert extra junk - var filter = m.filter; - attributeArray = function (node) { - /*** - - Return an array of attributes for a given node, - filtering out attributes that don't belong for - that are inserted by "Certain Browsers". - - ***/ - return filter(attributeArray.ignoreAttrFilter, node.attributes); - }; - attributeArray.ignoreAttr = {}; - var attrs = __tmpElement.attributes; - var ignoreAttr = attributeArray.ignoreAttr; - for (var i = 0; i < attrs.length; i++) { - var a = attrs[i]; - ignoreAttr[a.name] = a.value; - } - attributeArray.ignoreAttrFilter = function (a) { - return (attributeArray.ignoreAttr[a.name] != a.value); - }; - attributeArray.compliant = false; - attributeArray.renames = { - "class": "className", - "checked": "defaultChecked", - "usemap": "useMap", - "for": "htmlFor", - "readonly": "readOnly", - "colspan": "colSpan", - "bgcolor": "bgColor", - "cellspacing": "cellSpacing", - "cellpadding": "cellPadding" - }; - } else { - attributeArray = function (node) { - return node.attributes; - }; - attributeArray.compliant = true; - attributeArray.ignoreAttr = {}; - attributeArray.renames = {}; - } - this.attributeArray = attributeArray; - - // FIXME: this really belongs in Base, and could probably be cleaner - var _deprecated = function(fromModule, arr) { - var fromName = arr[0]; - var toName = arr[1]; - var toModule = toName.split('.')[1]; - var str = ''; - - str += 'if (!MochiKit.' + toModule + ') { throw new Error("'; - str += 'This function has been deprecated and depends on MochiKit.'; - str += toModule + '.");}'; - str += 'return ' + toName + '.apply(this, arguments);'; - MochiKit[fromModule][fromName] = new Function(str); - } - for (var i = 0; i < MochiKit.DOM.DEPRECATED.length; i++) { - _deprecated('DOM', MochiKit.DOM.DEPRECATED[i]); - } - - // shorthand for createDOM syntax - var createDOMFunc = this.createDOMFunc; - /** @id MochiKit.DOM.UL */ - this.UL = createDOMFunc("ul"); - /** @id MochiKit.DOM.OL */ - this.OL = createDOMFunc("ol"); - /** @id MochiKit.DOM.LI */ - this.LI = createDOMFunc("li"); - /** @id MochiKit.DOM.DL */ - this.DL = createDOMFunc("dl"); - /** @id MochiKit.DOM.DT */ - this.DT = createDOMFunc("dt"); - /** @id MochiKit.DOM.DD */ - this.DD = createDOMFunc("dd"); - /** @id MochiKit.DOM.TD */ - this.TD = createDOMFunc("td"); - /** @id MochiKit.DOM.TR */ - this.TR = createDOMFunc("tr"); - /** @id MochiKit.DOM.TBODY */ - this.TBODY = createDOMFunc("tbody"); - /** @id MochiKit.DOM.THEAD */ - this.THEAD = createDOMFunc("thead"); - /** @id MochiKit.DOM.TFOOT */ - this.TFOOT = createDOMFunc("tfoot"); - /** @id MochiKit.DOM.TABLE */ - this.TABLE = createDOMFunc("table"); - /** @id MochiKit.DOM.TH */ - this.TH = createDOMFunc("th"); - /** @id MochiKit.DOM.INPUT */ - this.INPUT = createDOMFunc("input"); - /** @id MochiKit.DOM.SPAN */ - this.SPAN = createDOMFunc("span"); - /** @id MochiKit.DOM.A */ - this.A = createDOMFunc("a"); - /** @id MochiKit.DOM.DIV */ - this.DIV = createDOMFunc("div"); - /** @id MochiKit.DOM.IMG */ - this.IMG = createDOMFunc("img"); - /** @id MochiKit.DOM.BUTTON */ - this.BUTTON = createDOMFunc("button"); - /** @id MochiKit.DOM.TT */ - this.TT = createDOMFunc("tt"); - /** @id MochiKit.DOM.PRE */ - this.PRE = createDOMFunc("pre"); - /** @id MochiKit.DOM.H1 */ - this.H1 = createDOMFunc("h1"); - /** @id MochiKit.DOM.H2 */ - this.H2 = createDOMFunc("h2"); - /** @id MochiKit.DOM.H3 */ - this.H3 = createDOMFunc("h3"); - /** @id MochiKit.DOM.H4 */ - this.H4 = createDOMFunc("h4"); - /** @id MochiKit.DOM.H5 */ - this.H5 = createDOMFunc("h5"); - /** @id MochiKit.DOM.H6 */ - this.H6 = createDOMFunc("h6"); - /** @id MochiKit.DOM.BR */ - this.BR = createDOMFunc("br"); - /** @id MochiKit.DOM.HR */ - this.HR = createDOMFunc("hr"); - /** @id MochiKit.DOM.LABEL */ - this.LABEL = createDOMFunc("label"); - /** @id MochiKit.DOM.TEXTAREA */ - this.TEXTAREA = createDOMFunc("textarea"); - /** @id MochiKit.DOM.FORM */ - this.FORM = createDOMFunc("form"); - /** @id MochiKit.DOM.P */ - this.P = createDOMFunc("p"); - /** @id MochiKit.DOM.SELECT */ - this.SELECT = createDOMFunc("select"); - /** @id MochiKit.DOM.OPTION */ - this.OPTION = createDOMFunc("option"); - /** @id MochiKit.DOM.OPTGROUP */ - this.OPTGROUP = createDOMFunc("optgroup"); - /** @id MochiKit.DOM.LEGEND */ - this.LEGEND = createDOMFunc("legend"); - /** @id MochiKit.DOM.FIELDSET */ - this.FIELDSET = createDOMFunc("fieldset"); - /** @id MochiKit.DOM.STRONG */ - this.STRONG = createDOMFunc("strong"); - /** @id MochiKit.DOM.CANVAS */ - this.CANVAS = createDOMFunc("canvas"); - - /** @id MochiKit.DOM.$ */ - this.$ = this.getElement; - - this.EXPORT_TAGS = { - ":common": this.EXPORT, - ":all": m.concat(this.EXPORT, this.EXPORT_OK) - }; - - m.nameFunctions(this); - - } -}); - - -MochiKit.DOM.__new__(((typeof(window) == "undefined") ? this : window)); - -// -// XXX: Internet Explorer blows -// -if (MochiKit.__export__) { - withWindow = MochiKit.DOM.withWindow; - withDocument = MochiKit.DOM.withDocument; -} - -MochiKit.Base._exportSymbols(this, MochiKit.DOM); diff --git a/static/MochiKit/DateTime.js b/static/MochiKit/DateTime.js deleted file mode 100644 index cbb3c91..0000000 --- a/static/MochiKit/DateTime.js +++ /dev/null @@ -1,222 +0,0 @@ -/*** - -MochiKit.DateTime 1.4.2 - -See for documentation, downloads, license, etc. - -(c) 2005 Bob Ippolito. All rights Reserved. - -***/ - -MochiKit.Base._deps('DateTime', ['Base']); - -MochiKit.DateTime.NAME = "MochiKit.DateTime"; -MochiKit.DateTime.VERSION = "1.4.2"; -MochiKit.DateTime.__repr__ = function () { - return "[" + this.NAME + " " + this.VERSION + "]"; -}; -MochiKit.DateTime.toString = function () { - return this.__repr__(); -}; - -/** @id MochiKit.DateTime.isoDate */ -MochiKit.DateTime.isoDate = function (str) { - str = str + ""; - if (typeof(str) != "string" || str.length === 0) { - return null; - } - var iso = str.split('-'); - if (iso.length === 0) { - return null; - } - var date = new Date(iso[0], iso[1] - 1, iso[2]); - date.setFullYear(iso[0]); - date.setMonth(iso[1] - 1); - date.setDate(iso[2]); - return date; -}; - -MochiKit.DateTime._isoRegexp = /(\d{4,})(?:-(\d{1,2})(?:-(\d{1,2})(?:[T ](\d{1,2}):(\d{1,2})(?::(\d{1,2})(?:\.(\d+))?)?(?:(Z)|([+-])(\d{1,2})(?::(\d{1,2}))?)?)?)?)?/; - -/** @id MochiKit.DateTime.isoTimestamp */ -MochiKit.DateTime.isoTimestamp = function (str) { - str = str + ""; - if (typeof(str) != "string" || str.length === 0) { - return null; - } - var res = str.match(MochiKit.DateTime._isoRegexp); - if (typeof(res) == "undefined" || res === null) { - return null; - } - var year, month, day, hour, min, sec, msec; - year = parseInt(res[1], 10); - if (typeof(res[2]) == "undefined" || res[2] === '') { - return new Date(year); - } - month = parseInt(res[2], 10) - 1; - day = parseInt(res[3], 10); - if (typeof(res[4]) == "undefined" || res[4] === '') { - return new Date(year, month, day); - } - hour = parseInt(res[4], 10); - min = parseInt(res[5], 10); - sec = (typeof(res[6]) != "undefined" && res[6] !== '') ? parseInt(res[6], 10) : 0; - if (typeof(res[7]) != "undefined" && res[7] !== '') { - msec = Math.round(1000.0 * parseFloat("0." + res[7])); - } else { - msec = 0; - } - if ((typeof(res[8]) == "undefined" || res[8] === '') && (typeof(res[9]) == "undefined" || res[9] === '')) { - return new Date(year, month, day, hour, min, sec, msec); - } - var ofs; - if (typeof(res[9]) != "undefined" && res[9] !== '') { - ofs = parseInt(res[10], 10) * 3600000; - if (typeof(res[11]) != "undefined" && res[11] !== '') { - ofs += parseInt(res[11], 10) * 60000; - } - if (res[9] == "-") { - ofs = -ofs; - } - } else { - ofs = 0; - } - return new Date(Date.UTC(year, month, day, hour, min, sec, msec) - ofs); -}; - -/** @id MochiKit.DateTime.toISOTime */ -MochiKit.DateTime.toISOTime = function (date, realISO/* = false */) { - if (typeof(date) == "undefined" || date === null) { - return null; - } - var hh = date.getHours(); - var mm = date.getMinutes(); - var ss = date.getSeconds(); - var lst = [ - ((realISO && (hh < 10)) ? "0" + hh : hh), - ((mm < 10) ? "0" + mm : mm), - ((ss < 10) ? "0" + ss : ss) - ]; - return lst.join(":"); -}; - -/** @id MochiKit.DateTime.toISOTimeStamp */ -MochiKit.DateTime.toISOTimestamp = function (date, realISO/* = false*/) { - if (typeof(date) == "undefined" || date === null) { - return null; - } - var sep = realISO ? "T" : " "; - var foot = realISO ? "Z" : ""; - if (realISO) { - date = new Date(date.getTime() + (date.getTimezoneOffset() * 60000)); - } - return MochiKit.DateTime.toISODate(date) + sep + MochiKit.DateTime.toISOTime(date, realISO) + foot; -}; - -/** @id MochiKit.DateTime.toISODate */ -MochiKit.DateTime.toISODate = function (date) { - if (typeof(date) == "undefined" || date === null) { - return null; - } - var _padTwo = MochiKit.DateTime._padTwo; - var _padFour = MochiKit.DateTime._padFour; - return [ - _padFour(date.getFullYear()), - _padTwo(date.getMonth() + 1), - _padTwo(date.getDate()) - ].join("-"); -}; - -/** @id MochiKit.DateTime.americanDate */ -MochiKit.DateTime.americanDate = function (d) { - d = d + ""; - if (typeof(d) != "string" || d.length === 0) { - return null; - } - var a = d.split('/'); - return new Date(a[2], a[0] - 1, a[1]); -}; - -MochiKit.DateTime._padTwo = function (n) { - return (n > 9) ? n : "0" + n; -}; - -MochiKit.DateTime._padFour = function(n) { - switch(n.toString().length) { - case 1: return "000" + n; break; - case 2: return "00" + n; break; - case 3: return "0" + n; break; - case 4: - default: - return n; - } -}; - -/** @id MochiKit.DateTime.toPaddedAmericanDate */ -MochiKit.DateTime.toPaddedAmericanDate = function (d) { - if (typeof(d) == "undefined" || d === null) { - return null; - } - var _padTwo = MochiKit.DateTime._padTwo; - return [ - _padTwo(d.getMonth() + 1), - _padTwo(d.getDate()), - d.getFullYear() - ].join('/'); -}; - -/** @id MochiKit.DateTime.toAmericanDate */ -MochiKit.DateTime.toAmericanDate = function (d) { - if (typeof(d) == "undefined" || d === null) { - return null; - } - return [d.getMonth() + 1, d.getDate(), d.getFullYear()].join('/'); -}; - -MochiKit.DateTime.EXPORT = [ - "isoDate", - "isoTimestamp", - "toISOTime", - "toISOTimestamp", - "toISODate", - "americanDate", - "toPaddedAmericanDate", - "toAmericanDate" -]; - -MochiKit.DateTime.EXPORT_OK = []; -MochiKit.DateTime.EXPORT_TAGS = { - ":common": MochiKit.DateTime.EXPORT, - ":all": MochiKit.DateTime.EXPORT -}; - -MochiKit.DateTime.__new__ = function () { - // MochiKit.Base.nameFunctions(this); - var base = this.NAME + "."; - for (var k in this) { - var o = this[k]; - if (typeof(o) == 'function' && typeof(o.NAME) == 'undefined') { - try { - o.NAME = base + k; - } catch (e) { - // pass - } - } - } -}; - -MochiKit.DateTime.__new__(); - -if (typeof(MochiKit.Base) != "undefined") { - MochiKit.Base._exportSymbols(this, MochiKit.DateTime); -} else { - (function (globals, module) { - if ((typeof(JSAN) == 'undefined' && typeof(dojo) == 'undefined') - || (MochiKit.__export__ === false)) { - var all = module.EXPORT_TAGS[":all"]; - for (var i = 0; i < all.length; i++) { - globals[all[i]] = module[all[i]]; - } - } - })(this, MochiKit.DateTime); -} diff --git a/static/MochiKit/DragAndDrop.js b/static/MochiKit/DragAndDrop.js deleted file mode 100644 index b23b102..0000000 --- a/static/MochiKit/DragAndDrop.js +++ /dev/null @@ -1,793 +0,0 @@ -/*** -MochiKit.DragAndDrop 1.4.2 - -See for documentation, downloads, license, etc. - -Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) - Mochi-ized By Thomas Herve (_firstname_@nimail.org) - -***/ - -MochiKit.Base._deps('DragAndDrop', ['Base', 'Iter', 'DOM', 'Signal', 'Visual', 'Position']); - -MochiKit.DragAndDrop.NAME = 'MochiKit.DragAndDrop'; -MochiKit.DragAndDrop.VERSION = '1.4.2'; - -MochiKit.DragAndDrop.__repr__ = function () { - return '[' + this.NAME + ' ' + this.VERSION + ']'; -}; - -MochiKit.DragAndDrop.toString = function () { - return this.__repr__(); -}; - -MochiKit.DragAndDrop.EXPORT = [ - "Droppable", - "Draggable" -]; - -MochiKit.DragAndDrop.EXPORT_OK = [ - "Droppables", - "Draggables" -]; - -MochiKit.DragAndDrop.Droppables = { - /*** - - Manage all droppables. Shouldn't be used, use the Droppable object instead. - - ***/ - drops: [], - - remove: function (element) { - this.drops = MochiKit.Base.filter(function (d) { - return d.element != MochiKit.DOM.getElement(element); - }, this.drops); - }, - - register: function (drop) { - this.drops.push(drop); - }, - - unregister: function (drop) { - this.drops = MochiKit.Base.filter(function (d) { - return d != drop; - }, this.drops); - }, - - prepare: function (element) { - MochiKit.Base.map(function (drop) { - if (drop.isAccepted(element)) { - if (drop.options.activeclass) { - MochiKit.DOM.addElementClass(drop.element, - drop.options.activeclass); - } - drop.options.onactive(drop.element, element); - } - }, this.drops); - }, - - findDeepestChild: function (drops) { - deepest = drops[0]; - - for (i = 1; i < drops.length; ++i) { - if (MochiKit.DOM.isChildNode(drops[i].element, deepest.element)) { - deepest = drops[i]; - } - } - return deepest; - }, - - show: function (point, element) { - if (!this.drops.length) { - return; - } - var affected = []; - - if (this.last_active) { - this.last_active.deactivate(); - } - MochiKit.Iter.forEach(this.drops, function (drop) { - if (drop.isAffected(point, element)) { - affected.push(drop); - } - }); - if (affected.length > 0) { - drop = this.findDeepestChild(affected); - MochiKit.Position.within(drop.element, point.page.x, point.page.y); - drop.options.onhover(element, drop.element, - MochiKit.Position.overlap(drop.options.overlap, drop.element)); - drop.activate(); - } - }, - - fire: function (event, element) { - if (!this.last_active) { - return; - } - MochiKit.Position.prepare(); - - if (this.last_active.isAffected(event.mouse(), element)) { - this.last_active.options.ondrop(element, - this.last_active.element, event); - } - }, - - reset: function (element) { - MochiKit.Base.map(function (drop) { - if (drop.options.activeclass) { - MochiKit.DOM.removeElementClass(drop.element, - drop.options.activeclass); - } - drop.options.ondesactive(drop.element, element); - }, this.drops); - if (this.last_active) { - this.last_active.deactivate(); - } - } -}; - -/** @id MochiKit.DragAndDrop.Droppable */ -MochiKit.DragAndDrop.Droppable = function (element, options) { - var cls = arguments.callee; - if (!(this instanceof cls)) { - return new cls(element, options); - } - this.__init__(element, options); -}; - -MochiKit.DragAndDrop.Droppable.prototype = { - /*** - - A droppable object. Simple use is to create giving an element: - - new MochiKit.DragAndDrop.Droppable('myelement'); - - Generally you'll want to define the 'ondrop' function and maybe the - 'accept' option to filter draggables. - - ***/ - __class__: MochiKit.DragAndDrop.Droppable, - - __init__: function (element, /* optional */options) { - var d = MochiKit.DOM; - var b = MochiKit.Base; - this.element = d.getElement(element); - this.options = b.update({ - - /** @id MochiKit.DragAndDrop.greedy */ - greedy: true, - - /** @id MochiKit.DragAndDrop.hoverclass */ - hoverclass: null, - - /** @id MochiKit.DragAndDrop.activeclass */ - activeclass: null, - - /** @id MochiKit.DragAndDrop.hoverfunc */ - hoverfunc: b.noop, - - /** @id MochiKit.DragAndDrop.accept */ - accept: null, - - /** @id MochiKit.DragAndDrop.onactive */ - onactive: b.noop, - - /** @id MochiKit.DragAndDrop.ondesactive */ - ondesactive: b.noop, - - /** @id MochiKit.DragAndDrop.onhover */ - onhover: b.noop, - - /** @id MochiKit.DragAndDrop.ondrop */ - ondrop: b.noop, - - /** @id MochiKit.DragAndDrop.containment */ - containment: [], - tree: false - }, options); - - // cache containers - this.options._containers = []; - b.map(MochiKit.Base.bind(function (c) { - this.options._containers.push(d.getElement(c)); - }, this), this.options.containment); - - MochiKit.Style.makePositioned(this.element); // fix IE - - MochiKit.DragAndDrop.Droppables.register(this); - }, - - /** @id MochiKit.DragAndDrop.isContained */ - isContained: function (element) { - if (this.options._containers.length) { - var containmentNode; - if (this.options.tree) { - containmentNode = element.treeNode; - } else { - containmentNode = element.parentNode; - } - return MochiKit.Iter.some(this.options._containers, function (c) { - return containmentNode == c; - }); - } else { - return true; - } - }, - - /** @id MochiKit.DragAndDrop.isAccepted */ - isAccepted: function (element) { - return ((!this.options.accept) || MochiKit.Iter.some( - this.options.accept, function (c) { - return MochiKit.DOM.hasElementClass(element, c); - })); - }, - - /** @id MochiKit.DragAndDrop.isAffected */ - isAffected: function (point, element) { - return ((this.element != element) && - this.isContained(element) && - this.isAccepted(element) && - MochiKit.Position.within(this.element, point.page.x, - point.page.y)); - }, - - /** @id MochiKit.DragAndDrop.deactivate */ - deactivate: function () { - /*** - - A droppable is deactivate when a draggable has been over it and left. - - ***/ - if (this.options.hoverclass) { - MochiKit.DOM.removeElementClass(this.element, - this.options.hoverclass); - } - this.options.hoverfunc(this.element, false); - MochiKit.DragAndDrop.Droppables.last_active = null; - }, - - /** @id MochiKit.DragAndDrop.activate */ - activate: function () { - /*** - - A droppable is active when a draggable is over it. - - ***/ - if (this.options.hoverclass) { - MochiKit.DOM.addElementClass(this.element, this.options.hoverclass); - } - this.options.hoverfunc(this.element, true); - MochiKit.DragAndDrop.Droppables.last_active = this; - }, - - /** @id MochiKit.DragAndDrop.destroy */ - destroy: function () { - /*** - - Delete this droppable. - - ***/ - MochiKit.DragAndDrop.Droppables.unregister(this); - }, - - /** @id MochiKit.DragAndDrop.repr */ - repr: function () { - return '[' + this.__class__.NAME + ", options:" + MochiKit.Base.repr(this.options) + "]"; - } -}; - -MochiKit.DragAndDrop.Draggables = { - /*** - - Manage draggables elements. Not intended to direct use. - - ***/ - drags: [], - - register: function (draggable) { - if (this.drags.length === 0) { - var conn = MochiKit.Signal.connect; - this.eventMouseUp = conn(document, 'onmouseup', this, this.endDrag); - this.eventMouseMove = conn(document, 'onmousemove', this, - this.updateDrag); - this.eventKeypress = conn(document, 'onkeypress', this, - this.keyPress); - } - this.drags.push(draggable); - }, - - unregister: function (draggable) { - this.drags = MochiKit.Base.filter(function (d) { - return d != draggable; - }, this.drags); - if (this.drags.length === 0) { - var disc = MochiKit.Signal.disconnect; - disc(this.eventMouseUp); - disc(this.eventMouseMove); - disc(this.eventKeypress); - } - }, - - activate: function (draggable) { - // allows keypress events if window is not currently focused - // fails for Safari - window.focus(); - this.activeDraggable = draggable; - }, - - deactivate: function () { - this.activeDraggable = null; - }, - - updateDrag: function (event) { - if (!this.activeDraggable) { - return; - } - var pointer = event.mouse(); - // Mozilla-based browsers fire successive mousemove events with - // the same coordinates, prevent needless redrawing (moz bug?) - if (this._lastPointer && (MochiKit.Base.repr(this._lastPointer.page) == - MochiKit.Base.repr(pointer.page))) { - return; - } - this._lastPointer = pointer; - this.activeDraggable.updateDrag(event, pointer); - }, - - endDrag: function (event) { - if (!this.activeDraggable) { - return; - } - this._lastPointer = null; - this.activeDraggable.endDrag(event); - this.activeDraggable = null; - }, - - keyPress: function (event) { - if (this.activeDraggable) { - this.activeDraggable.keyPress(event); - } - }, - - notify: function (eventName, draggable, event) { - MochiKit.Signal.signal(this, eventName, draggable, event); - } -}; - -/** @id MochiKit.DragAndDrop.Draggable */ -MochiKit.DragAndDrop.Draggable = function (element, options) { - var cls = arguments.callee; - if (!(this instanceof cls)) { - return new cls(element, options); - } - this.__init__(element, options); -}; - -MochiKit.DragAndDrop.Draggable.prototype = { - /*** - - A draggable object. Simple instantiate : - - new MochiKit.DragAndDrop.Draggable('myelement'); - - ***/ - __class__ : MochiKit.DragAndDrop.Draggable, - - __init__: function (element, /* optional */options) { - var v = MochiKit.Visual; - var b = MochiKit.Base; - options = b.update({ - - /** @id MochiKit.DragAndDrop.handle */ - handle: false, - - /** @id MochiKit.DragAndDrop.starteffect */ - starteffect: function (innerelement) { - this._savedOpacity = MochiKit.Style.getStyle(innerelement, 'opacity') || 1.0; - new v.Opacity(innerelement, {duration:0.2, from:this._savedOpacity, to:0.7}); - }, - /** @id MochiKit.DragAndDrop.reverteffect */ - reverteffect: function (innerelement, top_offset, left_offset) { - var dur = Math.sqrt(Math.abs(top_offset^2) + - Math.abs(left_offset^2))*0.02; - return new v.Move(innerelement, - {x: -left_offset, y: -top_offset, duration: dur}); - }, - - /** @id MochiKit.DragAndDrop.endeffect */ - endeffect: function (innerelement) { - new v.Opacity(innerelement, {duration:0.2, from:0.7, to:this._savedOpacity}); - }, - - /** @id MochiKit.DragAndDrop.onchange */ - onchange: b.noop, - - /** @id MochiKit.DragAndDrop.zindex */ - zindex: 1000, - - /** @id MochiKit.DragAndDrop.revert */ - revert: false, - - /** @id MochiKit.DragAndDrop.scroll */ - scroll: false, - - /** @id MochiKit.DragAndDrop.scrollSensitivity */ - scrollSensitivity: 20, - - /** @id MochiKit.DragAndDrop.scrollSpeed */ - scrollSpeed: 15, - // false, or xy or [x, y] or function (x, y){return [x, y];} - - /** @id MochiKit.DragAndDrop.snap */ - snap: false - }, options); - - var d = MochiKit.DOM; - this.element = d.getElement(element); - - if (options.handle && (typeof(options.handle) == 'string')) { - this.handle = d.getFirstElementByTagAndClassName(null, - options.handle, this.element); - } - if (!this.handle) { - this.handle = d.getElement(options.handle); - } - if (!this.handle) { - this.handle = this.element; - } - - if (options.scroll && !options.scroll.scrollTo && !options.scroll.outerHTML) { - options.scroll = d.getElement(options.scroll); - this._isScrollChild = MochiKit.DOM.isChildNode(this.element, options.scroll); - } - - MochiKit.Style.makePositioned(this.element); // fix IE - - this.delta = this.currentDelta(); - this.options = options; - this.dragging = false; - - this.eventMouseDown = MochiKit.Signal.connect(this.handle, - 'onmousedown', this, this.initDrag); - MochiKit.DragAndDrop.Draggables.register(this); - }, - - /** @id MochiKit.DragAndDrop.destroy */ - destroy: function () { - MochiKit.Signal.disconnect(this.eventMouseDown); - MochiKit.DragAndDrop.Draggables.unregister(this); - }, - - /** @id MochiKit.DragAndDrop.currentDelta */ - currentDelta: function () { - var s = MochiKit.Style.getStyle; - return [ - parseInt(s(this.element, 'left') || '0'), - parseInt(s(this.element, 'top') || '0')]; - }, - - /** @id MochiKit.DragAndDrop.initDrag */ - initDrag: function (event) { - if (!event.mouse().button.left) { - return; - } - // abort on form elements, fixes a Firefox issue - var src = event.target(); - var tagName = (src.tagName || '').toUpperCase(); - if (tagName === 'INPUT' || tagName === 'SELECT' || - tagName === 'OPTION' || tagName === 'BUTTON' || - tagName === 'TEXTAREA') { - return; - } - - if (this._revert) { - this._revert.cancel(); - this._revert = null; - } - - var pointer = event.mouse(); - var pos = MochiKit.Position.cumulativeOffset(this.element); - this.offset = [pointer.page.x - pos.x, pointer.page.y - pos.y]; - - MochiKit.DragAndDrop.Draggables.activate(this); - event.stop(); - }, - - /** @id MochiKit.DragAndDrop.startDrag */ - startDrag: function (event) { - this.dragging = true; - if (this.options.selectclass) { - MochiKit.DOM.addElementClass(this.element, - this.options.selectclass); - } - if (this.options.zindex) { - this.originalZ = parseInt(MochiKit.Style.getStyle(this.element, - 'z-index') || '0'); - this.element.style.zIndex = this.options.zindex; - } - - if (this.options.ghosting) { - this._clone = this.element.cloneNode(true); - this.ghostPosition = MochiKit.Position.absolutize(this.element); - this.element.parentNode.insertBefore(this._clone, this.element); - } - - if (this.options.scroll) { - if (this.options.scroll == window) { - var where = this._getWindowScroll(this.options.scroll); - this.originalScrollLeft = where.left; - this.originalScrollTop = where.top; - } else { - this.originalScrollLeft = this.options.scroll.scrollLeft; - this.originalScrollTop = this.options.scroll.scrollTop; - } - } - - MochiKit.DragAndDrop.Droppables.prepare(this.element); - MochiKit.DragAndDrop.Draggables.notify('start', this, event); - if (this.options.starteffect) { - this.options.starteffect(this.element); - } - }, - - /** @id MochiKit.DragAndDrop.updateDrag */ - updateDrag: function (event, pointer) { - if (!this.dragging) { - this.startDrag(event); - } - MochiKit.Position.prepare(); - MochiKit.DragAndDrop.Droppables.show(pointer, this.element); - MochiKit.DragAndDrop.Draggables.notify('drag', this, event); - this.draw(pointer); - this.options.onchange(this); - - if (this.options.scroll) { - this.stopScrolling(); - var p, q; - if (this.options.scroll == window) { - var s = this._getWindowScroll(this.options.scroll); - p = new MochiKit.Style.Coordinates(s.left, s.top); - q = new MochiKit.Style.Coordinates(s.left + s.width, - s.top + s.height); - } else { - p = MochiKit.Position.page(this.options.scroll); - p.x += this.options.scroll.scrollLeft; - p.y += this.options.scroll.scrollTop; - p.x += (window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0); - p.y += (window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0); - q = new MochiKit.Style.Coordinates(p.x + this.options.scroll.offsetWidth, - p.y + this.options.scroll.offsetHeight); - } - var speed = [0, 0]; - if (pointer.page.x > (q.x - this.options.scrollSensitivity)) { - speed[0] = pointer.page.x - (q.x - this.options.scrollSensitivity); - } else if (pointer.page.x < (p.x + this.options.scrollSensitivity)) { - speed[0] = pointer.page.x - (p.x + this.options.scrollSensitivity); - } - if (pointer.page.y > (q.y - this.options.scrollSensitivity)) { - speed[1] = pointer.page.y - (q.y - this.options.scrollSensitivity); - } else if (pointer.page.y < (p.y + this.options.scrollSensitivity)) { - speed[1] = pointer.page.y - (p.y + this.options.scrollSensitivity); - } - this.startScrolling(speed); - } - - // fix AppleWebKit rendering - if (/AppleWebKit/.test(navigator.appVersion)) { - window.scrollBy(0, 0); - } - event.stop(); - }, - - /** @id MochiKit.DragAndDrop.finishDrag */ - finishDrag: function (event, success) { - var dr = MochiKit.DragAndDrop; - this.dragging = false; - if (this.options.selectclass) { - MochiKit.DOM.removeElementClass(this.element, - this.options.selectclass); - } - - if (this.options.ghosting) { - // XXX: from a user point of view, it would be better to remove - // the node only *after* the MochiKit.Visual.Move end when used - // with revert. - MochiKit.Position.relativize(this.element, this.ghostPosition); - MochiKit.DOM.removeElement(this._clone); - this._clone = null; - } - - if (success) { - dr.Droppables.fire(event, this.element); - } - dr.Draggables.notify('end', this, event); - - var revert = this.options.revert; - if (revert && typeof(revert) == 'function') { - revert = revert(this.element); - } - - var d = this.currentDelta(); - if (revert && this.options.reverteffect) { - this._revert = this.options.reverteffect(this.element, - d[1] - this.delta[1], d[0] - this.delta[0]); - } else { - this.delta = d; - } - - if (this.options.zindex) { - this.element.style.zIndex = this.originalZ; - } - - if (this.options.endeffect) { - this.options.endeffect(this.element); - } - - dr.Draggables.deactivate(); - dr.Droppables.reset(this.element); - }, - - /** @id MochiKit.DragAndDrop.keyPress */ - keyPress: function (event) { - if (event.key().string != "KEY_ESCAPE") { - return; - } - this.finishDrag(event, false); - event.stop(); - }, - - /** @id MochiKit.DragAndDrop.endDrag */ - endDrag: function (event) { - if (!this.dragging) { - return; - } - this.stopScrolling(); - this.finishDrag(event, true); - event.stop(); - }, - - /** @id MochiKit.DragAndDrop.draw */ - draw: function (point) { - var pos = MochiKit.Position.cumulativeOffset(this.element); - var d = this.currentDelta(); - pos.x -= d[0]; - pos.y -= d[1]; - - if (this.options.scroll && (this.options.scroll != window && this._isScrollChild)) { - pos.x -= this.options.scroll.scrollLeft - this.originalScrollLeft; - pos.y -= this.options.scroll.scrollTop - this.originalScrollTop; - } - - var p = [point.page.x - pos.x - this.offset[0], - point.page.y - pos.y - this.offset[1]]; - - if (this.options.snap) { - if (typeof(this.options.snap) == 'function') { - p = this.options.snap(p[0], p[1]); - } else { - if (this.options.snap instanceof Array) { - var i = -1; - p = MochiKit.Base.map(MochiKit.Base.bind(function (v) { - i += 1; - return Math.round(v/this.options.snap[i]) * - this.options.snap[i]; - }, this), p); - } else { - p = MochiKit.Base.map(MochiKit.Base.bind(function (v) { - return Math.round(v/this.options.snap) * - this.options.snap; - }, this), p); - } - } - } - var style = this.element.style; - if ((!this.options.constraint) || - (this.options.constraint == 'horizontal')) { - style.left = p[0] + 'px'; - } - if ((!this.options.constraint) || - (this.options.constraint == 'vertical')) { - style.top = p[1] + 'px'; - } - if (style.visibility == 'hidden') { - style.visibility = ''; // fix gecko rendering - } - }, - - /** @id MochiKit.DragAndDrop.stopScrolling */ - stopScrolling: function () { - if (this.scrollInterval) { - clearInterval(this.scrollInterval); - this.scrollInterval = null; - MochiKit.DragAndDrop.Draggables._lastScrollPointer = null; - } - }, - - /** @id MochiKit.DragAndDrop.startScrolling */ - startScrolling: function (speed) { - if (!speed[0] && !speed[1]) { - return; - } - this.scrollSpeed = [speed[0] * this.options.scrollSpeed, - speed[1] * this.options.scrollSpeed]; - this.lastScrolled = new Date(); - this.scrollInterval = setInterval(MochiKit.Base.bind(this.scroll, this), 10); - }, - - /** @id MochiKit.DragAndDrop.scroll */ - scroll: function () { - var current = new Date(); - var delta = current - this.lastScrolled; - this.lastScrolled = current; - - if (this.options.scroll == window) { - var s = this._getWindowScroll(this.options.scroll); - if (this.scrollSpeed[0] || this.scrollSpeed[1]) { - var dm = delta / 1000; - this.options.scroll.scrollTo(s.left + dm * this.scrollSpeed[0], - s.top + dm * this.scrollSpeed[1]); - } - } else { - this.options.scroll.scrollLeft += this.scrollSpeed[0] * delta / 1000; - this.options.scroll.scrollTop += this.scrollSpeed[1] * delta / 1000; - } - - var d = MochiKit.DragAndDrop; - - MochiKit.Position.prepare(); - d.Droppables.show(d.Draggables._lastPointer, this.element); - d.Draggables.notify('drag', this); - if (this._isScrollChild) { - d.Draggables._lastScrollPointer = d.Draggables._lastScrollPointer || d.Draggables._lastPointer; - d.Draggables._lastScrollPointer.x += this.scrollSpeed[0] * delta / 1000; - d.Draggables._lastScrollPointer.y += this.scrollSpeed[1] * delta / 1000; - if (d.Draggables._lastScrollPointer.x < 0) { - d.Draggables._lastScrollPointer.x = 0; - } - if (d.Draggables._lastScrollPointer.y < 0) { - d.Draggables._lastScrollPointer.y = 0; - } - this.draw(d.Draggables._lastScrollPointer); - } - - this.options.onchange(this); - }, - - _getWindowScroll: function (win) { - var vp, w, h; - MochiKit.DOM.withWindow(win, function () { - vp = MochiKit.Style.getViewportPosition(win.document); - }); - if (win.innerWidth) { - w = win.innerWidth; - h = win.innerHeight; - } else if (win.document.documentElement && win.document.documentElement.clientWidth) { - w = win.document.documentElement.clientWidth; - h = win.document.documentElement.clientHeight; - } else { - w = win.document.body.offsetWidth; - h = win.document.body.offsetHeight; - } - return {top: vp.y, left: vp.x, width: w, height: h}; - }, - - /** @id MochiKit.DragAndDrop.repr */ - repr: function () { - return '[' + this.__class__.NAME + ", options:" + MochiKit.Base.repr(this.options) + "]"; - } -}; - -MochiKit.DragAndDrop.__new__ = function () { - MochiKit.Base.nameFunctions(this); - - this.EXPORT_TAGS = { - ":common": this.EXPORT, - ":all": MochiKit.Base.concat(this.EXPORT, this.EXPORT_OK) - }; -}; - -MochiKit.DragAndDrop.__new__(); - -MochiKit.Base._exportSymbols(this, MochiKit.DragAndDrop); - diff --git a/static/MochiKit/Format.js b/static/MochiKit/Format.js deleted file mode 100644 index 36b7153..0000000 --- a/static/MochiKit/Format.js +++ /dev/null @@ -1,304 +0,0 @@ -/*** - -MochiKit.Format 1.4.2 - -See for documentation, downloads, license, etc. - -(c) 2005 Bob Ippolito. All rights Reserved. - -***/ - -MochiKit.Base._deps('Format', ['Base']); - -MochiKit.Format.NAME = "MochiKit.Format"; -MochiKit.Format.VERSION = "1.4.2"; -MochiKit.Format.__repr__ = function () { - return "[" + this.NAME + " " + this.VERSION + "]"; -}; -MochiKit.Format.toString = function () { - return this.__repr__(); -}; - -MochiKit.Format._numberFormatter = function (placeholder, header, footer, locale, isPercent, precision, leadingZeros, separatorAt, trailingZeros) { - return function (num) { - num = parseFloat(num); - if (typeof(num) == "undefined" || num === null || isNaN(num)) { - return placeholder; - } - var curheader = header; - var curfooter = footer; - if (num < 0) { - num = -num; - } else { - curheader = curheader.replace(/-/, ""); - } - var me = arguments.callee; - var fmt = MochiKit.Format.formatLocale(locale); - if (isPercent) { - num = num * 100.0; - curfooter = fmt.percent + curfooter; - } - num = MochiKit.Format.roundToFixed(num, precision); - var parts = num.split(/\./); - var whole = parts[0]; - var frac = (parts.length == 1) ? "" : parts[1]; - var res = ""; - while (whole.length < leadingZeros) { - whole = "0" + whole; - } - if (separatorAt) { - while (whole.length > separatorAt) { - var i = whole.length - separatorAt; - //res = res + fmt.separator + whole.substring(i, whole.length); - res = fmt.separator + whole.substring(i, whole.length) + res; - whole = whole.substring(0, i); - } - } - res = whole + res; - if (precision > 0) { - while (frac.length < trailingZeros) { - frac = frac + "0"; - } - res = res + fmt.decimal + frac; - } - return curheader + res + curfooter; - }; -}; - -/** @id MochiKit.Format.numberFormatter */ -MochiKit.Format.numberFormatter = function (pattern, placeholder/* = "" */, locale/* = "default" */) { - // http://java.sun.com/docs/books/tutorial/i18n/format/numberpattern.html - // | 0 | leading or trailing zeros - // | # | just the number - // | , | separator - // | . | decimal separator - // | % | Multiply by 100 and format as percent - if (typeof(placeholder) == "undefined") { - placeholder = ""; - } - var match = pattern.match(/((?:[0#]+,)?[0#]+)(?:\.([0#]+))?(%)?/); - if (!match) { - throw TypeError("Invalid pattern"); - } - var header = pattern.substr(0, match.index); - var footer = pattern.substr(match.index + match[0].length); - if (header.search(/-/) == -1) { - header = header + "-"; - } - var whole = match[1]; - var frac = (typeof(match[2]) == "string" && match[2] != "") ? match[2] : ""; - var isPercent = (typeof(match[3]) == "string" && match[3] != ""); - var tmp = whole.split(/,/); - var separatorAt; - if (typeof(locale) == "undefined") { - locale = "default"; - } - if (tmp.length == 1) { - separatorAt = null; - } else { - separatorAt = tmp[1].length; - } - var leadingZeros = whole.length - whole.replace(/0/g, "").length; - var trailingZeros = frac.length - frac.replace(/0/g, "").length; - var precision = frac.length; - var rval = MochiKit.Format._numberFormatter( - placeholder, header, footer, locale, isPercent, precision, - leadingZeros, separatorAt, trailingZeros - ); - var m = MochiKit.Base; - if (m) { - var fn = arguments.callee; - var args = m.concat(arguments); - rval.repr = function () { - return [ - self.NAME, - "(", - map(m.repr, args).join(", "), - ")" - ].join(""); - }; - } - return rval; -}; - -/** @id MochiKit.Format.formatLocale */ -MochiKit.Format.formatLocale = function (locale) { - if (typeof(locale) == "undefined" || locale === null) { - locale = "default"; - } - if (typeof(locale) == "string") { - var rval = MochiKit.Format.LOCALE[locale]; - if (typeof(rval) == "string") { - rval = arguments.callee(rval); - MochiKit.Format.LOCALE[locale] = rval; - } - return rval; - } else { - return locale; - } -}; - -/** @id MochiKit.Format.twoDigitAverage */ -MochiKit.Format.twoDigitAverage = function (numerator, denominator) { - if (denominator) { - var res = numerator / denominator; - if (!isNaN(res)) { - return MochiKit.Format.twoDigitFloat(res); - } - } - return "0"; -}; - -/** @id MochiKit.Format.twoDigitFloat */ -MochiKit.Format.twoDigitFloat = function (aNumber) { - var res = roundToFixed(aNumber, 2); - if (res.indexOf(".00") > 0) { - return res.substring(0, res.length - 3); - } else if (res.charAt(res.length - 1) == "0") { - return res.substring(0, res.length - 1); - } else { - return res; - } -}; - -/** @id MochiKit.Format.lstrip */ -MochiKit.Format.lstrip = function (str, /* optional */chars) { - str = str + ""; - if (typeof(str) != "string") { - return null; - } - if (!chars) { - return str.replace(/^\s+/, ""); - } else { - return str.replace(new RegExp("^[" + chars + "]+"), ""); - } -}; - -/** @id MochiKit.Format.rstrip */ -MochiKit.Format.rstrip = function (str, /* optional */chars) { - str = str + ""; - if (typeof(str) != "string") { - return null; - } - if (!chars) { - return str.replace(/\s+$/, ""); - } else { - return str.replace(new RegExp("[" + chars + "]+$"), ""); - } -}; - -/** @id MochiKit.Format.strip */ -MochiKit.Format.strip = function (str, /* optional */chars) { - var self = MochiKit.Format; - return self.rstrip(self.lstrip(str, chars), chars); -}; - -/** @id MochiKit.Format.truncToFixed */ -MochiKit.Format.truncToFixed = function (aNumber, precision) { - var res = Math.floor(aNumber).toFixed(0); - if (aNumber < 0) { - res = Math.ceil(aNumber).toFixed(0); - if (res.charAt(0) != "-" && precision > 0) { - res = "-" + res; - } - } - if (res.indexOf("e") < 0 && precision > 0) { - var tail = aNumber.toString(); - if (tail.indexOf("e") > 0) { - tail = "."; - } else if (tail.indexOf(".") < 0) { - tail = "."; - } else { - tail = tail.substring(tail.indexOf(".")); - } - if (tail.length - 1 > precision) { - tail = tail.substring(0, precision + 1); - } - while (tail.length - 1 < precision) { - tail += "0"; - } - res += tail; - } - return res; -}; - -/** @id MochiKit.Format.roundToFixed */ -MochiKit.Format.roundToFixed = function (aNumber, precision) { - var upper = Math.abs(aNumber) + 0.5 * Math.pow(10, -precision); - var res = MochiKit.Format.truncToFixed(upper, precision); - if (aNumber < 0) { - res = "-" + res; - } - return res; -}; - -/** @id MochiKit.Format.percentFormat */ -MochiKit.Format.percentFormat = function (aNumber) { - return MochiKit.Format.twoDigitFloat(100 * aNumber) + '%'; -}; - -MochiKit.Format.EXPORT = [ - "truncToFixed", - "roundToFixed", - "numberFormatter", - "formatLocale", - "twoDigitAverage", - "twoDigitFloat", - "percentFormat", - "lstrip", - "rstrip", - "strip" -]; - -MochiKit.Format.LOCALE = { - en_US: {separator: ",", decimal: ".", percent: "%"}, - de_DE: {separator: ".", decimal: ",", percent: "%"}, - pt_BR: {separator: ".", decimal: ",", percent: "%"}, - fr_FR: {separator: " ", decimal: ",", percent: "%"}, - "default": "en_US" -}; - -MochiKit.Format.EXPORT_OK = []; -MochiKit.Format.EXPORT_TAGS = { - ':all': MochiKit.Format.EXPORT, - ':common': MochiKit.Format.EXPORT -}; - -MochiKit.Format.__new__ = function () { - // MochiKit.Base.nameFunctions(this); - var base = this.NAME + "."; - var k, v, o; - for (k in this.LOCALE) { - o = this.LOCALE[k]; - if (typeof(o) == "object") { - o.repr = function () { return this.NAME; }; - o.NAME = base + "LOCALE." + k; - } - } - for (k in this) { - o = this[k]; - if (typeof(o) == 'function' && typeof(o.NAME) == 'undefined') { - try { - o.NAME = base + k; - } catch (e) { - // pass - } - } - } -}; - -MochiKit.Format.__new__(); - -if (typeof(MochiKit.Base) != "undefined") { - MochiKit.Base._exportSymbols(this, MochiKit.Format); -} else { - (function (globals, module) { - if ((typeof(JSAN) == 'undefined' && typeof(dojo) == 'undefined') - || (MochiKit.__export__ === false)) { - var all = module.EXPORT_TAGS[":all"]; - for (var i = 0; i < all.length; i++) { - globals[all[i]] = module[all[i]]; - } - } - })(this, MochiKit.Format); -} diff --git a/static/MochiKit/Iter.js b/static/MochiKit/Iter.js deleted file mode 100644 index 99f3155..0000000 --- a/static/MochiKit/Iter.js +++ /dev/null @@ -1,844 +0,0 @@ -/*** - -MochiKit.Iter 1.4.2 - -See for documentation, downloads, license, etc. - -(c) 2005 Bob Ippolito. All rights Reserved. - -***/ - -MochiKit.Base._deps('Iter', ['Base']); - -MochiKit.Iter.NAME = "MochiKit.Iter"; -MochiKit.Iter.VERSION = "1.4.2"; -MochiKit.Base.update(MochiKit.Iter, { - __repr__: function () { - return "[" + this.NAME + " " + this.VERSION + "]"; - }, - toString: function () { - return this.__repr__(); - }, - - /** @id MochiKit.Iter.registerIteratorFactory */ - registerIteratorFactory: function (name, check, iterfactory, /* optional */ override) { - MochiKit.Iter.iteratorRegistry.register(name, check, iterfactory, override); - }, - - /** @id MochiKit.Iter.isIterable */ - isIterable: function(o) { - return o != null && - (typeof(o.next) == "function" || typeof(o.iter) == "function"); - }, - - /** @id MochiKit.Iter.iter */ - iter: function (iterable, /* optional */ sentinel) { - var self = MochiKit.Iter; - if (arguments.length == 2) { - return self.takewhile( - function (a) { return a != sentinel; }, - iterable - ); - } - if (typeof(iterable.next) == 'function') { - return iterable; - } else if (typeof(iterable.iter) == 'function') { - return iterable.iter(); - /* - } else if (typeof(iterable.__iterator__) == 'function') { - // - // XXX: We can't support JavaScript 1.7 __iterator__ directly - // because of Object.prototype.__iterator__ - // - return iterable.__iterator__(); - */ - } - - try { - return self.iteratorRegistry.match(iterable); - } catch (e) { - var m = MochiKit.Base; - if (e == m.NotFound) { - e = new TypeError(typeof(iterable) + ": " + m.repr(iterable) + " is not iterable"); - } - throw e; - } - }, - - /** @id MochiKit.Iter.count */ - count: function (n) { - if (!n) { - n = 0; - } - var m = MochiKit.Base; - return { - repr: function () { return "count(" + n + ")"; }, - toString: m.forwardCall("repr"), - next: m.counter(n) - }; - }, - - /** @id MochiKit.Iter.cycle */ - cycle: function (p) { - var self = MochiKit.Iter; - var m = MochiKit.Base; - var lst = []; - var iterator = self.iter(p); - return { - repr: function () { return "cycle(...)"; }, - toString: m.forwardCall("repr"), - next: function () { - try { - var rval = iterator.next(); - lst.push(rval); - return rval; - } catch (e) { - if (e != self.StopIteration) { - throw e; - } - if (lst.length === 0) { - this.next = function () { - throw self.StopIteration; - }; - } else { - var i = -1; - this.next = function () { - i = (i + 1) % lst.length; - return lst[i]; - }; - } - return this.next(); - } - } - }; - }, - - /** @id MochiKit.Iter.repeat */ - repeat: function (elem, /* optional */n) { - var m = MochiKit.Base; - if (typeof(n) == 'undefined') { - return { - repr: function () { - return "repeat(" + m.repr(elem) + ")"; - }, - toString: m.forwardCall("repr"), - next: function () { - return elem; - } - }; - } - return { - repr: function () { - return "repeat(" + m.repr(elem) + ", " + n + ")"; - }, - toString: m.forwardCall("repr"), - next: function () { - if (n <= 0) { - throw MochiKit.Iter.StopIteration; - } - n -= 1; - return elem; - } - }; - }, - - /** @id MochiKit.Iter.next */ - next: function (iterator) { - return iterator.next(); - }, - - /** @id MochiKit.Iter.izip */ - izip: function (p, q/*, ...*/) { - var m = MochiKit.Base; - var self = MochiKit.Iter; - var next = self.next; - var iterables = m.map(self.iter, arguments); - return { - repr: function () { return "izip(...)"; }, - toString: m.forwardCall("repr"), - next: function () { return m.map(next, iterables); } - }; - }, - - /** @id MochiKit.Iter.ifilter */ - ifilter: function (pred, seq) { - var m = MochiKit.Base; - seq = MochiKit.Iter.iter(seq); - if (pred === null) { - pred = m.operator.truth; - } - return { - repr: function () { return "ifilter(...)"; }, - toString: m.forwardCall("repr"), - next: function () { - while (true) { - var rval = seq.next(); - if (pred(rval)) { - return rval; - } - } - // mozilla warnings aren't too bright - return undefined; - } - }; - }, - - /** @id MochiKit.Iter.ifilterfalse */ - ifilterfalse: function (pred, seq) { - var m = MochiKit.Base; - seq = MochiKit.Iter.iter(seq); - if (pred === null) { - pred = m.operator.truth; - } - return { - repr: function () { return "ifilterfalse(...)"; }, - toString: m.forwardCall("repr"), - next: function () { - while (true) { - var rval = seq.next(); - if (!pred(rval)) { - return rval; - } - } - // mozilla warnings aren't too bright - return undefined; - } - }; - }, - - /** @id MochiKit.Iter.islice */ - islice: function (seq/*, [start,] stop[, step] */) { - var self = MochiKit.Iter; - var m = MochiKit.Base; - seq = self.iter(seq); - var start = 0; - var stop = 0; - var step = 1; - var i = -1; - if (arguments.length == 2) { - stop = arguments[1]; - } else if (arguments.length == 3) { - start = arguments[1]; - stop = arguments[2]; - } else { - start = arguments[1]; - stop = arguments[2]; - step = arguments[3]; - } - return { - repr: function () { - return "islice(" + ["...", start, stop, step].join(", ") + ")"; - }, - toString: m.forwardCall("repr"), - next: function () { - var rval; - while (i < start) { - rval = seq.next(); - i++; - } - if (start >= stop) { - throw self.StopIteration; - } - start += step; - return rval; - } - }; - }, - - /** @id MochiKit.Iter.imap */ - imap: function (fun, p, q/*, ...*/) { - var m = MochiKit.Base; - var self = MochiKit.Iter; - var iterables = m.map(self.iter, m.extend(null, arguments, 1)); - var map = m.map; - var next = self.next; - return { - repr: function () { return "imap(...)"; }, - toString: m.forwardCall("repr"), - next: function () { - return fun.apply(this, map(next, iterables)); - } - }; - }, - - /** @id MochiKit.Iter.applymap */ - applymap: function (fun, seq, self) { - seq = MochiKit.Iter.iter(seq); - var m = MochiKit.Base; - return { - repr: function () { return "applymap(...)"; }, - toString: m.forwardCall("repr"), - next: function () { - return fun.apply(self, seq.next()); - } - }; - }, - - /** @id MochiKit.Iter.chain */ - chain: function (p, q/*, ...*/) { - // dumb fast path - var self = MochiKit.Iter; - var m = MochiKit.Base; - if (arguments.length == 1) { - return self.iter(arguments[0]); - } - var argiter = m.map(self.iter, arguments); - return { - repr: function () { return "chain(...)"; }, - toString: m.forwardCall("repr"), - next: function () { - while (argiter.length > 1) { - try { - var result = argiter[0].next(); - return result; - } catch (e) { - if (e != self.StopIteration) { - throw e; - } - argiter.shift(); - var result = argiter[0].next(); - return result; - } - } - if (argiter.length == 1) { - // optimize last element - var arg = argiter.shift(); - this.next = m.bind("next", arg); - return this.next(); - } - throw self.StopIteration; - } - }; - }, - - /** @id MochiKit.Iter.takewhile */ - takewhile: function (pred, seq) { - var self = MochiKit.Iter; - seq = self.iter(seq); - return { - repr: function () { return "takewhile(...)"; }, - toString: MochiKit.Base.forwardCall("repr"), - next: function () { - var rval = seq.next(); - if (!pred(rval)) { - this.next = function () { - throw self.StopIteration; - }; - this.next(); - } - return rval; - } - }; - }, - - /** @id MochiKit.Iter.dropwhile */ - dropwhile: function (pred, seq) { - seq = MochiKit.Iter.iter(seq); - var m = MochiKit.Base; - var bind = m.bind; - return { - "repr": function () { return "dropwhile(...)"; }, - "toString": m.forwardCall("repr"), - "next": function () { - while (true) { - var rval = seq.next(); - if (!pred(rval)) { - break; - } - } - this.next = bind("next", seq); - return rval; - } - }; - }, - - _tee: function (ident, sync, iterable) { - sync.pos[ident] = -1; - var m = MochiKit.Base; - var listMin = m.listMin; - return { - repr: function () { return "tee(" + ident + ", ...)"; }, - toString: m.forwardCall("repr"), - next: function () { - var rval; - var i = sync.pos[ident]; - - if (i == sync.max) { - rval = iterable.next(); - sync.deque.push(rval); - sync.max += 1; - sync.pos[ident] += 1; - } else { - rval = sync.deque[i - sync.min]; - sync.pos[ident] += 1; - if (i == sync.min && listMin(sync.pos) != sync.min) { - sync.min += 1; - sync.deque.shift(); - } - } - return rval; - } - }; - }, - - /** @id MochiKit.Iter.tee */ - tee: function (iterable, n/* = 2 */) { - var rval = []; - var sync = { - "pos": [], - "deque": [], - "max": -1, - "min": -1 - }; - if (arguments.length == 1 || typeof(n) == "undefined" || n === null) { - n = 2; - } - var self = MochiKit.Iter; - iterable = self.iter(iterable); - var _tee = self._tee; - for (var i = 0; i < n; i++) { - rval.push(_tee(i, sync, iterable)); - } - return rval; - }, - - /** @id MochiKit.Iter.list */ - list: function (iterable) { - // Fast-path for Array and Array-like - var rval; - if (iterable instanceof Array) { - return iterable.slice(); - } - // this is necessary to avoid a Safari crash - if (typeof(iterable) == "function" && - !(iterable instanceof Function) && - typeof(iterable.length) == 'number') { - rval = []; - for (var i = 0; i < iterable.length; i++) { - rval.push(iterable[i]); - } - return rval; - } - - var self = MochiKit.Iter; - iterable = self.iter(iterable); - var rval = []; - var a_val; - try { - while (true) { - a_val = iterable.next(); - rval.push(a_val); - } - } catch (e) { - if (e != self.StopIteration) { - throw e; - } - return rval; - } - // mozilla warnings aren't too bright - return undefined; - }, - - - /** @id MochiKit.Iter.reduce */ - reduce: function (fn, iterable, /* optional */initial) { - var i = 0; - var x = initial; - var self = MochiKit.Iter; - iterable = self.iter(iterable); - if (arguments.length < 3) { - try { - x = iterable.next(); - } catch (e) { - if (e == self.StopIteration) { - e = new TypeError("reduce() of empty sequence with no initial value"); - } - throw e; - } - i++; - } - try { - while (true) { - x = fn(x, iterable.next()); - } - } catch (e) { - if (e != self.StopIteration) { - throw e; - } - } - return x; - }, - - /** @id MochiKit.Iter.range */ - range: function (/* [start,] stop[, step] */) { - var start = 0; - var stop = 0; - var step = 1; - if (arguments.length == 1) { - stop = arguments[0]; - } else if (arguments.length == 2) { - start = arguments[0]; - stop = arguments[1]; - } else if (arguments.length == 3) { - start = arguments[0]; - stop = arguments[1]; - step = arguments[2]; - } else { - throw new TypeError("range() takes 1, 2, or 3 arguments!"); - } - if (step === 0) { - throw new TypeError("range() step must not be 0"); - } - return { - next: function () { - if ((step > 0 && start >= stop) || (step < 0 && start <= stop)) { - throw MochiKit.Iter.StopIteration; - } - var rval = start; - start += step; - return rval; - }, - repr: function () { - return "range(" + [start, stop, step].join(", ") + ")"; - }, - toString: MochiKit.Base.forwardCall("repr") - }; - }, - - /** @id MochiKit.Iter.sum */ - sum: function (iterable, start/* = 0 */) { - if (typeof(start) == "undefined" || start === null) { - start = 0; - } - var x = start; - var self = MochiKit.Iter; - iterable = self.iter(iterable); - try { - while (true) { - x += iterable.next(); - } - } catch (e) { - if (e != self.StopIteration) { - throw e; - } - } - return x; - }, - - /** @id MochiKit.Iter.exhaust */ - exhaust: function (iterable) { - var self = MochiKit.Iter; - iterable = self.iter(iterable); - try { - while (true) { - iterable.next(); - } - } catch (e) { - if (e != self.StopIteration) { - throw e; - } - } - }, - - /** @id MochiKit.Iter.forEach */ - forEach: function (iterable, func, /* optional */obj) { - var m = MochiKit.Base; - var self = MochiKit.Iter; - if (arguments.length > 2) { - func = m.bind(func, obj); - } - // fast path for array - if (m.isArrayLike(iterable) && !self.isIterable(iterable)) { - try { - for (var i = 0; i < iterable.length; i++) { - func(iterable[i]); - } - } catch (e) { - if (e != self.StopIteration) { - throw e; - } - } - } else { - self.exhaust(self.imap(func, iterable)); - } - }, - - /** @id MochiKit.Iter.every */ - every: function (iterable, func) { - var self = MochiKit.Iter; - try { - self.ifilterfalse(func, iterable).next(); - return false; - } catch (e) { - if (e != self.StopIteration) { - throw e; - } - return true; - } - }, - - /** @id MochiKit.Iter.sorted */ - sorted: function (iterable, /* optional */cmp) { - var rval = MochiKit.Iter.list(iterable); - if (arguments.length == 1) { - cmp = MochiKit.Base.compare; - } - rval.sort(cmp); - return rval; - }, - - /** @id MochiKit.Iter.reversed */ - reversed: function (iterable) { - var rval = MochiKit.Iter.list(iterable); - rval.reverse(); - return rval; - }, - - /** @id MochiKit.Iter.some */ - some: function (iterable, func) { - var self = MochiKit.Iter; - try { - self.ifilter(func, iterable).next(); - return true; - } catch (e) { - if (e != self.StopIteration) { - throw e; - } - return false; - } - }, - - /** @id MochiKit.Iter.iextend */ - iextend: function (lst, iterable) { - var m = MochiKit.Base; - var self = MochiKit.Iter; - if (m.isArrayLike(iterable) && !self.isIterable(iterable)) { - // fast-path for array-like - for (var i = 0; i < iterable.length; i++) { - lst.push(iterable[i]); - } - } else { - iterable = self.iter(iterable); - try { - while (true) { - lst.push(iterable.next()); - } - } catch (e) { - if (e != self.StopIteration) { - throw e; - } - } - } - return lst; - }, - - /** @id MochiKit.Iter.groupby */ - groupby: function(iterable, /* optional */ keyfunc) { - var m = MochiKit.Base; - var self = MochiKit.Iter; - if (arguments.length < 2) { - keyfunc = m.operator.identity; - } - iterable = self.iter(iterable); - - // shared - var pk = undefined; - var k = undefined; - var v; - - function fetch() { - v = iterable.next(); - k = keyfunc(v); - }; - - function eat() { - var ret = v; - v = undefined; - return ret; - }; - - var first = true; - var compare = m.compare; - return { - repr: function () { return "groupby(...)"; }, - next: function() { - // iterator-next - - // iterate until meet next group - while (compare(k, pk) === 0) { - fetch(); - if (first) { - first = false; - break; - } - } - pk = k; - return [k, { - next: function() { - // subiterator-next - if (v == undefined) { // Is there something to eat? - fetch(); - } - if (compare(k, pk) !== 0) { - throw self.StopIteration; - } - return eat(); - } - }]; - } - }; - }, - - /** @id MochiKit.Iter.groupby_as_array */ - groupby_as_array: function (iterable, /* optional */ keyfunc) { - var m = MochiKit.Base; - var self = MochiKit.Iter; - if (arguments.length < 2) { - keyfunc = m.operator.identity; - } - - iterable = self.iter(iterable); - var result = []; - var first = true; - var prev_key; - var compare = m.compare; - while (true) { - try { - var value = iterable.next(); - var key = keyfunc(value); - } catch (e) { - if (e == self.StopIteration) { - break; - } - throw e; - } - if (first || compare(key, prev_key) !== 0) { - var values = []; - result.push([key, values]); - } - values.push(value); - first = false; - prev_key = key; - } - return result; - }, - - /** @id MochiKit.Iter.arrayLikeIter */ - arrayLikeIter: function (iterable) { - var i = 0; - return { - repr: function () { return "arrayLikeIter(...)"; }, - toString: MochiKit.Base.forwardCall("repr"), - next: function () { - if (i >= iterable.length) { - throw MochiKit.Iter.StopIteration; - } - return iterable[i++]; - } - }; - }, - - /** @id MochiKit.Iter.hasIterateNext */ - hasIterateNext: function (iterable) { - return (iterable && typeof(iterable.iterateNext) == "function"); - }, - - /** @id MochiKit.Iter.iterateNextIter */ - iterateNextIter: function (iterable) { - return { - repr: function () { return "iterateNextIter(...)"; }, - toString: MochiKit.Base.forwardCall("repr"), - next: function () { - var rval = iterable.iterateNext(); - if (rval === null || rval === undefined) { - throw MochiKit.Iter.StopIteration; - } - return rval; - } - }; - } -}); - - -MochiKit.Iter.EXPORT_OK = [ - "iteratorRegistry", - "arrayLikeIter", - "hasIterateNext", - "iterateNextIter" -]; - -MochiKit.Iter.EXPORT = [ - "StopIteration", - "registerIteratorFactory", - "iter", - "count", - "cycle", - "repeat", - "next", - "izip", - "ifilter", - "ifilterfalse", - "islice", - "imap", - "applymap", - "chain", - "takewhile", - "dropwhile", - "tee", - "list", - "reduce", - "range", - "sum", - "exhaust", - "forEach", - "every", - "sorted", - "reversed", - "some", - "iextend", - "groupby", - "groupby_as_array" -]; - -MochiKit.Iter.__new__ = function () { - var m = MochiKit.Base; - // Re-use StopIteration if exists (e.g. SpiderMonkey) - if (typeof(StopIteration) != "undefined") { - this.StopIteration = StopIteration; - } else { - /** @id MochiKit.Iter.StopIteration */ - this.StopIteration = new m.NamedError("StopIteration"); - } - this.iteratorRegistry = new m.AdapterRegistry(); - // Register the iterator factory for arrays - this.registerIteratorFactory( - "arrayLike", - m.isArrayLike, - this.arrayLikeIter - ); - - this.registerIteratorFactory( - "iterateNext", - this.hasIterateNext, - this.iterateNextIter - ); - - this.EXPORT_TAGS = { - ":common": this.EXPORT, - ":all": m.concat(this.EXPORT, this.EXPORT_OK) - }; - - m.nameFunctions(this); - -}; - -MochiKit.Iter.__new__(); - -// -// XXX: Internet Explorer blows -// -if (MochiKit.__export__) { - reduce = MochiKit.Iter.reduce; -} - -MochiKit.Base._exportSymbols(this, MochiKit.Iter); diff --git a/static/MochiKit/Logging.js b/static/MochiKit/Logging.js deleted file mode 100644 index 463ccd0..0000000 --- a/static/MochiKit/Logging.js +++ /dev/null @@ -1,315 +0,0 @@ -/*** - -MochiKit.Logging 1.4.2 - -See for documentation, downloads, license, etc. - -(c) 2005 Bob Ippolito. All rights Reserved. - -***/ - -MochiKit.Base._deps('Logging', ['Base']); - -MochiKit.Logging.NAME = "MochiKit.Logging"; -MochiKit.Logging.VERSION = "1.4.2"; -MochiKit.Logging.__repr__ = function () { - return "[" + this.NAME + " " + this.VERSION + "]"; -}; - -MochiKit.Logging.toString = function () { - return this.__repr__(); -}; - - -MochiKit.Logging.EXPORT = [ - "LogLevel", - "LogMessage", - "Logger", - "alertListener", - "logger", - "log", - "logError", - "logDebug", - "logFatal", - "logWarning" -]; - - -MochiKit.Logging.EXPORT_OK = [ - "logLevelAtLeast", - "isLogMessage", - "compareLogMessage" -]; - - -/** @id MochiKit.Logging.LogMessage */ -MochiKit.Logging.LogMessage = function (num, level, info) { - this.num = num; - this.level = level; - this.info = info; - this.timestamp = new Date(); -}; - -MochiKit.Logging.LogMessage.prototype = { - /** @id MochiKit.Logging.LogMessage.prototype.repr */ - repr: function () { - var m = MochiKit.Base; - return 'LogMessage(' + - m.map( - m.repr, - [this.num, this.level, this.info] - ).join(', ') + ')'; - }, - /** @id MochiKit.Logging.LogMessage.prototype.toString */ - toString: MochiKit.Base.forwardCall("repr") -}; - -MochiKit.Base.update(MochiKit.Logging, { - /** @id MochiKit.Logging.logLevelAtLeast */ - logLevelAtLeast: function (minLevel) { - var self = MochiKit.Logging; - if (typeof(minLevel) == 'string') { - minLevel = self.LogLevel[minLevel]; - } - return function (msg) { - var msgLevel = msg.level; - if (typeof(msgLevel) == 'string') { - msgLevel = self.LogLevel[msgLevel]; - } - return msgLevel >= minLevel; - }; - }, - - /** @id MochiKit.Logging.isLogMessage */ - isLogMessage: function (/* ... */) { - var LogMessage = MochiKit.Logging.LogMessage; - for (var i = 0; i < arguments.length; i++) { - if (!(arguments[i] instanceof LogMessage)) { - return false; - } - } - return true; - }, - - /** @id MochiKit.Logging.compareLogMessage */ - compareLogMessage: function (a, b) { - return MochiKit.Base.compare([a.level, a.info], [b.level, b.info]); - }, - - /** @id MochiKit.Logging.alertListener */ - alertListener: function (msg) { - alert( - "num: " + msg.num + - "\nlevel: " + msg.level + - "\ninfo: " + msg.info.join(" ") - ); - } - -}); - -/** @id MochiKit.Logging.Logger */ -MochiKit.Logging.Logger = function (/* optional */maxSize) { - this.counter = 0; - if (typeof(maxSize) == 'undefined' || maxSize === null) { - maxSize = -1; - } - this.maxSize = maxSize; - this._messages = []; - this.listeners = {}; - this.useNativeConsole = false; -}; - -MochiKit.Logging.Logger.prototype = { - /** @id MochiKit.Logging.Logger.prototype.clear */ - clear: function () { - this._messages.splice(0, this._messages.length); - }, - - /** @id MochiKit.Logging.Logger.prototype.logToConsole */ - logToConsole: function (msg) { - if (typeof(window) != "undefined" && window.console - && window.console.log) { - // Safari and FireBug 0.4 - // Percent replacement is a workaround for cute Safari crashing bug - window.console.log(msg.replace(/%/g, '\uFF05')); - } else if (typeof(opera) != "undefined" && opera.postError) { - // Opera - opera.postError(msg); - } else if (typeof(printfire) == "function") { - // FireBug 0.3 and earlier - printfire(msg); - } else if (typeof(Debug) != "undefined" && Debug.writeln) { - // IE Web Development Helper (?) - // http://www.nikhilk.net/Entry.aspx?id=93 - Debug.writeln(msg); - } else if (typeof(debug) != "undefined" && debug.trace) { - // Atlas framework (?) - // http://www.nikhilk.net/Entry.aspx?id=93 - debug.trace(msg); - } - }, - - /** @id MochiKit.Logging.Logger.prototype.dispatchListeners */ - dispatchListeners: function (msg) { - for (var k in this.listeners) { - var pair = this.listeners[k]; - if (pair.ident != k || (pair[0] && !pair[0](msg))) { - continue; - } - pair[1](msg); - } - }, - - /** @id MochiKit.Logging.Logger.prototype.addListener */ - addListener: function (ident, filter, listener) { - if (typeof(filter) == 'string') { - filter = MochiKit.Logging.logLevelAtLeast(filter); - } - var entry = [filter, listener]; - entry.ident = ident; - this.listeners[ident] = entry; - }, - - /** @id MochiKit.Logging.Logger.prototype.removeListener */ - removeListener: function (ident) { - delete this.listeners[ident]; - }, - - /** @id MochiKit.Logging.Logger.prototype.baseLog */ - baseLog: function (level, message/*, ...*/) { - if (typeof(level) == "number") { - if (level >= MochiKit.Logging.LogLevel.FATAL) { - level = 'FATAL'; - } else if (level >= MochiKit.Logging.LogLevel.ERROR) { - level = 'ERROR'; - } else if (level >= MochiKit.Logging.LogLevel.WARNING) { - level = 'WARNING'; - } else if (level >= MochiKit.Logging.LogLevel.INFO) { - level = 'INFO'; - } else { - level = 'DEBUG'; - } - } - var msg = new MochiKit.Logging.LogMessage( - this.counter, - level, - MochiKit.Base.extend(null, arguments, 1) - ); - this._messages.push(msg); - this.dispatchListeners(msg); - if (this.useNativeConsole) { - this.logToConsole(msg.level + ": " + msg.info.join(" ")); - } - this.counter += 1; - while (this.maxSize >= 0 && this._messages.length > this.maxSize) { - this._messages.shift(); - } - }, - - /** @id MochiKit.Logging.Logger.prototype.getMessages */ - getMessages: function (howMany) { - var firstMsg = 0; - if (!(typeof(howMany) == 'undefined' || howMany === null)) { - firstMsg = Math.max(0, this._messages.length - howMany); - } - return this._messages.slice(firstMsg); - }, - - /** @id MochiKit.Logging.Logger.prototype.getMessageText */ - getMessageText: function (howMany) { - if (typeof(howMany) == 'undefined' || howMany === null) { - howMany = 30; - } - var messages = this.getMessages(howMany); - if (messages.length) { - var lst = map(function (m) { - return '\n [' + m.num + '] ' + m.level + ': ' + m.info.join(' '); - }, messages); - lst.unshift('LAST ' + messages.length + ' MESSAGES:'); - return lst.join(''); - } - return ''; - }, - - /** @id MochiKit.Logging.Logger.prototype.debuggingBookmarklet */ - debuggingBookmarklet: function (inline) { - if (typeof(MochiKit.LoggingPane) == "undefined") { - alert(this.getMessageText()); - } else { - MochiKit.LoggingPane.createLoggingPane(inline || false); - } - } -}; - -MochiKit.Logging.__new__ = function () { - this.LogLevel = { - ERROR: 40, - FATAL: 50, - WARNING: 30, - INFO: 20, - DEBUG: 10 - }; - - var m = MochiKit.Base; - m.registerComparator("LogMessage", - this.isLogMessage, - this.compareLogMessage - ); - - var partial = m.partial; - - var Logger = this.Logger; - var baseLog = Logger.prototype.baseLog; - m.update(this.Logger.prototype, { - debug: partial(baseLog, 'DEBUG'), - log: partial(baseLog, 'INFO'), - error: partial(baseLog, 'ERROR'), - fatal: partial(baseLog, 'FATAL'), - warning: partial(baseLog, 'WARNING') - }); - - // indirectly find logger so it can be replaced - var self = this; - var connectLog = function (name) { - return function () { - self.logger[name].apply(self.logger, arguments); - }; - }; - - /** @id MochiKit.Logging.log */ - this.log = connectLog('log'); - /** @id MochiKit.Logging.logError */ - this.logError = connectLog('error'); - /** @id MochiKit.Logging.logDebug */ - this.logDebug = connectLog('debug'); - /** @id MochiKit.Logging.logFatal */ - this.logFatal = connectLog('fatal'); - /** @id MochiKit.Logging.logWarning */ - this.logWarning = connectLog('warning'); - this.logger = new Logger(); - this.logger.useNativeConsole = true; - - this.EXPORT_TAGS = { - ":common": this.EXPORT, - ":all": m.concat(this.EXPORT, this.EXPORT_OK) - }; - - m.nameFunctions(this); - -}; - -if (typeof(printfire) == "undefined" && - typeof(document) != "undefined" && document.createEvent && - typeof(dispatchEvent) != "undefined") { - // FireBug really should be less lame about this global function - printfire = function () { - printfire.args = arguments; - var ev = document.createEvent("Events"); - ev.initEvent("printfire", false, true); - dispatchEvent(ev); - }; -} - -MochiKit.Logging.__new__(); - -MochiKit.Base._exportSymbols(this, MochiKit.Logging); diff --git a/static/MochiKit/LoggingPane.js b/static/MochiKit/LoggingPane.js deleted file mode 100644 index 95c4fe5..0000000 --- a/static/MochiKit/LoggingPane.js +++ /dev/null @@ -1,353 +0,0 @@ -/*** - -MochiKit.LoggingPane 1.4.2 - -See for documentation, downloads, license, etc. - -(c) 2005 Bob Ippolito. All rights Reserved. - -***/ - -MochiKit.Base._deps('LoggingPane', ['Base', 'Logging']); - -MochiKit.LoggingPane.NAME = "MochiKit.LoggingPane"; -MochiKit.LoggingPane.VERSION = "1.4.2"; -MochiKit.LoggingPane.__repr__ = function () { - return "[" + this.NAME + " " + this.VERSION + "]"; -}; - -MochiKit.LoggingPane.toString = function () { - return this.__repr__(); -}; - -/** @id MochiKit.LoggingPane.createLoggingPane */ -MochiKit.LoggingPane.createLoggingPane = function (inline/* = false */) { - var m = MochiKit.LoggingPane; - inline = !(!inline); - if (m._loggingPane && m._loggingPane.inline != inline) { - m._loggingPane.closePane(); - m._loggingPane = null; - } - if (!m._loggingPane || m._loggingPane.closed) { - m._loggingPane = new m.LoggingPane(inline, MochiKit.Logging.logger); - } - return m._loggingPane; -}; - -/** @id MochiKit.LoggingPane.LoggingPane */ -MochiKit.LoggingPane.LoggingPane = function (inline/* = false */, logger/* = MochiKit.Logging.logger */) { - - /* Use a div if inline, pop up a window if not */ - /* Create the elements */ - if (typeof(logger) == "undefined" || logger === null) { - logger = MochiKit.Logging.logger; - } - this.logger = logger; - var update = MochiKit.Base.update; - var updatetree = MochiKit.Base.updatetree; - var bind = MochiKit.Base.bind; - var clone = MochiKit.Base.clone; - var win = window; - var uid = "_MochiKit_LoggingPane"; - if (typeof(MochiKit.DOM) != "undefined") { - win = MochiKit.DOM.currentWindow(); - } - if (!inline) { - // name the popup with the base URL for uniqueness - var url = win.location.href.split("?")[0].replace(/[#:\/.><&%-]/g, "_"); - var name = uid + "_" + url; - var nwin = win.open("", name, "dependent,resizable,height=200"); - if (!nwin) { - alert("Not able to open debugging window due to pop-up blocking."); - return undefined; - } - nwin.document.write( - '' - + '[MochiKit.LoggingPane]' - + '' - ); - nwin.document.close(); - nwin.document.title += ' ' + win.document.title; - win = nwin; - } - var doc = win.document; - this.doc = doc; - - // Connect to the debug pane if it already exists (i.e. in a window orphaned by the page being refreshed) - var debugPane = doc.getElementById(uid); - var existing_pane = !!debugPane; - if (debugPane && typeof(debugPane.loggingPane) != "undefined") { - debugPane.loggingPane.logger = this.logger; - debugPane.loggingPane.buildAndApplyFilter(); - return debugPane.loggingPane; - } - - if (existing_pane) { - // clear any existing contents - var child; - while ((child = debugPane.firstChild)) { - debugPane.removeChild(child); - } - } else { - debugPane = doc.createElement("div"); - debugPane.id = uid; - } - debugPane.loggingPane = this; - var levelFilterField = doc.createElement("input"); - var infoFilterField = doc.createElement("input"); - var filterButton = doc.createElement("button"); - var loadButton = doc.createElement("button"); - var clearButton = doc.createElement("button"); - var closeButton = doc.createElement("button"); - var logPaneArea = doc.createElement("div"); - var logPane = doc.createElement("div"); - - /* Set up the functions */ - var listenerId = uid + "_Listener"; - this.colorTable = clone(this.colorTable); - var messages = []; - var messageFilter = null; - - /** @id MochiKit.LoggingPane.messageLevel */ - var messageLevel = function (msg) { - var level = msg.level; - if (typeof(level) == "number") { - level = MochiKit.Logging.LogLevel[level]; - } - return level; - }; - - /** @id MochiKit.LoggingPane.messageText */ - var messageText = function (msg) { - return msg.info.join(" "); - }; - - /** @id MochiKit.LoggingPane.addMessageText */ - var addMessageText = bind(function (msg) { - var level = messageLevel(msg); - var text = messageText(msg); - var c = this.colorTable[level]; - var p = doc.createElement("span"); - p.className = "MochiKit-LogMessage MochiKit-LogLevel-" + level; - p.style.cssText = "margin: 0px; white-space: -moz-pre-wrap; white-space: -o-pre-wrap; white-space: pre-wrap; white-space: pre-line; word-wrap: break-word; wrap-option: emergency; color: " + c; - p.appendChild(doc.createTextNode(level + ": " + text)); - logPane.appendChild(p); - logPane.appendChild(doc.createElement("br")); - if (logPaneArea.offsetHeight > logPaneArea.scrollHeight) { - logPaneArea.scrollTop = 0; - } else { - logPaneArea.scrollTop = logPaneArea.scrollHeight; - } - }, this); - - /** @id MochiKit.LoggingPane.addMessage */ - var addMessage = function (msg) { - messages[messages.length] = msg; - addMessageText(msg); - }; - - /** @id MochiKit.LoggingPane.buildMessageFilter */ - var buildMessageFilter = function () { - var levelre, infore; - try { - /* Catch any exceptions that might arise due to invalid regexes */ - levelre = new RegExp(levelFilterField.value); - infore = new RegExp(infoFilterField.value); - } catch(e) { - /* If there was an error with the regexes, do no filtering */ - logDebug("Error in filter regex: " + e.message); - return null; - } - - return function (msg) { - return ( - levelre.test(messageLevel(msg)) && - infore.test(messageText(msg)) - ); - }; - }; - - /** @id MochiKit.LoggingPane.clearMessagePane */ - var clearMessagePane = function () { - while (logPane.firstChild) { - logPane.removeChild(logPane.firstChild); - } - }; - - /** @id MochiKit.LoggingPane.clearMessages */ - var clearMessages = function () { - messages = []; - clearMessagePane(); - }; - - /** @id MochiKit.LoggingPane.closePane */ - var closePane = bind(function () { - if (this.closed) { - return; - } - this.closed = true; - if (MochiKit.LoggingPane._loggingPane == this) { - MochiKit.LoggingPane._loggingPane = null; - } - this.logger.removeListener(listenerId); - try { - try { - debugPane.loggingPane = null; - } catch(e) { logFatal("Bookmarklet was closed incorrectly."); } - if (inline) { - debugPane.parentNode.removeChild(debugPane); - } else { - this.win.close(); - } - } catch(e) {} - }, this); - - /** @id MochiKit.LoggingPane.filterMessages */ - var filterMessages = function () { - clearMessagePane(); - - for (var i = 0; i < messages.length; i++) { - var msg = messages[i]; - if (messageFilter === null || messageFilter(msg)) { - addMessageText(msg); - } - } - }; - - this.buildAndApplyFilter = function () { - messageFilter = buildMessageFilter(); - - filterMessages(); - - this.logger.removeListener(listenerId); - this.logger.addListener(listenerId, messageFilter, addMessage); - }; - - - /** @id MochiKit.LoggingPane.loadMessages */ - var loadMessages = bind(function () { - messages = this.logger.getMessages(); - filterMessages(); - }, this); - - /** @id MochiKit.LoggingPane.filterOnEnter */ - var filterOnEnter = bind(function (event) { - event = event || window.event; - key = event.which || event.keyCode; - if (key == 13) { - this.buildAndApplyFilter(); - } - }, this); - - /* Create the debug pane */ - var style = "display: block; z-index: 1000; left: 0px; bottom: 0px; position: fixed; width: 100%; background-color: white; font: " + this.logFont; - if (inline) { - style += "; height: 10em; border-top: 2px solid black"; - } else { - style += "; height: 100%;"; - } - debugPane.style.cssText = style; - - if (!existing_pane) { - doc.body.appendChild(debugPane); - } - - /* Create the filter fields */ - style = {"cssText": "width: 33%; display: inline; font: " + this.logFont}; - - updatetree(levelFilterField, { - "value": "FATAL|ERROR|WARNING|INFO|DEBUG", - "onkeypress": filterOnEnter, - "style": style - }); - debugPane.appendChild(levelFilterField); - - updatetree(infoFilterField, { - "value": ".*", - "onkeypress": filterOnEnter, - "style": style - }); - debugPane.appendChild(infoFilterField); - - /* Create the buttons */ - style = "width: 8%; display:inline; font: " + this.logFont; - - filterButton.appendChild(doc.createTextNode("Filter")); - filterButton.onclick = bind("buildAndApplyFilter", this); - filterButton.style.cssText = style; - debugPane.appendChild(filterButton); - - loadButton.appendChild(doc.createTextNode("Load")); - loadButton.onclick = loadMessages; - loadButton.style.cssText = style; - debugPane.appendChild(loadButton); - - clearButton.appendChild(doc.createTextNode("Clear")); - clearButton.onclick = clearMessages; - clearButton.style.cssText = style; - debugPane.appendChild(clearButton); - - closeButton.appendChild(doc.createTextNode("Close")); - closeButton.onclick = closePane; - closeButton.style.cssText = style; - debugPane.appendChild(closeButton); - - /* Create the logging pane */ - logPaneArea.style.cssText = "overflow: auto; width: 100%"; - logPane.style.cssText = "width: 100%; height: " + (inline ? "8em" : "100%"); - - logPaneArea.appendChild(logPane); - debugPane.appendChild(logPaneArea); - - this.buildAndApplyFilter(); - loadMessages(); - - if (inline) { - this.win = undefined; - } else { - this.win = win; - } - this.inline = inline; - this.closePane = closePane; - this.closed = false; - - - return this; -}; - -MochiKit.LoggingPane.LoggingPane.prototype = { - "logFont": "8pt Verdana,sans-serif", - "colorTable": { - "ERROR": "red", - "FATAL": "darkred", - "WARNING": "blue", - "INFO": "black", - "DEBUG": "green" - } -}; - - -MochiKit.LoggingPane.EXPORT_OK = [ - "LoggingPane" -]; - -MochiKit.LoggingPane.EXPORT = [ - "createLoggingPane" -]; - -MochiKit.LoggingPane.__new__ = function () { - this.EXPORT_TAGS = { - ":common": this.EXPORT, - ":all": MochiKit.Base.concat(this.EXPORT, this.EXPORT_OK) - }; - - MochiKit.Base.nameFunctions(this); - - MochiKit.LoggingPane._loggingPane = null; - -}; - -MochiKit.LoggingPane.__new__(); - -MochiKit.Base._exportSymbols(this, MochiKit.LoggingPane); diff --git a/static/MochiKit/MochiKit.js b/static/MochiKit/MochiKit.js deleted file mode 100644 index 1ec157e..0000000 --- a/static/MochiKit/MochiKit.js +++ /dev/null @@ -1,188 +0,0 @@ -/*** - -MochiKit.MochiKit 1.4.2 - -See for documentation, downloads, license, etc. - -(c) 2005 Bob Ippolito. All rights Reserved. - -***/ - -if (typeof(MochiKit) == 'undefined') { - MochiKit = {}; -} - -if (typeof(MochiKit.MochiKit) == 'undefined') { - /** @id MochiKit.MochiKit */ - MochiKit.MochiKit = {}; -} - -MochiKit.MochiKit.NAME = "MochiKit.MochiKit"; -MochiKit.MochiKit.VERSION = "1.4.2"; -MochiKit.MochiKit.__repr__ = function () { - return "[" + this.NAME + " " + this.VERSION + "]"; -}; - -/** @id MochiKit.MochiKit.toString */ -MochiKit.MochiKit.toString = function () { - return this.__repr__(); -}; - -/** @id MochiKit.MochiKit.SUBMODULES */ -MochiKit.MochiKit.SUBMODULES = [ - "Base", - "Iter", - "Logging", - "DateTime", - "Format", - "Async", - "DOM", - "Selector", - "Style", - "LoggingPane", - "Color", - "Signal", - "Position", - "Visual", - "DragAndDrop", - "Sortable" -]; - -if (typeof(JSAN) != 'undefined' || typeof(dojo) != 'undefined') { - if (typeof(dojo) != 'undefined') { - dojo.provide('MochiKit.MochiKit'); - (function (lst) { - for (var i = 0; i < lst.length; i++) { - dojo.require("MochiKit." + lst[i]); - } - })(MochiKit.MochiKit.SUBMODULES); - } - if (typeof(JSAN) != 'undefined') { - (function (lst) { - for (var i = 0; i < lst.length; i++) { - JSAN.use("MochiKit." + lst[i], []); - } - })(MochiKit.MochiKit.SUBMODULES); - } - (function () { - var extend = MochiKit.Base.extend; - var self = MochiKit.MochiKit; - var modules = self.SUBMODULES; - var EXPORT = []; - var EXPORT_OK = []; - var EXPORT_TAGS = {}; - var i, k, m, all; - for (i = 0; i < modules.length; i++) { - m = MochiKit[modules[i]]; - extend(EXPORT, m.EXPORT); - extend(EXPORT_OK, m.EXPORT_OK); - for (k in m.EXPORT_TAGS) { - EXPORT_TAGS[k] = extend(EXPORT_TAGS[k], m.EXPORT_TAGS[k]); - } - all = m.EXPORT_TAGS[":all"]; - if (!all) { - all = extend(null, m.EXPORT, m.EXPORT_OK); - } - var j; - for (j = 0; j < all.length; j++) { - k = all[j]; - self[k] = m[k]; - } - } - self.EXPORT = EXPORT; - self.EXPORT_OK = EXPORT_OK; - self.EXPORT_TAGS = EXPORT_TAGS; - }()); - -} else { - if (typeof(MochiKit.__compat__) == 'undefined') { - MochiKit.__compat__ = true; - } - (function () { - if (typeof(document) == "undefined") { - return; - } - var scripts = document.getElementsByTagName("script"); - var kXHTMLNSURI = "http://www.w3.org/1999/xhtml"; - var kSVGNSURI = "http://www.w3.org/2000/svg"; - var kXLINKNSURI = "http://www.w3.org/1999/xlink"; - var kXULNSURI = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; - var base = null; - var baseElem = null; - var allScripts = {}; - var i; - var src; - for (i = 0; i < scripts.length; i++) { - src = null; - switch (scripts[i].namespaceURI) { - case kSVGNSURI: - src = scripts[i].getAttributeNS(kXLINKNSURI, "href"); - break; - /* - case null: // HTML - case '': // HTML - case kXHTMLNSURI: - case kXULNSURI: - */ - default: - src = scripts[i].getAttribute("src"); - break; - } - if (!src) { - continue; - } - allScripts[src] = true; - if (src.match(/MochiKit.js(\?.*)?$/)) { - base = src.substring(0, src.lastIndexOf('MochiKit.js')); - baseElem = scripts[i]; - } - } - if (base === null) { - return; - } - var modules = MochiKit.MochiKit.SUBMODULES; - for (var i = 0; i < modules.length; i++) { - if (MochiKit[modules[i]]) { - continue; - } - var uri = base + modules[i] + '.js'; - if (uri in allScripts) { - continue; - } - if (baseElem.namespaceURI == kSVGNSURI || - baseElem.namespaceURI == kXULNSURI) { - // SVG, XUL - /* - SVG does not support document.write, so if Safari wants to - support SVG tests it should fix its deferred loading bug - (see following below). - - */ - var s = document.createElementNS(baseElem.namespaceURI, 'script'); - s.setAttribute("id", "MochiKit_" + base + modules[i]); - if (baseElem.namespaceURI == kSVGNSURI) { - s.setAttributeNS(kXLINKNSURI, 'href', uri); - } else { - s.setAttribute('src', uri); - } - s.setAttribute("type", "application/x-javascript"); - baseElem.parentNode.appendChild(s); - } else { - // HTML, XHTML - /* - DOM can not be used here because Safari does - deferred loading of scripts unless they are - in the document or inserted with document.write - - This is not XHTML compliant. If you want XHTML - compliance then you must use the packed version of MochiKit - or include each script individually (basically unroll - these document.write calls into your XHTML source) - - */ - document.write('<' + baseElem.nodeName + ' src="' + uri + - '" type="text/javascript">'); - } - }; - })(); -} diff --git a/static/MochiKit/MockDOM.js b/static/MochiKit/MockDOM.js deleted file mode 100644 index 250d12e..0000000 --- a/static/MochiKit/MockDOM.js +++ /dev/null @@ -1,115 +0,0 @@ -/*** - -MochiKit.MockDOM 1.4.2 - -See for documentation, downloads, license, etc. - -(c) 2005 Bob Ippolito. All rights Reserved. - -***/ - -if (typeof(MochiKit) == "undefined") { - MochiKit = {}; -} - -if (typeof(MochiKit.MockDOM) == "undefined") { - MochiKit.MockDOM = {}; -} - -MochiKit.MockDOM.NAME = "MochiKit.MockDOM"; -MochiKit.MockDOM.VERSION = "1.4.2"; - -MochiKit.MockDOM.__repr__ = function () { - return "[" + this.NAME + " " + this.VERSION + "]"; -}; - -/** @id MochiKit.MockDOM.toString */ -MochiKit.MockDOM.toString = function () { - return this.__repr__(); -}; - -/** @id MochiKit.MockDOM.createDocument */ -MochiKit.MockDOM.createDocument = function () { - var doc = new MochiKit.MockDOM.MockElement("DOCUMENT"); - doc.body = doc.createElement("BODY"); - doc.appendChild(doc.body); - return doc; -}; - -/** @id MochiKit.MockDOM.MockElement */ -MochiKit.MockDOM.MockElement = function (name, data, ownerDocument) { - this.tagName = this.nodeName = name.toUpperCase(); - this.ownerDocument = ownerDocument || null; - if (name == "DOCUMENT") { - this.nodeType = 9; - this.childNodes = []; - } else if (typeof(data) == "string") { - this.nodeValue = data; - this.nodeType = 3; - } else { - this.nodeType = 1; - this.childNodes = []; - } - if (name.substring(0, 1) == "<") { - var nameattr = name.substring( - name.indexOf('"') + 1, name.lastIndexOf('"')); - name = name.substring(1, name.indexOf(" ")); - this.tagName = this.nodeName = name.toUpperCase(); - this.setAttribute("name", nameattr); - } -}; - -MochiKit.MockDOM.MockElement.prototype = { - /** @id MochiKit.MockDOM.MockElement.prototype.createElement */ - createElement: function (tagName) { - return new MochiKit.MockDOM.MockElement(tagName, null, this.nodeType == 9 ? this : this.ownerDocument); - }, - /** @id MochiKit.MockDOM.MockElement.prototype.createTextNode */ - createTextNode: function (text) { - return new MochiKit.MockDOM.MockElement("text", text, this.nodeType == 9 ? this : this.ownerDocument); - }, - /** @id MochiKit.MockDOM.MockElement.prototype.setAttribute */ - setAttribute: function (name, value) { - this[name] = value; - }, - /** @id MochiKit.MockDOM.MockElement.prototype.getAttribute */ - getAttribute: function (name) { - return this[name]; - }, - /** @id MochiKit.MockDOM.MockElement.prototype.appendChild */ - appendChild: function (child) { - this.childNodes.push(child); - }, - /** @id MochiKit.MockDOM.MockElement.prototype.toString */ - toString: function () { - return "MockElement(" + this.tagName + ")"; - }, - /** @id MochiKit.MockDOM.MockElement.prototype.getElementsByTagName */ - getElementsByTagName: function (tagName) { - var foundElements = []; - MochiKit.Base.nodeWalk(this, function(node){ - if (tagName == '*' || tagName == node.tagName) { - foundElements.push(node); - return node.childNodes; - } - }); - return foundElements; - } -}; - - /** @id MochiKit.MockDOM.EXPORT_OK */ -MochiKit.MockDOM.EXPORT_OK = [ - "mockElement", - "createDocument" -]; - - /** @id MochiKit.MockDOM.EXPORT */ -MochiKit.MockDOM.EXPORT = [ - "document" -]; - -MochiKit.MockDOM.__new__ = function () { - this.document = this.createDocument(); -}; - -MochiKit.MockDOM.__new__(); diff --git a/static/MochiKit/Position.js b/static/MochiKit/Position.js deleted file mode 100644 index 70288c7..0000000 --- a/static/MochiKit/Position.js +++ /dev/null @@ -1,236 +0,0 @@ -/*** - -MochiKit.Position 1.4.2 - -See for documentation, downloads, license, etc. - -(c) 2005-2006 Bob Ippolito and others. All rights Reserved. - -***/ - -MochiKit.Base._deps('Position', ['Base', 'DOM', 'Style']); - -MochiKit.Position.NAME = 'MochiKit.Position'; -MochiKit.Position.VERSION = '1.4.2'; -MochiKit.Position.__repr__ = function () { - return '[' + this.NAME + ' ' + this.VERSION + ']'; -}; -MochiKit.Position.toString = function () { - return this.__repr__(); -}; - -MochiKit.Position.EXPORT_OK = []; - -MochiKit.Position.EXPORT = [ -]; - - -MochiKit.Base.update(MochiKit.Position, { - // set to true if needed, warning: firefox performance problems - // NOT neeeded for page scrolling, only if draggable contained in - // scrollable elements - includeScrollOffsets: false, - - /** @id MochiKit.Position.prepare */ - prepare: function () { - var deltaX = window.pageXOffset - || document.documentElement.scrollLeft - || document.body.scrollLeft - || 0; - var deltaY = window.pageYOffset - || document.documentElement.scrollTop - || document.body.scrollTop - || 0; - this.windowOffset = new MochiKit.Style.Coordinates(deltaX, deltaY); - }, - - /** @id MochiKit.Position.cumulativeOffset */ - cumulativeOffset: function (element) { - var valueT = 0; - var valueL = 0; - do { - valueT += element.offsetTop || 0; - valueL += element.offsetLeft || 0; - element = element.offsetParent; - } while (element); - return new MochiKit.Style.Coordinates(valueL, valueT); - }, - - /** @id MochiKit.Position.realOffset */ - realOffset: function (element) { - var valueT = 0; - var valueL = 0; - do { - valueT += element.scrollTop || 0; - valueL += element.scrollLeft || 0; - element = element.parentNode; - } while (element); - return new MochiKit.Style.Coordinates(valueL, valueT); - }, - - /** @id MochiKit.Position.within */ - within: function (element, x, y) { - if (this.includeScrollOffsets) { - return this.withinIncludingScrolloffsets(element, x, y); - } - this.xcomp = x; - this.ycomp = y; - this.offset = this.cumulativeOffset(element); - if (element.style.position == "fixed") { - this.offset.x += this.windowOffset.x; - this.offset.y += this.windowOffset.y; - } - - return (y >= this.offset.y && - y < this.offset.y + element.offsetHeight && - x >= this.offset.x && - x < this.offset.x + element.offsetWidth); - }, - - /** @id MochiKit.Position.withinIncludingScrolloffsets */ - withinIncludingScrolloffsets: function (element, x, y) { - var offsetcache = this.realOffset(element); - - this.xcomp = x + offsetcache.x - this.windowOffset.x; - this.ycomp = y + offsetcache.y - this.windowOffset.y; - this.offset = this.cumulativeOffset(element); - - return (this.ycomp >= this.offset.y && - this.ycomp < this.offset.y + element.offsetHeight && - this.xcomp >= this.offset.x && - this.xcomp < this.offset.x + element.offsetWidth); - }, - - // within must be called directly before - /** @id MochiKit.Position.overlap */ - overlap: function (mode, element) { - if (!mode) { - return 0; - } - if (mode == 'vertical') { - return ((this.offset.y + element.offsetHeight) - this.ycomp) / - element.offsetHeight; - } - if (mode == 'horizontal') { - return ((this.offset.x + element.offsetWidth) - this.xcomp) / - element.offsetWidth; - } - }, - - /** @id MochiKit.Position.absolutize */ - absolutize: function (element) { - element = MochiKit.DOM.getElement(element); - if (element.style.position == 'absolute') { - return; - } - MochiKit.Position.prepare(); - - var offsets = MochiKit.Position.positionedOffset(element); - var width = element.clientWidth; - var height = element.clientHeight; - - var oldStyle = { - 'position': element.style.position, - 'left': offsets.x - parseFloat(element.style.left || 0), - 'top': offsets.y - parseFloat(element.style.top || 0), - 'width': element.style.width, - 'height': element.style.height - }; - - element.style.position = 'absolute'; - element.style.top = offsets.y + 'px'; - element.style.left = offsets.x + 'px'; - element.style.width = width + 'px'; - element.style.height = height + 'px'; - - return oldStyle; - }, - - /** @id MochiKit.Position.positionedOffset */ - positionedOffset: function (element) { - var valueT = 0, valueL = 0; - do { - valueT += element.offsetTop || 0; - valueL += element.offsetLeft || 0; - element = element.offsetParent; - if (element) { - p = MochiKit.Style.getStyle(element, 'position'); - if (p == 'relative' || p == 'absolute') { - break; - } - } - } while (element); - return new MochiKit.Style.Coordinates(valueL, valueT); - }, - - /** @id MochiKit.Position.relativize */ - relativize: function (element, oldPos) { - element = MochiKit.DOM.getElement(element); - if (element.style.position == 'relative') { - return; - } - MochiKit.Position.prepare(); - - var top = parseFloat(element.style.top || 0) - - (oldPos['top'] || 0); - var left = parseFloat(element.style.left || 0) - - (oldPos['left'] || 0); - - element.style.position = oldPos['position']; - element.style.top = top + 'px'; - element.style.left = left + 'px'; - element.style.width = oldPos['width']; - element.style.height = oldPos['height']; - }, - - /** @id MochiKit.Position.clone */ - clone: function (source, target) { - source = MochiKit.DOM.getElement(source); - target = MochiKit.DOM.getElement(target); - target.style.position = 'absolute'; - var offsets = this.cumulativeOffset(source); - target.style.top = offsets.y + 'px'; - target.style.left = offsets.x + 'px'; - target.style.width = source.offsetWidth + 'px'; - target.style.height = source.offsetHeight + 'px'; - }, - - /** @id MochiKit.Position.page */ - page: function (forElement) { - var valueT = 0; - var valueL = 0; - - var element = forElement; - do { - valueT += element.offsetTop || 0; - valueL += element.offsetLeft || 0; - - // Safari fix - if (element.offsetParent == document.body && MochiKit.Style.getStyle(element, 'position') == 'absolute') { - break; - } - } while (element = element.offsetParent); - - element = forElement; - do { - valueT -= element.scrollTop || 0; - valueL -= element.scrollLeft || 0; - } while (element = element.parentNode); - - return new MochiKit.Style.Coordinates(valueL, valueT); - } -}); - -MochiKit.Position.__new__ = function (win) { - var m = MochiKit.Base; - this.EXPORT_TAGS = { - ':common': this.EXPORT, - ':all': m.concat(this.EXPORT, this.EXPORT_OK) - }; - - m.nameFunctions(this); -}; - -MochiKit.Position.__new__(this); - -MochiKit.Base._exportSymbols(this, MochiKit.Position); \ No newline at end of file diff --git a/static/MochiKit/Selector.js b/static/MochiKit/Selector.js deleted file mode 100644 index fe96533..0000000 --- a/static/MochiKit/Selector.js +++ /dev/null @@ -1,415 +0,0 @@ -/*** - -MochiKit.Selector 1.4.2 - -See for documentation, downloads, license, etc. - -(c) 2005 Bob Ippolito and others. All rights Reserved. - -***/ - -MochiKit.Base._deps('Selector', ['Base', 'DOM', 'Iter']); - -MochiKit.Selector.NAME = "MochiKit.Selector"; -MochiKit.Selector.VERSION = "1.4.2"; - -MochiKit.Selector.__repr__ = function () { - return "[" + this.NAME + " " + this.VERSION + "]"; -}; - -MochiKit.Selector.toString = function () { - return this.__repr__(); -}; - -MochiKit.Selector.EXPORT = [ - "Selector", - "findChildElements", - "findDocElements", - "$$" -]; - -MochiKit.Selector.EXPORT_OK = [ -]; - -MochiKit.Selector.Selector = function (expression) { - this.params = {classNames: [], pseudoClassNames: []}; - this.expression = expression.toString().replace(/(^\s+|\s+$)/g, ''); - this.parseExpression(); - this.compileMatcher(); -}; - -MochiKit.Selector.Selector.prototype = { - /*** - - Selector class: convenient object to make CSS selections. - - ***/ - __class__: MochiKit.Selector.Selector, - - /** @id MochiKit.Selector.Selector.prototype.parseExpression */ - parseExpression: function () { - function abort(message) { - throw 'Parse error in selector: ' + message; - } - - if (this.expression == '') { - abort('empty expression'); - } - - var repr = MochiKit.Base.repr; - var params = this.params; - var expr = this.expression; - var match, modifier, clause, rest; - while (match = expr.match(/^(.*)\[([a-z0-9_:-]+?)(?:([~\|!^$*]?=)(?:"([^"]*)"|([^\]\s]*)))?\]$/i)) { - params.attributes = params.attributes || []; - params.attributes.push({name: match[2], operator: match[3], value: match[4] || match[5] || ''}); - expr = match[1]; - } - - if (expr == '*') { - return this.params.wildcard = true; - } - - while (match = expr.match(/^([^a-z0-9_-])?([a-z0-9_-]+(?:\([^)]*\))?)(.*)/i)) { - modifier = match[1]; - clause = match[2]; - rest = match[3]; - switch (modifier) { - case '#': - params.id = clause; - break; - case '.': - params.classNames.push(clause); - break; - case ':': - params.pseudoClassNames.push(clause); - break; - case '': - case undefined: - params.tagName = clause.toUpperCase(); - break; - default: - abort(repr(expr)); - } - expr = rest; - } - - if (expr.length > 0) { - abort(repr(expr)); - } - }, - - /** @id MochiKit.Selector.Selector.prototype.buildMatchExpression */ - buildMatchExpression: function () { - var repr = MochiKit.Base.repr; - var params = this.params; - var conditions = []; - var clause, i; - - function childElements(element) { - return "MochiKit.Base.filter(function (node) { return node.nodeType == 1; }, " + element + ".childNodes)"; - } - - if (params.wildcard) { - conditions.push('true'); - } - if (clause = params.id) { - conditions.push('element.id == ' + repr(clause)); - } - if (clause = params.tagName) { - conditions.push('element.tagName.toUpperCase() == ' + repr(clause)); - } - if ((clause = params.classNames).length > 0) { - for (i = 0; i < clause.length; i++) { - conditions.push('MochiKit.DOM.hasElementClass(element, ' + repr(clause[i]) + ')'); - } - } - if ((clause = params.pseudoClassNames).length > 0) { - for (i = 0; i < clause.length; i++) { - var match = clause[i].match(/^([^(]+)(?:\((.*)\))?$/); - var pseudoClass = match[1]; - var pseudoClassArgument = match[2]; - switch (pseudoClass) { - case 'root': - conditions.push('element.nodeType == 9 || element === element.ownerDocument.documentElement'); break; - case 'nth-child': - case 'nth-last-child': - case 'nth-of-type': - case 'nth-last-of-type': - match = pseudoClassArgument.match(/^((?:(\d+)n\+)?(\d+)|odd|even)$/); - if (!match) { - throw "Invalid argument to pseudo element nth-child: " + pseudoClassArgument; - } - var a, b; - if (match[0] == 'odd') { - a = 2; - b = 1; - } else if (match[0] == 'even') { - a = 2; - b = 0; - } else { - a = match[2] && parseInt(match) || null; - b = parseInt(match[3]); - } - conditions.push('this.nthChild(element,' + a + ',' + b - + ',' + !!pseudoClass.match('^nth-last') // Reverse - + ',' + !!pseudoClass.match('of-type$') // Restrict to same tagName - + ')'); - break; - case 'first-child': - conditions.push('this.nthChild(element, null, 1)'); - break; - case 'last-child': - conditions.push('this.nthChild(element, null, 1, true)'); - break; - case 'first-of-type': - conditions.push('this.nthChild(element, null, 1, false, true)'); - break; - case 'last-of-type': - conditions.push('this.nthChild(element, null, 1, true, true)'); - break; - case 'only-child': - conditions.push(childElements('element.parentNode') + '.length == 1'); - break; - case 'only-of-type': - conditions.push('MochiKit.Base.filter(function (node) { return node.tagName == element.tagName; }, ' + childElements('element.parentNode') + ').length == 1'); - break; - case 'empty': - conditions.push('element.childNodes.length == 0'); - break; - case 'enabled': - conditions.push('(this.isUIElement(element) && element.disabled === false)'); - break; - case 'disabled': - conditions.push('(this.isUIElement(element) && element.disabled === true)'); - break; - case 'checked': - conditions.push('(this.isUIElement(element) && element.checked === true)'); - break; - case 'not': - var subselector = new MochiKit.Selector.Selector(pseudoClassArgument); - conditions.push('!( ' + subselector.buildMatchExpression() + ')') - break; - } - } - } - if (clause = params.attributes) { - MochiKit.Base.map(function (attribute) { - var value = 'MochiKit.DOM.getNodeAttribute(element, ' + repr(attribute.name) + ')'; - var splitValueBy = function (delimiter) { - return value + '.split(' + repr(delimiter) + ')'; - } - conditions.push(value + ' != null'); - switch (attribute.operator) { - case '=': - conditions.push(value + ' == ' + repr(attribute.value)); - break; - case '~=': - conditions.push('MochiKit.Base.findValue(' + splitValueBy(' ') + ', ' + repr(attribute.value) + ') > -1'); - break; - case '^=': - conditions.push(value + '.substring(0, ' + attribute.value.length + ') == ' + repr(attribute.value)); - break; - case '$=': - conditions.push(value + '.substring(' + value + '.length - ' + attribute.value.length + ') == ' + repr(attribute.value)); - break; - case '*=': - conditions.push(value + '.match(' + repr(attribute.value) + ')'); - break; - case '|=': - conditions.push(splitValueBy('-') + '[0].toUpperCase() == ' + repr(attribute.value.toUpperCase())); - break; - case '!=': - conditions.push(value + ' != ' + repr(attribute.value)); - break; - case '': - case undefined: - // Condition already added above - break; - default: - throw 'Unknown operator ' + attribute.operator + ' in selector'; - } - }, clause); - } - - return conditions.join(' && '); - }, - - /** @id MochiKit.Selector.Selector.prototype.compileMatcher */ - compileMatcher: function () { - var code = 'return (!element.tagName) ? false : ' + - this.buildMatchExpression() + ';'; - this.match = new Function('element', code); - }, - - /** @id MochiKit.Selector.Selector.prototype.nthChild */ - nthChild: function (element, a, b, reverse, sametag){ - var siblings = MochiKit.Base.filter(function (node) { - return node.nodeType == 1; - }, element.parentNode.childNodes); - if (sametag) { - siblings = MochiKit.Base.filter(function (node) { - return node.tagName == element.tagName; - }, siblings); - } - if (reverse) { - siblings = MochiKit.Iter.reversed(siblings); - } - if (a) { - var actualIndex = MochiKit.Base.findIdentical(siblings, element); - return ((actualIndex + 1 - b) / a) % 1 == 0; - } else { - return b == MochiKit.Base.findIdentical(siblings, element) + 1; - } - }, - - /** @id MochiKit.Selector.Selector.prototype.isUIElement */ - isUIElement: function (element) { - return MochiKit.Base.findValue(['input', 'button', 'select', 'option', 'textarea', 'object'], - element.tagName.toLowerCase()) > -1; - }, - - /** @id MochiKit.Selector.Selector.prototype.findElements */ - findElements: function (scope, axis) { - var element; - - if (axis == undefined) { - axis = ""; - } - - function inScope(element, scope) { - if (axis == "") { - return MochiKit.DOM.isChildNode(element, scope); - } else if (axis == ">") { - return element.parentNode === scope; - } else if (axis == "+") { - return element === nextSiblingElement(scope); - } else if (axis == "~") { - var sibling = scope; - while (sibling = nextSiblingElement(sibling)) { - if (element === sibling) { - return true; - } - } - return false; - } else { - throw "Invalid axis: " + axis; - } - } - - if (element = MochiKit.DOM.getElement(this.params.id)) { - if (this.match(element)) { - if (!scope || inScope(element, scope)) { - return [element]; - } - } - } - - function nextSiblingElement(node) { - node = node.nextSibling; - while (node && node.nodeType != 1) { - node = node.nextSibling; - } - return node; - } - - if (axis == "") { - scope = (scope || MochiKit.DOM.currentDocument()).getElementsByTagName(this.params.tagName || '*'); - } else if (axis == ">") { - if (!scope) { - throw "> combinator not allowed without preceeding expression"; - } - scope = MochiKit.Base.filter(function (node) { - return node.nodeType == 1; - }, scope.childNodes); - } else if (axis == "+") { - if (!scope) { - throw "+ combinator not allowed without preceeding expression"; - } - scope = nextSiblingElement(scope) && [nextSiblingElement(scope)]; - } else if (axis == "~") { - if (!scope) { - throw "~ combinator not allowed without preceeding expression"; - } - var newscope = []; - while (nextSiblingElement(scope)) { - scope = nextSiblingElement(scope); - newscope.push(scope); - } - scope = newscope; - } - - if (!scope) { - return []; - } - - var results = MochiKit.Base.filter(MochiKit.Base.bind(function (scopeElt) { - return this.match(scopeElt); - }, this), scope); - - return results; - }, - - /** @id MochiKit.Selector.Selector.prototype.repr */ - repr: function () { - return 'Selector(' + this.expression + ')'; - }, - - toString: MochiKit.Base.forwardCall("repr") -}; - -MochiKit.Base.update(MochiKit.Selector, { - - /** @id MochiKit.Selector.findChildElements */ - findChildElements: function (element, expressions) { - var uniq = function(arr) { - var res = []; - for (var i = 0; i < arr.length; i++) { - if (MochiKit.Base.findIdentical(res, arr[i]) < 0) { - res.push(arr[i]); - } - } - return res; - }; - return MochiKit.Base.flattenArray(MochiKit.Base.map(function (expression) { - var nextScope = ""; - var reducer = function (results, expr) { - if (match = expr.match(/^[>+~]$/)) { - nextScope = match[0]; - return results; - } else { - var selector = new MochiKit.Selector.Selector(expr); - var elements = MochiKit.Iter.reduce(function (elements, result) { - return MochiKit.Base.extend(elements, selector.findElements(result || element, nextScope)); - }, results, []); - nextScope = ""; - return elements; - } - }; - var exprs = expression.replace(/(^\s+|\s+$)/g, '').split(/\s+/); - return uniq(MochiKit.Iter.reduce(reducer, exprs, [null])); - }, expressions)); - }, - - findDocElements: function () { - return MochiKit.Selector.findChildElements(MochiKit.DOM.currentDocument(), arguments); - }, - - __new__: function () { - var m = MochiKit.Base; - - this.$$ = this.findDocElements; - - this.EXPORT_TAGS = { - ":common": this.EXPORT, - ":all": m.concat(this.EXPORT, this.EXPORT_OK) - }; - - m.nameFunctions(this); - } -}); - -MochiKit.Selector.__new__(); - -MochiKit.Base._exportSymbols(this, MochiKit.Selector); - diff --git a/static/MochiKit/Signal.js b/static/MochiKit/Signal.js deleted file mode 100644 index d49513c..0000000 --- a/static/MochiKit/Signal.js +++ /dev/null @@ -1,897 +0,0 @@ -/*** - -MochiKit.Signal 1.4.2 - -See for documentation, downloads, license, etc. - -(c) 2006 Jonathan Gardner, Beau Hartshorne, Bob Ippolito. All rights Reserved. - -***/ - -MochiKit.Base._deps('Signal', ['Base', 'DOM', 'Style']); - -MochiKit.Signal.NAME = 'MochiKit.Signal'; -MochiKit.Signal.VERSION = '1.4.2'; - -MochiKit.Signal._observers = []; - -/** @id MochiKit.Signal.Event */ -MochiKit.Signal.Event = function (src, e) { - this._event = e || window.event; - this._src = src; -}; - -MochiKit.Base.update(MochiKit.Signal.Event.prototype, { - - __repr__: function () { - var repr = MochiKit.Base.repr; - var str = '{event(): ' + repr(this.event()) + - ', src(): ' + repr(this.src()) + - ', type(): ' + repr(this.type()) + - ', target(): ' + repr(this.target()); - - if (this.type() && - this.type().indexOf('key') === 0 || - this.type().indexOf('mouse') === 0 || - this.type().indexOf('click') != -1 || - this.type() == 'contextmenu') { - str += ', modifier(): ' + '{alt: ' + repr(this.modifier().alt) + - ', ctrl: ' + repr(this.modifier().ctrl) + - ', meta: ' + repr(this.modifier().meta) + - ', shift: ' + repr(this.modifier().shift) + - ', any: ' + repr(this.modifier().any) + '}'; - } - - if (this.type() && this.type().indexOf('key') === 0) { - str += ', key(): {code: ' + repr(this.key().code) + - ', string: ' + repr(this.key().string) + '}'; - } - - if (this.type() && ( - this.type().indexOf('mouse') === 0 || - this.type().indexOf('click') != -1 || - this.type() == 'contextmenu')) { - - str += ', mouse(): {page: ' + repr(this.mouse().page) + - ', client: ' + repr(this.mouse().client); - - if (this.type() != 'mousemove' && this.type() != 'mousewheel') { - str += ', button: {left: ' + repr(this.mouse().button.left) + - ', middle: ' + repr(this.mouse().button.middle) + - ', right: ' + repr(this.mouse().button.right) + '}'; - } - if (this.type() == 'mousewheel') { - str += ', wheel: ' + repr(this.mouse().wheel); - } - str += '}'; - } - if (this.type() == 'mouseover' || this.type() == 'mouseout' || - this.type() == 'mouseenter' || this.type() == 'mouseleave') { - str += ', relatedTarget(): ' + repr(this.relatedTarget()); - } - str += '}'; - return str; - }, - - /** @id MochiKit.Signal.Event.prototype.toString */ - toString: function () { - return this.__repr__(); - }, - - /** @id MochiKit.Signal.Event.prototype.src */ - src: function () { - return this._src; - }, - - /** @id MochiKit.Signal.Event.prototype.event */ - event: function () { - return this._event; - }, - - /** @id MochiKit.Signal.Event.prototype.type */ - type: function () { - if (this._event.type === "DOMMouseScroll") { - return "mousewheel"; - } else { - return this._event.type || undefined; - } - }, - - /** @id MochiKit.Signal.Event.prototype.target */ - target: function () { - return this._event.target || this._event.srcElement; - }, - - _relatedTarget: null, - /** @id MochiKit.Signal.Event.prototype.relatedTarget */ - relatedTarget: function () { - if (this._relatedTarget !== null) { - return this._relatedTarget; - } - - var elem = null; - if (this.type() == 'mouseover' || this.type() == 'mouseenter') { - elem = (this._event.relatedTarget || - this._event.fromElement); - } else if (this.type() == 'mouseout' || this.type() == 'mouseleave') { - elem = (this._event.relatedTarget || - this._event.toElement); - } - try { - if (elem !== null && elem.nodeType !== null) { - this._relatedTarget = elem; - return elem; - } - } catch (ignore) { - // Firefox 3 throws a permission denied error when accessing - // any property on XUL elements (e.g. scrollbars)... - } - - return undefined; - }, - - _modifier: null, - /** @id MochiKit.Signal.Event.prototype.modifier */ - modifier: function () { - if (this._modifier !== null) { - return this._modifier; - } - var m = {}; - m.alt = this._event.altKey; - m.ctrl = this._event.ctrlKey; - m.meta = this._event.metaKey || false; // IE and Opera punt here - m.shift = this._event.shiftKey; - m.any = m.alt || m.ctrl || m.shift || m.meta; - this._modifier = m; - return m; - }, - - _key: null, - /** @id MochiKit.Signal.Event.prototype.key */ - key: function () { - if (this._key !== null) { - return this._key; - } - var k = {}; - if (this.type() && this.type().indexOf('key') === 0) { - - /* - - If you're looking for a special key, look for it in keydown or - keyup, but never keypress. If you're looking for a Unicode - chracter, look for it with keypress, but never keyup or - keydown. - - Notes: - - FF key event behavior: - key event charCode keyCode - DOWN ku,kd 0 40 - DOWN kp 0 40 - ESC ku,kd 0 27 - ESC kp 0 27 - a ku,kd 0 65 - a kp 97 0 - shift+a ku,kd 0 65 - shift+a kp 65 0 - 1 ku,kd 0 49 - 1 kp 49 0 - shift+1 ku,kd 0 0 - shift+1 kp 33 0 - - IE key event behavior: - (IE doesn't fire keypress events for special keys.) - key event keyCode - DOWN ku,kd 40 - DOWN kp undefined - ESC ku,kd 27 - ESC kp 27 - a ku,kd 65 - a kp 97 - shift+a ku,kd 65 - shift+a kp 65 - 1 ku,kd 49 - 1 kp 49 - shift+1 ku,kd 49 - shift+1 kp 33 - - Safari key event behavior: - (Safari sets charCode and keyCode to something crazy for - special keys.) - key event charCode keyCode - DOWN ku,kd 63233 40 - DOWN kp 63233 63233 - ESC ku,kd 27 27 - ESC kp 27 27 - a ku,kd 97 65 - a kp 97 97 - shift+a ku,kd 65 65 - shift+a kp 65 65 - 1 ku,kd 49 49 - 1 kp 49 49 - shift+1 ku,kd 33 49 - shift+1 kp 33 33 - - */ - - /* look for special keys here */ - if (this.type() == 'keydown' || this.type() == 'keyup') { - k.code = this._event.keyCode; - k.string = (MochiKit.Signal._specialKeys[k.code] || - 'KEY_UNKNOWN'); - this._key = k; - return k; - - /* look for characters here */ - } else if (this.type() == 'keypress') { - - /* - - Special key behavior: - - IE: does not fire keypress events for special keys - FF: sets charCode to 0, and sets the correct keyCode - Safari: sets keyCode and charCode to something stupid - - */ - - k.code = 0; - k.string = ''; - - if (typeof(this._event.charCode) != 'undefined' && - this._event.charCode !== 0 && - !MochiKit.Signal._specialMacKeys[this._event.charCode]) { - k.code = this._event.charCode; - k.string = String.fromCharCode(k.code); - } else if (this._event.keyCode && - typeof(this._event.charCode) == 'undefined') { // IE - k.code = this._event.keyCode; - k.string = String.fromCharCode(k.code); - } - - this._key = k; - return k; - } - } - return undefined; - }, - - _mouse: null, - /** @id MochiKit.Signal.Event.prototype.mouse */ - mouse: function () { - if (this._mouse !== null) { - return this._mouse; - } - - var m = {}; - var e = this._event; - - if (this.type() && ( - this.type().indexOf('mouse') === 0 || - this.type().indexOf('click') != -1 || - this.type() == 'contextmenu')) { - - m.client = new MochiKit.Style.Coordinates(0, 0); - if (e.clientX || e.clientY) { - m.client.x = (!e.clientX || e.clientX < 0) ? 0 : e.clientX; - m.client.y = (!e.clientY || e.clientY < 0) ? 0 : e.clientY; - } - - m.page = new MochiKit.Style.Coordinates(0, 0); - if (e.pageX || e.pageY) { - m.page.x = (!e.pageX || e.pageX < 0) ? 0 : e.pageX; - m.page.y = (!e.pageY || e.pageY < 0) ? 0 : e.pageY; - } else { - /* - - The IE shortcut can be off by two. We fix it. See: - http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/getboundingclientrect.asp - - This is similar to the method used in - MochiKit.Style.getElementPosition(). - - */ - var de = MochiKit.DOM._document.documentElement; - var b = MochiKit.DOM._document.body; - - m.page.x = e.clientX + - (de.scrollLeft || b.scrollLeft) - - (de.clientLeft || 0); - - m.page.y = e.clientY + - (de.scrollTop || b.scrollTop) - - (de.clientTop || 0); - - } - if (this.type() != 'mousemove' && this.type() != 'mousewheel') { - m.button = {}; - m.button.left = false; - m.button.right = false; - m.button.middle = false; - - /* we could check e.button, but which is more consistent */ - if (e.which) { - m.button.left = (e.which == 1); - m.button.middle = (e.which == 2); - m.button.right = (e.which == 3); - - /* - - Mac browsers and right click: - - - Safari doesn't fire any click events on a right - click: - http://bugs.webkit.org/show_bug.cgi?id=6595 - - - Firefox fires the event, and sets ctrlKey = true - - - Opera fires the event, and sets metaKey = true - - oncontextmenu is fired on right clicks between - browsers and across platforms. - - */ - - } else { - m.button.left = !!(e.button & 1); - m.button.right = !!(e.button & 2); - m.button.middle = !!(e.button & 4); - } - } - if (this.type() == 'mousewheel') { - m.wheel = new MochiKit.Style.Coordinates(0, 0); - if (e.wheelDeltaX || e.wheelDeltaY) { - m.wheel.x = e.wheelDeltaX / -40 || 0; - m.wheel.y = e.wheelDeltaY / -40 || 0; - } else if (e.wheelDelta) { - m.wheel.y = e.wheelDelta / -40; - } else { - m.wheel.y = e.detail || 0; - } - } - this._mouse = m; - return m; - } - return undefined; - }, - - /** @id MochiKit.Signal.Event.prototype.stop */ - stop: function () { - this.stopPropagation(); - this.preventDefault(); - }, - - /** @id MochiKit.Signal.Event.prototype.stopPropagation */ - stopPropagation: function () { - if (this._event.stopPropagation) { - this._event.stopPropagation(); - } else { - this._event.cancelBubble = true; - } - }, - - /** @id MochiKit.Signal.Event.prototype.preventDefault */ - preventDefault: function () { - if (this._event.preventDefault) { - this._event.preventDefault(); - } else if (this._confirmUnload === null) { - this._event.returnValue = false; - } - }, - - _confirmUnload: null, - - /** @id MochiKit.Signal.Event.prototype.confirmUnload */ - confirmUnload: function (msg) { - if (this.type() == 'beforeunload') { - this._confirmUnload = msg; - this._event.returnValue = msg; - } - } -}); - -/* Safari sets keyCode to these special values onkeypress. */ -MochiKit.Signal._specialMacKeys = { - 3: 'KEY_ENTER', - 63289: 'KEY_NUM_PAD_CLEAR', - 63276: 'KEY_PAGE_UP', - 63277: 'KEY_PAGE_DOWN', - 63275: 'KEY_END', - 63273: 'KEY_HOME', - 63234: 'KEY_ARROW_LEFT', - 63232: 'KEY_ARROW_UP', - 63235: 'KEY_ARROW_RIGHT', - 63233: 'KEY_ARROW_DOWN', - 63302: 'KEY_INSERT', - 63272: 'KEY_DELETE' -}; - -/* for KEY_F1 - KEY_F12 */ -(function () { - var _specialMacKeys = MochiKit.Signal._specialMacKeys; - for (i = 63236; i <= 63242; i++) { - // no F0 - _specialMacKeys[i] = 'KEY_F' + (i - 63236 + 1); - } -})(); - -/* Standard keyboard key codes. */ -MochiKit.Signal._specialKeys = { - 8: 'KEY_BACKSPACE', - 9: 'KEY_TAB', - 12: 'KEY_NUM_PAD_CLEAR', // weird, for Safari and Mac FF only - 13: 'KEY_ENTER', - 16: 'KEY_SHIFT', - 17: 'KEY_CTRL', - 18: 'KEY_ALT', - 19: 'KEY_PAUSE', - 20: 'KEY_CAPS_LOCK', - 27: 'KEY_ESCAPE', - 32: 'KEY_SPACEBAR', - 33: 'KEY_PAGE_UP', - 34: 'KEY_PAGE_DOWN', - 35: 'KEY_END', - 36: 'KEY_HOME', - 37: 'KEY_ARROW_LEFT', - 38: 'KEY_ARROW_UP', - 39: 'KEY_ARROW_RIGHT', - 40: 'KEY_ARROW_DOWN', - 44: 'KEY_PRINT_SCREEN', - 45: 'KEY_INSERT', - 46: 'KEY_DELETE', - 59: 'KEY_SEMICOLON', // weird, for Safari and IE only - 91: 'KEY_WINDOWS_LEFT', - 92: 'KEY_WINDOWS_RIGHT', - 93: 'KEY_SELECT', - 106: 'KEY_NUM_PAD_ASTERISK', - 107: 'KEY_NUM_PAD_PLUS_SIGN', - 109: 'KEY_NUM_PAD_HYPHEN-MINUS', - 110: 'KEY_NUM_PAD_FULL_STOP', - 111: 'KEY_NUM_PAD_SOLIDUS', - 144: 'KEY_NUM_LOCK', - 145: 'KEY_SCROLL_LOCK', - 186: 'KEY_SEMICOLON', - 187: 'KEY_EQUALS_SIGN', - 188: 'KEY_COMMA', - 189: 'KEY_HYPHEN-MINUS', - 190: 'KEY_FULL_STOP', - 191: 'KEY_SOLIDUS', - 192: 'KEY_GRAVE_ACCENT', - 219: 'KEY_LEFT_SQUARE_BRACKET', - 220: 'KEY_REVERSE_SOLIDUS', - 221: 'KEY_RIGHT_SQUARE_BRACKET', - 222: 'KEY_APOSTROPHE' - // undefined: 'KEY_UNKNOWN' -}; - -(function () { - /* for KEY_0 - KEY_9 */ - var _specialKeys = MochiKit.Signal._specialKeys; - for (var i = 48; i <= 57; i++) { - _specialKeys[i] = 'KEY_' + (i - 48); - } - - /* for KEY_A - KEY_Z */ - for (i = 65; i <= 90; i++) { - _specialKeys[i] = 'KEY_' + String.fromCharCode(i); - } - - /* for KEY_NUM_PAD_0 - KEY_NUM_PAD_9 */ - for (i = 96; i <= 105; i++) { - _specialKeys[i] = 'KEY_NUM_PAD_' + (i - 96); - } - - /* for KEY_F1 - KEY_F12 */ - for (i = 112; i <= 123; i++) { - // no F0 - _specialKeys[i] = 'KEY_F' + (i - 112 + 1); - } -})(); - -/* Internal object to keep track of created signals. */ -MochiKit.Signal.Ident = function (ident) { - this.source = ident.source; - this.signal = ident.signal; - this.listener = ident.listener; - this.isDOM = ident.isDOM; - this.objOrFunc = ident.objOrFunc; - this.funcOrStr = ident.funcOrStr; - this.connected = ident.connected; -}; - -MochiKit.Signal.Ident.prototype = {}; - -MochiKit.Base.update(MochiKit.Signal, { - - __repr__: function () { - return '[' + this.NAME + ' ' + this.VERSION + ']'; - }, - - toString: function () { - return this.__repr__(); - }, - - _unloadCache: function () { - var self = MochiKit.Signal; - var observers = self._observers; - - for (var i = 0; i < observers.length; i++) { - if (observers[i].signal !== 'onload' && observers[i].signal !== 'onunload') { - self._disconnect(observers[i]); - } - } - }, - - _listener: function (src, sig, func, obj, isDOM) { - var self = MochiKit.Signal; - var E = self.Event; - if (!isDOM) { - /* We don't want to re-bind already bound methods */ - if (typeof(func.im_self) == 'undefined') { - return MochiKit.Base.bindLate(func, obj); - } else { - return func; - } - } - obj = obj || src; - if (typeof(func) == "string") { - if (sig === 'onload' || sig === 'onunload') { - return function (nativeEvent) { - obj[func].apply(obj, [new E(src, nativeEvent)]); - - var ident = new MochiKit.Signal.Ident({ - source: src, signal: sig, objOrFunc: obj, funcOrStr: func}); - - MochiKit.Signal._disconnect(ident); - }; - } else { - return function (nativeEvent) { - obj[func].apply(obj, [new E(src, nativeEvent)]); - }; - } - } else { - if (sig === 'onload' || sig === 'onunload') { - return function (nativeEvent) { - func.apply(obj, [new E(src, nativeEvent)]); - - var ident = new MochiKit.Signal.Ident({ - source: src, signal: sig, objOrFunc: func}); - - MochiKit.Signal._disconnect(ident); - }; - } else { - return function (nativeEvent) { - func.apply(obj, [new E(src, nativeEvent)]); - }; - } - } - }, - - _browserAlreadyHasMouseEnterAndLeave: function () { - return /MSIE/.test(navigator.userAgent); - }, - - _browserLacksMouseWheelEvent: function () { - return /Gecko\//.test(navigator.userAgent); - }, - - _mouseEnterListener: function (src, sig, func, obj) { - var E = MochiKit.Signal.Event; - return function (nativeEvent) { - var e = new E(src, nativeEvent); - try { - e.relatedTarget().nodeName; - } catch (err) { - /* probably hit a permission denied error; possibly one of - * firefox's screwy anonymous DIVs inside an input element. - * Allow this event to propogate up. - */ - return; - } - e.stop(); - if (MochiKit.DOM.isChildNode(e.relatedTarget(), src)) { - /* We've moved between our node and a child. Ignore. */ - return; - } - e.type = function () { return sig; }; - if (typeof(func) == "string") { - return obj[func].apply(obj, [e]); - } else { - return func.apply(obj, [e]); - } - }; - }, - - _getDestPair: function (objOrFunc, funcOrStr) { - var obj = null; - var func = null; - if (typeof(funcOrStr) != 'undefined') { - obj = objOrFunc; - func = funcOrStr; - if (typeof(funcOrStr) == 'string') { - if (typeof(objOrFunc[funcOrStr]) != "function") { - throw new Error("'funcOrStr' must be a function on 'objOrFunc'"); - } - } else if (typeof(funcOrStr) != 'function') { - throw new Error("'funcOrStr' must be a function or string"); - } - } else if (typeof(objOrFunc) != "function") { - throw new Error("'objOrFunc' must be a function if 'funcOrStr' is not given"); - } else { - func = objOrFunc; - } - return [obj, func]; - }, - - /** @id MochiKit.Signal.connect */ - connect: function (src, sig, objOrFunc/* optional */, funcOrStr) { - src = MochiKit.DOM.getElement(src); - var self = MochiKit.Signal; - - if (typeof(sig) != 'string') { - throw new Error("'sig' must be a string"); - } - - var destPair = self._getDestPair(objOrFunc, funcOrStr); - var obj = destPair[0]; - var func = destPair[1]; - if (typeof(obj) == 'undefined' || obj === null) { - obj = src; - } - - var isDOM = !!(src.addEventListener || src.attachEvent); - if (isDOM && (sig === "onmouseenter" || sig === "onmouseleave") - && !self._browserAlreadyHasMouseEnterAndLeave()) { - var listener = self._mouseEnterListener(src, sig.substr(2), func, obj); - if (sig === "onmouseenter") { - sig = "onmouseover"; - } else { - sig = "onmouseout"; - } - } else if (isDOM && sig == "onmousewheel" && self._browserLacksMouseWheelEvent()) { - var listener = self._listener(src, sig, func, obj, isDOM); - sig = "onDOMMouseScroll"; - } else { - var listener = self._listener(src, sig, func, obj, isDOM); - } - - if (src.addEventListener) { - src.addEventListener(sig.substr(2), listener, false); - } else if (src.attachEvent) { - src.attachEvent(sig, listener); // useCapture unsupported - } - - var ident = new MochiKit.Signal.Ident({ - source: src, - signal: sig, - listener: listener, - isDOM: isDOM, - objOrFunc: objOrFunc, - funcOrStr: funcOrStr, - connected: true - }); - self._observers.push(ident); - - if (!isDOM && typeof(src.__connect__) == 'function') { - var args = MochiKit.Base.extend([ident], arguments, 1); - src.__connect__.apply(src, args); - } - - return ident; - }, - - _disconnect: function (ident) { - // already disconnected - if (!ident.connected) { - return; - } - ident.connected = false; - var src = ident.source; - var sig = ident.signal; - var listener = ident.listener; - // check isDOM - if (!ident.isDOM) { - if (typeof(src.__disconnect__) == 'function') { - src.__disconnect__(ident, sig, ident.objOrFunc, ident.funcOrStr); - } - return; - } - if (src.removeEventListener) { - src.removeEventListener(sig.substr(2), listener, false); - } else if (src.detachEvent) { - src.detachEvent(sig, listener); // useCapture unsupported - } else { - throw new Error("'src' must be a DOM element"); - } - }, - - /** @id MochiKit.Signal.disconnect */ - disconnect: function (ident) { - var self = MochiKit.Signal; - var observers = self._observers; - var m = MochiKit.Base; - if (arguments.length > 1) { - // compatibility API - var src = MochiKit.DOM.getElement(arguments[0]); - var sig = arguments[1]; - var obj = arguments[2]; - var func = arguments[3]; - for (var i = observers.length - 1; i >= 0; i--) { - var o = observers[i]; - if (o.source === src && o.signal === sig && o.objOrFunc === obj && o.funcOrStr === func) { - self._disconnect(o); - if (!self._lock) { - observers.splice(i, 1); - } else { - self._dirty = true; - } - return true; - } - } - } else { - var idx = m.findIdentical(observers, ident); - if (idx >= 0) { - self._disconnect(ident); - if (!self._lock) { - observers.splice(idx, 1); - } else { - self._dirty = true; - } - return true; - } - } - return false; - }, - - /** @id MochiKit.Signal.disconnectAllTo */ - disconnectAllTo: function (objOrFunc, /* optional */funcOrStr) { - var self = MochiKit.Signal; - var observers = self._observers; - var disconnect = self._disconnect; - var locked = self._lock; - var dirty = self._dirty; - if (typeof(funcOrStr) === 'undefined') { - funcOrStr = null; - } - for (var i = observers.length - 1; i >= 0; i--) { - var ident = observers[i]; - if (ident.objOrFunc === objOrFunc && - (funcOrStr === null || ident.funcOrStr === funcOrStr)) { - disconnect(ident); - if (locked) { - dirty = true; - } else { - observers.splice(i, 1); - } - } - } - self._dirty = dirty; - }, - - /** @id MochiKit.Signal.disconnectAll */ - disconnectAll: function (src/* optional */, sig) { - src = MochiKit.DOM.getElement(src); - var m = MochiKit.Base; - var signals = m.flattenArguments(m.extend(null, arguments, 1)); - var self = MochiKit.Signal; - var disconnect = self._disconnect; - var observers = self._observers; - var i, ident; - var locked = self._lock; - var dirty = self._dirty; - if (signals.length === 0) { - // disconnect all - for (i = observers.length - 1; i >= 0; i--) { - ident = observers[i]; - if (ident.source === src) { - disconnect(ident); - if (!locked) { - observers.splice(i, 1); - } else { - dirty = true; - } - } - } - } else { - var sigs = {}; - for (i = 0; i < signals.length; i++) { - sigs[signals[i]] = true; - } - for (i = observers.length - 1; i >= 0; i--) { - ident = observers[i]; - if (ident.source === src && ident.signal in sigs) { - disconnect(ident); - if (!locked) { - observers.splice(i, 1); - } else { - dirty = true; - } - } - } - } - self._dirty = dirty; - }, - - /** @id MochiKit.Signal.signal */ - signal: function (src, sig) { - var self = MochiKit.Signal; - var observers = self._observers; - src = MochiKit.DOM.getElement(src); - var args = MochiKit.Base.extend(null, arguments, 2); - var errors = []; - self._lock = true; - for (var i = 0; i < observers.length; i++) { - var ident = observers[i]; - if (ident.source === src && ident.signal === sig && - ident.connected) { - try { - ident.listener.apply(src, args); - } catch (e) { - errors.push(e); - } - } - } - self._lock = false; - if (self._dirty) { - self._dirty = false; - for (var i = observers.length - 1; i >= 0; i--) { - if (!observers[i].connected) { - observers.splice(i, 1); - } - } - } - if (errors.length == 1) { - throw errors[0]; - } else if (errors.length > 1) { - var e = new Error("Multiple errors thrown in handling 'sig', see errors property"); - e.errors = errors; - throw e; - } - } - -}); - -MochiKit.Signal.EXPORT_OK = []; - -MochiKit.Signal.EXPORT = [ - 'connect', - 'disconnect', - 'signal', - 'disconnectAll', - 'disconnectAllTo' -]; - -MochiKit.Signal.__new__ = function (win) { - var m = MochiKit.Base; - this._document = document; - this._window = win; - this._lock = false; - this._dirty = false; - - try { - this.connect(window, 'onunload', this._unloadCache); - } catch (e) { - // pass: might not be a browser - } - - this.EXPORT_TAGS = { - ':common': this.EXPORT, - ':all': m.concat(this.EXPORT, this.EXPORT_OK) - }; - - m.nameFunctions(this); -}; - -MochiKit.Signal.__new__(this); - -// -// XXX: Internet Explorer blows -// -if (MochiKit.__export__) { - connect = MochiKit.Signal.connect; - disconnect = MochiKit.Signal.disconnect; - disconnectAll = MochiKit.Signal.disconnectAll; - signal = MochiKit.Signal.signal; -} - -MochiKit.Base._exportSymbols(this, MochiKit.Signal); diff --git a/static/MochiKit/Sortable.js b/static/MochiKit/Sortable.js deleted file mode 100644 index 463cce2..0000000 --- a/static/MochiKit/Sortable.js +++ /dev/null @@ -1,589 +0,0 @@ -/*** -Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) - Mochi-ized By Thomas Herve (_firstname_@nimail.org) - -See scriptaculous.js for full license. - -***/ - -MochiKit.Base._deps('Sortable', ['Base', 'Iter', 'DOM', 'Position', 'DragAndDrop']); - -MochiKit.Sortable.NAME = 'MochiKit.Sortable'; -MochiKit.Sortable.VERSION = '1.4.2'; - -MochiKit.Sortable.__repr__ = function () { - return '[' + this.NAME + ' ' + this.VERSION + ']'; -}; - -MochiKit.Sortable.toString = function () { - return this.__repr__(); -}; - -MochiKit.Sortable.EXPORT = [ -]; - -MochiKit.Sortable.EXPORT_OK = [ -]; - -MochiKit.Base.update(MochiKit.Sortable, { - /*** - - Manage sortables. Mainly use the create function to add a sortable. - - ***/ - sortables: {}, - - _findRootElement: function (element) { - while (element.tagName.toUpperCase() != "BODY") { - if (element.id && MochiKit.Sortable.sortables[element.id]) { - return element; - } - element = element.parentNode; - } - }, - - _createElementId: function(element) { - if (element.id == null || element.id == "") { - var d = MochiKit.DOM; - var id; - var count = 1; - while (d.getElement(id = "sortable" + count) != null) { - count += 1; - } - d.setNodeAttribute(element, "id", id); - } - }, - - /** @id MochiKit.Sortable.options */ - options: function (element) { - element = MochiKit.Sortable._findRootElement(MochiKit.DOM.getElement(element)); - if (!element) { - return; - } - return MochiKit.Sortable.sortables[element.id]; - }, - - /** @id MochiKit.Sortable.destroy */ - destroy: function (element){ - var s = MochiKit.Sortable.options(element); - var b = MochiKit.Base; - var d = MochiKit.DragAndDrop; - - if (s) { - MochiKit.Signal.disconnect(s.startHandle); - MochiKit.Signal.disconnect(s.endHandle); - b.map(function (dr) { - d.Droppables.remove(dr); - }, s.droppables); - b.map(function (dr) { - dr.destroy(); - }, s.draggables); - - delete MochiKit.Sortable.sortables[s.element.id]; - } - }, - - /** @id MochiKit.Sortable.create */ - create: function (element, options) { - element = MochiKit.DOM.getElement(element); - var self = MochiKit.Sortable; - self._createElementId(element); - - /** @id MochiKit.Sortable.options */ - options = MochiKit.Base.update({ - - /** @id MochiKit.Sortable.element */ - element: element, - - /** @id MochiKit.Sortable.tag */ - tag: 'li', // assumes li children, override with tag: 'tagname' - - /** @id MochiKit.Sortable.dropOnEmpty */ - dropOnEmpty: false, - - /** @id MochiKit.Sortable.tree */ - tree: false, - - /** @id MochiKit.Sortable.treeTag */ - treeTag: 'ul', - - /** @id MochiKit.Sortable.overlap */ - overlap: 'vertical', // one of 'vertical', 'horizontal' - - /** @id MochiKit.Sortable.constraint */ - constraint: 'vertical', // one of 'vertical', 'horizontal', false - // also takes array of elements (or ids); or false - - /** @id MochiKit.Sortable.containment */ - containment: [element], - - /** @id MochiKit.Sortable.handle */ - handle: false, // or a CSS class - - /** @id MochiKit.Sortable.only */ - only: false, - - /** @id MochiKit.Sortable.hoverclass */ - hoverclass: null, - - /** @id MochiKit.Sortable.ghosting */ - ghosting: false, - - /** @id MochiKit.Sortable.scroll */ - scroll: false, - - /** @id MochiKit.Sortable.scrollSensitivity */ - scrollSensitivity: 20, - - /** @id MochiKit.Sortable.scrollSpeed */ - scrollSpeed: 15, - - /** @id MochiKit.Sortable.format */ - format: /^[^_]*_(.*)$/, - - /** @id MochiKit.Sortable.onChange */ - onChange: MochiKit.Base.noop, - - /** @id MochiKit.Sortable.onUpdate */ - onUpdate: MochiKit.Base.noop, - - /** @id MochiKit.Sortable.accept */ - accept: null - }, options); - - // clear any old sortable with same element - self.destroy(element); - - // build options for the draggables - var options_for_draggable = { - revert: true, - ghosting: options.ghosting, - scroll: options.scroll, - scrollSensitivity: options.scrollSensitivity, - scrollSpeed: options.scrollSpeed, - constraint: options.constraint, - handle: options.handle - }; - - if (options.starteffect) { - options_for_draggable.starteffect = options.starteffect; - } - - if (options.reverteffect) { - options_for_draggable.reverteffect = options.reverteffect; - } else if (options.ghosting) { - options_for_draggable.reverteffect = function (innerelement) { - innerelement.style.top = 0; - innerelement.style.left = 0; - }; - } - - if (options.endeffect) { - options_for_draggable.endeffect = options.endeffect; - } - - if (options.zindex) { - options_for_draggable.zindex = options.zindex; - } - - // build options for the droppables - var options_for_droppable = { - overlap: options.overlap, - containment: options.containment, - hoverclass: options.hoverclass, - onhover: self.onHover, - tree: options.tree, - accept: options.accept - } - - var options_for_tree = { - onhover: self.onEmptyHover, - overlap: options.overlap, - containment: options.containment, - hoverclass: options.hoverclass, - accept: options.accept - } - - // fix for gecko engine - MochiKit.DOM.removeEmptyTextNodes(element); - - options.draggables = []; - options.droppables = []; - - // drop on empty handling - if (options.dropOnEmpty || options.tree) { - new MochiKit.DragAndDrop.Droppable(element, options_for_tree); - options.droppables.push(element); - } - MochiKit.Base.map(function (e) { - // handles are per-draggable - var handle = options.handle ? - MochiKit.DOM.getFirstElementByTagAndClassName(null, - options.handle, e) : e; - options.draggables.push( - new MochiKit.DragAndDrop.Draggable(e, - MochiKit.Base.update(options_for_draggable, - {handle: handle}))); - new MochiKit.DragAndDrop.Droppable(e, options_for_droppable); - if (options.tree) { - e.treeNode = element; - } - options.droppables.push(e); - }, (self.findElements(element, options) || [])); - - if (options.tree) { - MochiKit.Base.map(function (e) { - new MochiKit.DragAndDrop.Droppable(e, options_for_tree); - e.treeNode = element; - options.droppables.push(e); - }, (self.findTreeElements(element, options) || [])); - } - - // keep reference - self.sortables[element.id] = options; - - options.lastValue = self.serialize(element); - options.startHandle = MochiKit.Signal.connect(MochiKit.DragAndDrop.Draggables, 'start', - MochiKit.Base.partial(self.onStart, element)); - options.endHandle = MochiKit.Signal.connect(MochiKit.DragAndDrop.Draggables, 'end', - MochiKit.Base.partial(self.onEnd, element)); - }, - - /** @id MochiKit.Sortable.onStart */ - onStart: function (element, draggable) { - var self = MochiKit.Sortable; - var options = self.options(element); - options.lastValue = self.serialize(options.element); - }, - - /** @id MochiKit.Sortable.onEnd */ - onEnd: function (element, draggable) { - var self = MochiKit.Sortable; - self.unmark(); - var options = self.options(element); - if (options.lastValue != self.serialize(options.element)) { - options.onUpdate(options.element); - } - }, - - // return all suitable-for-sortable elements in a guaranteed order - - /** @id MochiKit.Sortable.findElements */ - findElements: function (element, options) { - return MochiKit.Sortable.findChildren(element, options.only, options.tree, options.tag); - }, - - /** @id MochiKit.Sortable.findTreeElements */ - findTreeElements: function (element, options) { - return MochiKit.Sortable.findChildren( - element, options.only, options.tree ? true : false, options.treeTag); - }, - - /** @id MochiKit.Sortable.findChildren */ - findChildren: function (element, only, recursive, tagName) { - if (!element.hasChildNodes()) { - return null; - } - tagName = tagName.toUpperCase(); - if (only) { - only = MochiKit.Base.flattenArray([only]); - } - var elements = []; - MochiKit.Base.map(function (e) { - if (e.tagName && - e.tagName.toUpperCase() == tagName && - (!only || - MochiKit.Iter.some(only, function (c) { - return MochiKit.DOM.hasElementClass(e, c); - }))) { - elements.push(e); - } - if (recursive) { - var grandchildren = MochiKit.Sortable.findChildren(e, only, recursive, tagName); - if (grandchildren && grandchildren.length > 0) { - elements = elements.concat(grandchildren); - } - } - }, element.childNodes); - return elements; - }, - - /** @id MochiKit.Sortable.onHover */ - onHover: function (element, dropon, overlap) { - if (MochiKit.DOM.isChildNode(dropon, element)) { - return; - } - var self = MochiKit.Sortable; - - if (overlap > .33 && overlap < .66 && self.options(dropon).tree) { - return; - } else if (overlap > 0.5) { - self.mark(dropon, 'before'); - if (dropon.previousSibling != element) { - var oldParentNode = element.parentNode; - element.style.visibility = 'hidden'; // fix gecko rendering - dropon.parentNode.insertBefore(element, dropon); - if (dropon.parentNode != oldParentNode) { - self.options(oldParentNode).onChange(element); - } - self.options(dropon.parentNode).onChange(element); - } - } else { - self.mark(dropon, 'after'); - var nextElement = dropon.nextSibling || null; - if (nextElement != element) { - var oldParentNode = element.parentNode; - element.style.visibility = 'hidden'; // fix gecko rendering - dropon.parentNode.insertBefore(element, nextElement); - if (dropon.parentNode != oldParentNode) { - self.options(oldParentNode).onChange(element); - } - self.options(dropon.parentNode).onChange(element); - } - } - }, - - _offsetSize: function (element, type) { - if (type == 'vertical' || type == 'height') { - return element.offsetHeight; - } else { - return element.offsetWidth; - } - }, - - /** @id MochiKit.Sortable.onEmptyHover */ - onEmptyHover: function (element, dropon, overlap) { - var oldParentNode = element.parentNode; - var self = MochiKit.Sortable; - var droponOptions = self.options(dropon); - - if (!MochiKit.DOM.isChildNode(dropon, element)) { - var index; - - var children = self.findElements(dropon, {tag: droponOptions.tag, - only: droponOptions.only}); - var child = null; - - if (children) { - var offset = self._offsetSize(dropon, droponOptions.overlap) * (1.0 - overlap); - - for (index = 0; index < children.length; index += 1) { - if (offset - self._offsetSize(children[index], droponOptions.overlap) >= 0) { - offset -= self._offsetSize(children[index], droponOptions.overlap); - } else if (offset - (self._offsetSize (children[index], droponOptions.overlap) / 2) >= 0) { - child = index + 1 < children.length ? children[index + 1] : null; - break; - } else { - child = children[index]; - break; - } - } - } - - dropon.insertBefore(element, child); - - self.options(oldParentNode).onChange(element); - droponOptions.onChange(element); - } - }, - - /** @id MochiKit.Sortable.unmark */ - unmark: function () { - var m = MochiKit.Sortable._marker; - if (m) { - MochiKit.Style.hideElement(m); - } - }, - - /** @id MochiKit.Sortable.mark */ - mark: function (dropon, position) { - // mark on ghosting only - var d = MochiKit.DOM; - var self = MochiKit.Sortable; - var sortable = self.options(dropon.parentNode); - if (sortable && !sortable.ghosting) { - return; - } - - if (!self._marker) { - self._marker = d.getElement('dropmarker') || - document.createElement('DIV'); - MochiKit.Style.hideElement(self._marker); - d.addElementClass(self._marker, 'dropmarker'); - self._marker.style.position = 'absolute'; - document.getElementsByTagName('body').item(0).appendChild(self._marker); - } - var offsets = MochiKit.Position.cumulativeOffset(dropon); - self._marker.style.left = offsets.x + 'px'; - self._marker.style.top = offsets.y + 'px'; - - if (position == 'after') { - if (sortable.overlap == 'horizontal') { - self._marker.style.left = (offsets.x + dropon.clientWidth) + 'px'; - } else { - self._marker.style.top = (offsets.y + dropon.clientHeight) + 'px'; - } - } - MochiKit.Style.showElement(self._marker); - }, - - _tree: function (element, options, parent) { - var self = MochiKit.Sortable; - var children = self.findElements(element, options) || []; - - for (var i = 0; i < children.length; ++i) { - var match = children[i].id.match(options.format); - - if (!match) { - continue; - } - - var child = { - id: encodeURIComponent(match ? match[1] : null), - element: element, - parent: parent, - children: [], - position: parent.children.length, - container: self._findChildrenElement(children[i], options.treeTag.toUpperCase()) - } - - /* Get the element containing the children and recurse over it */ - if (child.container) { - self._tree(child.container, options, child) - } - - parent.children.push (child); - } - - return parent; - }, - - /* Finds the first element of the given tag type within a parent element. - Used for finding the first LI[ST] within a L[IST]I[TEM].*/ - _findChildrenElement: function (element, containerTag) { - if (element && element.hasChildNodes) { - containerTag = containerTag.toUpperCase(); - for (var i = 0; i < element.childNodes.length; ++i) { - if (element.childNodes[i].tagName.toUpperCase() == containerTag) { - return element.childNodes[i]; - } - } - } - return null; - }, - - /** @id MochiKit.Sortable.tree */ - tree: function (element, options) { - element = MochiKit.DOM.getElement(element); - var sortableOptions = MochiKit.Sortable.options(element); - options = MochiKit.Base.update({ - tag: sortableOptions.tag, - treeTag: sortableOptions.treeTag, - only: sortableOptions.only, - name: element.id, - format: sortableOptions.format - }, options || {}); - - var root = { - id: null, - parent: null, - children: new Array, - container: element, - position: 0 - } - - return MochiKit.Sortable._tree(element, options, root); - }, - - /** - * Specifies the sequence for the Sortable. - * @param {Node} element Element to use as the Sortable. - * @param {Object} newSequence New sequence to use. - * @param {Object} options Options to use fro the Sortable. - */ - setSequence: function (element, newSequence, options) { - var self = MochiKit.Sortable; - var b = MochiKit.Base; - element = MochiKit.DOM.getElement(element); - options = b.update(self.options(element), options || {}); - - var nodeMap = {}; - b.map(function (n) { - var m = n.id.match(options.format); - if (m) { - nodeMap[m[1]] = [n, n.parentNode]; - } - n.parentNode.removeChild(n); - }, self.findElements(element, options)); - - b.map(function (ident) { - var n = nodeMap[ident]; - if (n) { - n[1].appendChild(n[0]); - delete nodeMap[ident]; - } - }, newSequence); - }, - - /* Construct a [i] index for a particular node */ - _constructIndex: function (node) { - var index = ''; - do { - if (node.id) { - index = '[' + node.position + ']' + index; - } - } while ((node = node.parent) != null); - return index; - }, - - /** @id MochiKit.Sortable.sequence */ - sequence: function (element, options) { - element = MochiKit.DOM.getElement(element); - var self = MochiKit.Sortable; - var options = MochiKit.Base.update(self.options(element), options || {}); - - return MochiKit.Base.map(function (item) { - return item.id.match(options.format) ? item.id.match(options.format)[1] : ''; - }, MochiKit.DOM.getElement(self.findElements(element, options) || [])); - }, - - /** - * Serializes the content of a Sortable. Useful to send this content through a XMLHTTPRequest. - * These options override the Sortable options for the serialization only. - * @param {Node} element Element to serialize. - * @param {Object} options Serialization options. - */ - serialize: function (element, options) { - element = MochiKit.DOM.getElement(element); - var self = MochiKit.Sortable; - options = MochiKit.Base.update(self.options(element), options || {}); - var name = encodeURIComponent(options.name || element.id); - - if (options.tree) { - return MochiKit.Base.flattenArray(MochiKit.Base.map(function (item) { - return [name + self._constructIndex(item) + "[id]=" + - encodeURIComponent(item.id)].concat(item.children.map(arguments.callee)); - }, self.tree(element, options).children)).join('&'); - } else { - return MochiKit.Base.map(function (item) { - return name + "[]=" + encodeURIComponent(item); - }, self.sequence(element, options)).join('&'); - } - } -}); - -// trunk compatibility -MochiKit.Sortable.Sortable = MochiKit.Sortable; - -MochiKit.Sortable.__new__ = function () { - MochiKit.Base.nameFunctions(this); - - this.EXPORT_TAGS = { - ":common": this.EXPORT, - ":all": MochiKit.Base.concat(this.EXPORT, this.EXPORT_OK) - }; -}; - -MochiKit.Sortable.__new__(); - -MochiKit.Base._exportSymbols(this, MochiKit.Sortable); diff --git a/static/MochiKit/Style.js b/static/MochiKit/Style.js deleted file mode 100644 index 68bd919..0000000 --- a/static/MochiKit/Style.js +++ /dev/null @@ -1,594 +0,0 @@ -/*** - -MochiKit.Style 1.4.2 - -See for documentation, downloads, license, etc. - -(c) 2005-2006 Bob Ippolito, Beau Hartshorne. All rights Reserved. - -***/ - -MochiKit.Base._deps('Style', ['Base', 'DOM']); - -MochiKit.Style.NAME = 'MochiKit.Style'; -MochiKit.Style.VERSION = '1.4.2'; -MochiKit.Style.__repr__ = function () { - return '[' + this.NAME + ' ' + this.VERSION + ']'; -}; -MochiKit.Style.toString = function () { - return this.__repr__(); -}; - -MochiKit.Style.EXPORT_OK = []; - -MochiKit.Style.EXPORT = [ - 'setStyle', - 'setOpacity', - 'getStyle', - 'getElementDimensions', - 'elementDimensions', // deprecated - 'setElementDimensions', - 'getElementPosition', - 'elementPosition', // deprecated - 'setElementPosition', - "makePositioned", - "undoPositioned", - "makeClipping", - "undoClipping", - 'setDisplayForElement', - 'hideElement', - 'showElement', - 'getViewportDimensions', - 'getViewportPosition', - 'Dimensions', - 'Coordinates' -]; - - -/* - - Dimensions - -*/ -/** @id MochiKit.Style.Dimensions */ -MochiKit.Style.Dimensions = function (w, h) { - this.w = w; - this.h = h; -}; - -MochiKit.Style.Dimensions.prototype.__repr__ = function () { - var repr = MochiKit.Base.repr; - return '{w: ' + repr(this.w) + ', h: ' + repr(this.h) + '}'; -}; - -MochiKit.Style.Dimensions.prototype.toString = function () { - return this.__repr__(); -}; - - -/* - - Coordinates - -*/ -/** @id MochiKit.Style.Coordinates */ -MochiKit.Style.Coordinates = function (x, y) { - this.x = x; - this.y = y; -}; - -MochiKit.Style.Coordinates.prototype.__repr__ = function () { - var repr = MochiKit.Base.repr; - return '{x: ' + repr(this.x) + ', y: ' + repr(this.y) + '}'; -}; - -MochiKit.Style.Coordinates.prototype.toString = function () { - return this.__repr__(); -}; - - -MochiKit.Base.update(MochiKit.Style, { - - /** @id MochiKit.Style.getStyle */ - getStyle: function (elem, cssProperty) { - var dom = MochiKit.DOM; - var d = dom._document; - - elem = dom.getElement(elem); - cssProperty = MochiKit.Base.camelize(cssProperty); - - if (!elem || elem == d) { - return undefined; - } - if (cssProperty == 'opacity' && typeof(elem.filters) != 'undefined') { - var opacity = (MochiKit.Style.getStyle(elem, 'filter') || '').match(/alpha\(opacity=(.*)\)/); - if (opacity && opacity[1]) { - return parseFloat(opacity[1]) / 100; - } - return 1.0; - } - if (cssProperty == 'float' || cssProperty == 'cssFloat' || cssProperty == 'styleFloat') { - if (elem.style["float"]) { - return elem.style["float"]; - } else if (elem.style.cssFloat) { - return elem.style.cssFloat; - } else if (elem.style.styleFloat) { - return elem.style.styleFloat; - } else { - return "none"; - } - } - var value = elem.style ? elem.style[cssProperty] : null; - if (!value) { - if (d.defaultView && d.defaultView.getComputedStyle) { - var css = d.defaultView.getComputedStyle(elem, null); - cssProperty = cssProperty.replace(/([A-Z])/g, '-$1' - ).toLowerCase(); // from dojo.style.toSelectorCase - value = css ? css.getPropertyValue(cssProperty) : null; - } else if (elem.currentStyle) { - value = elem.currentStyle[cssProperty]; - if (/^\d/.test(value) && !/px$/.test(value) && cssProperty != 'fontWeight') { - /* Convert to px using an hack from Dean Edwards */ - var left = elem.style.left; - var rsLeft = elem.runtimeStyle.left; - elem.runtimeStyle.left = elem.currentStyle.left; - elem.style.left = value || 0; - value = elem.style.pixelLeft + "px"; - elem.style.left = left; - elem.runtimeStyle.left = rsLeft; - } - } - } - if (cssProperty == 'opacity') { - value = parseFloat(value); - } - - if (/Opera/.test(navigator.userAgent) && (MochiKit.Base.findValue(['left', 'top', 'right', 'bottom'], cssProperty) != -1)) { - if (MochiKit.Style.getStyle(elem, 'position') == 'static') { - value = 'auto'; - } - } - - return value == 'auto' ? null : value; - }, - - /** @id MochiKit.Style.setStyle */ - setStyle: function (elem, style) { - elem = MochiKit.DOM.getElement(elem); - for (var name in style) { - switch (name) { - case 'opacity': - MochiKit.Style.setOpacity(elem, style[name]); - break; - case 'float': - case 'cssFloat': - case 'styleFloat': - if (typeof(elem.style["float"]) != "undefined") { - elem.style["float"] = style[name]; - } else if (typeof(elem.style.cssFloat) != "undefined") { - elem.style.cssFloat = style[name]; - } else { - elem.style.styleFloat = style[name]; - } - break; - default: - elem.style[MochiKit.Base.camelize(name)] = style[name]; - } - } - }, - - /** @id MochiKit.Style.setOpacity */ - setOpacity: function (elem, o) { - elem = MochiKit.DOM.getElement(elem); - var self = MochiKit.Style; - if (o == 1) { - var toSet = /Gecko/.test(navigator.userAgent) && !(/Konqueror|AppleWebKit|KHTML/.test(navigator.userAgent)); - elem.style["opacity"] = toSet ? 0.999999 : 1.0; - if (/MSIE/.test(navigator.userAgent)) { - elem.style['filter'] = - self.getStyle(elem, 'filter').replace(/alpha\([^\)]*\)/gi, ''); - } - } else { - if (o < 0.00001) { - o = 0; - } - elem.style["opacity"] = o; - if (/MSIE/.test(navigator.userAgent)) { - elem.style['filter'] = - self.getStyle(elem, 'filter').replace(/alpha\([^\)]*\)/gi, '') + 'alpha(opacity=' + o * 100 + ')'; - } - } - }, - - /* - - getElementPosition is adapted from YAHOO.util.Dom.getXY v0.9.0. - Copyright: Copyright (c) 2006, Yahoo! Inc. All rights reserved. - License: BSD, http://developer.yahoo.net/yui/license.txt - - */ - - /** @id MochiKit.Style.getElementPosition */ - getElementPosition: function (elem, /* optional */relativeTo) { - var self = MochiKit.Style; - var dom = MochiKit.DOM; - elem = dom.getElement(elem); - - if (!elem || - (!(elem.x && elem.y) && - (!elem.parentNode === null || - self.getStyle(elem, 'display') == 'none'))) { - return undefined; - } - - var c = new self.Coordinates(0, 0); - var box = null; - var parent = null; - - var d = MochiKit.DOM._document; - var de = d.documentElement; - var b = d.body; - - if (!elem.parentNode && elem.x && elem.y) { - /* it's just a MochiKit.Style.Coordinates object */ - c.x += elem.x || 0; - c.y += elem.y || 0; - } else if (elem.getBoundingClientRect) { // IE shortcut - /* - - The IE shortcut can be off by two. We fix it. See: - http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/getboundingclientrect.asp - - This is similar to the method used in - MochiKit.Signal.Event.mouse(). - - */ - box = elem.getBoundingClientRect(); - - c.x += box.left + - (de.scrollLeft || b.scrollLeft) - - (de.clientLeft || 0); - - c.y += box.top + - (de.scrollTop || b.scrollTop) - - (de.clientTop || 0); - - } else if (elem.offsetParent) { - c.x += elem.offsetLeft; - c.y += elem.offsetTop; - parent = elem.offsetParent; - - if (parent != elem) { - while (parent) { - c.x += parseInt(parent.style.borderLeftWidth) || 0; - c.y += parseInt(parent.style.borderTopWidth) || 0; - c.x += parent.offsetLeft; - c.y += parent.offsetTop; - parent = parent.offsetParent; - } - } - - /* - - Opera < 9 and old Safari (absolute) incorrectly account for - body offsetTop and offsetLeft. - - */ - var ua = navigator.userAgent.toLowerCase(); - if ((typeof(opera) != 'undefined' && - parseFloat(opera.version()) < 9) || - (ua.indexOf('AppleWebKit') != -1 && - self.getStyle(elem, 'position') == 'absolute')) { - - c.x -= b.offsetLeft; - c.y -= b.offsetTop; - - } - - // Adjust position for strange Opera scroll bug - if (elem.parentNode) { - parent = elem.parentNode; - } else { - parent = null; - } - while (parent) { - var tagName = parent.tagName.toUpperCase(); - if (tagName === 'BODY' || tagName === 'HTML') { - break; - } - var disp = self.getStyle(parent, 'display'); - // Handle strange Opera bug for some display - if (disp.search(/^inline|table-row.*$/i)) { - c.x -= parent.scrollLeft; - c.y -= parent.scrollTop; - } - if (parent.parentNode) { - parent = parent.parentNode; - } else { - parent = null; - } - } - } - - if (typeof(relativeTo) != 'undefined') { - relativeTo = arguments.callee(relativeTo); - if (relativeTo) { - c.x -= (relativeTo.x || 0); - c.y -= (relativeTo.y || 0); - } - } - - return c; - }, - - /** @id MochiKit.Style.setElementPosition */ - setElementPosition: function (elem, newPos/* optional */, units) { - elem = MochiKit.DOM.getElement(elem); - if (typeof(units) == 'undefined') { - units = 'px'; - } - var newStyle = {}; - var isUndefNull = MochiKit.Base.isUndefinedOrNull; - if (!isUndefNull(newPos.x)) { - newStyle['left'] = newPos.x + units; - } - if (!isUndefNull(newPos.y)) { - newStyle['top'] = newPos.y + units; - } - MochiKit.DOM.updateNodeAttributes(elem, {'style': newStyle}); - }, - - /** @id MochiKit.Style.makePositioned */ - makePositioned: function (element) { - element = MochiKit.DOM.getElement(element); - var pos = MochiKit.Style.getStyle(element, 'position'); - if (pos == 'static' || !pos) { - element.style.position = 'relative'; - // Opera returns the offset relative to the positioning context, - // when an element is position relative but top and left have - // not been defined - if (/Opera/.test(navigator.userAgent)) { - element.style.top = 0; - element.style.left = 0; - } - } - }, - - /** @id MochiKit.Style.undoPositioned */ - undoPositioned: function (element) { - element = MochiKit.DOM.getElement(element); - if (element.style.position == 'relative') { - element.style.position = element.style.top = element.style.left = element.style.bottom = element.style.right = ''; - } - }, - - /** @id MochiKit.Style.makeClipping */ - makeClipping: function (element) { - element = MochiKit.DOM.getElement(element); - var s = element.style; - var oldOverflow = { 'overflow': s.overflow, - 'overflow-x': s.overflowX, - 'overflow-y': s.overflowY }; - if ((MochiKit.Style.getStyle(element, 'overflow') || 'visible') != 'hidden') { - element.style.overflow = 'hidden'; - element.style.overflowX = 'hidden'; - element.style.overflowY = 'hidden'; - } - return oldOverflow; - }, - - /** @id MochiKit.Style.undoClipping */ - undoClipping: function (element, overflow) { - element = MochiKit.DOM.getElement(element); - if (typeof(overflow) == 'string') { - element.style.overflow = overflow; - } else if (overflow != null) { - element.style.overflow = overflow['overflow']; - element.style.overflowX = overflow['overflow-x']; - element.style.overflowY = overflow['overflow-y']; - } - }, - - /** @id MochiKit.Style.getElementDimensions */ - getElementDimensions: function (elem, contentSize/*optional*/) { - var self = MochiKit.Style; - var dom = MochiKit.DOM; - if (typeof(elem.w) == 'number' || typeof(elem.h) == 'number') { - return new self.Dimensions(elem.w || 0, elem.h || 0); - } - elem = dom.getElement(elem); - if (!elem) { - return undefined; - } - var disp = self.getStyle(elem, 'display'); - // display can be empty/undefined on WebKit/KHTML - if (disp == 'none' || disp == '' || typeof(disp) == 'undefined') { - var s = elem.style; - var originalVisibility = s.visibility; - var originalPosition = s.position; - var originalDisplay = s.display; - s.visibility = 'hidden'; - s.position = 'absolute'; - s.display = self._getDefaultDisplay(elem); - var originalWidth = elem.offsetWidth; - var originalHeight = elem.offsetHeight; - s.display = originalDisplay; - s.position = originalPosition; - s.visibility = originalVisibility; - } else { - originalWidth = elem.offsetWidth || 0; - originalHeight = elem.offsetHeight || 0; - } - if (contentSize) { - var tableCell = 'colSpan' in elem && 'rowSpan' in elem; - var collapse = (tableCell && elem.parentNode && self.getStyle( - elem.parentNode, 'borderCollapse') == 'collapse') - if (collapse) { - if (/MSIE/.test(navigator.userAgent)) { - var borderLeftQuota = elem.previousSibling? 0.5 : 1; - var borderRightQuota = elem.nextSibling? 0.5 : 1; - } - else { - var borderLeftQuota = 0.5; - var borderRightQuota = 0.5; - } - } else { - var borderLeftQuota = 1; - var borderRightQuota = 1; - } - originalWidth -= Math.round( - (parseFloat(self.getStyle(elem, 'paddingLeft')) || 0) - + (parseFloat(self.getStyle(elem, 'paddingRight')) || 0) - + borderLeftQuota * - (parseFloat(self.getStyle(elem, 'borderLeftWidth')) || 0) - + borderRightQuota * - (parseFloat(self.getStyle(elem, 'borderRightWidth')) || 0) - ); - if (tableCell) { - if (/Gecko|Opera/.test(navigator.userAgent) - && !/Konqueror|AppleWebKit|KHTML/.test(navigator.userAgent)) { - var borderHeightQuota = 0; - } else if (/MSIE/.test(navigator.userAgent)) { - var borderHeightQuota = 1; - } else { - var borderHeightQuota = collapse? 0.5 : 1; - } - } else { - var borderHeightQuota = 1; - } - originalHeight -= Math.round( - (parseFloat(self.getStyle(elem, 'paddingTop')) || 0) - + (parseFloat(self.getStyle(elem, 'paddingBottom')) || 0) - + borderHeightQuota * ( - (parseFloat(self.getStyle(elem, 'borderTopWidth')) || 0) - + (parseFloat(self.getStyle(elem, 'borderBottomWidth')) || 0)) - ); - } - return new self.Dimensions(originalWidth, originalHeight); - }, - - /** @id MochiKit.Style.setElementDimensions */ - setElementDimensions: function (elem, newSize/* optional */, units) { - elem = MochiKit.DOM.getElement(elem); - if (typeof(units) == 'undefined') { - units = 'px'; - } - var newStyle = {}; - var isUndefNull = MochiKit.Base.isUndefinedOrNull; - if (!isUndefNull(newSize.w)) { - newStyle['width'] = newSize.w + units; - } - if (!isUndefNull(newSize.h)) { - newStyle['height'] = newSize.h + units; - } - MochiKit.DOM.updateNodeAttributes(elem, {'style': newStyle}); - }, - - _getDefaultDisplay: function (elem) { - var self = MochiKit.Style; - var dom = MochiKit.DOM; - elem = dom.getElement(elem); - if (!elem) { - return undefined; - } - var tagName = elem.tagName.toUpperCase(); - return self._defaultDisplay[tagName] || 'block'; - }, - - /** @id MochiKit.Style.setDisplayForElement */ - setDisplayForElement: function (display, element/*, ...*/) { - var elements = MochiKit.Base.extend(null, arguments, 1); - var getElement = MochiKit.DOM.getElement; - for (var i = 0; i < elements.length; i++) { - element = getElement(elements[i]); - if (element) { - element.style.display = display; - } - } - }, - - /** @id MochiKit.Style.getViewportDimensions */ - getViewportDimensions: function () { - var d = new MochiKit.Style.Dimensions(); - var w = MochiKit.DOM._window; - var b = MochiKit.DOM._document.body; - if (w.innerWidth) { - d.w = w.innerWidth; - d.h = w.innerHeight; - } else if (b && b.parentElement && b.parentElement.clientWidth) { - d.w = b.parentElement.clientWidth; - d.h = b.parentElement.clientHeight; - } else if (b && b.clientWidth) { - d.w = b.clientWidth; - d.h = b.clientHeight; - } - return d; - }, - - /** @id MochiKit.Style.getViewportPosition */ - getViewportPosition: function () { - var c = new MochiKit.Style.Coordinates(0, 0); - var d = MochiKit.DOM._document; - var de = d.documentElement; - var db = d.body; - if (de && (de.scrollTop || de.scrollLeft)) { - c.x = de.scrollLeft; - c.y = de.scrollTop; - } else if (db) { - c.x = db.scrollLeft; - c.y = db.scrollTop; - } - return c; - }, - - __new__: function () { - var m = MochiKit.Base; - - var inlines = ['A','ABBR','ACRONYM','B','BASEFONT','BDO','BIG','BR', - 'CITE','CODE','DFN','EM','FONT','I','IMG','KBD','LABEL', - 'Q','S','SAMP','SMALL','SPAN','STRIKE','STRONG','SUB', - 'SUP','TEXTAREA','TT','U','VAR']; - this._defaultDisplay = { 'TABLE': 'table', - 'THEAD': 'table-header-group', - 'TBODY': 'table-row-group', - 'TFOOT': 'table-footer-group', - 'COLGROUP': 'table-column-group', - 'COL': 'table-column', - 'TR': 'table-row', - 'TD': 'table-cell', - 'TH': 'table-cell', - 'CAPTION': 'table-caption', - 'LI': 'list-item', - 'INPUT': 'inline-block', - 'SELECT': 'inline-block' }; - // CSS 'display' support in IE6/7 is just broken... - if (/MSIE/.test(navigator.userAgent)) { - for (var k in this._defaultDisplay) { - var v = this._defaultDisplay[k]; - if (v.indexOf('table') == 0) { - this._defaultDisplay[k] = 'block'; - } - } - } - for (var i = 0; i < inlines.length; i++) { - this._defaultDisplay[inlines[i]] = 'inline'; - } - - this.elementPosition = this.getElementPosition; - this.elementDimensions = this.getElementDimensions; - - this.hideElement = m.partial(this.setDisplayForElement, 'none'); - // TODO: showElement could be improved by using getDefaultDisplay. - this.showElement = m.partial(this.setDisplayForElement, 'block'); - - this.EXPORT_TAGS = { - ':common': this.EXPORT, - ':all': m.concat(this.EXPORT, this.EXPORT_OK) - }; - - m.nameFunctions(this); - } -}); - -MochiKit.Style.__new__(); -MochiKit.Base._exportSymbols(this, MochiKit.Style); diff --git a/static/MochiKit/Test.js b/static/MochiKit/Test.js deleted file mode 100644 index 30bfb4c..0000000 --- a/static/MochiKit/Test.js +++ /dev/null @@ -1,162 +0,0 @@ -/*** - -MochiKit.Test 1.4.2 - -See for documentation, downloads, license, etc. - -(c) 2005 Bob Ippolito. All rights Reserved. - -***/ - -MochiKit.Base._deps('Test', ['Base']); - -MochiKit.Test.NAME = "MochiKit.Test"; -MochiKit.Test.VERSION = "1.4.2"; -MochiKit.Test.__repr__ = function () { - return "[" + this.NAME + " " + this.VERSION + "]"; -}; - -MochiKit.Test.toString = function () { - return this.__repr__(); -}; - - -MochiKit.Test.EXPORT = ["runTests"]; -MochiKit.Test.EXPORT_OK = []; - -MochiKit.Test.runTests = function (obj) { - if (typeof(obj) == "string") { - obj = JSAN.use(obj); - } - var suite = new MochiKit.Test.Suite(); - suite.run(obj); -}; - -MochiKit.Test.Suite = function () { - this.testIndex = 0; - MochiKit.Base.bindMethods(this); -}; - -MochiKit.Test.Suite.prototype = { - run: function (obj) { - try { - obj(this); - } catch (e) { - this.traceback(e); - } - }, - traceback: function (e) { - var items = MochiKit.Iter.sorted(MochiKit.Base.items(e)); - print("not ok " + this.testIndex + " - Error thrown"); - for (var i = 0; i < items.length; i++) { - var kv = items[i]; - if (kv[0] == "stack") { - kv[1] = kv[1].split(/\n/)[0]; - } - this.print("# " + kv.join(": ")); - } - }, - print: function (s) { - print(s); - }, - is: function (got, expected, /* optional */message) { - var res = 1; - var msg = null; - try { - res = MochiKit.Base.compare(got, expected); - } catch (e) { - msg = "Can not compare " + typeof(got) + ":" + typeof(expected); - } - if (res) { - msg = "Expected value did not compare equal"; - } - if (!res) { - return this.testResult(true, message); - } - return this.testResult(false, message, - [[msg], ["got:", got], ["expected:", expected]]); - }, - - testResult: function (pass, msg, failures) { - this.testIndex += 1; - if (pass) { - this.print("ok " + this.testIndex + " - " + msg); - return; - } - this.print("not ok " + this.testIndex + " - " + msg); - if (failures) { - for (var i = 0; i < failures.length; i++) { - this.print("# " + failures[i].join(" ")); - } - } - }, - - isDeeply: function (got, expected, /* optional */message) { - var m = MochiKit.Base; - var res = 1; - try { - res = m.compare(got, expected); - } catch (e) { - // pass - } - if (res === 0) { - return this.ok(true, message); - } - var gk = m.keys(got); - var ek = m.keys(expected); - gk.sort(); - ek.sort(); - if (m.compare(gk, ek)) { - // differing keys - var cmp = {}; - var i; - for (i = 0; i < gk.length; i++) { - cmp[gk[i]] = "got"; - } - for (i = 0; i < ek.length; i++) { - if (ek[i] in cmp) { - delete cmp[ek[i]]; - } else { - cmp[ek[i]] = "expected"; - } - } - var diffkeys = m.keys(cmp); - diffkeys.sort(); - var gotkeys = []; - var expkeys = []; - while (diffkeys.length) { - var k = diffkeys.shift(); - if (k in Object.prototype) { - continue; - } - (cmp[k] == "got" ? gotkeys : expkeys).push(k); - } - - - } - - return this.testResult((!res), msg, - (msg ? [["got:", got], ["expected:", expected]] : undefined) - ); - }, - - ok: function (res, message) { - return this.testResult(res, message); - } -}; - -MochiKit.Test.__new__ = function () { - var m = MochiKit.Base; - - this.EXPORT_TAGS = { - ":common": this.EXPORT, - ":all": m.concat(this.EXPORT, this.EXPORT_OK) - }; - - m.nameFunctions(this); - -}; - -MochiKit.Test.__new__(); - -MochiKit.Base._exportSymbols(this, MochiKit.Test); diff --git a/static/MochiKit/Visual.js b/static/MochiKit/Visual.js deleted file mode 100644 index df97554..0000000 --- a/static/MochiKit/Visual.js +++ /dev/null @@ -1,2026 +0,0 @@ -/*** - -MochiKit.Visual 1.4.2 - -See for documentation, downloads, license, etc. - -(c) 2005 Bob Ippolito and others. All rights Reserved. - -***/ - -MochiKit.Base._deps('Visual', ['Base', 'DOM', 'Style', 'Color', 'Position']); - -MochiKit.Visual.NAME = "MochiKit.Visual"; -MochiKit.Visual.VERSION = "1.4.2"; - -MochiKit.Visual.__repr__ = function () { - return "[" + this.NAME + " " + this.VERSION + "]"; -}; - -MochiKit.Visual.toString = function () { - return this.__repr__(); -}; - -MochiKit.Visual._RoundCorners = function (e, options) { - e = MochiKit.DOM.getElement(e); - this._setOptions(options); - if (this.options.__unstable__wrapElement) { - e = this._doWrap(e); - } - - var color = this.options.color; - var C = MochiKit.Color.Color; - if (this.options.color === "fromElement") { - color = C.fromBackground(e); - } else if (!(color instanceof C)) { - color = C.fromString(color); - } - this.isTransparent = (color.asRGB().a <= 0); - - var bgColor = this.options.bgColor; - if (this.options.bgColor === "fromParent") { - bgColor = C.fromBackground(e.offsetParent); - } else if (!(bgColor instanceof C)) { - bgColor = C.fromString(bgColor); - } - - this._roundCornersImpl(e, color, bgColor); -}; - -MochiKit.Visual._RoundCorners.prototype = { - _doWrap: function (e) { - var parent = e.parentNode; - var doc = MochiKit.DOM.currentDocument(); - if (typeof(doc.defaultView) === "undefined" - || doc.defaultView === null) { - return e; - } - var style = doc.defaultView.getComputedStyle(e, null); - if (typeof(style) === "undefined" || style === null) { - return e; - } - var wrapper = MochiKit.DOM.DIV({"style": { - display: "block", - // convert padding to margin - marginTop: style.getPropertyValue("padding-top"), - marginRight: style.getPropertyValue("padding-right"), - marginBottom: style.getPropertyValue("padding-bottom"), - marginLeft: style.getPropertyValue("padding-left"), - // remove padding so the rounding looks right - padding: "0px" - /* - paddingRight: "0px", - paddingLeft: "0px" - */ - }}); - wrapper.innerHTML = e.innerHTML; - e.innerHTML = ""; - e.appendChild(wrapper); - return e; - }, - - _roundCornersImpl: function (e, color, bgColor) { - if (this.options.border) { - this._renderBorder(e, bgColor); - } - if (this._isTopRounded()) { - this._roundTopCorners(e, color, bgColor); - } - if (this._isBottomRounded()) { - this._roundBottomCorners(e, color, bgColor); - } - }, - - _renderBorder: function (el, bgColor) { - var borderValue = "1px solid " + this._borderColor(bgColor); - var borderL = "border-left: " + borderValue; - var borderR = "border-right: " + borderValue; - var style = "style='" + borderL + ";" + borderR + "'"; - el.innerHTML = "
" + el.innerHTML + "
"; - }, - - _roundTopCorners: function (el, color, bgColor) { - var corner = this._createCorner(bgColor); - for (var i = 0; i < this.options.numSlices; i++) { - corner.appendChild( - this._createCornerSlice(color, bgColor, i, "top") - ); - } - el.style.paddingTop = 0; - el.insertBefore(corner, el.firstChild); - }, - - _roundBottomCorners: function (el, color, bgColor) { - var corner = this._createCorner(bgColor); - for (var i = (this.options.numSlices - 1); i >= 0; i--) { - corner.appendChild( - this._createCornerSlice(color, bgColor, i, "bottom") - ); - } - el.style.paddingBottom = 0; - el.appendChild(corner); - }, - - _createCorner: function (bgColor) { - var dom = MochiKit.DOM; - return dom.DIV({style: {backgroundColor: bgColor.toString()}}); - }, - - _createCornerSlice: function (color, bgColor, n, position) { - var slice = MochiKit.DOM.SPAN(); - - var inStyle = slice.style; - inStyle.backgroundColor = color.toString(); - inStyle.display = "block"; - inStyle.height = "1px"; - inStyle.overflow = "hidden"; - inStyle.fontSize = "1px"; - - var borderColor = this._borderColor(color, bgColor); - if (this.options.border && n === 0) { - inStyle.borderTopStyle = "solid"; - inStyle.borderTopWidth = "1px"; - inStyle.borderLeftWidth = "0px"; - inStyle.borderRightWidth = "0px"; - inStyle.borderBottomWidth = "0px"; - // assumes css compliant box model - inStyle.height = "0px"; - inStyle.borderColor = borderColor.toString(); - } else if (borderColor) { - inStyle.borderColor = borderColor.toString(); - inStyle.borderStyle = "solid"; - inStyle.borderWidth = "0px 1px"; - } - - if (!this.options.compact && (n == (this.options.numSlices - 1))) { - inStyle.height = "2px"; - } - - this._setMargin(slice, n, position); - this._setBorder(slice, n, position); - - return slice; - }, - - _setOptions: function (options) { - this.options = { - corners: "all", - color: "fromElement", - bgColor: "fromParent", - blend: true, - border: false, - compact: false, - __unstable__wrapElement: false - }; - MochiKit.Base.update(this.options, options); - - this.options.numSlices = (this.options.compact ? 2 : 4); - }, - - _whichSideTop: function () { - var corners = this.options.corners; - if (this._hasString(corners, "all", "top")) { - return ""; - } - - var has_tl = (corners.indexOf("tl") != -1); - var has_tr = (corners.indexOf("tr") != -1); - if (has_tl && has_tr) { - return ""; - } - if (has_tl) { - return "left"; - } - if (has_tr) { - return "right"; - } - return ""; - }, - - _whichSideBottom: function () { - var corners = this.options.corners; - if (this._hasString(corners, "all", "bottom")) { - return ""; - } - - var has_bl = (corners.indexOf('bl') != -1); - var has_br = (corners.indexOf('br') != -1); - if (has_bl && has_br) { - return ""; - } - if (has_bl) { - return "left"; - } - if (has_br) { - return "right"; - } - return ""; - }, - - _borderColor: function (color, bgColor) { - if (color == "transparent") { - return bgColor; - } else if (this.options.border) { - return this.options.border; - } else if (this.options.blend) { - return bgColor.blendedColor(color); - } - return ""; - }, - - - _setMargin: function (el, n, corners) { - var marginSize = this._marginSize(n) + "px"; - var whichSide = ( - corners == "top" ? this._whichSideTop() : this._whichSideBottom() - ); - var style = el.style; - - if (whichSide == "left") { - style.marginLeft = marginSize; - style.marginRight = "0px"; - } else if (whichSide == "right") { - style.marginRight = marginSize; - style.marginLeft = "0px"; - } else { - style.marginLeft = marginSize; - style.marginRight = marginSize; - } - }, - - _setBorder: function (el, n, corners) { - var borderSize = this._borderSize(n) + "px"; - var whichSide = ( - corners == "top" ? this._whichSideTop() : this._whichSideBottom() - ); - - var style = el.style; - if (whichSide == "left") { - style.borderLeftWidth = borderSize; - style.borderRightWidth = "0px"; - } else if (whichSide == "right") { - style.borderRightWidth = borderSize; - style.borderLeftWidth = "0px"; - } else { - style.borderLeftWidth = borderSize; - style.borderRightWidth = borderSize; - } - }, - - _marginSize: function (n) { - if (this.isTransparent) { - return 0; - } - - var o = this.options; - if (o.compact && o.blend) { - var smBlendedMarginSizes = [1, 0]; - return smBlendedMarginSizes[n]; - } else if (o.compact) { - var compactMarginSizes = [2, 1]; - return compactMarginSizes[n]; - } else if (o.blend) { - var blendedMarginSizes = [3, 2, 1, 0]; - return blendedMarginSizes[n]; - } else { - var marginSizes = [5, 3, 2, 1]; - return marginSizes[n]; - } - }, - - _borderSize: function (n) { - var o = this.options; - var borderSizes; - if (o.compact && (o.blend || this.isTransparent)) { - return 1; - } else if (o.compact) { - borderSizes = [1, 0]; - } else if (o.blend) { - borderSizes = [2, 1, 1, 1]; - } else if (o.border) { - borderSizes = [0, 2, 0, 0]; - } else if (this.isTransparent) { - borderSizes = [5, 3, 2, 1]; - } else { - return 0; - } - return borderSizes[n]; - }, - - _hasString: function (str) { - for (var i = 1; i< arguments.length; i++) { - if (str.indexOf(arguments[i]) != -1) { - return true; - } - } - return false; - }, - - _isTopRounded: function () { - return this._hasString(this.options.corners, - "all", "top", "tl", "tr" - ); - }, - - _isBottomRounded: function () { - return this._hasString(this.options.corners, - "all", "bottom", "bl", "br" - ); - }, - - _hasSingleTextChild: function (el) { - return (el.childNodes.length == 1 && el.childNodes[0].nodeType == 3); - } -}; - -/** @id MochiKit.Visual.roundElement */ -MochiKit.Visual.roundElement = function (e, options) { - new MochiKit.Visual._RoundCorners(e, options); -}; - -/** @id MochiKit.Visual.roundClass */ -MochiKit.Visual.roundClass = function (tagName, className, options) { - var elements = MochiKit.DOM.getElementsByTagAndClassName( - tagName, className - ); - for (var i = 0; i < elements.length; i++) { - MochiKit.Visual.roundElement(elements[i], options); - } -}; - -/** @id MochiKit.Visual.tagifyText */ -MochiKit.Visual.tagifyText = function (element, /* optional */tagifyStyle) { - /*** - - Change a node text to character in tags. - - @param tagifyStyle: the style to apply to character nodes, default to - 'position: relative'. - - ***/ - tagifyStyle = tagifyStyle || 'position:relative'; - if (/MSIE/.test(navigator.userAgent)) { - tagifyStyle += ';zoom:1'; - } - element = MochiKit.DOM.getElement(element); - var ma = MochiKit.Base.map; - ma(function (child) { - if (child.nodeType == 3) { - ma(function (character) { - element.insertBefore( - MochiKit.DOM.SPAN({style: tagifyStyle}, - character == ' ' ? String.fromCharCode(160) : character), child); - }, child.nodeValue.split('')); - MochiKit.DOM.removeElement(child); - } - }, element.childNodes); -}; - -/** @id MochiKit.Visual.forceRerendering */ -MochiKit.Visual.forceRerendering = function (element) { - try { - element = MochiKit.DOM.getElement(element); - var n = document.createTextNode(' '); - element.appendChild(n); - element.removeChild(n); - } catch(e) { - } -}; - -/** @id MochiKit.Visual.multiple */ -MochiKit.Visual.multiple = function (elements, effect, /* optional */options) { - /*** - - Launch the same effect subsequently on given elements. - - ***/ - options = MochiKit.Base.update({ - speed: 0.1, delay: 0.0 - }, options); - var masterDelay = options.delay; - var index = 0; - MochiKit.Base.map(function (innerelement) { - options.delay = index * options.speed + masterDelay; - new effect(innerelement, options); - index += 1; - }, elements); -}; - -MochiKit.Visual.PAIRS = { - 'slide': ['slideDown', 'slideUp'], - 'blind': ['blindDown', 'blindUp'], - 'appear': ['appear', 'fade'], - 'size': ['grow', 'shrink'] -}; - -/** @id MochiKit.Visual.toggle */ -MochiKit.Visual.toggle = function (element, /* optional */effect, /* optional */options) { - /*** - - Toggle an item between two state depending of its visibility, making - a effect between these states. Default effect is 'appear', can be - 'slide' or 'blind'. - - ***/ - element = MochiKit.DOM.getElement(element); - effect = (effect || 'appear').toLowerCase(); - options = MochiKit.Base.update({ - queue: {position: 'end', scope: (element.id || 'global'), limit: 1} - }, options); - var v = MochiKit.Visual; - v[MochiKit.Style.getStyle(element, 'display') != 'none' ? - v.PAIRS[effect][1] : v.PAIRS[effect][0]](element, options); -}; - -/*** - -Transitions: define functions calculating variations depending of a position. - -***/ - -MochiKit.Visual.Transitions = {}; - -/** @id MochiKit.Visual.Transitions.linear */ -MochiKit.Visual.Transitions.linear = function (pos) { - return pos; -}; - -/** @id MochiKit.Visual.Transitions.sinoidal */ -MochiKit.Visual.Transitions.sinoidal = function (pos) { - return 0.5 - Math.cos(pos*Math.PI)/2; -}; - -/** @id MochiKit.Visual.Transitions.reverse */ -MochiKit.Visual.Transitions.reverse = function (pos) { - return 1 - pos; -}; - -/** @id MochiKit.Visual.Transitions.flicker */ -MochiKit.Visual.Transitions.flicker = function (pos) { - return 0.25 - Math.cos(pos*Math.PI)/4 + Math.random()/2; -}; - -/** @id MochiKit.Visual.Transitions.wobble */ -MochiKit.Visual.Transitions.wobble = function (pos) { - return 0.5 - Math.cos(9*pos*Math.PI)/2; -}; - -/** @id MochiKit.Visual.Transitions.pulse */ -MochiKit.Visual.Transitions.pulse = function (pos, pulses) { - if (pulses) { - pos *= 2 * pulses; - } else { - pos *= 10; - } - var decimals = pos - Math.floor(pos); - return (Math.floor(pos) % 2 == 0) ? decimals : 1 - decimals; -}; - -/** @id MochiKit.Visual.Transitions.parabolic */ -MochiKit.Visual.Transitions.parabolic = function (pos) { - return pos * pos; -}; - -/** @id MochiKit.Visual.Transitions.none */ -MochiKit.Visual.Transitions.none = function (pos) { - return 0; -}; - -/** @id MochiKit.Visual.Transitions.full */ -MochiKit.Visual.Transitions.full = function (pos) { - return 1; -}; - -/*** - -Core effects - -***/ - -MochiKit.Visual.ScopedQueue = function () { - var cls = arguments.callee; - if (!(this instanceof cls)) { - return new cls(); - } - this.__init__(); -}; - -MochiKit.Base.update(MochiKit.Visual.ScopedQueue.prototype, { - __init__: function () { - this.effects = []; - this.interval = null; - }, - - /** @id MochiKit.Visual.ScopedQueue.prototype.add */ - add: function (effect) { - var timestamp = new Date().getTime(); - - var position = (typeof(effect.options.queue) == 'string') ? - effect.options.queue : effect.options.queue.position; - - var ma = MochiKit.Base.map; - switch (position) { - case 'front': - // move unstarted effects after this effect - ma(function (e) { - if (e.state == 'idle') { - e.startOn += effect.finishOn; - e.finishOn += effect.finishOn; - } - }, this.effects); - break; - case 'end': - var finish; - // start effect after last queued effect has finished - ma(function (e) { - var i = e.finishOn; - if (i >= (finish || i)) { - finish = i; - } - }, this.effects); - timestamp = finish || timestamp; - break; - case 'break': - ma(function (e) { - e.finalize(); - }, this.effects); - break; - } - - effect.startOn += timestamp; - effect.finishOn += timestamp; - if (!effect.options.queue.limit || - this.effects.length < effect.options.queue.limit) { - this.effects.push(effect); - } - - if (!this.interval) { - this.interval = this.startLoop(MochiKit.Base.bind(this.loop, this), - 40); - } - }, - - /** @id MochiKit.Visual.ScopedQueue.prototype.startLoop */ - startLoop: function (func, interval) { - return setInterval(func, interval); - }, - - /** @id MochiKit.Visual.ScopedQueue.prototype.remove */ - remove: function (effect) { - this.effects = MochiKit.Base.filter(function (e) { - return e != effect; - }, this.effects); - if (!this.effects.length) { - this.stopLoop(this.interval); - this.interval = null; - } - }, - - /** @id MochiKit.Visual.ScopedQueue.prototype.stopLoop */ - stopLoop: function (interval) { - clearInterval(interval); - }, - - /** @id MochiKit.Visual.ScopedQueue.prototype.loop */ - loop: function () { - var timePos = new Date().getTime(); - MochiKit.Base.map(function (effect) { - effect.loop(timePos); - }, this.effects); - } -}); - -MochiKit.Visual.Queues = { - instances: {}, - - get: function (queueName) { - if (typeof(queueName) != 'string') { - return queueName; - } - - if (!this.instances[queueName]) { - this.instances[queueName] = new MochiKit.Visual.ScopedQueue(); - } - return this.instances[queueName]; - } -}; - -MochiKit.Visual.Queue = MochiKit.Visual.Queues.get('global'); - -MochiKit.Visual.DefaultOptions = { - transition: MochiKit.Visual.Transitions.sinoidal, - duration: 1.0, // seconds - fps: 25.0, // max. 25fps due to MochiKit.Visual.Queue implementation - sync: false, // true for combining - from: 0.0, - to: 1.0, - delay: 0.0, - queue: 'parallel' -}; - -MochiKit.Visual.Base = function () {}; - -MochiKit.Visual.Base.prototype = { - /*** - - Basic class for all Effects. Define a looping mechanism called for each step - of an effect. Don't instantiate it, only subclass it. - - ***/ - - __class__ : MochiKit.Visual.Base, - - /** @id MochiKit.Visual.Base.prototype.start */ - start: function (options) { - var v = MochiKit.Visual; - this.options = MochiKit.Base.setdefault(options, - v.DefaultOptions); - this.currentFrame = 0; - this.state = 'idle'; - this.startOn = this.options.delay*1000; - this.finishOn = this.startOn + (this.options.duration*1000); - this.event('beforeStart'); - if (!this.options.sync) { - v.Queues.get(typeof(this.options.queue) == 'string' ? - 'global' : this.options.queue.scope).add(this); - } - }, - - /** @id MochiKit.Visual.Base.prototype.loop */ - loop: function (timePos) { - if (timePos >= this.startOn) { - if (timePos >= this.finishOn) { - return this.finalize(); - } - var pos = (timePos - this.startOn) / (this.finishOn - this.startOn); - var frame = - Math.round(pos * this.options.fps * this.options.duration); - if (frame > this.currentFrame) { - this.render(pos); - this.currentFrame = frame; - } - } - }, - - /** @id MochiKit.Visual.Base.prototype.render */ - render: function (pos) { - if (this.state == 'idle') { - this.state = 'running'; - this.event('beforeSetup'); - this.setup(); - this.event('afterSetup'); - } - if (this.state == 'running') { - if (this.options.transition) { - pos = this.options.transition(pos); - } - pos *= (this.options.to - this.options.from); - pos += this.options.from; - this.event('beforeUpdate'); - this.update(pos); - this.event('afterUpdate'); - } - }, - - /** @id MochiKit.Visual.Base.prototype.cancel */ - cancel: function () { - if (!this.options.sync) { - MochiKit.Visual.Queues.get(typeof(this.options.queue) == 'string' ? - 'global' : this.options.queue.scope).remove(this); - } - this.state = 'finished'; - }, - - /** @id MochiKit.Visual.Base.prototype.finalize */ - finalize: function () { - this.render(1.0); - this.cancel(); - this.event('beforeFinish'); - this.finish(); - this.event('afterFinish'); - }, - - setup: function () { - }, - - finish: function () { - }, - - update: function (position) { - }, - - /** @id MochiKit.Visual.Base.prototype.event */ - event: function (eventName) { - if (this.options[eventName + 'Internal']) { - this.options[eventName + 'Internal'](this); - } - if (this.options[eventName]) { - this.options[eventName](this); - } - }, - - /** @id MochiKit.Visual.Base.prototype.repr */ - repr: function () { - return '[' + this.__class__.NAME + ', options:' + - MochiKit.Base.repr(this.options) + ']'; - } -}; - -/** @id MochiKit.Visual.Parallel */ -MochiKit.Visual.Parallel = function (effects, options) { - var cls = arguments.callee; - if (!(this instanceof cls)) { - return new cls(effects, options); - } - - this.__init__(effects, options); -}; - -MochiKit.Visual.Parallel.prototype = new MochiKit.Visual.Base(); - -MochiKit.Base.update(MochiKit.Visual.Parallel.prototype, { - /*** - - Run multiple effects at the same time. - - ***/ - - __class__ : MochiKit.Visual.Parallel, - - __init__: function (effects, options) { - this.effects = effects || []; - this.start(options); - }, - - /** @id MochiKit.Visual.Parallel.prototype.update */ - update: function (position) { - MochiKit.Base.map(function (effect) { - effect.render(position); - }, this.effects); - }, - - /** @id MochiKit.Visual.Parallel.prototype.finish */ - finish: function () { - MochiKit.Base.map(function (effect) { - effect.finalize(); - }, this.effects); - } -}); - -/** @id MochiKit.Visual.Sequence */ -MochiKit.Visual.Sequence = function (effects, options) { - var cls = arguments.callee; - if (!(this instanceof cls)) { - return new cls(effects, options); - } - this.__init__(effects, options); -}; - -MochiKit.Visual.Sequence.prototype = new MochiKit.Visual.Base(); - -MochiKit.Base.update(MochiKit.Visual.Sequence.prototype, { - - __class__ : MochiKit.Visual.Sequence, - - __init__: function (effects, options) { - var defs = { transition: MochiKit.Visual.Transitions.linear, - duration: 0 }; - this.effects = effects || []; - MochiKit.Base.map(function (effect) { - defs.duration += effect.options.duration; - }, this.effects); - MochiKit.Base.setdefault(options, defs); - this.start(options); - }, - - /** @id MochiKit.Visual.Sequence.prototype.update */ - update: function (position) { - var time = position * this.options.duration; - for (var i = 0; i < this.effects.length; i++) { - var effect = this.effects[i]; - if (time <= effect.options.duration) { - effect.render(time / effect.options.duration); - break; - } else { - time -= effect.options.duration; - } - } - }, - - /** @id MochiKit.Visual.Sequence.prototype.finish */ - finish: function () { - MochiKit.Base.map(function (effect) { - effect.finalize(); - }, this.effects); - } -}); - -/** @id MochiKit.Visual.Opacity */ -MochiKit.Visual.Opacity = function (element, options) { - var cls = arguments.callee; - if (!(this instanceof cls)) { - return new cls(element, options); - } - this.__init__(element, options); -}; - -MochiKit.Visual.Opacity.prototype = new MochiKit.Visual.Base(); - -MochiKit.Base.update(MochiKit.Visual.Opacity.prototype, { - /*** - - Change the opacity of an element. - - @param options: 'from' and 'to' change the starting and ending opacities. - Must be between 0.0 and 1.0. Default to current opacity and 1.0. - - ***/ - - __class__ : MochiKit.Visual.Opacity, - - __init__: function (element, /* optional */options) { - var b = MochiKit.Base; - var s = MochiKit.Style; - this.element = MochiKit.DOM.getElement(element); - // make this work on IE on elements without 'layout' - if (this.element.currentStyle && - (!this.element.currentStyle.hasLayout)) { - s.setStyle(this.element, {zoom: 1}); - } - options = b.update({ - from: s.getStyle(this.element, 'opacity') || 0.0, - to: 1.0 - }, options); - this.start(options); - }, - - /** @id MochiKit.Visual.Opacity.prototype.update */ - update: function (position) { - MochiKit.Style.setStyle(this.element, {'opacity': position}); - } -}); - -/** @id MochiKit.Visual.Move.prototype */ -MochiKit.Visual.Move = function (element, options) { - var cls = arguments.callee; - if (!(this instanceof cls)) { - return new cls(element, options); - } - this.__init__(element, options); -}; - -MochiKit.Visual.Move.prototype = new MochiKit.Visual.Base(); - -MochiKit.Base.update(MochiKit.Visual.Move.prototype, { - /*** - - Move an element between its current position to a defined position - - @param options: 'x' and 'y' for final positions, default to 0, 0. - - ***/ - - __class__ : MochiKit.Visual.Move, - - __init__: function (element, /* optional */options) { - this.element = MochiKit.DOM.getElement(element); - options = MochiKit.Base.update({ - x: 0, - y: 0, - mode: 'relative' - }, options); - this.start(options); - }, - - /** @id MochiKit.Visual.Move.prototype.setup */ - setup: function () { - // Bug in Opera: Opera returns the 'real' position of a static element - // or relative element that does not have top/left explicitly set. - // ==> Always set top and left for position relative elements in your - // stylesheets (to 0 if you do not need them) - MochiKit.Style.makePositioned(this.element); - - var s = this.element.style; - var originalVisibility = s.visibility; - var originalDisplay = s.display; - if (originalDisplay == 'none') { - s.visibility = 'hidden'; - s.display = ''; - } - - this.originalLeft = parseFloat(MochiKit.Style.getStyle(this.element, 'left') || '0'); - this.originalTop = parseFloat(MochiKit.Style.getStyle(this.element, 'top') || '0'); - - if (this.options.mode == 'absolute') { - // absolute movement, so we need to calc deltaX and deltaY - this.options.x -= this.originalLeft; - this.options.y -= this.originalTop; - } - if (originalDisplay == 'none') { - s.visibility = originalVisibility; - s.display = originalDisplay; - } - }, - - /** @id MochiKit.Visual.Move.prototype.update */ - update: function (position) { - MochiKit.Style.setStyle(this.element, { - left: Math.round(this.options.x * position + this.originalLeft) + 'px', - top: Math.round(this.options.y * position + this.originalTop) + 'px' - }); - } -}); - -/** @id MochiKit.Visual.Scale */ -MochiKit.Visual.Scale = function (element, percent, options) { - var cls = arguments.callee; - if (!(this instanceof cls)) { - return new cls(element, percent, options); - } - this.__init__(element, percent, options); -}; - -MochiKit.Visual.Scale.prototype = new MochiKit.Visual.Base(); - -MochiKit.Base.update(MochiKit.Visual.Scale.prototype, { - /*** - - Change the size of an element. - - @param percent: final_size = percent*original_size - - @param options: several options changing scale behaviour - - ***/ - - __class__ : MochiKit.Visual.Scale, - - __init__: function (element, percent, /* optional */options) { - this.element = MochiKit.DOM.getElement(element); - options = MochiKit.Base.update({ - scaleX: true, - scaleY: true, - scaleContent: true, - scaleFromCenter: false, - scaleMode: 'box', // 'box' or 'contents' or {} with provided values - scaleFrom: 100.0, - scaleTo: percent - }, options); - this.start(options); - }, - - /** @id MochiKit.Visual.Scale.prototype.setup */ - setup: function () { - this.restoreAfterFinish = this.options.restoreAfterFinish || false; - this.elementPositioning = MochiKit.Style.getStyle(this.element, - 'position'); - - var ma = MochiKit.Base.map; - var b = MochiKit.Base.bind; - this.originalStyle = {}; - ma(b(function (k) { - this.originalStyle[k] = this.element.style[k]; - }, this), ['top', 'left', 'width', 'height', 'fontSize']); - - this.originalTop = this.element.offsetTop; - this.originalLeft = this.element.offsetLeft; - - var fontSize = MochiKit.Style.getStyle(this.element, - 'font-size') || '100%'; - ma(b(function (fontSizeType) { - if (fontSize.indexOf(fontSizeType) > 0) { - this.fontSize = parseFloat(fontSize); - this.fontSizeType = fontSizeType; - } - }, this), ['em', 'px', '%']); - - this.factor = (this.options.scaleTo - this.options.scaleFrom)/100; - - if (/^content/.test(this.options.scaleMode)) { - this.dims = [this.element.scrollHeight, this.element.scrollWidth]; - } else if (this.options.scaleMode == 'box') { - this.dims = [this.element.offsetHeight, this.element.offsetWidth]; - } else { - this.dims = [this.options.scaleMode.originalHeight, - this.options.scaleMode.originalWidth]; - } - }, - - /** @id MochiKit.Visual.Scale.prototype.update */ - update: function (position) { - var currentScale = (this.options.scaleFrom/100.0) + - (this.factor * position); - if (this.options.scaleContent && this.fontSize) { - MochiKit.Style.setStyle(this.element, { - fontSize: this.fontSize * currentScale + this.fontSizeType - }); - } - this.setDimensions(this.dims[0] * currentScale, - this.dims[1] * currentScale); - }, - - /** @id MochiKit.Visual.Scale.prototype.finish */ - finish: function () { - if (this.restoreAfterFinish) { - MochiKit.Style.setStyle(this.element, this.originalStyle); - } - }, - - /** @id MochiKit.Visual.Scale.prototype.setDimensions */ - setDimensions: function (height, width) { - var d = {}; - var r = Math.round; - if (/MSIE/.test(navigator.userAgent)) { - r = Math.ceil; - } - if (this.options.scaleX) { - d.width = r(width) + 'px'; - } - if (this.options.scaleY) { - d.height = r(height) + 'px'; - } - if (this.options.scaleFromCenter) { - var topd = (height - this.dims[0])/2; - var leftd = (width - this.dims[1])/2; - if (this.elementPositioning == 'absolute') { - if (this.options.scaleY) { - d.top = this.originalTop - topd + 'px'; - } - if (this.options.scaleX) { - d.left = this.originalLeft - leftd + 'px'; - } - } else { - if (this.options.scaleY) { - d.top = -topd + 'px'; - } - if (this.options.scaleX) { - d.left = -leftd + 'px'; - } - } - } - MochiKit.Style.setStyle(this.element, d); - } -}); - -/** @id MochiKit.Visual.Highlight */ -MochiKit.Visual.Highlight = function (element, options) { - var cls = arguments.callee; - if (!(this instanceof cls)) { - return new cls(element, options); - } - this.__init__(element, options); -}; - -MochiKit.Visual.Highlight.prototype = new MochiKit.Visual.Base(); - -MochiKit.Base.update(MochiKit.Visual.Highlight.prototype, { - /*** - - Highlight an item of the page. - - @param options: 'startcolor' for choosing highlighting color, default - to '#ffff99'. - - ***/ - - __class__ : MochiKit.Visual.Highlight, - - __init__: function (element, /* optional */options) { - this.element = MochiKit.DOM.getElement(element); - options = MochiKit.Base.update({ - startcolor: '#ffff99' - }, options); - this.start(options); - }, - - /** @id MochiKit.Visual.Highlight.prototype.setup */ - setup: function () { - var b = MochiKit.Base; - var s = MochiKit.Style; - // Prevent executing on elements not in the layout flow - if (s.getStyle(this.element, 'display') == 'none') { - this.cancel(); - return; - } - // Disable background image during the effect - this.oldStyle = { - backgroundImage: s.getStyle(this.element, 'background-image') - }; - s.setStyle(this.element, { - backgroundImage: 'none' - }); - - if (!this.options.endcolor) { - this.options.endcolor = - MochiKit.Color.Color.fromBackground(this.element).toHexString(); - } - if (b.isUndefinedOrNull(this.options.restorecolor)) { - this.options.restorecolor = s.getStyle(this.element, - 'background-color'); - } - // init color calculations - this._base = b.map(b.bind(function (i) { - return parseInt( - this.options.startcolor.slice(i*2 + 1, i*2 + 3), 16); - }, this), [0, 1, 2]); - this._delta = b.map(b.bind(function (i) { - return parseInt(this.options.endcolor.slice(i*2 + 1, i*2 + 3), 16) - - this._base[i]; - }, this), [0, 1, 2]); - }, - - /** @id MochiKit.Visual.Highlight.prototype.update */ - update: function (position) { - var m = '#'; - MochiKit.Base.map(MochiKit.Base.bind(function (i) { - m += MochiKit.Color.toColorPart(Math.round(this._base[i] + - this._delta[i]*position)); - }, this), [0, 1, 2]); - MochiKit.Style.setStyle(this.element, { - backgroundColor: m - }); - }, - - /** @id MochiKit.Visual.Highlight.prototype.finish */ - finish: function () { - MochiKit.Style.setStyle(this.element, - MochiKit.Base.update(this.oldStyle, { - backgroundColor: this.options.restorecolor - })); - } -}); - -/** @id MochiKit.Visual.ScrollTo */ -MochiKit.Visual.ScrollTo = function (element, options) { - var cls = arguments.callee; - if (!(this instanceof cls)) { - return new cls(element, options); - } - this.__init__(element, options); -}; - -MochiKit.Visual.ScrollTo.prototype = new MochiKit.Visual.Base(); - -MochiKit.Base.update(MochiKit.Visual.ScrollTo.prototype, { - /*** - - Scroll to an element in the page. - - ***/ - - __class__ : MochiKit.Visual.ScrollTo, - - __init__: function (element, /* optional */options) { - this.element = MochiKit.DOM.getElement(element); - this.start(options); - }, - - /** @id MochiKit.Visual.ScrollTo.prototype.setup */ - setup: function () { - var p = MochiKit.Position; - p.prepare(); - var offsets = p.cumulativeOffset(this.element); - if (this.options.offset) { - offsets.y += this.options.offset; - } - var max; - if (window.innerHeight) { - max = window.innerHeight - window.height; - } else if (document.documentElement && - document.documentElement.clientHeight) { - max = document.documentElement.clientHeight - - document.body.scrollHeight; - } else if (document.body) { - max = document.body.clientHeight - document.body.scrollHeight; - } - this.scrollStart = p.windowOffset.y; - this.delta = (offsets.y > max ? max : offsets.y) - this.scrollStart; - }, - - /** @id MochiKit.Visual.ScrollTo.prototype.update */ - update: function (position) { - var p = MochiKit.Position; - p.prepare(); - window.scrollTo(p.windowOffset.x, this.scrollStart + (position * this.delta)); - } -}); - -MochiKit.Visual.CSS_LENGTH = /^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/; - -MochiKit.Visual.Morph = function (element, options) { - var cls = arguments.callee; - if (!(this instanceof cls)) { - return new cls(element, options); - } - this.__init__(element, options); -}; - -MochiKit.Visual.Morph.prototype = new MochiKit.Visual.Base(); - -MochiKit.Base.update(MochiKit.Visual.Morph.prototype, { - /*** - - Morph effect: make a transformation from current style to the given style, - automatically making a transition between the two. - - ***/ - - __class__ : MochiKit.Visual.Morph, - - __init__: function (element, /* optional */options) { - this.element = MochiKit.DOM.getElement(element); - this.start(options); - }, - - /** @id MochiKit.Visual.Morph.prototype.setup */ - setup: function () { - var b = MochiKit.Base; - var style = this.options.style; - this.styleStart = {}; - this.styleEnd = {}; - this.units = {}; - var value, unit; - for (var s in style) { - value = style[s]; - s = b.camelize(s); - if (MochiKit.Visual.CSS_LENGTH.test(value)) { - var components = value.match(/^([\+\-]?[0-9\.]+)(.*)$/); - value = parseFloat(components[1]); - unit = (components.length == 3) ? components[2] : null; - this.styleEnd[s] = value; - this.units[s] = unit; - value = MochiKit.Style.getStyle(this.element, s); - components = value.match(/^([\+\-]?[0-9\.]+)(.*)$/); - value = parseFloat(components[1]); - this.styleStart[s] = value; - } else if (/[Cc]olor$/.test(s)) { - var c = MochiKit.Color.Color; - value = c.fromString(value); - if (value) { - this.units[s] = "color"; - this.styleEnd[s] = value.toHexString(); - value = MochiKit.Style.getStyle(this.element, s); - this.styleStart[s] = c.fromString(value).toHexString(); - - this.styleStart[s] = b.map(b.bind(function (i) { - return parseInt( - this.styleStart[s].slice(i*2 + 1, i*2 + 3), 16); - }, this), [0, 1, 2]); - this.styleEnd[s] = b.map(b.bind(function (i) { - return parseInt( - this.styleEnd[s].slice(i*2 + 1, i*2 + 3), 16); - }, this), [0, 1, 2]); - } - } else { - // For non-length & non-color properties, we just set the value - this.element.style[s] = value; - } - } - }, - - /** @id MochiKit.Visual.Morph.prototype.update */ - update: function (position) { - var value; - for (var s in this.styleStart) { - if (this.units[s] == "color") { - var m = '#'; - var start = this.styleStart[s]; - var end = this.styleEnd[s]; - MochiKit.Base.map(MochiKit.Base.bind(function (i) { - m += MochiKit.Color.toColorPart(Math.round(start[i] + - (end[i] - start[i])*position)); - }, this), [0, 1, 2]); - this.element.style[s] = m; - } else { - value = this.styleStart[s] + Math.round((this.styleEnd[s] - this.styleStart[s]) * position * 1000) / 1000 + this.units[s]; - this.element.style[s] = value; - } - } - } -}); - -/*** - -Combination effects. - -***/ - -/** @id MochiKit.Visual.fade */ -MochiKit.Visual.fade = function (element, /* optional */ options) { - /*** - - Fade a given element: change its opacity and hide it in the end. - - @param options: 'to' and 'from' to change opacity. - - ***/ - var s = MochiKit.Style; - var oldOpacity = s.getStyle(element, 'opacity'); - options = MochiKit.Base.update({ - from: s.getStyle(element, 'opacity') || 1.0, - to: 0.0, - afterFinishInternal: function (effect) { - if (effect.options.to !== 0) { - return; - } - s.hideElement(effect.element); - s.setStyle(effect.element, {'opacity': oldOpacity}); - } - }, options); - return new MochiKit.Visual.Opacity(element, options); -}; - -/** @id MochiKit.Visual.appear */ -MochiKit.Visual.appear = function (element, /* optional */ options) { - /*** - - Make an element appear. - - @param options: 'to' and 'from' to change opacity. - - ***/ - var s = MochiKit.Style; - var v = MochiKit.Visual; - options = MochiKit.Base.update({ - from: (s.getStyle(element, 'display') == 'none' ? 0.0 : - s.getStyle(element, 'opacity') || 0.0), - to: 1.0, - // force Safari to render floated elements properly - afterFinishInternal: function (effect) { - v.forceRerendering(effect.element); - }, - beforeSetupInternal: function (effect) { - s.setStyle(effect.element, {'opacity': effect.options.from}); - s.showElement(effect.element); - } - }, options); - return new v.Opacity(element, options); -}; - -/** @id MochiKit.Visual.puff */ -MochiKit.Visual.puff = function (element, /* optional */ options) { - /*** - - 'Puff' an element: grow it to double size, fading it and make it hidden. - - ***/ - var s = MochiKit.Style; - var v = MochiKit.Visual; - element = MochiKit.DOM.getElement(element); - var elementDimensions = MochiKit.Style.getElementDimensions(element, true); - var oldStyle = { - position: s.getStyle(element, 'position'), - top: element.style.top, - left: element.style.left, - width: element.style.width, - height: element.style.height, - opacity: s.getStyle(element, 'opacity') - }; - options = MochiKit.Base.update({ - beforeSetupInternal: function (effect) { - MochiKit.Position.absolutize(effect.effects[0].element); - }, - afterFinishInternal: function (effect) { - s.hideElement(effect.effects[0].element); - s.setStyle(effect.effects[0].element, oldStyle); - }, - scaleContent: true, - scaleFromCenter: true - }, options); - return new v.Parallel( - [new v.Scale(element, 200, - {sync: true, scaleFromCenter: options.scaleFromCenter, - scaleMode: {originalHeight: elementDimensions.h, - originalWidth: elementDimensions.w}, - scaleContent: options.scaleContent, restoreAfterFinish: true}), - new v.Opacity(element, {sync: true, to: 0.0 })], - options); -}; - -/** @id MochiKit.Visual.blindUp */ -MochiKit.Visual.blindUp = function (element, /* optional */ options) { - /*** - - Blind an element up: change its vertical size to 0. - - ***/ - var d = MochiKit.DOM; - var s = MochiKit.Style; - element = d.getElement(element); - var elementDimensions = s.getElementDimensions(element, true); - var elemClip = s.makeClipping(element); - options = MochiKit.Base.update({ - scaleContent: false, - scaleX: false, - scaleMode: {originalHeight: elementDimensions.h, - originalWidth: elementDimensions.w}, - restoreAfterFinish: true, - afterFinishInternal: function (effect) { - s.hideElement(effect.element); - s.undoClipping(effect.element, elemClip); - } - }, options); - return new MochiKit.Visual.Scale(element, 0, options); -}; - -/** @id MochiKit.Visual.blindDown */ -MochiKit.Visual.blindDown = function (element, /* optional */ options) { - /*** - - Blind an element down: restore its vertical size. - - ***/ - var d = MochiKit.DOM; - var s = MochiKit.Style; - element = d.getElement(element); - var elementDimensions = s.getElementDimensions(element, true); - var elemClip; - options = MochiKit.Base.update({ - scaleContent: false, - scaleX: false, - scaleFrom: 0, - scaleMode: {originalHeight: elementDimensions.h, - originalWidth: elementDimensions.w}, - restoreAfterFinish: true, - afterSetupInternal: function (effect) { - elemClip = s.makeClipping(effect.element); - s.setStyle(effect.element, {height: '0px'}); - s.showElement(effect.element); - }, - afterFinishInternal: function (effect) { - s.undoClipping(effect.element, elemClip); - } - }, options); - return new MochiKit.Visual.Scale(element, 100, options); -}; - -/** @id MochiKit.Visual.switchOff */ -MochiKit.Visual.switchOff = function (element, /* optional */ options) { - /*** - - Apply a switch-off-like effect. - - ***/ - var d = MochiKit.DOM; - var s = MochiKit.Style; - element = d.getElement(element); - var elementDimensions = s.getElementDimensions(element, true); - var oldOpacity = s.getStyle(element, 'opacity'); - var elemClip; - options = MochiKit.Base.update({ - duration: 0.7, - restoreAfterFinish: true, - beforeSetupInternal: function (effect) { - s.makePositioned(element); - elemClip = s.makeClipping(element); - }, - afterFinishInternal: function (effect) { - s.hideElement(element); - s.undoClipping(element, elemClip); - s.undoPositioned(element); - s.setStyle(element, {'opacity': oldOpacity}); - } - }, options); - var v = MochiKit.Visual; - return new v.Sequence( - [new v.appear(element, - { sync: true, duration: 0.57 * options.duration, - from: 0, transition: v.Transitions.flicker }), - new v.Scale(element, 1, - { sync: true, duration: 0.43 * options.duration, - scaleFromCenter: true, scaleX: false, - scaleMode: {originalHeight: elementDimensions.h, - originalWidth: elementDimensions.w}, - scaleContent: false, restoreAfterFinish: true })], - options); -}; - -/** @id MochiKit.Visual.dropOut */ -MochiKit.Visual.dropOut = function (element, /* optional */ options) { - /*** - - Make an element fall and disappear. - - ***/ - var d = MochiKit.DOM; - var s = MochiKit.Style; - element = d.getElement(element); - var oldStyle = { - top: s.getStyle(element, 'top'), - left: s.getStyle(element, 'left'), - opacity: s.getStyle(element, 'opacity') - }; - - options = MochiKit.Base.update({ - duration: 0.5, - distance: 100, - beforeSetupInternal: function (effect) { - s.makePositioned(effect.effects[0].element); - }, - afterFinishInternal: function (effect) { - s.hideElement(effect.effects[0].element); - s.undoPositioned(effect.effects[0].element); - s.setStyle(effect.effects[0].element, oldStyle); - } - }, options); - var v = MochiKit.Visual; - return new v.Parallel( - [new v.Move(element, {x: 0, y: options.distance, sync: true}), - new v.Opacity(element, {sync: true, to: 0.0})], - options); -}; - -/** @id MochiKit.Visual.shake */ -MochiKit.Visual.shake = function (element, /* optional */ options) { - /*** - - Move an element from left to right several times. - - ***/ - var d = MochiKit.DOM; - var v = MochiKit.Visual; - var s = MochiKit.Style; - element = d.getElement(element); - var oldStyle = { - top: s.getStyle(element, 'top'), - left: s.getStyle(element, 'left') - }; - options = MochiKit.Base.update({ - duration: 0.5, - afterFinishInternal: function (effect) { - s.undoPositioned(element); - s.setStyle(element, oldStyle); - } - }, options); - return new v.Sequence( - [new v.Move(element, { sync: true, duration: 0.1 * options.duration, - x: 20, y: 0 }), - new v.Move(element, { sync: true, duration: 0.2 * options.duration, - x: -40, y: 0 }), - new v.Move(element, { sync: true, duration: 0.2 * options.duration, - x: 40, y: 0 }), - new v.Move(element, { sync: true, duration: 0.2 * options.duration, - x: -40, y: 0 }), - new v.Move(element, { sync: true, duration: 0.2 * options.duration, - x: 40, y: 0 }), - new v.Move(element, { sync: true, duration: 0.1 * options.duration, - x: -20, y: 0 })], - options); -}; - -/** @id MochiKit.Visual.slideDown */ -MochiKit.Visual.slideDown = function (element, /* optional */ options) { - /*** - - Slide an element down. - It needs to have the content of the element wrapped in a container - element with fixed height. - - ***/ - var d = MochiKit.DOM; - var b = MochiKit.Base; - var s = MochiKit.Style; - element = d.getElement(element); - if (!element.firstChild) { - throw new Error("MochiKit.Visual.slideDown must be used on a element with a child"); - } - d.removeEmptyTextNodes(element); - var oldInnerBottom = s.getStyle(element.firstChild, 'bottom') || 0; - var elementDimensions = s.getElementDimensions(element, true); - var elemClip; - options = b.update({ - scaleContent: false, - scaleX: false, - scaleFrom: 0, - scaleMode: {originalHeight: elementDimensions.h, - originalWidth: elementDimensions.w}, - restoreAfterFinish: true, - afterSetupInternal: function (effect) { - s.makePositioned(effect.element); - s.makePositioned(effect.element.firstChild); - if (/Opera/.test(navigator.userAgent)) { - s.setStyle(effect.element, {top: ''}); - } - elemClip = s.makeClipping(effect.element); - s.setStyle(effect.element, {height: '0px'}); - s.showElement(effect.element); - }, - afterUpdateInternal: function (effect) { - var elementDimensions = s.getElementDimensions(effect.element, true); - s.setStyle(effect.element.firstChild, - {bottom: (effect.dims[0] - elementDimensions.h) + 'px'}); - }, - afterFinishInternal: function (effect) { - s.undoClipping(effect.element, elemClip); - // IE will crash if child is undoPositioned first - if (/MSIE/.test(navigator.userAgent)) { - s.undoPositioned(effect.element); - s.undoPositioned(effect.element.firstChild); - } else { - s.undoPositioned(effect.element.firstChild); - s.undoPositioned(effect.element); - } - s.setStyle(effect.element.firstChild, {bottom: oldInnerBottom}); - } - }, options); - - return new MochiKit.Visual.Scale(element, 100, options); -}; - -/** @id MochiKit.Visual.slideUp */ -MochiKit.Visual.slideUp = function (element, /* optional */ options) { - /*** - - Slide an element up. - It needs to have the content of the element wrapped in a container - element with fixed height. - - ***/ - var d = MochiKit.DOM; - var b = MochiKit.Base; - var s = MochiKit.Style; - element = d.getElement(element); - if (!element.firstChild) { - throw new Error("MochiKit.Visual.slideUp must be used on a element with a child"); - } - d.removeEmptyTextNodes(element); - var oldInnerBottom = s.getStyle(element.firstChild, 'bottom'); - var elementDimensions = s.getElementDimensions(element, true); - var elemClip; - options = b.update({ - scaleContent: false, - scaleX: false, - scaleMode: {originalHeight: elementDimensions.h, - originalWidth: elementDimensions.w}, - scaleFrom: 100, - restoreAfterFinish: true, - beforeStartInternal: function (effect) { - s.makePositioned(effect.element); - s.makePositioned(effect.element.firstChild); - if (/Opera/.test(navigator.userAgent)) { - s.setStyle(effect.element, {top: ''}); - } - elemClip = s.makeClipping(effect.element); - s.showElement(effect.element); - }, - afterUpdateInternal: function (effect) { - var elementDimensions = s.getElementDimensions(effect.element, true); - s.setStyle(effect.element.firstChild, - {bottom: (effect.dims[0] - elementDimensions.h) + 'px'}); - }, - afterFinishInternal: function (effect) { - s.hideElement(effect.element); - s.undoClipping(effect.element, elemClip); - s.undoPositioned(effect.element.firstChild); - s.undoPositioned(effect.element); - s.setStyle(effect.element.firstChild, {bottom: oldInnerBottom}); - } - }, options); - return new MochiKit.Visual.Scale(element, 0, options); -}; - -// Bug in opera makes the TD containing this element expand for a instance -// after finish -/** @id MochiKit.Visual.squish */ -MochiKit.Visual.squish = function (element, /* optional */ options) { - /*** - - Reduce an element and make it disappear. - - ***/ - var d = MochiKit.DOM; - var b = MochiKit.Base; - var s = MochiKit.Style; - var elementDimensions = s.getElementDimensions(element, true); - var elemClip; - options = b.update({ - restoreAfterFinish: true, - scaleMode: {originalHeight: elementDimensions.w, - originalWidth: elementDimensions.h}, - beforeSetupInternal: function (effect) { - elemClip = s.makeClipping(effect.element); - }, - afterFinishInternal: function (effect) { - s.hideElement(effect.element); - s.undoClipping(effect.element, elemClip); - } - }, options); - - return new MochiKit.Visual.Scale(element, /Opera/.test(navigator.userAgent) ? 1 : 0, options); -}; - -/** @id MochiKit.Visual.grow */ -MochiKit.Visual.grow = function (element, /* optional */ options) { - /*** - - Grow an element to its original size. Make it zero-sized before - if necessary. - - ***/ - var d = MochiKit.DOM; - var v = MochiKit.Visual; - var s = MochiKit.Style; - element = d.getElement(element); - options = MochiKit.Base.update({ - direction: 'center', - moveTransition: v.Transitions.sinoidal, - scaleTransition: v.Transitions.sinoidal, - opacityTransition: v.Transitions.full, - scaleContent: true, - scaleFromCenter: false - }, options); - var oldStyle = { - top: element.style.top, - left: element.style.left, - height: element.style.height, - width: element.style.width, - opacity: s.getStyle(element, 'opacity') - }; - var dims = s.getElementDimensions(element, true); - var initialMoveX, initialMoveY; - var moveX, moveY; - - switch (options.direction) { - case 'top-left': - initialMoveX = initialMoveY = moveX = moveY = 0; - break; - case 'top-right': - initialMoveX = dims.w; - initialMoveY = moveY = 0; - moveX = -dims.w; - break; - case 'bottom-left': - initialMoveX = moveX = 0; - initialMoveY = dims.h; - moveY = -dims.h; - break; - case 'bottom-right': - initialMoveX = dims.w; - initialMoveY = dims.h; - moveX = -dims.w; - moveY = -dims.h; - break; - case 'center': - initialMoveX = dims.w / 2; - initialMoveY = dims.h / 2; - moveX = -dims.w / 2; - moveY = -dims.h / 2; - break; - } - - var optionsParallel = MochiKit.Base.update({ - beforeSetupInternal: function (effect) { - s.setStyle(effect.effects[0].element, {height: '0px'}); - s.showElement(effect.effects[0].element); - }, - afterFinishInternal: function (effect) { - s.undoClipping(effect.effects[0].element); - s.undoPositioned(effect.effects[0].element); - s.setStyle(effect.effects[0].element, oldStyle); - } - }, options); - - return new v.Move(element, { - x: initialMoveX, - y: initialMoveY, - duration: 0.01, - beforeSetupInternal: function (effect) { - s.hideElement(effect.element); - s.makeClipping(effect.element); - s.makePositioned(effect.element); - }, - afterFinishInternal: function (effect) { - new v.Parallel( - [new v.Opacity(effect.element, { - sync: true, to: 1.0, from: 0.0, - transition: options.opacityTransition - }), - new v.Move(effect.element, { - x: moveX, y: moveY, sync: true, - transition: options.moveTransition - }), - new v.Scale(effect.element, 100, { - scaleMode: {originalHeight: dims.h, - originalWidth: dims.w}, - sync: true, - scaleFrom: /Opera/.test(navigator.userAgent) ? 1 : 0, - transition: options.scaleTransition, - scaleContent: options.scaleContent, - scaleFromCenter: options.scaleFromCenter, - restoreAfterFinish: true - }) - ], optionsParallel - ); - } - }); -}; - -/** @id MochiKit.Visual.shrink */ -MochiKit.Visual.shrink = function (element, /* optional */ options) { - /*** - - Shrink an element and make it disappear. - - ***/ - var d = MochiKit.DOM; - var v = MochiKit.Visual; - var s = MochiKit.Style; - element = d.getElement(element); - options = MochiKit.Base.update({ - direction: 'center', - moveTransition: v.Transitions.sinoidal, - scaleTransition: v.Transitions.sinoidal, - opacityTransition: v.Transitions.none, - scaleContent: true, - scaleFromCenter: false - }, options); - var oldStyle = { - top: element.style.top, - left: element.style.left, - height: element.style.height, - width: element.style.width, - opacity: s.getStyle(element, 'opacity') - }; - - var dims = s.getElementDimensions(element, true); - var moveX, moveY; - - switch (options.direction) { - case 'top-left': - moveX = moveY = 0; - break; - case 'top-right': - moveX = dims.w; - moveY = 0; - break; - case 'bottom-left': - moveX = 0; - moveY = dims.h; - break; - case 'bottom-right': - moveX = dims.w; - moveY = dims.h; - break; - case 'center': - moveX = dims.w / 2; - moveY = dims.h / 2; - break; - } - var elemClip; - - var optionsParallel = MochiKit.Base.update({ - beforeStartInternal: function (effect) { - s.makePositioned(effect.effects[0].element); - elemClip = s.makeClipping(effect.effects[0].element); - }, - afterFinishInternal: function (effect) { - s.hideElement(effect.effects[0].element); - s.undoClipping(effect.effects[0].element, elemClip); - s.undoPositioned(effect.effects[0].element); - s.setStyle(effect.effects[0].element, oldStyle); - } - }, options); - - return new v.Parallel( - [new v.Opacity(element, { - sync: true, to: 0.0, from: 1.0, - transition: options.opacityTransition - }), - new v.Scale(element, /Opera/.test(navigator.userAgent) ? 1 : 0, { - scaleMode: {originalHeight: dims.h, originalWidth: dims.w}, - sync: true, transition: options.scaleTransition, - scaleContent: options.scaleContent, - scaleFromCenter: options.scaleFromCenter, - restoreAfterFinish: true - }), - new v.Move(element, { - x: moveX, y: moveY, sync: true, transition: options.moveTransition - }) - ], optionsParallel - ); -}; - -/** @id MochiKit.Visual.pulsate */ -MochiKit.Visual.pulsate = function (element, /* optional */ options) { - /*** - - Pulse an element between appear/fade. - - ***/ - var d = MochiKit.DOM; - var v = MochiKit.Visual; - var b = MochiKit.Base; - var oldOpacity = MochiKit.Style.getStyle(element, 'opacity'); - options = b.update({ - duration: 3.0, - from: 0, - afterFinishInternal: function (effect) { - MochiKit.Style.setStyle(effect.element, {'opacity': oldOpacity}); - } - }, options); - var transition = options.transition || v.Transitions.sinoidal; - options.transition = function (pos) { - return transition(1 - v.Transitions.pulse(pos, options.pulses)); - }; - return new v.Opacity(element, options); -}; - -/** @id MochiKit.Visual.fold */ -MochiKit.Visual.fold = function (element, /* optional */ options) { - /*** - - Fold an element, first vertically, then horizontally. - - ***/ - var d = MochiKit.DOM; - var v = MochiKit.Visual; - var s = MochiKit.Style; - element = d.getElement(element); - var elementDimensions = s.getElementDimensions(element, true); - var oldStyle = { - top: element.style.top, - left: element.style.left, - width: element.style.width, - height: element.style.height - }; - var elemClip = s.makeClipping(element); - options = MochiKit.Base.update({ - scaleContent: false, - scaleX: false, - scaleMode: {originalHeight: elementDimensions.h, - originalWidth: elementDimensions.w}, - afterFinishInternal: function (effect) { - new v.Scale(element, 1, { - scaleContent: false, - scaleY: false, - scaleMode: {originalHeight: elementDimensions.h, - originalWidth: elementDimensions.w}, - afterFinishInternal: function (effect) { - s.hideElement(effect.element); - s.undoClipping(effect.element, elemClip); - s.setStyle(effect.element, oldStyle); - } - }); - } - }, options); - return new v.Scale(element, 5, options); -}; - - -// Compatibility with MochiKit 1.0 -MochiKit.Visual.Color = MochiKit.Color.Color; -MochiKit.Visual.getElementsComputedStyle = MochiKit.DOM.computedStyle; - -/* end of Rico adaptation */ - -MochiKit.Visual.__new__ = function () { - var m = MochiKit.Base; - - m.nameFunctions(this); - - this.EXPORT_TAGS = { - ":common": this.EXPORT, - ":all": m.concat(this.EXPORT, this.EXPORT_OK) - }; - -}; - -MochiKit.Visual.EXPORT = [ - "roundElement", - "roundClass", - "tagifyText", - "multiple", - "toggle", - "Parallel", - "Sequence", - "Opacity", - "Move", - "Scale", - "Highlight", - "ScrollTo", - "Morph", - "fade", - "appear", - "puff", - "blindUp", - "blindDown", - "switchOff", - "dropOut", - "shake", - "slideDown", - "slideUp", - "squish", - "grow", - "shrink", - "pulsate", - "fold" -]; - -MochiKit.Visual.EXPORT_OK = [ - "Base", - "PAIRS" -]; - -MochiKit.Visual.__new__(); - -MochiKit.Base._exportSymbols(this, MochiKit.Visual); diff --git a/static/MochiKit/__package__.js b/static/MochiKit/__package__.js deleted file mode 100644 index 8d644b1..0000000 --- a/static/MochiKit/__package__.js +++ /dev/null @@ -1,18 +0,0 @@ -dojo.kwCompoundRequire({ - "common": [ - "MochiKit.Base", - "MochiKit.Iter", - "MochiKit.Logging", - "MochiKit.DateTime", - "MochiKit.Format", - "MochiKit.Async", - "MochiKit.DOM", - "MochiKit.Style", - "MochiKit.LoggingPane", - "MochiKit.Color", - "MochiKit.Signal", - "MochiKit.Position", - "MochiKit.Visual" - ] -}); -dojo.provide("MochiKit.*"); diff --git a/static/arrow.gif b/static/arrow.gif deleted file mode 100644 index 1b91abd..0000000 Binary files a/static/arrow.gif and /dev/null differ diff --git a/static/arrowsub.gif b/static/arrowsub.gif deleted file mode 100644 index 1b91abd..0000000 Binary files a/static/arrowsub.gif and /dev/null differ diff --git a/static/arrowsub.png b/static/arrowsub.png deleted file mode 100644 index 4040348..0000000 Binary files a/static/arrowsub.png and /dev/null differ diff --git a/static/file-icons.png b/static/file-icons.png deleted file mode 100644 index 58fdd60..0000000 Binary files a/static/file-icons.png and /dev/null differ diff --git a/static/font-awesome.css b/static/font-awesome.css deleted file mode 100644 index 048cff9..0000000 --- a/static/font-awesome.css +++ /dev/null @@ -1,1338 +0,0 @@ -/*! - * Font Awesome 4.0.3 by @davegandy - http://fontawesome.io - @fontawesome - * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) - */ -/* FONT PATH - * -------------------------- */ -@font-face { - font-family: 'FontAwesome'; - src: url('../fonts/fontawesome-webfont.eot?v=4.0.3'); - src: url('../fonts/fontawesome-webfont.eot?#iefix&v=4.0.3') format('embedded-opentype'), url('../fonts/fontawesome-webfont.woff?v=4.0.3') format('woff'), url('../fonts/fontawesome-webfont.ttf?v=4.0.3') format('truetype'), url('../fonts/fontawesome-webfont.svg?v=4.0.3#fontawesomeregular') format('svg'); - font-weight: normal; - font-style: normal; -} -.fa { - display: inline-block; - font-family: FontAwesome; - font-style: normal; - font-weight: normal; - line-height: 1; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} -/* makes the font 33% larger relative to the icon container */ -.fa-lg { - font-size: 1.3333333333333333em; - line-height: 0.75em; - vertical-align: -15%; -} -.fa-2x { - font-size: 2em; -} -.fa-3x { - font-size: 3em; -} -.fa-4x { - font-size: 4em; -} -.fa-5x { - font-size: 5em; -} -.fa-fw { - width: 1.2857142857142858em; - text-align: center; -} -.fa-ul { - padding-left: 0; - margin-left: 2.142857142857143em; - list-style-type: none; -} -.fa-ul > li { - position: relative; -} -.fa-li { - position: absolute; - left: -2.142857142857143em; - width: 2.142857142857143em; - top: 0.14285714285714285em; - text-align: center; -} -.fa-li.fa-lg { - left: -1.8571428571428572em; -} -.fa-border { - padding: .2em .25em .15em; - border: solid 0.08em #eeeeee; - border-radius: .1em; -} -.pull-right { - float: right; -} -.pull-left { - float: left; -} -.fa.pull-left { - margin-right: .3em; -} -.fa.pull-right { - margin-left: .3em; -} -.fa-spin { - -webkit-animation: spin 2s infinite linear; - -moz-animation: spin 2s infinite linear; - -o-animation: spin 2s infinite linear; - animation: spin 2s infinite linear; -} -@-moz-keyframes spin { - 0% { - -moz-transform: rotate(0deg); - } - 100% { - -moz-transform: rotate(359deg); - } -} -@-webkit-keyframes spin { - 0% { - -webkit-transform: rotate(0deg); - } - 100% { - -webkit-transform: rotate(359deg); - } -} -@-o-keyframes spin { - 0% { - -o-transform: rotate(0deg); - } - 100% { - -o-transform: rotate(359deg); - } -} -@-ms-keyframes spin { - 0% { - -ms-transform: rotate(0deg); - } - 100% { - -ms-transform: rotate(359deg); - } -} -@keyframes spin { - 0% { - transform: rotate(0deg); - } - 100% { - transform: rotate(359deg); - } -} -.fa-rotate-90 { - filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=1); - -webkit-transform: rotate(90deg); - -moz-transform: rotate(90deg); - -ms-transform: rotate(90deg); - -o-transform: rotate(90deg); - transform: rotate(90deg); -} -.fa-rotate-180 { - filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=2); - -webkit-transform: rotate(180deg); - -moz-transform: rotate(180deg); - -ms-transform: rotate(180deg); - -o-transform: rotate(180deg); - transform: rotate(180deg); -} -.fa-rotate-270 { - filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3); - -webkit-transform: rotate(270deg); - -moz-transform: rotate(270deg); - -ms-transform: rotate(270deg); - -o-transform: rotate(270deg); - transform: rotate(270deg); -} -.fa-flip-horizontal { - filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1); - -webkit-transform: scale(-1, 1); - -moz-transform: scale(-1, 1); - -ms-transform: scale(-1, 1); - -o-transform: scale(-1, 1); - transform: scale(-1, 1); -} -.fa-flip-vertical { - filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1); - -webkit-transform: scale(1, -1); - -moz-transform: scale(1, -1); - -ms-transform: scale(1, -1); - -o-transform: scale(1, -1); - transform: scale(1, -1); -} -.fa-stack { - position: relative; - display: inline-block; - width: 2em; - height: 2em; - line-height: 2em; - vertical-align: middle; -} -.fa-stack-1x, -.fa-stack-2x { - position: absolute; - left: 0; - width: 100%; - text-align: center; -} -.fa-stack-1x { - line-height: inherit; -} -.fa-stack-2x { - font-size: 2em; -} -.fa-inverse { - color: #ffffff; -} -/* Font Awesome uses the Unicode Private Use Area (PUA) to ensure screen - readers do not read off random characters that represent icons */ -.fa-glass:before { - content: "\f000"; -} -.fa-music:before { - content: "\f001"; -} -.fa-search:before { - content: "\f002"; -} -.fa-envelope-o:before { - content: "\f003"; -} -.fa-heart:before { - content: "\f004"; -} -.fa-star:before { - content: "\f005"; -} -.fa-star-o:before { - content: "\f006"; -} -.fa-user:before { - content: "\f007"; -} -.fa-film:before { - content: "\f008"; -} -.fa-th-large:before { - content: "\f009"; -} -.fa-th:before { - content: "\f00a"; -} -.fa-th-list:before { - content: "\f00b"; -} -.fa-check:before { - content: "\f00c"; -} -.fa-times:before { - content: "\f00d"; -} -.fa-search-plus:before { - content: "\f00e"; -} -.fa-search-minus:before { - content: "\f010"; -} -.fa-power-off:before { - content: "\f011"; -} -.fa-signal:before { - content: "\f012"; -} -.fa-gear:before, -.fa-cog:before { - content: "\f013"; -} -.fa-trash-o:before { - content: "\f014"; -} -.fa-home:before { - content: "\f015"; -} -.fa-file-o:before { - content: "\f016"; -} -.fa-clock-o:before { - content: "\f017"; -} -.fa-road:before { - content: "\f018"; -} -.fa-download:before { - content: "\f019"; -} -.fa-arrow-circle-o-down:before { - content: "\f01a"; -} -.fa-arrow-circle-o-up:before { - content: "\f01b"; -} -.fa-inbox:before { - content: "\f01c"; -} -.fa-play-circle-o:before { - content: "\f01d"; -} -.fa-rotate-right:before, -.fa-repeat:before { - content: "\f01e"; -} -.fa-refresh:before { - content: "\f021"; -} -.fa-list-alt:before { - content: "\f022"; -} -.fa-lock:before { - content: "\f023"; -} -.fa-flag:before { - content: "\f024"; -} -.fa-headphones:before { - content: "\f025"; -} -.fa-volume-off:before { - content: "\f026"; -} -.fa-volume-down:before { - content: "\f027"; -} -.fa-volume-up:before { - content: "\f028"; -} -.fa-qrcode:before { - content: "\f029"; -} -.fa-barcode:before { - content: "\f02a"; -} -.fa-tag:before { - content: "\f02b"; -} -.fa-tags:before { - content: "\f02c"; -} -.fa-book:before { - content: "\f02d"; -} -.fa-bookmark:before { - content: "\f02e"; -} -.fa-print:before { - content: "\f02f"; -} -.fa-camera:before { - content: "\f030"; -} -.fa-font:before { - content: "\f031"; -} -.fa-bold:before { - content: "\f032"; -} -.fa-italic:before { - content: "\f033"; -} -.fa-text-height:before { - content: "\f034"; -} -.fa-text-width:before { - content: "\f035"; -} -.fa-align-left:before { - content: "\f036"; -} -.fa-align-center:before { - content: "\f037"; -} -.fa-align-right:before { - content: "\f038"; -} -.fa-align-justify:before { - content: "\f039"; -} -.fa-list:before { - content: "\f03a"; -} -.fa-dedent:before, -.fa-outdent:before { - content: "\f03b"; -} -.fa-indent:before { - content: "\f03c"; -} -.fa-video-camera:before { - content: "\f03d"; -} -.fa-picture-o:before { - content: "\f03e"; -} -.fa-pencil:before { - content: "\f040"; -} -.fa-map-marker:before { - content: "\f041"; -} -.fa-adjust:before { - content: "\f042"; -} -.fa-tint:before { - content: "\f043"; -} -.fa-edit:before, -.fa-pencil-square-o:before { - content: "\f044"; -} -.fa-share-square-o:before { - content: "\f045"; -} -.fa-check-square-o:before { - content: "\f046"; -} -.fa-arrows:before { - content: "\f047"; -} -.fa-step-backward:before { - content: "\f048"; -} -.fa-fast-backward:before { - content: "\f049"; -} -.fa-backward:before { - content: "\f04a"; -} -.fa-play:before { - content: "\f04b"; -} -.fa-pause:before { - content: "\f04c"; -} -.fa-stop:before { - content: "\f04d"; -} -.fa-forward:before { - content: "\f04e"; -} -.fa-fast-forward:before { - content: "\f050"; -} -.fa-step-forward:before { - content: "\f051"; -} -.fa-eject:before { - content: "\f052"; -} -.fa-chevron-left:before { - content: "\f053"; -} -.fa-chevron-right:before { - content: "\f054"; -} -.fa-plus-circle:before { - content: "\f055"; -} -.fa-minus-circle:before { - content: "\f056"; -} -.fa-times-circle:before { - content: "\f057"; -} -.fa-check-circle:before { - content: "\f058"; -} -.fa-question-circle:before { - content: "\f059"; -} -.fa-info-circle:before { - content: "\f05a"; -} -.fa-crosshairs:before { - content: "\f05b"; -} -.fa-times-circle-o:before { - content: "\f05c"; -} -.fa-check-circle-o:before { - content: "\f05d"; -} -.fa-ban:before { - content: "\f05e"; -} -.fa-arrow-left:before { - content: "\f060"; -} -.fa-arrow-right:before { - content: "\f061"; -} -.fa-arrow-up:before { - content: "\f062"; -} -.fa-arrow-down:before { - content: "\f063"; -} -.fa-mail-forward:before, -.fa-share:before { - content: "\f064"; -} -.fa-expand:before { - content: "\f065"; -} -.fa-compress:before { - content: "\f066"; -} -.fa-plus:before { - content: "\f067"; -} -.fa-minus:before { - content: "\f068"; -} -.fa-asterisk:before { - content: "\f069"; -} -.fa-exclamation-circle:before { - content: "\f06a"; -} -.fa-gift:before { - content: "\f06b"; -} -.fa-leaf:before { - content: "\f06c"; -} -.fa-fire:before { - content: "\f06d"; -} -.fa-eye:before { - content: "\f06e"; -} -.fa-eye-slash:before { - content: "\f070"; -} -.fa-warning:before, -.fa-exclamation-triangle:before { - content: "\f071"; -} -.fa-plane:before { - content: "\f072"; -} -.fa-calendar:before { - content: "\f073"; -} -.fa-random:before { - content: "\f074"; -} -.fa-comment:before { - content: "\f075"; -} -.fa-magnet:before { - content: "\f076"; -} -.fa-chevron-up:before { - content: "\f077"; -} -.fa-chevron-down:before { - content: "\f078"; -} -.fa-retweet:before { - content: "\f079"; -} -.fa-shopping-cart:before { - content: "\f07a"; -} -.fa-folder:before { - content: "\f07b"; -} -.fa-folder-open:before { - content: "\f07c"; -} -.fa-arrows-v:before { - content: "\f07d"; -} -.fa-arrows-h:before { - content: "\f07e"; -} -.fa-bar-chart-o:before { - content: "\f080"; -} -.fa-twitter-square:before { - content: "\f081"; -} -.fa-facebook-square:before { - content: "\f082"; -} -.fa-camera-retro:before { - content: "\f083"; -} -.fa-key:before { - content: "\f084"; -} -.fa-gears:before, -.fa-cogs:before { - content: "\f085"; -} -.fa-comments:before { - content: "\f086"; -} -.fa-thumbs-o-up:before { - content: "\f087"; -} -.fa-thumbs-o-down:before { - content: "\f088"; -} -.fa-star-half:before { - content: "\f089"; -} -.fa-heart-o:before { - content: "\f08a"; -} -.fa-sign-out:before { - content: "\f08b"; -} -.fa-linkedin-square:before { - content: "\f08c"; -} -.fa-thumb-tack:before { - content: "\f08d"; -} -.fa-external-link:before { - content: "\f08e"; -} -.fa-sign-in:before { - content: "\f090"; -} -.fa-trophy:before { - content: "\f091"; -} -.fa-github-square:before { - content: "\f092"; -} -.fa-upload:before { - content: "\f093"; -} -.fa-lemon-o:before { - content: "\f094"; -} -.fa-phone:before { - content: "\f095"; -} -.fa-square-o:before { - content: "\f096"; -} -.fa-bookmark-o:before { - content: "\f097"; -} -.fa-phone-square:before { - content: "\f098"; -} -.fa-twitter:before { - content: "\f099"; -} -.fa-facebook:before { - content: "\f09a"; -} -.fa-github:before { - content: "\f09b"; -} -.fa-unlock:before { - content: "\f09c"; -} -.fa-credit-card:before { - content: "\f09d"; -} -.fa-rss:before { - content: "\f09e"; -} -.fa-hdd-o:before { - content: "\f0a0"; -} -.fa-bullhorn:before { - content: "\f0a1"; -} -.fa-bell:before { - content: "\f0f3"; -} -.fa-certificate:before { - content: "\f0a3"; -} -.fa-hand-o-right:before { - content: "\f0a4"; -} -.fa-hand-o-left:before { - content: "\f0a5"; -} -.fa-hand-o-up:before { - content: "\f0a6"; -} -.fa-hand-o-down:before { - content: "\f0a7"; -} -.fa-arrow-circle-left:before { - content: "\f0a8"; -} -.fa-arrow-circle-right:before { - content: "\f0a9"; -} -.fa-arrow-circle-up:before { - content: "\f0aa"; -} -.fa-arrow-circle-down:before { - content: "\f0ab"; -} -.fa-globe:before { - content: "\f0ac"; -} -.fa-wrench:before { - content: "\f0ad"; -} -.fa-tasks:before { - content: "\f0ae"; -} -.fa-filter:before { - content: "\f0b0"; -} -.fa-briefcase:before { - content: "\f0b1"; -} -.fa-arrows-alt:before { - content: "\f0b2"; -} -.fa-group:before, -.fa-users:before { - content: "\f0c0"; -} -.fa-chain:before, -.fa-link:before { - content: "\f0c1"; -} -.fa-cloud:before { - content: "\f0c2"; -} -.fa-flask:before { - content: "\f0c3"; -} -.fa-cut:before, -.fa-scissors:before { - content: "\f0c4"; -} -.fa-copy:before, -.fa-files-o:before { - content: "\f0c5"; -} -.fa-paperclip:before { - content: "\f0c6"; -} -.fa-save:before, -.fa-floppy-o:before { - content: "\f0c7"; -} -.fa-square:before { - content: "\f0c8"; -} -.fa-bars:before { - content: "\f0c9"; -} -.fa-list-ul:before { - content: "\f0ca"; -} -.fa-list-ol:before { - content: "\f0cb"; -} -.fa-strikethrough:before { - content: "\f0cc"; -} -.fa-underline:before { - content: "\f0cd"; -} -.fa-table:before { - content: "\f0ce"; -} -.fa-magic:before { - content: "\f0d0"; -} -.fa-truck:before { - content: "\f0d1"; -} -.fa-pinterest:before { - content: "\f0d2"; -} -.fa-pinterest-square:before { - content: "\f0d3"; -} -.fa-google-plus-square:before { - content: "\f0d4"; -} -.fa-google-plus:before { - content: "\f0d5"; -} -.fa-money:before { - content: "\f0d6"; -} -.fa-caret-down:before { - content: "\f0d7"; -} -.fa-caret-up:before { - content: "\f0d8"; -} -.fa-caret-left:before { - content: "\f0d9"; -} -.fa-caret-right:before { - content: "\f0da"; -} -.fa-columns:before { - content: "\f0db"; -} -.fa-unsorted:before, -.fa-sort:before { - content: "\f0dc"; -} -.fa-sort-down:before, -.fa-sort-asc:before { - content: "\f0dd"; -} -.fa-sort-up:before, -.fa-sort-desc:before { - content: "\f0de"; -} -.fa-envelope:before { - content: "\f0e0"; -} -.fa-linkedin:before { - content: "\f0e1"; -} -.fa-rotate-left:before, -.fa-undo:before { - content: "\f0e2"; -} -.fa-legal:before, -.fa-gavel:before { - content: "\f0e3"; -} -.fa-dashboard:before, -.fa-tachometer:before { - content: "\f0e4"; -} -.fa-comment-o:before { - content: "\f0e5"; -} -.fa-comments-o:before { - content: "\f0e6"; -} -.fa-flash:before, -.fa-bolt:before { - content: "\f0e7"; -} -.fa-sitemap:before { - content: "\f0e8"; -} -.fa-umbrella:before { - content: "\f0e9"; -} -.fa-paste:before, -.fa-clipboard:before { - content: "\f0ea"; -} -.fa-lightbulb-o:before { - content: "\f0eb"; -} -.fa-exchange:before { - content: "\f0ec"; -} -.fa-cloud-download:before { - content: "\f0ed"; -} -.fa-cloud-upload:before { - content: "\f0ee"; -} -.fa-user-md:before { - content: "\f0f0"; -} -.fa-stethoscope:before { - content: "\f0f1"; -} -.fa-suitcase:before { - content: "\f0f2"; -} -.fa-bell-o:before { - content: "\f0a2"; -} -.fa-coffee:before { - content: "\f0f4"; -} -.fa-cutlery:before { - content: "\f0f5"; -} -.fa-file-text-o:before { - content: "\f0f6"; -} -.fa-building-o:before { - content: "\f0f7"; -} -.fa-hospital-o:before { - content: "\f0f8"; -} -.fa-ambulance:before { - content: "\f0f9"; -} -.fa-medkit:before { - content: "\f0fa"; -} -.fa-fighter-jet:before { - content: "\f0fb"; -} -.fa-beer:before { - content: "\f0fc"; -} -.fa-h-square:before { - content: "\f0fd"; -} -.fa-plus-square:before { - content: "\f0fe"; -} -.fa-angle-double-left:before { - content: "\f100"; -} -.fa-angle-double-right:before { - content: "\f101"; -} -.fa-angle-double-up:before { - content: "\f102"; -} -.fa-angle-double-down:before { - content: "\f103"; -} -.fa-angle-left:before { - content: "\f104"; -} -.fa-angle-right:before { - content: "\f105"; -} -.fa-angle-up:before { - content: "\f106"; -} -.fa-angle-down:before { - content: "\f107"; -} -.fa-desktop:before { - content: "\f108"; -} -.fa-laptop:before { - content: "\f109"; -} -.fa-tablet:before { - content: "\f10a"; -} -.fa-mobile-phone:before, -.fa-mobile:before { - content: "\f10b"; -} -.fa-circle-o:before { - content: "\f10c"; -} -.fa-quote-left:before { - content: "\f10d"; -} -.fa-quote-right:before { - content: "\f10e"; -} -.fa-spinner:before { - content: "\f110"; -} -.fa-circle:before { - content: "\f111"; -} -.fa-mail-reply:before, -.fa-reply:before { - content: "\f112"; -} -.fa-github-alt:before { - content: "\f113"; -} -.fa-folder-o:before { - content: "\f114"; -} -.fa-folder-open-o:before { - content: "\f115"; -} -.fa-smile-o:before { - content: "\f118"; -} -.fa-frown-o:before { - content: "\f119"; -} -.fa-meh-o:before { - content: "\f11a"; -} -.fa-gamepad:before { - content: "\f11b"; -} -.fa-keyboard-o:before { - content: "\f11c"; -} -.fa-flag-o:before { - content: "\f11d"; -} -.fa-flag-checkered:before { - content: "\f11e"; -} -.fa-terminal:before { - content: "\f120"; -} -.fa-code:before { - content: "\f121"; -} -.fa-reply-all:before { - content: "\f122"; -} -.fa-mail-reply-all:before { - content: "\f122"; -} -.fa-star-half-empty:before, -.fa-star-half-full:before, -.fa-star-half-o:before { - content: "\f123"; -} -.fa-location-arrow:before { - content: "\f124"; -} -.fa-crop:before { - content: "\f125"; -} -.fa-code-fork:before { - content: "\f126"; -} -.fa-unlink:before, -.fa-chain-broken:before { - content: "\f127"; -} -.fa-question:before { - content: "\f128"; -} -.fa-info:before { - content: "\f129"; -} -.fa-exclamation:before { - content: "\f12a"; -} -.fa-superscript:before { - content: "\f12b"; -} -.fa-subscript:before { - content: "\f12c"; -} -.fa-eraser:before { - content: "\f12d"; -} -.fa-puzzle-piece:before { - content: "\f12e"; -} -.fa-microphone:before { - content: "\f130"; -} -.fa-microphone-slash:before { - content: "\f131"; -} -.fa-shield:before { - content: "\f132"; -} -.fa-calendar-o:before { - content: "\f133"; -} -.fa-fire-extinguisher:before { - content: "\f134"; -} -.fa-rocket:before { - content: "\f135"; -} -.fa-maxcdn:before { - content: "\f136"; -} -.fa-chevron-circle-left:before { - content: "\f137"; -} -.fa-chevron-circle-right:before { - content: "\f138"; -} -.fa-chevron-circle-up:before { - content: "\f139"; -} -.fa-chevron-circle-down:before { - content: "\f13a"; -} -.fa-html5:before { - content: "\f13b"; -} -.fa-css3:before { - content: "\f13c"; -} -.fa-anchor:before { - content: "\f13d"; -} -.fa-unlock-alt:before { - content: "\f13e"; -} -.fa-bullseye:before { - content: "\f140"; -} -.fa-ellipsis-h:before { - content: "\f141"; -} -.fa-ellipsis-v:before { - content: "\f142"; -} -.fa-rss-square:before { - content: "\f143"; -} -.fa-play-circle:before { - content: "\f144"; -} -.fa-ticket:before { - content: "\f145"; -} -.fa-minus-square:before { - content: "\f146"; -} -.fa-minus-square-o:before { - content: "\f147"; -} -.fa-level-up:before { - content: "\f148"; -} -.fa-level-down:before { - content: "\f149"; -} -.fa-check-square:before { - content: "\f14a"; -} -.fa-pencil-square:before { - content: "\f14b"; -} -.fa-external-link-square:before { - content: "\f14c"; -} -.fa-share-square:before { - content: "\f14d"; -} -.fa-compass:before { - content: "\f14e"; -} -.fa-toggle-down:before, -.fa-caret-square-o-down:before { - content: "\f150"; -} -.fa-toggle-up:before, -.fa-caret-square-o-up:before { - content: "\f151"; -} -.fa-toggle-right:before, -.fa-caret-square-o-right:before { - content: "\f152"; -} -.fa-euro:before, -.fa-eur:before { - content: "\f153"; -} -.fa-gbp:before { - content: "\f154"; -} -.fa-dollar:before, -.fa-usd:before { - content: "\f155"; -} -.fa-rupee:before, -.fa-inr:before { - content: "\f156"; -} -.fa-cny:before, -.fa-rmb:before, -.fa-yen:before, -.fa-jpy:before { - content: "\f157"; -} -.fa-ruble:before, -.fa-rouble:before, -.fa-rub:before { - content: "\f158"; -} -.fa-won:before, -.fa-krw:before { - content: "\f159"; -} -.fa-bitcoin:before, -.fa-btc:before { - content: "\f15a"; -} -.fa-file:before { - content: "\f15b"; -} -.fa-file-text:before { - content: "\f15c"; -} -.fa-sort-alpha-asc:before { - content: "\f15d"; -} -.fa-sort-alpha-desc:before { - content: "\f15e"; -} -.fa-sort-amount-asc:before { - content: "\f160"; -} -.fa-sort-amount-desc:before { - content: "\f161"; -} -.fa-sort-numeric-asc:before { - content: "\f162"; -} -.fa-sort-numeric-desc:before { - content: "\f163"; -} -.fa-thumbs-up:before { - content: "\f164"; -} -.fa-thumbs-down:before { - content: "\f165"; -} -.fa-youtube-square:before { - content: "\f166"; -} -.fa-youtube:before { - content: "\f167"; -} -.fa-xing:before { - content: "\f168"; -} -.fa-xing-square:before { - content: "\f169"; -} -.fa-youtube-play:before { - content: "\f16a"; -} -.fa-dropbox:before { - content: "\f16b"; -} -.fa-stack-overflow:before { - content: "\f16c"; -} -.fa-instagram:before { - content: "\f16d"; -} -.fa-flickr:before { - content: "\f16e"; -} -.fa-adn:before { - content: "\f170"; -} -.fa-bitbucket:before { - content: "\f171"; -} -.fa-bitbucket-square:before { - content: "\f172"; -} -.fa-tumblr:before { - content: "\f173"; -} -.fa-tumblr-square:before { - content: "\f174"; -} -.fa-long-arrow-down:before { - content: "\f175"; -} -.fa-long-arrow-up:before { - content: "\f176"; -} -.fa-long-arrow-left:before { - content: "\f177"; -} -.fa-long-arrow-right:before { - content: "\f178"; -} -.fa-apple:before { - content: "\f179"; -} -.fa-windows:before { - content: "\f17a"; -} -.fa-android:before { - content: "\f17b"; -} -.fa-linux:before { - content: "\f17c"; -} -.fa-dribbble:before { - content: "\f17d"; -} -.fa-skype:before { - content: "\f17e"; -} -.fa-foursquare:before { - content: "\f180"; -} -.fa-trello:before { - content: "\f181"; -} -.fa-female:before { - content: "\f182"; -} -.fa-male:before { - content: "\f183"; -} -.fa-gittip:before { - content: "\f184"; -} -.fa-sun-o:before { - content: "\f185"; -} -.fa-moon-o:before { - content: "\f186"; -} -.fa-archive:before { - content: "\f187"; -} -.fa-bug:before { - content: "\f188"; -} -.fa-vk:before { - content: "\f189"; -} -.fa-weibo:before { - content: "\f18a"; -} -.fa-renren:before { - content: "\f18b"; -} -.fa-pagelines:before { - content: "\f18c"; -} -.fa-stack-exchange:before { - content: "\f18d"; -} -.fa-arrow-circle-o-right:before { - content: "\f18e"; -} -.fa-arrow-circle-o-left:before { - content: "\f190"; -} -.fa-toggle-left:before, -.fa-caret-square-o-left:before { - content: "\f191"; -} -.fa-dot-circle-o:before { - content: "\f192"; -} -.fa-wheelchair:before { - content: "\f193"; -} -.fa-vimeo-square:before { - content: "\f194"; -} -.fa-turkish-lira:before, -.fa-try:before { - content: "\f195"; -} -.fa-plus-square-o:before { - content: "\f196"; -} diff --git a/static/geomarkers.js b/static/geomarkers.js deleted file mode 100644 index fa58ff3..0000000 --- a/static/geomarkers.js +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Created by ignace on 29-9-15. - */ - function addMarker(map, latlong, text) { - var ll = latlong.split(','); - var myLatlng = new google.maps.LatLng(ll[0],ll[1]); - var marker = new google.maps.Marker({ - position: myLatlng, - title: text - }); - marker.setMap(map); - } - function makeGoogleMap() { - - var mapOptions = { - center: new google.maps.LatLng(50,0), - zoom: 1, - mapTypeId: google.maps.MapTypeId.ROADMAP - }; - var map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions); - addAllMarkers(map); - } \ No newline at end of file diff --git a/static/grids-responsive-min.css b/static/grids-responsive-min.css deleted file mode 100644 index 1df05db..0000000 --- a/static/grids-responsive-min.css +++ /dev/null @@ -1,7 +0,0 @@ -/*! -Pure v0.6.0 -Copyright 2014 Yahoo! Inc. All rights reserved. -Licensed under the BSD License. -https://github.com/yahoo/pure/blob/master/LICENSE.md -*/ -@media screen and (min-width:35.5em){.pure-u-sm-1,.pure-u-sm-1-1,.pure-u-sm-1-2,.pure-u-sm-1-3,.pure-u-sm-2-3,.pure-u-sm-1-4,.pure-u-sm-3-4,.pure-u-sm-1-5,.pure-u-sm-2-5,.pure-u-sm-3-5,.pure-u-sm-4-5,.pure-u-sm-5-5,.pure-u-sm-1-6,.pure-u-sm-5-6,.pure-u-sm-1-8,.pure-u-sm-3-8,.pure-u-sm-5-8,.pure-u-sm-7-8,.pure-u-sm-1-12,.pure-u-sm-5-12,.pure-u-sm-7-12,.pure-u-sm-11-12,.pure-u-sm-1-24,.pure-u-sm-2-24,.pure-u-sm-3-24,.pure-u-sm-4-24,.pure-u-sm-5-24,.pure-u-sm-6-24,.pure-u-sm-7-24,.pure-u-sm-8-24,.pure-u-sm-9-24,.pure-u-sm-10-24,.pure-u-sm-11-24,.pure-u-sm-12-24,.pure-u-sm-13-24,.pure-u-sm-14-24,.pure-u-sm-15-24,.pure-u-sm-16-24,.pure-u-sm-17-24,.pure-u-sm-18-24,.pure-u-sm-19-24,.pure-u-sm-20-24,.pure-u-sm-21-24,.pure-u-sm-22-24,.pure-u-sm-23-24,.pure-u-sm-24-24{display:inline-block;*display:inline;zoom:1;letter-spacing:normal;word-spacing:normal;vertical-align:top;text-rendering:auto}.pure-u-sm-1-24{width:4.1667%;*width:4.1357%}.pure-u-sm-1-12,.pure-u-sm-2-24{width:8.3333%;*width:8.3023%}.pure-u-sm-1-8,.pure-u-sm-3-24{width:12.5%;*width:12.469%}.pure-u-sm-1-6,.pure-u-sm-4-24{width:16.6667%;*width:16.6357%}.pure-u-sm-1-5{width:20%;*width:19.969%}.pure-u-sm-5-24{width:20.8333%;*width:20.8023%}.pure-u-sm-1-4,.pure-u-sm-6-24{width:25%;*width:24.969%}.pure-u-sm-7-24{width:29.1667%;*width:29.1357%}.pure-u-sm-1-3,.pure-u-sm-8-24{width:33.3333%;*width:33.3023%}.pure-u-sm-3-8,.pure-u-sm-9-24{width:37.5%;*width:37.469%}.pure-u-sm-2-5{width:40%;*width:39.969%}.pure-u-sm-5-12,.pure-u-sm-10-24{width:41.6667%;*width:41.6357%}.pure-u-sm-11-24{width:45.8333%;*width:45.8023%}.pure-u-sm-1-2,.pure-u-sm-12-24{width:50%;*width:49.969%}.pure-u-sm-13-24{width:54.1667%;*width:54.1357%}.pure-u-sm-7-12,.pure-u-sm-14-24{width:58.3333%;*width:58.3023%}.pure-u-sm-3-5{width:60%;*width:59.969%}.pure-u-sm-5-8,.pure-u-sm-15-24{width:62.5%;*width:62.469%}.pure-u-sm-2-3,.pure-u-sm-16-24{width:66.6667%;*width:66.6357%}.pure-u-sm-17-24{width:70.8333%;*width:70.8023%}.pure-u-sm-3-4,.pure-u-sm-18-24{width:75%;*width:74.969%}.pure-u-sm-19-24{width:79.1667%;*width:79.1357%}.pure-u-sm-4-5{width:80%;*width:79.969%}.pure-u-sm-5-6,.pure-u-sm-20-24{width:83.3333%;*width:83.3023%}.pure-u-sm-7-8,.pure-u-sm-21-24{width:87.5%;*width:87.469%}.pure-u-sm-11-12,.pure-u-sm-22-24{width:91.6667%;*width:91.6357%}.pure-u-sm-23-24{width:95.8333%;*width:95.8023%}.pure-u-sm-1,.pure-u-sm-1-1,.pure-u-sm-5-5,.pure-u-sm-24-24{width:100%}}@media screen and (min-width:48em){.pure-u-md-1,.pure-u-md-1-1,.pure-u-md-1-2,.pure-u-md-1-3,.pure-u-md-2-3,.pure-u-md-1-4,.pure-u-md-3-4,.pure-u-md-1-5,.pure-u-md-2-5,.pure-u-md-3-5,.pure-u-md-4-5,.pure-u-md-5-5,.pure-u-md-1-6,.pure-u-md-5-6,.pure-u-md-1-8,.pure-u-md-3-8,.pure-u-md-5-8,.pure-u-md-7-8,.pure-u-md-1-12,.pure-u-md-5-12,.pure-u-md-7-12,.pure-u-md-11-12,.pure-u-md-1-24,.pure-u-md-2-24,.pure-u-md-3-24,.pure-u-md-4-24,.pure-u-md-5-24,.pure-u-md-6-24,.pure-u-md-7-24,.pure-u-md-8-24,.pure-u-md-9-24,.pure-u-md-10-24,.pure-u-md-11-24,.pure-u-md-12-24,.pure-u-md-13-24,.pure-u-md-14-24,.pure-u-md-15-24,.pure-u-md-16-24,.pure-u-md-17-24,.pure-u-md-18-24,.pure-u-md-19-24,.pure-u-md-20-24,.pure-u-md-21-24,.pure-u-md-22-24,.pure-u-md-23-24,.pure-u-md-24-24{display:inline-block;*display:inline;zoom:1;letter-spacing:normal;word-spacing:normal;vertical-align:top;text-rendering:auto}.pure-u-md-1-24{width:4.1667%;*width:4.1357%}.pure-u-md-1-12,.pure-u-md-2-24{width:8.3333%;*width:8.3023%}.pure-u-md-1-8,.pure-u-md-3-24{width:12.5%;*width:12.469%}.pure-u-md-1-6,.pure-u-md-4-24{width:16.6667%;*width:16.6357%}.pure-u-md-1-5{width:20%;*width:19.969%}.pure-u-md-5-24{width:20.8333%;*width:20.8023%}.pure-u-md-1-4,.pure-u-md-6-24{width:25%;*width:24.969%}.pure-u-md-7-24{width:29.1667%;*width:29.1357%}.pure-u-md-1-3,.pure-u-md-8-24{width:33.3333%;*width:33.3023%}.pure-u-md-3-8,.pure-u-md-9-24{width:37.5%;*width:37.469%}.pure-u-md-2-5{width:40%;*width:39.969%}.pure-u-md-5-12,.pure-u-md-10-24{width:41.6667%;*width:41.6357%}.pure-u-md-11-24{width:45.8333%;*width:45.8023%}.pure-u-md-1-2,.pure-u-md-12-24{width:50%;*width:49.969%}.pure-u-md-13-24{width:54.1667%;*width:54.1357%}.pure-u-md-7-12,.pure-u-md-14-24{width:58.3333%;*width:58.3023%}.pure-u-md-3-5{width:60%;*width:59.969%}.pure-u-md-5-8,.pure-u-md-15-24{width:62.5%;*width:62.469%}.pure-u-md-2-3,.pure-u-md-16-24{width:66.6667%;*width:66.6357%}.pure-u-md-17-24{width:70.8333%;*width:70.8023%}.pure-u-md-3-4,.pure-u-md-18-24{width:75%;*width:74.969%}.pure-u-md-19-24{width:79.1667%;*width:79.1357%}.pure-u-md-4-5{width:80%;*width:79.969%}.pure-u-md-5-6,.pure-u-md-20-24{width:83.3333%;*width:83.3023%}.pure-u-md-7-8,.pure-u-md-21-24{width:87.5%;*width:87.469%}.pure-u-md-11-12,.pure-u-md-22-24{width:91.6667%;*width:91.6357%}.pure-u-md-23-24{width:95.8333%;*width:95.8023%}.pure-u-md-1,.pure-u-md-1-1,.pure-u-md-5-5,.pure-u-md-24-24{width:100%}}@media screen and (min-width:64em){.pure-u-lg-1,.pure-u-lg-1-1,.pure-u-lg-1-2,.pure-u-lg-1-3,.pure-u-lg-2-3,.pure-u-lg-1-4,.pure-u-lg-3-4,.pure-u-lg-1-5,.pure-u-lg-2-5,.pure-u-lg-3-5,.pure-u-lg-4-5,.pure-u-lg-5-5,.pure-u-lg-1-6,.pure-u-lg-5-6,.pure-u-lg-1-8,.pure-u-lg-3-8,.pure-u-lg-5-8,.pure-u-lg-7-8,.pure-u-lg-1-12,.pure-u-lg-5-12,.pure-u-lg-7-12,.pure-u-lg-11-12,.pure-u-lg-1-24,.pure-u-lg-2-24,.pure-u-lg-3-24,.pure-u-lg-4-24,.pure-u-lg-5-24,.pure-u-lg-6-24,.pure-u-lg-7-24,.pure-u-lg-8-24,.pure-u-lg-9-24,.pure-u-lg-10-24,.pure-u-lg-11-24,.pure-u-lg-12-24,.pure-u-lg-13-24,.pure-u-lg-14-24,.pure-u-lg-15-24,.pure-u-lg-16-24,.pure-u-lg-17-24,.pure-u-lg-18-24,.pure-u-lg-19-24,.pure-u-lg-20-24,.pure-u-lg-21-24,.pure-u-lg-22-24,.pure-u-lg-23-24,.pure-u-lg-24-24{display:inline-block;*display:inline;zoom:1;letter-spacing:normal;word-spacing:normal;vertical-align:top;text-rendering:auto}.pure-u-lg-1-24{width:4.1667%;*width:4.1357%}.pure-u-lg-1-12,.pure-u-lg-2-24{width:8.3333%;*width:8.3023%}.pure-u-lg-1-8,.pure-u-lg-3-24{width:12.5%;*width:12.469%}.pure-u-lg-1-6,.pure-u-lg-4-24{width:16.6667%;*width:16.6357%}.pure-u-lg-1-5{width:20%;*width:19.969%}.pure-u-lg-5-24{width:20.8333%;*width:20.8023%}.pure-u-lg-1-4,.pure-u-lg-6-24{width:25%;*width:24.969%}.pure-u-lg-7-24{width:29.1667%;*width:29.1357%}.pure-u-lg-1-3,.pure-u-lg-8-24{width:33.3333%;*width:33.3023%}.pure-u-lg-3-8,.pure-u-lg-9-24{width:37.5%;*width:37.469%}.pure-u-lg-2-5{width:40%;*width:39.969%}.pure-u-lg-5-12,.pure-u-lg-10-24{width:41.6667%;*width:41.6357%}.pure-u-lg-11-24{width:45.8333%;*width:45.8023%}.pure-u-lg-1-2,.pure-u-lg-12-24{width:50%;*width:49.969%}.pure-u-lg-13-24{width:54.1667%;*width:54.1357%}.pure-u-lg-7-12,.pure-u-lg-14-24{width:58.3333%;*width:58.3023%}.pure-u-lg-3-5{width:60%;*width:59.969%}.pure-u-lg-5-8,.pure-u-lg-15-24{width:62.5%;*width:62.469%}.pure-u-lg-2-3,.pure-u-lg-16-24{width:66.6667%;*width:66.6357%}.pure-u-lg-17-24{width:70.8333%;*width:70.8023%}.pure-u-lg-3-4,.pure-u-lg-18-24{width:75%;*width:74.969%}.pure-u-lg-19-24{width:79.1667%;*width:79.1357%}.pure-u-lg-4-5{width:80%;*width:79.969%}.pure-u-lg-5-6,.pure-u-lg-20-24{width:83.3333%;*width:83.3023%}.pure-u-lg-7-8,.pure-u-lg-21-24{width:87.5%;*width:87.469%}.pure-u-lg-11-12,.pure-u-lg-22-24{width:91.6667%;*width:91.6357%}.pure-u-lg-23-24{width:95.8333%;*width:95.8023%}.pure-u-lg-1,.pure-u-lg-1-1,.pure-u-lg-5-5,.pure-u-lg-24-24{width:100%}}@media screen and (min-width:80em){.pure-u-xl-1,.pure-u-xl-1-1,.pure-u-xl-1-2,.pure-u-xl-1-3,.pure-u-xl-2-3,.pure-u-xl-1-4,.pure-u-xl-3-4,.pure-u-xl-1-5,.pure-u-xl-2-5,.pure-u-xl-3-5,.pure-u-xl-4-5,.pure-u-xl-5-5,.pure-u-xl-1-6,.pure-u-xl-5-6,.pure-u-xl-1-8,.pure-u-xl-3-8,.pure-u-xl-5-8,.pure-u-xl-7-8,.pure-u-xl-1-12,.pure-u-xl-5-12,.pure-u-xl-7-12,.pure-u-xl-11-12,.pure-u-xl-1-24,.pure-u-xl-2-24,.pure-u-xl-3-24,.pure-u-xl-4-24,.pure-u-xl-5-24,.pure-u-xl-6-24,.pure-u-xl-7-24,.pure-u-xl-8-24,.pure-u-xl-9-24,.pure-u-xl-10-24,.pure-u-xl-11-24,.pure-u-xl-12-24,.pure-u-xl-13-24,.pure-u-xl-14-24,.pure-u-xl-15-24,.pure-u-xl-16-24,.pure-u-xl-17-24,.pure-u-xl-18-24,.pure-u-xl-19-24,.pure-u-xl-20-24,.pure-u-xl-21-24,.pure-u-xl-22-24,.pure-u-xl-23-24,.pure-u-xl-24-24{display:inline-block;*display:inline;zoom:1;letter-spacing:normal;word-spacing:normal;vertical-align:top;text-rendering:auto}.pure-u-xl-1-24{width:4.1667%;*width:4.1357%}.pure-u-xl-1-12,.pure-u-xl-2-24{width:8.3333%;*width:8.3023%}.pure-u-xl-1-8,.pure-u-xl-3-24{width:12.5%;*width:12.469%}.pure-u-xl-1-6,.pure-u-xl-4-24{width:16.6667%;*width:16.6357%}.pure-u-xl-1-5{width:20%;*width:19.969%}.pure-u-xl-5-24{width:20.8333%;*width:20.8023%}.pure-u-xl-1-4,.pure-u-xl-6-24{width:25%;*width:24.969%}.pure-u-xl-7-24{width:29.1667%;*width:29.1357%}.pure-u-xl-1-3,.pure-u-xl-8-24{width:33.3333%;*width:33.3023%}.pure-u-xl-3-8,.pure-u-xl-9-24{width:37.5%;*width:37.469%}.pure-u-xl-2-5{width:40%;*width:39.969%}.pure-u-xl-5-12,.pure-u-xl-10-24{width:41.6667%;*width:41.6357%}.pure-u-xl-11-24{width:45.8333%;*width:45.8023%}.pure-u-xl-1-2,.pure-u-xl-12-24{width:50%;*width:49.969%}.pure-u-xl-13-24{width:54.1667%;*width:54.1357%}.pure-u-xl-7-12,.pure-u-xl-14-24{width:58.3333%;*width:58.3023%}.pure-u-xl-3-5{width:60%;*width:59.969%}.pure-u-xl-5-8,.pure-u-xl-15-24{width:62.5%;*width:62.469%}.pure-u-xl-2-3,.pure-u-xl-16-24{width:66.6667%;*width:66.6357%}.pure-u-xl-17-24{width:70.8333%;*width:70.8023%}.pure-u-xl-3-4,.pure-u-xl-18-24{width:75%;*width:74.969%}.pure-u-xl-19-24{width:79.1667%;*width:79.1357%}.pure-u-xl-4-5{width:80%;*width:79.969%}.pure-u-xl-5-6,.pure-u-xl-20-24{width:83.3333%;*width:83.3023%}.pure-u-xl-7-8,.pure-u-xl-21-24{width:87.5%;*width:87.469%}.pure-u-xl-11-12,.pure-u-xl-22-24{width:91.6667%;*width:91.6357%}.pure-u-xl-23-24{width:95.8333%;*width:95.8023%}.pure-u-xl-1,.pure-u-xl-1-1,.pure-u-xl-5-5,.pure-u-xl-24-24{width:100%}} \ No newline at end of file diff --git a/static/grids-responsive-min.css.1 b/static/grids-responsive-min.css.1 deleted file mode 100644 index 1df05db..0000000 --- a/static/grids-responsive-min.css.1 +++ /dev/null @@ -1,7 +0,0 @@ -/*! -Pure v0.6.0 -Copyright 2014 Yahoo! Inc. All rights reserved. -Licensed under the BSD License. -https://github.com/yahoo/pure/blob/master/LICENSE.md -*/ -@media screen and (min-width:35.5em){.pure-u-sm-1,.pure-u-sm-1-1,.pure-u-sm-1-2,.pure-u-sm-1-3,.pure-u-sm-2-3,.pure-u-sm-1-4,.pure-u-sm-3-4,.pure-u-sm-1-5,.pure-u-sm-2-5,.pure-u-sm-3-5,.pure-u-sm-4-5,.pure-u-sm-5-5,.pure-u-sm-1-6,.pure-u-sm-5-6,.pure-u-sm-1-8,.pure-u-sm-3-8,.pure-u-sm-5-8,.pure-u-sm-7-8,.pure-u-sm-1-12,.pure-u-sm-5-12,.pure-u-sm-7-12,.pure-u-sm-11-12,.pure-u-sm-1-24,.pure-u-sm-2-24,.pure-u-sm-3-24,.pure-u-sm-4-24,.pure-u-sm-5-24,.pure-u-sm-6-24,.pure-u-sm-7-24,.pure-u-sm-8-24,.pure-u-sm-9-24,.pure-u-sm-10-24,.pure-u-sm-11-24,.pure-u-sm-12-24,.pure-u-sm-13-24,.pure-u-sm-14-24,.pure-u-sm-15-24,.pure-u-sm-16-24,.pure-u-sm-17-24,.pure-u-sm-18-24,.pure-u-sm-19-24,.pure-u-sm-20-24,.pure-u-sm-21-24,.pure-u-sm-22-24,.pure-u-sm-23-24,.pure-u-sm-24-24{display:inline-block;*display:inline;zoom:1;letter-spacing:normal;word-spacing:normal;vertical-align:top;text-rendering:auto}.pure-u-sm-1-24{width:4.1667%;*width:4.1357%}.pure-u-sm-1-12,.pure-u-sm-2-24{width:8.3333%;*width:8.3023%}.pure-u-sm-1-8,.pure-u-sm-3-24{width:12.5%;*width:12.469%}.pure-u-sm-1-6,.pure-u-sm-4-24{width:16.6667%;*width:16.6357%}.pure-u-sm-1-5{width:20%;*width:19.969%}.pure-u-sm-5-24{width:20.8333%;*width:20.8023%}.pure-u-sm-1-4,.pure-u-sm-6-24{width:25%;*width:24.969%}.pure-u-sm-7-24{width:29.1667%;*width:29.1357%}.pure-u-sm-1-3,.pure-u-sm-8-24{width:33.3333%;*width:33.3023%}.pure-u-sm-3-8,.pure-u-sm-9-24{width:37.5%;*width:37.469%}.pure-u-sm-2-5{width:40%;*width:39.969%}.pure-u-sm-5-12,.pure-u-sm-10-24{width:41.6667%;*width:41.6357%}.pure-u-sm-11-24{width:45.8333%;*width:45.8023%}.pure-u-sm-1-2,.pure-u-sm-12-24{width:50%;*width:49.969%}.pure-u-sm-13-24{width:54.1667%;*width:54.1357%}.pure-u-sm-7-12,.pure-u-sm-14-24{width:58.3333%;*width:58.3023%}.pure-u-sm-3-5{width:60%;*width:59.969%}.pure-u-sm-5-8,.pure-u-sm-15-24{width:62.5%;*width:62.469%}.pure-u-sm-2-3,.pure-u-sm-16-24{width:66.6667%;*width:66.6357%}.pure-u-sm-17-24{width:70.8333%;*width:70.8023%}.pure-u-sm-3-4,.pure-u-sm-18-24{width:75%;*width:74.969%}.pure-u-sm-19-24{width:79.1667%;*width:79.1357%}.pure-u-sm-4-5{width:80%;*width:79.969%}.pure-u-sm-5-6,.pure-u-sm-20-24{width:83.3333%;*width:83.3023%}.pure-u-sm-7-8,.pure-u-sm-21-24{width:87.5%;*width:87.469%}.pure-u-sm-11-12,.pure-u-sm-22-24{width:91.6667%;*width:91.6357%}.pure-u-sm-23-24{width:95.8333%;*width:95.8023%}.pure-u-sm-1,.pure-u-sm-1-1,.pure-u-sm-5-5,.pure-u-sm-24-24{width:100%}}@media screen and (min-width:48em){.pure-u-md-1,.pure-u-md-1-1,.pure-u-md-1-2,.pure-u-md-1-3,.pure-u-md-2-3,.pure-u-md-1-4,.pure-u-md-3-4,.pure-u-md-1-5,.pure-u-md-2-5,.pure-u-md-3-5,.pure-u-md-4-5,.pure-u-md-5-5,.pure-u-md-1-6,.pure-u-md-5-6,.pure-u-md-1-8,.pure-u-md-3-8,.pure-u-md-5-8,.pure-u-md-7-8,.pure-u-md-1-12,.pure-u-md-5-12,.pure-u-md-7-12,.pure-u-md-11-12,.pure-u-md-1-24,.pure-u-md-2-24,.pure-u-md-3-24,.pure-u-md-4-24,.pure-u-md-5-24,.pure-u-md-6-24,.pure-u-md-7-24,.pure-u-md-8-24,.pure-u-md-9-24,.pure-u-md-10-24,.pure-u-md-11-24,.pure-u-md-12-24,.pure-u-md-13-24,.pure-u-md-14-24,.pure-u-md-15-24,.pure-u-md-16-24,.pure-u-md-17-24,.pure-u-md-18-24,.pure-u-md-19-24,.pure-u-md-20-24,.pure-u-md-21-24,.pure-u-md-22-24,.pure-u-md-23-24,.pure-u-md-24-24{display:inline-block;*display:inline;zoom:1;letter-spacing:normal;word-spacing:normal;vertical-align:top;text-rendering:auto}.pure-u-md-1-24{width:4.1667%;*width:4.1357%}.pure-u-md-1-12,.pure-u-md-2-24{width:8.3333%;*width:8.3023%}.pure-u-md-1-8,.pure-u-md-3-24{width:12.5%;*width:12.469%}.pure-u-md-1-6,.pure-u-md-4-24{width:16.6667%;*width:16.6357%}.pure-u-md-1-5{width:20%;*width:19.969%}.pure-u-md-5-24{width:20.8333%;*width:20.8023%}.pure-u-md-1-4,.pure-u-md-6-24{width:25%;*width:24.969%}.pure-u-md-7-24{width:29.1667%;*width:29.1357%}.pure-u-md-1-3,.pure-u-md-8-24{width:33.3333%;*width:33.3023%}.pure-u-md-3-8,.pure-u-md-9-24{width:37.5%;*width:37.469%}.pure-u-md-2-5{width:40%;*width:39.969%}.pure-u-md-5-12,.pure-u-md-10-24{width:41.6667%;*width:41.6357%}.pure-u-md-11-24{width:45.8333%;*width:45.8023%}.pure-u-md-1-2,.pure-u-md-12-24{width:50%;*width:49.969%}.pure-u-md-13-24{width:54.1667%;*width:54.1357%}.pure-u-md-7-12,.pure-u-md-14-24{width:58.3333%;*width:58.3023%}.pure-u-md-3-5{width:60%;*width:59.969%}.pure-u-md-5-8,.pure-u-md-15-24{width:62.5%;*width:62.469%}.pure-u-md-2-3,.pure-u-md-16-24{width:66.6667%;*width:66.6357%}.pure-u-md-17-24{width:70.8333%;*width:70.8023%}.pure-u-md-3-4,.pure-u-md-18-24{width:75%;*width:74.969%}.pure-u-md-19-24{width:79.1667%;*width:79.1357%}.pure-u-md-4-5{width:80%;*width:79.969%}.pure-u-md-5-6,.pure-u-md-20-24{width:83.3333%;*width:83.3023%}.pure-u-md-7-8,.pure-u-md-21-24{width:87.5%;*width:87.469%}.pure-u-md-11-12,.pure-u-md-22-24{width:91.6667%;*width:91.6357%}.pure-u-md-23-24{width:95.8333%;*width:95.8023%}.pure-u-md-1,.pure-u-md-1-1,.pure-u-md-5-5,.pure-u-md-24-24{width:100%}}@media screen and (min-width:64em){.pure-u-lg-1,.pure-u-lg-1-1,.pure-u-lg-1-2,.pure-u-lg-1-3,.pure-u-lg-2-3,.pure-u-lg-1-4,.pure-u-lg-3-4,.pure-u-lg-1-5,.pure-u-lg-2-5,.pure-u-lg-3-5,.pure-u-lg-4-5,.pure-u-lg-5-5,.pure-u-lg-1-6,.pure-u-lg-5-6,.pure-u-lg-1-8,.pure-u-lg-3-8,.pure-u-lg-5-8,.pure-u-lg-7-8,.pure-u-lg-1-12,.pure-u-lg-5-12,.pure-u-lg-7-12,.pure-u-lg-11-12,.pure-u-lg-1-24,.pure-u-lg-2-24,.pure-u-lg-3-24,.pure-u-lg-4-24,.pure-u-lg-5-24,.pure-u-lg-6-24,.pure-u-lg-7-24,.pure-u-lg-8-24,.pure-u-lg-9-24,.pure-u-lg-10-24,.pure-u-lg-11-24,.pure-u-lg-12-24,.pure-u-lg-13-24,.pure-u-lg-14-24,.pure-u-lg-15-24,.pure-u-lg-16-24,.pure-u-lg-17-24,.pure-u-lg-18-24,.pure-u-lg-19-24,.pure-u-lg-20-24,.pure-u-lg-21-24,.pure-u-lg-22-24,.pure-u-lg-23-24,.pure-u-lg-24-24{display:inline-block;*display:inline;zoom:1;letter-spacing:normal;word-spacing:normal;vertical-align:top;text-rendering:auto}.pure-u-lg-1-24{width:4.1667%;*width:4.1357%}.pure-u-lg-1-12,.pure-u-lg-2-24{width:8.3333%;*width:8.3023%}.pure-u-lg-1-8,.pure-u-lg-3-24{width:12.5%;*width:12.469%}.pure-u-lg-1-6,.pure-u-lg-4-24{width:16.6667%;*width:16.6357%}.pure-u-lg-1-5{width:20%;*width:19.969%}.pure-u-lg-5-24{width:20.8333%;*width:20.8023%}.pure-u-lg-1-4,.pure-u-lg-6-24{width:25%;*width:24.969%}.pure-u-lg-7-24{width:29.1667%;*width:29.1357%}.pure-u-lg-1-3,.pure-u-lg-8-24{width:33.3333%;*width:33.3023%}.pure-u-lg-3-8,.pure-u-lg-9-24{width:37.5%;*width:37.469%}.pure-u-lg-2-5{width:40%;*width:39.969%}.pure-u-lg-5-12,.pure-u-lg-10-24{width:41.6667%;*width:41.6357%}.pure-u-lg-11-24{width:45.8333%;*width:45.8023%}.pure-u-lg-1-2,.pure-u-lg-12-24{width:50%;*width:49.969%}.pure-u-lg-13-24{width:54.1667%;*width:54.1357%}.pure-u-lg-7-12,.pure-u-lg-14-24{width:58.3333%;*width:58.3023%}.pure-u-lg-3-5{width:60%;*width:59.969%}.pure-u-lg-5-8,.pure-u-lg-15-24{width:62.5%;*width:62.469%}.pure-u-lg-2-3,.pure-u-lg-16-24{width:66.6667%;*width:66.6357%}.pure-u-lg-17-24{width:70.8333%;*width:70.8023%}.pure-u-lg-3-4,.pure-u-lg-18-24{width:75%;*width:74.969%}.pure-u-lg-19-24{width:79.1667%;*width:79.1357%}.pure-u-lg-4-5{width:80%;*width:79.969%}.pure-u-lg-5-6,.pure-u-lg-20-24{width:83.3333%;*width:83.3023%}.pure-u-lg-7-8,.pure-u-lg-21-24{width:87.5%;*width:87.469%}.pure-u-lg-11-12,.pure-u-lg-22-24{width:91.6667%;*width:91.6357%}.pure-u-lg-23-24{width:95.8333%;*width:95.8023%}.pure-u-lg-1,.pure-u-lg-1-1,.pure-u-lg-5-5,.pure-u-lg-24-24{width:100%}}@media screen and (min-width:80em){.pure-u-xl-1,.pure-u-xl-1-1,.pure-u-xl-1-2,.pure-u-xl-1-3,.pure-u-xl-2-3,.pure-u-xl-1-4,.pure-u-xl-3-4,.pure-u-xl-1-5,.pure-u-xl-2-5,.pure-u-xl-3-5,.pure-u-xl-4-5,.pure-u-xl-5-5,.pure-u-xl-1-6,.pure-u-xl-5-6,.pure-u-xl-1-8,.pure-u-xl-3-8,.pure-u-xl-5-8,.pure-u-xl-7-8,.pure-u-xl-1-12,.pure-u-xl-5-12,.pure-u-xl-7-12,.pure-u-xl-11-12,.pure-u-xl-1-24,.pure-u-xl-2-24,.pure-u-xl-3-24,.pure-u-xl-4-24,.pure-u-xl-5-24,.pure-u-xl-6-24,.pure-u-xl-7-24,.pure-u-xl-8-24,.pure-u-xl-9-24,.pure-u-xl-10-24,.pure-u-xl-11-24,.pure-u-xl-12-24,.pure-u-xl-13-24,.pure-u-xl-14-24,.pure-u-xl-15-24,.pure-u-xl-16-24,.pure-u-xl-17-24,.pure-u-xl-18-24,.pure-u-xl-19-24,.pure-u-xl-20-24,.pure-u-xl-21-24,.pure-u-xl-22-24,.pure-u-xl-23-24,.pure-u-xl-24-24{display:inline-block;*display:inline;zoom:1;letter-spacing:normal;word-spacing:normal;vertical-align:top;text-rendering:auto}.pure-u-xl-1-24{width:4.1667%;*width:4.1357%}.pure-u-xl-1-12,.pure-u-xl-2-24{width:8.3333%;*width:8.3023%}.pure-u-xl-1-8,.pure-u-xl-3-24{width:12.5%;*width:12.469%}.pure-u-xl-1-6,.pure-u-xl-4-24{width:16.6667%;*width:16.6357%}.pure-u-xl-1-5{width:20%;*width:19.969%}.pure-u-xl-5-24{width:20.8333%;*width:20.8023%}.pure-u-xl-1-4,.pure-u-xl-6-24{width:25%;*width:24.969%}.pure-u-xl-7-24{width:29.1667%;*width:29.1357%}.pure-u-xl-1-3,.pure-u-xl-8-24{width:33.3333%;*width:33.3023%}.pure-u-xl-3-8,.pure-u-xl-9-24{width:37.5%;*width:37.469%}.pure-u-xl-2-5{width:40%;*width:39.969%}.pure-u-xl-5-12,.pure-u-xl-10-24{width:41.6667%;*width:41.6357%}.pure-u-xl-11-24{width:45.8333%;*width:45.8023%}.pure-u-xl-1-2,.pure-u-xl-12-24{width:50%;*width:49.969%}.pure-u-xl-13-24{width:54.1667%;*width:54.1357%}.pure-u-xl-7-12,.pure-u-xl-14-24{width:58.3333%;*width:58.3023%}.pure-u-xl-3-5{width:60%;*width:59.969%}.pure-u-xl-5-8,.pure-u-xl-15-24{width:62.5%;*width:62.469%}.pure-u-xl-2-3,.pure-u-xl-16-24{width:66.6667%;*width:66.6357%}.pure-u-xl-17-24{width:70.8333%;*width:70.8023%}.pure-u-xl-3-4,.pure-u-xl-18-24{width:75%;*width:74.969%}.pure-u-xl-19-24{width:79.1667%;*width:79.1357%}.pure-u-xl-4-5{width:80%;*width:79.969%}.pure-u-xl-5-6,.pure-u-xl-20-24{width:83.3333%;*width:83.3023%}.pure-u-xl-7-8,.pure-u-xl-21-24{width:87.5%;*width:87.469%}.pure-u-xl-11-12,.pure-u-xl-22-24{width:91.6667%;*width:91.6357%}.pure-u-xl-23-24{width:95.8333%;*width:95.8023%}.pure-u-xl-1,.pure-u-xl-1-1,.pure-u-xl-5-5,.pure-u-xl-24-24{width:100%}} \ No newline at end of file diff --git a/static/hsep.png b/static/hsep.png deleted file mode 100644 index f9b7c51..0000000 Binary files a/static/hsep.png and /dev/null differ diff --git a/static/icon_minus.gif b/static/icon_minus.gif deleted file mode 100755 index 9dadc71..0000000 Binary files a/static/icon_minus.gif and /dev/null differ diff --git a/static/icon_plus.gif b/static/icon_plus.gif deleted file mode 100755 index f7f58ab..0000000 Binary files a/static/icon_plus.gif and /dev/null differ diff --git a/static/jquery-min.js b/static/jquery-min.js deleted file mode 100644 index 4c5be4c..0000000 --- a/static/jquery-min.js +++ /dev/null @@ -1,4 +0,0 @@ -/*! jQuery v3.1.1 | (c) jQuery Foundation | jquery.org/license */ -!function(a,b){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){"use strict";var c=[],d=a.document,e=Object.getPrototypeOf,f=c.slice,g=c.concat,h=c.push,i=c.indexOf,j={},k=j.toString,l=j.hasOwnProperty,m=l.toString,n=m.call(Object),o={};function p(a,b){b=b||d;var c=b.createElement("script");c.text=a,b.head.appendChild(c).parentNode.removeChild(c)}var q="3.1.1",r=function(a,b){return new r.fn.init(a,b)},s=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,t=/^-ms-/,u=/-([a-z])/g,v=function(a,b){return b.toUpperCase()};r.fn=r.prototype={jquery:q,constructor:r,length:0,toArray:function(){return f.call(this)},get:function(a){return null==a?f.call(this):a<0?this[a+this.length]:this[a]},pushStack:function(a){var b=r.merge(this.constructor(),a);return b.prevObject=this,b},each:function(a){return r.each(this,a)},map:function(a){return this.pushStack(r.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(f.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(a<0?b:0);return this.pushStack(c>=0&&c0&&b-1 in a)}var x=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C={}.hasOwnProperty,D=[],E=D.pop,F=D.push,G=D.push,H=D.slice,I=function(a,b){for(var c=0,d=a.length;c+~]|"+K+")"+K+"*"),S=new RegExp("="+K+"*([^\\]'\"]*?)"+K+"*\\]","g"),T=new RegExp(N),U=new RegExp("^"+L+"$"),V={ID:new RegExp("^#("+L+")"),CLASS:new RegExp("^\\.("+L+")"),TAG:new RegExp("^("+L+"|[*])"),ATTR:new RegExp("^"+M),PSEUDO:new RegExp("^"+N),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+K+"*(even|odd|(([+-]|)(\\d*)n|)"+K+"*(?:([+-]|)"+K+"*(\\d+)|))"+K+"*\\)|)","i"),bool:new RegExp("^(?:"+J+")$","i"),needsContext:new RegExp("^"+K+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+K+"*((?:-\\d)?\\d*)"+K+"*\\)|)(?=[^-]|$)","i")},W=/^(?:input|select|textarea|button)$/i,X=/^h\d$/i,Y=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,$=/[+~]/,_=new RegExp("\\\\([\\da-f]{1,6}"+K+"?|("+K+")|.)","ig"),aa=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:d<0?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ba=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ca=function(a,b){return b?"\0"===a?"\ufffd":a.slice(0,-1)+"\\"+a.charCodeAt(a.length-1).toString(16)+" ":"\\"+a},da=function(){m()},ea=ta(function(a){return a.disabled===!0&&("form"in a||"label"in a)},{dir:"parentNode",next:"legend"});try{G.apply(D=H.call(v.childNodes),v.childNodes),D[v.childNodes.length].nodeType}catch(fa){G={apply:D.length?function(a,b){F.apply(a,H.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s=b&&b.ownerDocument,w=b?b.nodeType:9;if(d=d||[],"string"!=typeof a||!a||1!==w&&9!==w&&11!==w)return d;if(!e&&((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,p)){if(11!==w&&(l=Z.exec(a)))if(f=l[1]){if(9===w){if(!(j=b.getElementById(f)))return d;if(j.id===f)return d.push(j),d}else if(s&&(j=s.getElementById(f))&&t(b,j)&&j.id===f)return d.push(j),d}else{if(l[2])return G.apply(d,b.getElementsByTagName(a)),d;if((f=l[3])&&c.getElementsByClassName&&b.getElementsByClassName)return G.apply(d,b.getElementsByClassName(f)),d}if(c.qsa&&!A[a+" "]&&(!q||!q.test(a))){if(1!==w)s=b,r=a;else if("object"!==b.nodeName.toLowerCase()){(k=b.getAttribute("id"))?k=k.replace(ba,ca):b.setAttribute("id",k=u),o=g(a),h=o.length;while(h--)o[h]="#"+k+" "+sa(o[h]);r=o.join(","),s=$.test(a)&&qa(b.parentNode)||b}if(r)try{return G.apply(d,s.querySelectorAll(r)),d}catch(x){}finally{k===u&&b.removeAttribute("id")}}}return i(a.replace(P,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("fieldset");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=c.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&a.sourceIndex-b.sourceIndex;if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return function(b){return"form"in b?b.parentNode&&b.disabled===!1?"label"in b?"label"in b.parentNode?b.parentNode.disabled===a:b.disabled===a:b.isDisabled===a||b.isDisabled!==!a&&ea(b)===a:b.disabled===a:"label"in b&&b.disabled===a}}function pa(a){return ia(function(b){return b=+b,ia(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function qa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return!!b&&"HTML"!==b.nodeName},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=n.documentElement,p=!f(n),v!==n&&(e=n.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener("unload",da,!1):e.attachEvent&&e.attachEvent("onunload",da)),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(n.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Y.test(n.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!n.getElementsByName||!n.getElementsByName(u).length}),c.getById?(d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){return a.getAttribute("id")===b}},d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c?[c]:[]}}):(d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}},d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c,d,e,f=b.getElementById(a);if(f){if(c=f.getAttributeNode("id"),c&&c.value===a)return[f];e=b.getElementsByName(a),d=0;while(f=e[d++])if(c=f.getAttributeNode("id"),c&&c.value===a)return[f]}return[]}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){if("undefined"!=typeof b.getElementsByClassName&&p)return b.getElementsByClassName(a)},r=[],q=[],(c.qsa=Y.test(n.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+K+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+K+"*(?:value|"+J+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){a.innerHTML="";var b=n.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+K+"*[*^$|!~]?="),2!==a.querySelectorAll(":enabled").length&&q.push(":enabled",":disabled"),o.appendChild(a).disabled=!0,2!==a.querySelectorAll(":disabled").length&&q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=Y.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"*"),s.call(a,"[s!='']:x"),r.push("!=",N)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=Y.test(o.compareDocumentPosition),t=b||Y.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===n||a.ownerDocument===v&&t(v,a)?-1:b===n||b.ownerDocument===v&&t(v,b)?1:k?I(k,a)-I(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,g=[a],h=[b];if(!e||!f)return a===n?-1:b===n?1:e?-1:f?1:k?I(k,a)-I(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)g.unshift(c);c=b;while(c=c.parentNode)h.unshift(c);while(g[d]===h[d])d++;return d?la(g[d],h[d]):g[d]===v?-1:h[d]===v?1:0},n):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(S,"='$1']"),c.matchesSelector&&p&&!A[b+" "]&&(!r||!r.test(b))&&(!q||!q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&C.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.escape=function(a){return(a+"").replace(ba,ca)},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(_,aa),a[3]=(a[3]||a[4]||a[5]||"").replace(_,aa),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||ga.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return V.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&T.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(_,aa).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+K+")"+a+"("+K+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ga.attr(d,a);return null==e?"!="===b:!b||(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(O," ")+" ").indexOf(c)>-1:"|="===b&&(e===c||e.slice(0,c.length+1)===c+"-"))}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h,t=!1;if(q){if(f){while(p){m=b;while(m=m[p])if(h?m.nodeName.toLowerCase()===r:1===m.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){m=q,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n&&j[2],m=n&&q.childNodes[n];while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if(1===m.nodeType&&++t&&m===b){k[a]=[w,n,t];break}}else if(s&&(m=b,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n),t===!1)while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if((h?m.nodeName.toLowerCase()===r:1===m.nodeType)&&++t&&(s&&(l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),k[a]=[w,t]),m===b))break;return t-=e,t===d||t%d===0&&t/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=I(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(P,"$1"));return d[u]?ia(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(_,aa),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return U.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(_,aa).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:oa(!1),disabled:oa(!0),checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return X.test(a.nodeName)},input:function(a){return W.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:pa(function(){return[0]}),last:pa(function(a,b){return[b-1]}),eq:pa(function(a,b,c){return[c<0?c+b:c]}),even:pa(function(a,b){for(var c=0;c=0;)a.push(d);return a}),gt:pa(function(a,b,c){for(var d=c<0?c+b:c;++d1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function va(a,b,c){for(var d=0,e=b.length;d-1&&(f[j]=!(g[j]=l))}}else r=wa(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):G.apply(g,r)})}function ya(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=ta(function(a){return a===b},h,!0),l=ta(function(a){return I(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];i1&&ua(m),i>1&&sa(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(P,"$1"),c,i0,e=a.length>0,f=function(f,g,h,i,k){var l,o,q,r=0,s="0",t=f&&[],u=[],v=j,x=f||e&&d.find.TAG("*",k),y=w+=null==v?1:Math.random()||.1,z=x.length;for(k&&(j=g===n||g||k);s!==z&&null!=(l=x[s]);s++){if(e&&l){o=0,g||l.ownerDocument===n||(m(l),h=!p);while(q=a[o++])if(q(l,g||n,h)){i.push(l);break}k&&(w=y)}c&&((l=!q&&l)&&r--,f&&t.push(l))}if(r+=s,c&&s!==r){o=0;while(q=b[o++])q(t,u,g,h);if(f){if(r>0)while(s--)t[s]||u[s]||(u[s]=E.call(i));u=wa(u)}G.apply(i,u),k&&!f&&u.length>0&&r+b.length>1&&ga.uniqueSort(i)}return k&&(w=y,j=v),t};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=ya(b[c]),f[u]?d.push(f):e.push(f);f=A(a,za(e,d)),f.selector=a}return f},i=ga.select=function(a,b,c,e){var f,i,j,k,l,m="function"==typeof a&&a,n=!e&&g(a=m.selector||a);if(c=c||[],1===n.length){if(i=n[0]=n[0].slice(0),i.length>2&&"ID"===(j=i[0]).type&&9===b.nodeType&&p&&d.relative[i[1].type]){if(b=(d.find.ID(j.matches[0].replace(_,aa),b)||[])[0],!b)return c;m&&(b=b.parentNode),a=a.slice(i.shift().value.length)}f=V.needsContext.test(a)?0:i.length;while(f--){if(j=i[f],d.relative[k=j.type])break;if((l=d.find[k])&&(e=l(j.matches[0].replace(_,aa),$.test(i[0].type)&&qa(b.parentNode)||b))){if(i.splice(f,1),a=e.length&&sa(i),!a)return G.apply(c,e),c;break}}}return(m||h(a,n))(e,b,!p,c,!b||$.test(a)&&qa(b.parentNode)||b),c},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("fieldset"))}),ja(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){if(!c)return a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){if(!c&&"input"===a.nodeName.toLowerCase())return a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(J,function(a,b,c){var d;if(!c)return a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);r.find=x,r.expr=x.selectors,r.expr[":"]=r.expr.pseudos,r.uniqueSort=r.unique=x.uniqueSort,r.text=x.getText,r.isXMLDoc=x.isXML,r.contains=x.contains,r.escapeSelector=x.escape;var y=function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&r(a).is(c))break;d.push(a)}return d},z=function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c},A=r.expr.match.needsContext,B=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i,C=/^.[^:#\[\.,]*$/;function D(a,b,c){return r.isFunction(b)?r.grep(a,function(a,d){return!!b.call(a,d,a)!==c}):b.nodeType?r.grep(a,function(a){return a===b!==c}):"string"!=typeof b?r.grep(a,function(a){return i.call(b,a)>-1!==c}):C.test(b)?r.filter(b,a,c):(b=r.filter(b,a),r.grep(a,function(a){return i.call(b,a)>-1!==c&&1===a.nodeType}))}r.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?r.find.matchesSelector(d,a)?[d]:[]:r.find.matches(a,r.grep(b,function(a){return 1===a.nodeType}))},r.fn.extend({find:function(a){var b,c,d=this.length,e=this;if("string"!=typeof a)return this.pushStack(r(a).filter(function(){for(b=0;b1?r.uniqueSort(c):c},filter:function(a){return this.pushStack(D(this,a||[],!1))},not:function(a){return this.pushStack(D(this,a||[],!0))},is:function(a){return!!D(this,"string"==typeof a&&A.test(a)?r(a):a||[],!1).length}});var E,F=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,G=r.fn.init=function(a,b,c){var e,f;if(!a)return this;if(c=c||E,"string"==typeof a){if(e="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:F.exec(a),!e||!e[1]&&b)return!b||b.jquery?(b||c).find(a):this.constructor(b).find(a);if(e[1]){if(b=b instanceof r?b[0]:b,r.merge(this,r.parseHTML(e[1],b&&b.nodeType?b.ownerDocument||b:d,!0)),B.test(e[1])&&r.isPlainObject(b))for(e in b)r.isFunction(this[e])?this[e](b[e]):this.attr(e,b[e]);return this}return f=d.getElementById(e[2]),f&&(this[0]=f,this.length=1),this}return a.nodeType?(this[0]=a,this.length=1,this):r.isFunction(a)?void 0!==c.ready?c.ready(a):a(r):r.makeArray(a,this)};G.prototype=r.fn,E=r(d);var H=/^(?:parents|prev(?:Until|All))/,I={children:!0,contents:!0,next:!0,prev:!0};r.fn.extend({has:function(a){var b=r(a,this),c=b.length;return this.filter(function(){for(var a=0;a-1:1===c.nodeType&&r.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?r.uniqueSort(f):f)},index:function(a){return a?"string"==typeof a?i.call(r(a),this[0]):i.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(r.uniqueSort(r.merge(this.get(),r(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function J(a,b){while((a=a[b])&&1!==a.nodeType);return a}r.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return y(a,"parentNode")},parentsUntil:function(a,b,c){return y(a,"parentNode",c)},next:function(a){return J(a,"nextSibling")},prev:function(a){return J(a,"previousSibling")},nextAll:function(a){return y(a,"nextSibling")},prevAll:function(a){return y(a,"previousSibling")},nextUntil:function(a,b,c){return y(a,"nextSibling",c)},prevUntil:function(a,b,c){return y(a,"previousSibling",c)},siblings:function(a){return z((a.parentNode||{}).firstChild,a)},children:function(a){return z(a.firstChild)},contents:function(a){return a.contentDocument||r.merge([],a.childNodes)}},function(a,b){r.fn[a]=function(c,d){var e=r.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=r.filter(d,e)),this.length>1&&(I[a]||r.uniqueSort(e),H.test(a)&&e.reverse()),this.pushStack(e)}});var K=/[^\x20\t\r\n\f]+/g;function L(a){var b={};return r.each(a.match(K)||[],function(a,c){b[c]=!0}),b}r.Callbacks=function(a){a="string"==typeof a?L(a):r.extend({},a);var b,c,d,e,f=[],g=[],h=-1,i=function(){for(e=a.once,d=b=!0;g.length;h=-1){c=g.shift();while(++h-1)f.splice(c,1),c<=h&&h--}),this},has:function(a){return a?r.inArray(a,f)>-1:f.length>0},empty:function(){return f&&(f=[]),this},disable:function(){return e=g=[],f=c="",this},disabled:function(){return!f},lock:function(){return e=g=[],c||b||(f=c=""),this},locked:function(){return!!e},fireWith:function(a,c){return e||(c=c||[],c=[a,c.slice?c.slice():c],g.push(c),b||i()),this},fire:function(){return j.fireWith(this,arguments),this},fired:function(){return!!d}};return j};function M(a){return a}function N(a){throw a}function O(a,b,c){var d;try{a&&r.isFunction(d=a.promise)?d.call(a).done(b).fail(c):a&&r.isFunction(d=a.then)?d.call(a,b,c):b.call(void 0,a)}catch(a){c.call(void 0,a)}}r.extend({Deferred:function(b){var c=[["notify","progress",r.Callbacks("memory"),r.Callbacks("memory"),2],["resolve","done",r.Callbacks("once memory"),r.Callbacks("once memory"),0,"resolved"],["reject","fail",r.Callbacks("once memory"),r.Callbacks("once memory"),1,"rejected"]],d="pending",e={state:function(){return d},always:function(){return f.done(arguments).fail(arguments),this},"catch":function(a){return e.then(null,a)},pipe:function(){var a=arguments;return r.Deferred(function(b){r.each(c,function(c,d){var e=r.isFunction(a[d[4]])&&a[d[4]];f[d[1]](function(){var a=e&&e.apply(this,arguments);a&&r.isFunction(a.promise)?a.promise().progress(b.notify).done(b.resolve).fail(b.reject):b[d[0]+"With"](this,e?[a]:arguments)})}),a=null}).promise()},then:function(b,d,e){var f=0;function g(b,c,d,e){return function(){var h=this,i=arguments,j=function(){var a,j;if(!(b=f&&(d!==N&&(h=void 0,i=[a]),c.rejectWith(h,i))}};b?k():(r.Deferred.getStackHook&&(k.stackTrace=r.Deferred.getStackHook()),a.setTimeout(k))}}return r.Deferred(function(a){c[0][3].add(g(0,a,r.isFunction(e)?e:M,a.notifyWith)),c[1][3].add(g(0,a,r.isFunction(b)?b:M)),c[2][3].add(g(0,a,r.isFunction(d)?d:N))}).promise()},promise:function(a){return null!=a?r.extend(a,e):e}},f={};return r.each(c,function(a,b){var g=b[2],h=b[5];e[b[1]]=g.add,h&&g.add(function(){d=h},c[3-a][2].disable,c[0][2].lock),g.add(b[3].fire),f[b[0]]=function(){return f[b[0]+"With"](this===f?void 0:this,arguments),this},f[b[0]+"With"]=g.fireWith}),e.promise(f),b&&b.call(f,f),f},when:function(a){var b=arguments.length,c=b,d=Array(c),e=f.call(arguments),g=r.Deferred(),h=function(a){return function(c){d[a]=this,e[a]=arguments.length>1?f.call(arguments):c,--b||g.resolveWith(d,e)}};if(b<=1&&(O(a,g.done(h(c)).resolve,g.reject),"pending"===g.state()||r.isFunction(e[c]&&e[c].then)))return g.then();while(c--)O(e[c],h(c),g.reject);return g.promise()}});var P=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;r.Deferred.exceptionHook=function(b,c){a.console&&a.console.warn&&b&&P.test(b.name)&&a.console.warn("jQuery.Deferred exception: "+b.message,b.stack,c)},r.readyException=function(b){a.setTimeout(function(){throw b})};var Q=r.Deferred();r.fn.ready=function(a){return Q.then(a)["catch"](function(a){r.readyException(a)}),this},r.extend({isReady:!1,readyWait:1,holdReady:function(a){a?r.readyWait++:r.ready(!0)},ready:function(a){(a===!0?--r.readyWait:r.isReady)||(r.isReady=!0,a!==!0&&--r.readyWait>0||Q.resolveWith(d,[r]))}}),r.ready.then=Q.then;function R(){d.removeEventListener("DOMContentLoaded",R), -a.removeEventListener("load",R),r.ready()}"complete"===d.readyState||"loading"!==d.readyState&&!d.documentElement.doScroll?a.setTimeout(r.ready):(d.addEventListener("DOMContentLoaded",R),a.addEventListener("load",R));var S=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===r.type(c)){e=!0;for(h in c)S(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,r.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(r(a),c)})),b))for(;h1,null,!0)},removeData:function(a){return this.each(function(){W.remove(this,a)})}}),r.extend({queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=V.get(a,b),c&&(!d||r.isArray(c)?d=V.access(a,b,r.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=r.queue(a,b),d=c.length,e=c.shift(),f=r._queueHooks(a,b),g=function(){r.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return V.get(a,c)||V.access(a,c,{empty:r.Callbacks("once memory").add(function(){V.remove(a,[b+"queue",c])})})}}),r.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length\x20\t\r\n\f]+)/i,ka=/^$|\/(?:java|ecma)script/i,la={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};la.optgroup=la.option,la.tbody=la.tfoot=la.colgroup=la.caption=la.thead,la.th=la.td;function ma(a,b){var c;return c="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):[],void 0===b||b&&r.nodeName(a,b)?r.merge([a],c):c}function na(a,b){for(var c=0,d=a.length;c-1)e&&e.push(f);else if(j=r.contains(f.ownerDocument,f),g=ma(l.appendChild(f),"script"),j&&na(g),c){k=0;while(f=g[k++])ka.test(f.type||"")&&c.push(f)}return l}!function(){var a=d.createDocumentFragment(),b=a.appendChild(d.createElement("div")),c=d.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),o.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="",o.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var qa=d.documentElement,ra=/^key/,sa=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,ta=/^([^.]*)(?:\.(.+)|)/;function ua(){return!0}function va(){return!1}function wa(){try{return d.activeElement}catch(a){}}function xa(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof c&&(d=d||c,c=void 0);for(h in b)xa(a,h,c,d,b[h],f);return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&("string"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1)e=va;else if(!e)return a;return 1===f&&(g=e,e=function(a){return r().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=r.guid++)),a.each(function(){r.event.add(this,b,e,d,c)})}r.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=V.get(a);if(q){c.handler&&(f=c,c=f.handler,e=f.selector),e&&r.find.matchesSelector(qa,e),c.guid||(c.guid=r.guid++),(i=q.events)||(i=q.events={}),(g=q.handle)||(g=q.handle=function(b){return"undefined"!=typeof r&&r.event.triggered!==b.type?r.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(K)||[""],j=b.length;while(j--)h=ta.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n&&(l=r.event.special[n]||{},n=(e?l.delegateType:l.bindType)||n,l=r.event.special[n]||{},k=r.extend({type:n,origType:p,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&r.expr.match.needsContext.test(e),namespace:o.join(".")},f),(m=i[n])||(m=i[n]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,o,g)!==!1||a.addEventListener&&a.addEventListener(n,g)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),r.event.global[n]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=V.hasData(a)&&V.get(a);if(q&&(i=q.events)){b=(b||"").match(K)||[""],j=b.length;while(j--)if(h=ta.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n){l=r.event.special[n]||{},n=(d?l.delegateType:l.bindType)||n,m=i[n]||[],h=h[2]&&new RegExp("(^|\\.)"+o.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&p!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,o,q.handle)!==!1||r.removeEvent(a,n,q.handle),delete i[n])}else for(n in i)r.event.remove(a,n+b[j],c,d,!0);r.isEmptyObject(i)&&V.remove(a,"handle events")}},dispatch:function(a){var b=r.event.fix(a),c,d,e,f,g,h,i=new Array(arguments.length),j=(V.get(this,"events")||{})[b.type]||[],k=r.event.special[b.type]||{};for(i[0]=b,c=1;c=1))for(;j!==this;j=j.parentNode||this)if(1===j.nodeType&&("click"!==a.type||j.disabled!==!0)){for(f=[],g={},c=0;c-1:r.find(e,this,null,[j]).length),g[e]&&f.push(d);f.length&&h.push({elem:j,handlers:f})}return j=this,i\x20\t\r\n\f]*)[^>]*)\/>/gi,za=/\s*$/g;function Da(a,b){return r.nodeName(a,"table")&&r.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a:a}function Ea(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function Fa(a){var b=Ba.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function Ga(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(V.hasData(a)&&(f=V.access(a),g=V.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;c1&&"string"==typeof q&&!o.checkClone&&Aa.test(q))return a.each(function(e){var f=a.eq(e);s&&(b[0]=q.call(this,e,f.html())),Ia(f,b,c,d)});if(m&&(e=pa(b,a[0].ownerDocument,!1,a,d),f=e.firstChild,1===e.childNodes.length&&(e=f),f||d)){for(h=r.map(ma(e,"script"),Ea),i=h.length;l")},clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=r.contains(a.ownerDocument,a);if(!(o.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||r.isXMLDoc(a)))for(g=ma(h),f=ma(a),d=0,e=f.length;d0&&na(g,!i&&ma(a,"script")),h},cleanData:function(a){for(var b,c,d,e=r.event.special,f=0;void 0!==(c=a[f]);f++)if(T(c)){if(b=c[V.expando]){if(b.events)for(d in b.events)e[d]?r.event.remove(c,d):r.removeEvent(c,d,b.handle);c[V.expando]=void 0}c[W.expando]&&(c[W.expando]=void 0)}}}),r.fn.extend({detach:function(a){return Ja(this,a,!0)},remove:function(a){return Ja(this,a)},text:function(a){return S(this,function(a){return void 0===a?r.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=a)})},null,a,arguments.length)},append:function(){return Ia(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Da(this,a);b.appendChild(a)}})},prepend:function(){return Ia(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Da(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return Ia(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return Ia(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(r.cleanData(ma(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null!=a&&a,b=null==b?a:b,this.map(function(){return r.clone(this,a,b)})},html:function(a){return S(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!za.test(a)&&!la[(ja.exec(a)||["",""])[1].toLowerCase()]){a=r.htmlPrefilter(a);try{for(;c1)}});function Ya(a,b,c,d,e){return new Ya.prototype.init(a,b,c,d,e)}r.Tween=Ya,Ya.prototype={constructor:Ya,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||r.easing._default,this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(r.cssNumber[c]?"":"px")},cur:function(){var a=Ya.propHooks[this.prop];return a&&a.get?a.get(this):Ya.propHooks._default.get(this)},run:function(a){var b,c=Ya.propHooks[this.prop];return this.options.duration?this.pos=b=r.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Ya.propHooks._default.set(this),this}},Ya.prototype.init.prototype=Ya.prototype,Ya.propHooks={_default:{get:function(a){var b;return 1!==a.elem.nodeType||null!=a.elem[a.prop]&&null==a.elem.style[a.prop]?a.elem[a.prop]:(b=r.css(a.elem,a.prop,""),b&&"auto"!==b?b:0)},set:function(a){r.fx.step[a.prop]?r.fx.step[a.prop](a):1!==a.elem.nodeType||null==a.elem.style[r.cssProps[a.prop]]&&!r.cssHooks[a.prop]?a.elem[a.prop]=a.now:r.style(a.elem,a.prop,a.now+a.unit)}}},Ya.propHooks.scrollTop=Ya.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},r.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2},_default:"swing"},r.fx=Ya.prototype.init,r.fx.step={};var Za,$a,_a=/^(?:toggle|show|hide)$/,ab=/queueHooks$/;function bb(){$a&&(a.requestAnimationFrame(bb),r.fx.tick())}function cb(){return a.setTimeout(function(){Za=void 0}),Za=r.now()}function db(a,b){var c,d=0,e={height:a};for(b=b?1:0;d<4;d+=2-b)c=ba[d],e["margin"+c]=e["padding"+c]=a;return b&&(e.opacity=e.width=a),e}function eb(a,b,c){for(var d,e=(hb.tweeners[b]||[]).concat(hb.tweeners["*"]),f=0,g=e.length;f1)},removeAttr:function(a){return this.each(function(){r.removeAttr(this,a)})}}),r.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return"undefined"==typeof a.getAttribute?r.prop(a,b,c):(1===f&&r.isXMLDoc(a)||(e=r.attrHooks[b.toLowerCase()]||(r.expr.match.bool.test(b)?ib:void 0)), -void 0!==c?null===c?void r.removeAttr(a,b):e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:(a.setAttribute(b,c+""),c):e&&"get"in e&&null!==(d=e.get(a,b))?d:(d=r.find.attr(a,b),null==d?void 0:d))},attrHooks:{type:{set:function(a,b){if(!o.radioValue&&"radio"===b&&r.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}},removeAttr:function(a,b){var c,d=0,e=b&&b.match(K);if(e&&1===a.nodeType)while(c=e[d++])a.removeAttribute(c)}}),ib={set:function(a,b,c){return b===!1?r.removeAttr(a,c):a.setAttribute(c,c),c}},r.each(r.expr.match.bool.source.match(/\w+/g),function(a,b){var c=jb[b]||r.find.attr;jb[b]=function(a,b,d){var e,f,g=b.toLowerCase();return d||(f=jb[g],jb[g]=e,e=null!=c(a,b,d)?g:null,jb[g]=f),e}});var kb=/^(?:input|select|textarea|button)$/i,lb=/^(?:a|area)$/i;r.fn.extend({prop:function(a,b){return S(this,r.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[r.propFix[a]||a]})}}),r.extend({prop:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return 1===f&&r.isXMLDoc(a)||(b=r.propFix[b]||b,e=r.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=r.find.attr(a,"tabindex");return b?parseInt(b,10):kb.test(a.nodeName)||lb.test(a.nodeName)&&a.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),o.optSelected||(r.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null},set:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}}),r.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){r.propFix[this.toLowerCase()]=this});function mb(a){var b=a.match(K)||[];return b.join(" ")}function nb(a){return a.getAttribute&&a.getAttribute("class")||""}r.fn.extend({addClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).addClass(a.call(this,b,nb(this)))});if("string"==typeof a&&a){b=a.match(K)||[];while(c=this[i++])if(e=nb(c),d=1===c.nodeType&&" "+mb(e)+" "){g=0;while(f=b[g++])d.indexOf(" "+f+" ")<0&&(d+=f+" ");h=mb(d),e!==h&&c.setAttribute("class",h)}}return this},removeClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).removeClass(a.call(this,b,nb(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof a&&a){b=a.match(K)||[];while(c=this[i++])if(e=nb(c),d=1===c.nodeType&&" "+mb(e)+" "){g=0;while(f=b[g++])while(d.indexOf(" "+f+" ")>-1)d=d.replace(" "+f+" "," ");h=mb(d),e!==h&&c.setAttribute("class",h)}}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):r.isFunction(a)?this.each(function(c){r(this).toggleClass(a.call(this,c,nb(this),b),b)}):this.each(function(){var b,d,e,f;if("string"===c){d=0,e=r(this),f=a.match(K)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else void 0!==a&&"boolean"!==c||(b=nb(this),b&&V.set(this,"__className__",b),this.setAttribute&&this.setAttribute("class",b||a===!1?"":V.get(this,"__className__")||""))})},hasClass:function(a){var b,c,d=0;b=" "+a+" ";while(c=this[d++])if(1===c.nodeType&&(" "+mb(nb(c))+" ").indexOf(b)>-1)return!0;return!1}});var ob=/\r/g;r.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=r.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,r(this).val()):a,null==e?e="":"number"==typeof e?e+="":r.isArray(e)&&(e=r.map(e,function(a){return null==a?"":a+""})),b=r.valHooks[this.type]||r.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=r.valHooks[e.type]||r.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(ob,""):null==c?"":c)}}}),r.extend({valHooks:{option:{get:function(a){var b=r.find.attr(a,"value");return null!=b?b:mb(r.text(a))}},select:{get:function(a){var b,c,d,e=a.options,f=a.selectedIndex,g="select-one"===a.type,h=g?null:[],i=g?f+1:e.length;for(d=f<0?i:g?f:0;d-1)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),r.each(["radio","checkbox"],function(){r.valHooks[this]={set:function(a,b){if(r.isArray(b))return a.checked=r.inArray(r(a).val(),b)>-1}},o.checkOn||(r.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var pb=/^(?:focusinfocus|focusoutblur)$/;r.extend(r.event,{trigger:function(b,c,e,f){var g,h,i,j,k,m,n,o=[e||d],p=l.call(b,"type")?b.type:b,q=l.call(b,"namespace")?b.namespace.split("."):[];if(h=i=e=e||d,3!==e.nodeType&&8!==e.nodeType&&!pb.test(p+r.event.triggered)&&(p.indexOf(".")>-1&&(q=p.split("."),p=q.shift(),q.sort()),k=p.indexOf(":")<0&&"on"+p,b=b[r.expando]?b:new r.Event(p,"object"==typeof b&&b),b.isTrigger=f?2:3,b.namespace=q.join("."),b.rnamespace=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=e),c=null==c?[b]:r.makeArray(c,[b]),n=r.event.special[p]||{},f||!n.trigger||n.trigger.apply(e,c)!==!1)){if(!f&&!n.noBubble&&!r.isWindow(e)){for(j=n.delegateType||p,pb.test(j+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),i=h;i===(e.ownerDocument||d)&&o.push(i.defaultView||i.parentWindow||a)}g=0;while((h=o[g++])&&!b.isPropagationStopped())b.type=g>1?j:n.bindType||p,m=(V.get(h,"events")||{})[b.type]&&V.get(h,"handle"),m&&m.apply(h,c),m=k&&h[k],m&&m.apply&&T(h)&&(b.result=m.apply(h,c),b.result===!1&&b.preventDefault());return b.type=p,f||b.isDefaultPrevented()||n._default&&n._default.apply(o.pop(),c)!==!1||!T(e)||k&&r.isFunction(e[p])&&!r.isWindow(e)&&(i=e[k],i&&(e[k]=null),r.event.triggered=p,e[p](),r.event.triggered=void 0,i&&(e[k]=i)),b.result}},simulate:function(a,b,c){var d=r.extend(new r.Event,c,{type:a,isSimulated:!0});r.event.trigger(d,null,b)}}),r.fn.extend({trigger:function(a,b){return this.each(function(){r.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];if(c)return r.event.trigger(a,b,c,!0)}}),r.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(a,b){r.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),r.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),o.focusin="onfocusin"in a,o.focusin||r.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){r.event.simulate(b,a.target,r.event.fix(a))};r.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=V.access(d,b);e||d.addEventListener(a,c,!0),V.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=V.access(d,b)-1;e?V.access(d,b,e):(d.removeEventListener(a,c,!0),V.remove(d,b))}}});var qb=a.location,rb=r.now(),sb=/\?/;r.parseXML=function(b){var c;if(!b||"string"!=typeof b)return null;try{c=(new a.DOMParser).parseFromString(b,"text/xml")}catch(d){c=void 0}return c&&!c.getElementsByTagName("parsererror").length||r.error("Invalid XML: "+b),c};var tb=/\[\]$/,ub=/\r?\n/g,vb=/^(?:submit|button|image|reset|file)$/i,wb=/^(?:input|select|textarea|keygen)/i;function xb(a,b,c,d){var e;if(r.isArray(b))r.each(b,function(b,e){c||tb.test(a)?d(a,e):xb(a+"["+("object"==typeof e&&null!=e?b:"")+"]",e,c,d)});else if(c||"object"!==r.type(b))d(a,b);else for(e in b)xb(a+"["+e+"]",b[e],c,d)}r.param=function(a,b){var c,d=[],e=function(a,b){var c=r.isFunction(b)?b():b;d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(null==c?"":c)};if(r.isArray(a)||a.jquery&&!r.isPlainObject(a))r.each(a,function(){e(this.name,this.value)});else for(c in a)xb(c,a[c],b,e);return d.join("&")},r.fn.extend({serialize:function(){return r.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=r.prop(this,"elements");return a?r.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!r(this).is(":disabled")&&wb.test(this.nodeName)&&!vb.test(a)&&(this.checked||!ia.test(a))}).map(function(a,b){var c=r(this).val();return null==c?null:r.isArray(c)?r.map(c,function(a){return{name:b.name,value:a.replace(ub,"\r\n")}}):{name:b.name,value:c.replace(ub,"\r\n")}}).get()}});var yb=/%20/g,zb=/#.*$/,Ab=/([?&])_=[^&]*/,Bb=/^(.*?):[ \t]*([^\r\n]*)$/gm,Cb=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Db=/^(?:GET|HEAD)$/,Eb=/^\/\//,Fb={},Gb={},Hb="*/".concat("*"),Ib=d.createElement("a");Ib.href=qb.href;function Jb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(K)||[];if(r.isFunction(c))while(d=f[e++])"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Kb(a,b,c,d){var e={},f=a===Gb;function g(h){var i;return e[h]=!0,r.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Lb(a,b){var c,d,e=r.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&r.extend(!0,a,d),a}function Mb(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===d&&(d=a.mimeType||b.getResponseHeader("Content-Type"));if(d)for(e in h)if(h[e]&&h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+" "+i[0]]){f=e;break}g||(g=e)}f=f||g}if(f)return f!==i[0]&&i.unshift(f),c[f]}function Nb(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}r.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:qb.href,type:"GET",isLocal:Cb.test(qb.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Hb,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":r.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Lb(Lb(a,r.ajaxSettings),b):Lb(r.ajaxSettings,a)},ajaxPrefilter:Jb(Fb),ajaxTransport:Jb(Gb),ajax:function(b,c){"object"==typeof b&&(c=b,b=void 0),c=c||{};var e,f,g,h,i,j,k,l,m,n,o=r.ajaxSetup({},c),p=o.context||o,q=o.context&&(p.nodeType||p.jquery)?r(p):r.event,s=r.Deferred(),t=r.Callbacks("once memory"),u=o.statusCode||{},v={},w={},x="canceled",y={readyState:0,getResponseHeader:function(a){var b;if(k){if(!h){h={};while(b=Bb.exec(g))h[b[1].toLowerCase()]=b[2]}b=h[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return k?g:null},setRequestHeader:function(a,b){return null==k&&(a=w[a.toLowerCase()]=w[a.toLowerCase()]||a,v[a]=b),this},overrideMimeType:function(a){return null==k&&(o.mimeType=a),this},statusCode:function(a){var b;if(a)if(k)y.always(a[y.status]);else for(b in a)u[b]=[u[b],a[b]];return this},abort:function(a){var b=a||x;return e&&e.abort(b),A(0,b),this}};if(s.promise(y),o.url=((b||o.url||qb.href)+"").replace(Eb,qb.protocol+"//"),o.type=c.method||c.type||o.method||o.type,o.dataTypes=(o.dataType||"*").toLowerCase().match(K)||[""],null==o.crossDomain){j=d.createElement("a");try{j.href=o.url,j.href=j.href,o.crossDomain=Ib.protocol+"//"+Ib.host!=j.protocol+"//"+j.host}catch(z){o.crossDomain=!0}}if(o.data&&o.processData&&"string"!=typeof o.data&&(o.data=r.param(o.data,o.traditional)),Kb(Fb,o,c,y),k)return y;l=r.event&&o.global,l&&0===r.active++&&r.event.trigger("ajaxStart"),o.type=o.type.toUpperCase(),o.hasContent=!Db.test(o.type),f=o.url.replace(zb,""),o.hasContent?o.data&&o.processData&&0===(o.contentType||"").indexOf("application/x-www-form-urlencoded")&&(o.data=o.data.replace(yb,"+")):(n=o.url.slice(f.length),o.data&&(f+=(sb.test(f)?"&":"?")+o.data,delete o.data),o.cache===!1&&(f=f.replace(Ab,"$1"),n=(sb.test(f)?"&":"?")+"_="+rb++ +n),o.url=f+n),o.ifModified&&(r.lastModified[f]&&y.setRequestHeader("If-Modified-Since",r.lastModified[f]),r.etag[f]&&y.setRequestHeader("If-None-Match",r.etag[f])),(o.data&&o.hasContent&&o.contentType!==!1||c.contentType)&&y.setRequestHeader("Content-Type",o.contentType),y.setRequestHeader("Accept",o.dataTypes[0]&&o.accepts[o.dataTypes[0]]?o.accepts[o.dataTypes[0]]+("*"!==o.dataTypes[0]?", "+Hb+"; q=0.01":""):o.accepts["*"]);for(m in o.headers)y.setRequestHeader(m,o.headers[m]);if(o.beforeSend&&(o.beforeSend.call(p,y,o)===!1||k))return y.abort();if(x="abort",t.add(o.complete),y.done(o.success),y.fail(o.error),e=Kb(Gb,o,c,y)){if(y.readyState=1,l&&q.trigger("ajaxSend",[y,o]),k)return y;o.async&&o.timeout>0&&(i=a.setTimeout(function(){y.abort("timeout")},o.timeout));try{k=!1,e.send(v,A)}catch(z){if(k)throw z;A(-1,z)}}else A(-1,"No Transport");function A(b,c,d,h){var j,m,n,v,w,x=c;k||(k=!0,i&&a.clearTimeout(i),e=void 0,g=h||"",y.readyState=b>0?4:0,j=b>=200&&b<300||304===b,d&&(v=Mb(o,y,d)),v=Nb(o,v,y,j),j?(o.ifModified&&(w=y.getResponseHeader("Last-Modified"),w&&(r.lastModified[f]=w),w=y.getResponseHeader("etag"),w&&(r.etag[f]=w)),204===b||"HEAD"===o.type?x="nocontent":304===b?x="notmodified":(x=v.state,m=v.data,n=v.error,j=!n)):(n=x,!b&&x||(x="error",b<0&&(b=0))),y.status=b,y.statusText=(c||x)+"",j?s.resolveWith(p,[m,x,y]):s.rejectWith(p,[y,x,n]),y.statusCode(u),u=void 0,l&&q.trigger(j?"ajaxSuccess":"ajaxError",[y,o,j?m:n]),t.fireWith(p,[y,x]),l&&(q.trigger("ajaxComplete",[y,o]),--r.active||r.event.trigger("ajaxStop")))}return y},getJSON:function(a,b,c){return r.get(a,b,c,"json")},getScript:function(a,b){return r.get(a,void 0,b,"script")}}),r.each(["get","post"],function(a,b){r[b]=function(a,c,d,e){return r.isFunction(c)&&(e=e||d,d=c,c=void 0),r.ajax(r.extend({url:a,type:b,dataType:e,data:c,success:d},r.isPlainObject(a)&&a))}}),r._evalUrl=function(a){return r.ajax({url:a,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},r.fn.extend({wrapAll:function(a){var b;return this[0]&&(r.isFunction(a)&&(a=a.call(this[0])),b=r(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstElementChild)a=a.firstElementChild;return a}).append(this)),this},wrapInner:function(a){return r.isFunction(a)?this.each(function(b){r(this).wrapInner(a.call(this,b))}):this.each(function(){var b=r(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=r.isFunction(a);return this.each(function(c){r(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(a){return this.parent(a).not("body").each(function(){r(this).replaceWith(this.childNodes)}),this}}),r.expr.pseudos.hidden=function(a){return!r.expr.pseudos.visible(a)},r.expr.pseudos.visible=function(a){return!!(a.offsetWidth||a.offsetHeight||a.getClientRects().length)},r.ajaxSettings.xhr=function(){try{return new a.XMLHttpRequest}catch(b){}};var Ob={0:200,1223:204},Pb=r.ajaxSettings.xhr();o.cors=!!Pb&&"withCredentials"in Pb,o.ajax=Pb=!!Pb,r.ajaxTransport(function(b){var c,d;if(o.cors||Pb&&!b.crossDomain)return{send:function(e,f){var g,h=b.xhr();if(h.open(b.type,b.url,b.async,b.username,b.password),b.xhrFields)for(g in b.xhrFields)h[g]=b.xhrFields[g];b.mimeType&&h.overrideMimeType&&h.overrideMimeType(b.mimeType),b.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest");for(g in e)h.setRequestHeader(g,e[g]);c=function(a){return function(){c&&(c=d=h.onload=h.onerror=h.onabort=h.onreadystatechange=null,"abort"===a?h.abort():"error"===a?"number"!=typeof h.status?f(0,"error"):f(h.status,h.statusText):f(Ob[h.status]||h.status,h.statusText,"text"!==(h.responseType||"text")||"string"!=typeof h.responseText?{binary:h.response}:{text:h.responseText},h.getAllResponseHeaders()))}},h.onload=c(),d=h.onerror=c("error"),void 0!==h.onabort?h.onabort=d:h.onreadystatechange=function(){4===h.readyState&&a.setTimeout(function(){c&&d()})},c=c("abort");try{h.send(b.hasContent&&b.data||null)}catch(i){if(c)throw i}},abort:function(){c&&c()}}}),r.ajaxPrefilter(function(a){a.crossDomain&&(a.contents.script=!1)}),r.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(a){return r.globalEval(a),a}}}),r.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),r.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(e,f){b=r(" - - - - - - -
-
- Flowers - - -
-
- - - - - - -
-
-
-
- -
-
- - - - - - - - - - - - - - - - - -
- - org2, login2 - - 2016-11-30
- RABO creditcard, - - 2001-03-17
- ABN AMRO creditcard, 5422 2300 0373 7907 - - 2001-03-17
- -
-
- -
-
-
- -
- - - - - -
- - - - - -
- - - - - - - - - - - - diff --git a/templates/common.html b/templates/common.html index f003e59..cae503e 100644 --- a/templates/common.html +++ b/templates/common.html @@ -13,7 +13,7 @@ Flowers -