From d7ad8177e2efde14b72e8295bccda13d8dd59436 Mon Sep 17 00:00:00 2001 From: Amirouche Boubekki Date: Sun, 12 May 2013 16:36:26 +0200 Subject: [PATCH 001/860] update documentation and small fix --- Makefile | 3 + doc/source/conf.py | 14 ++- doc/source/index.rst | 10 +- doc/source/internals.rst | 178 ++++++++++++++++++++++++++++++++- pythonscript/pythonpythonjs.py | 20 +++- 5 files changed, 216 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 70c5e6c..808a300 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,9 @@ all: jquery pythonscript jquery: ./pythonscript/main.py < bindings/jquery.py > bindings/jquery.py.js +weblib.py: + ./pythonscript/main.py < weblib/main.py > weblib.py.js + builtins: ./pythonscript/main.py < builtins.py > builtins.py.js diff --git a/doc/source/conf.py b/doc/source/conf.py index 87faa23..0a1b136 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -25,7 +25,17 @@ # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ['sphinx.ext.autodoc', 'sphinx.ext.coverage', 'sphinx.ext.viewcode'] +extensions = [ + 'sphinx.ext.autodoc', + 'sphinx.ext.coverage', + 'sphinx.ext.viewcode', + # contrib + 'sphinxcontrib.blockdiag', + 'sphinxcontrib.seqdiag', + 'sphinxcontrib.nwdiag', + 'sphinxcontrib.actdiag', + +] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -81,7 +91,7 @@ #show_authors = False # The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' +pygments_style = 'monokai' # A list of ignored prefixes for module index sorting. #modindex_common_prefix = [] diff --git a/doc/source/index.rst b/doc/source/index.rst index ec2a71c..ba10b93 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -6,9 +6,6 @@ Welcome to PythonScript's documentation! ======================================== -Reading the ``.py`` from the `forge `_ might give you a head start about how it works but without a good understanding of how `ast module `_ works it will be difficult to understand all the magic. Is it usefull ? -No. You don't need to understand how it works to use it, but since it's buggy (but usable) you might want to know what Python is converted to what Javascript to understand the errors that may arise and circuvent them and also you might learn something about Python or Javascript or both and contribute to PythonScript. Anyway most of the time trial and errror works perfectly! - .. warning:: if all you want is experiment with the language there is an `online editor `_. Start by reading the howtos to learn more about the specific capabilities of PythonScript, then the remaining part if you feel advanturous and know javascript, how it's done. @@ -17,6 +14,13 @@ Start by reading the howtos to learn more about the specific capabilities of Pyt :maxdepth: 2 howtos + +Reading the ``.py`` from the `forge `_ might give you a head start about how it works but without a good understanding of how `ast module `_ works it will be difficult to understand all the magic. Is it useful ? +No. You don't need to understand how it works to use it, but since it's buggy (but usable) you might want to know what Python is converted to what Javascript to understand the errors that may arise and circuvent them and also you might learn something about Python or Javascript or both and contribute to PythonScript. Anyway most of the time trial and errror works perfectly! + +.. toctree:: + :maxdepth: 2 + internals diff --git a/doc/source/internals.rst b/doc/source/internals.rst index 45eb132..665d498 100644 --- a/doc/source/internals.rst +++ b/doc/source/internals.rst @@ -1,4 +1,180 @@ PythonScript internals ###################### -Translation step by step... +Big picture +=========== + +This might not make sens right now, but you can read it nonetheless and as you read what follows you will get the point: + +Compilation +----------- + +.. blockdiag:: + + blockdiag { + "Python" -> PythonToPythonJS -> "PythonJS" -> JSGenerator -> "Javascript"; + + PythonToPythonJS -> "PythonJS" [folded]; + JSGenerator -> "Javascript" [folded]; + } + +This is the description of ``pythonscript`` command. Mind the fact that there is no actual ``pythontopythonjs`` command this is done on the fly. + +Execution +--------- + +.. blockdiag:: + + blockdiag { + "pythonpythonjs.py" -> PythonJS -> "pythonscript.js"; + "app.py" -> "pythonscript" -> "app.py.js"; + "app.py.js"-> "running application"; + "pythonscript.js"-> "running application"; + } + +This is how a script can be run, it needs ``pythonscript.js`` which is the runtime library written in Python actually PythonJS. Read along the make things more clear. + +How does it executes ? +====================== + +To run, a python file translated by ``pythonscript`` must come after ``pythonscript.js`` which is ``pythonpythonjs.py`` that is translated by ``pythonjs`` command. + +In the following we will see in order: + +* ``pythonjs`` the translator that maps a subset of Python to a subset of Javascript. +* ``pythonpython.py`` which is the runtime library which is used by translated ``.py`` (except itself) to run. +* ``pythonscript`` which is the command can generate a ``.js`` file that given the functions defined in ``pythonpython.py`` and possibly other objects available at runtime time can execute in a browser. + + + +``pythonjs`` +------------ + +``pythonjs`` knows how to translate: + +- Python functions to Javascript ones +- It handles attribute access e.g. ``spam.egg.foobarbaz`` +- Add brackets and semi-colons +- ``print(*args)`` are converted to ``console.log(*args)`` +- ``for i in jsrange(int)`` are converted to Javascript for loops + +It also support two special functions ``JS(str)`` and ``var(*args)``: + + +``JS(str)`` +~~~~~~~~~~~ + +``pythonjs`` will inline the content of the string in the output of the translation. Which means that, the following: + +.. code-block:: python + + d = JS('new Array()') + d.push(1) + +Will be translated to the following Javascript code: + +.. code-block:: javascript + + d = new Array(); + d.push(1) + +This makes it possible to: + +- Support Javascript syntax that is not supported by Python. +- Bypass translation process as it will be shown later. + +As matter of fact that is the function which is used to create bindings of DOM API or javascript libraries. + + +``var(*args)`` +~~~~~~~~~~~~~~ + +It will take all the arguments that are given and ``var`` them. For instance the following code: + +.. code-block:: python + + var(spam, egg) + spam = 1 + egg = spam + 2 + print spam, egg + +Will be translated to the following javascript code: + +.. code-block:: javascript + + var spam, egg; + spam = 1; + egg = spam + 2; + console.log(spam, egg) + +This allows to take control of variable scope definition which is in Javascript by default global, otherwise said ``var`` makes variables local which what you want most of the time. This is needed given the way PythonScript works, it doesn't emulate Python scope definition instead it use Javascript one, and ``var`` is needed to make it possible to actually write code that works (just like it's needed in Javascript). + +``pythonpythonjs.py`` +--------------------- + +This is Python written in PythonJS, the actual Python subset that can be translated to Javascript, the one presented just before. It defines a certain number of functions that allows to emulate Python behavior like ``class``, ``getattr``, ``setattr`` and other things that are needed by the *emulation* process. + +In the following you will find all the functions that are defined in ``pythonpythonjs.py``: + +``jsrange(int)`` +~~~~~~~~~~~~~~~~ + +Create an array of integers that can be iterated over by the ``for`` loop generated by pythonjs. This is similar in principle to Python ``range`` but not actually the same since it doesn't ``pythonjs`` ``for`` loop doesn't handle iterable classes (since no class exists at this level). + + +``create_arrary(*args)`` +~~~~~~~~~~~~~~~~~~~~~~~~ + +``create_array`` will create a Javascript array with ``args``. This function circunvent a behavior in Javascript where ``new Array(42)`` and ``new Array(42, 24)`` behaves differently. + + + +``adapt_arguments()`` +~~~~~~~~~~~~~~~~~~~~~ + +It's somekind of decorator in the sens that it takes a function as argument and change wrap it in a function that change the arguments of the function to be compatible with the arguments scheme of functions generated from Python. + + +``create_class(class_name, parents, attrs)`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +This is the function that is called when you call ``type`` from Python code, it build the class which actually means to create a javascript object and populating with some information. It also check for the presence ``__metaclass__`` *in the current class definition* (read: not the bases) so that the user can hook it's own class constructor. + + +``get_attribute(object, attribute)`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +This is the internal ``getattr`` which is used to fetch attributes every time you use the dot notation. It's in this function that must come the code that implements ``__getattribute__`` and ``__getattr__`` hook. Currently it handles: + +- data descriptors +- method access +- property access + + +``set_attribute(object, attribute, value)`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +This is the internal ``setattr`` which is used to set attributes. + +``get_arguments(signature, args, kwargs)`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +This is the function used in every function (or method) call to retrieve actual parameters given args and kwargs and a signature. + + +``type(args, kwargs)`` +~~~~~~~~~~~~~~~~~~~~~~ + +This is the function that is callable from Python code and does create a class «dynamically». It converts its arguments to be compatible with ``create_class``. + + +``getattr(args, kwargs)`` +~~~~~~~~~~~~~~~~~~~~~~~~~ + +This is the function that is callable from Python code and does fetch the attribute of an object . It converts its arguments to be compatible with ``get_attribute``. + + +``setattr(args, kwargs)`` +~~~~~~~~~~~~~~~~~~~~~~~~~ + +This is the function that is callable from Python code and does set an attribute of an object to a value. It converts its arguments to be compatible with ``set_attribute``. diff --git a/pythonscript/pythonpythonjs.py b/pythonscript/pythonpythonjs.py index 417713b..2d4b04f 100644 --- a/pythonscript/pythonpythonjs.py +++ b/pythonscript/pythonpythonjs.py @@ -1,7 +1,6 @@ def jsrange(num): """Emulates Python's range function""" - JS('var i') - JS('var r') + var(i, r) i = 0 r = JS('[]') while i < num: @@ -21,7 +20,7 @@ def create_array(): def adapt_arguments(handler): - """Useful to transform callback arguments to positional arguments""" + """Useful to transform Javascript arguments to Python arguments""" def func(): handler(Array.prototype.slice.call(arguments)) return func @@ -211,3 +210,18 @@ def type(args, kwargs): parents = JS('args[1]') attrs = JS('args[2]') return create_class(class_name, parents, attrs) + + +def getattr(args, kwargs): + var(object, attribute) + object = JS('args[0]') + attribute = JS('args[1]') + return get_attribute(object, attribute) + + +def setattr(args, kwargs): + var(object, attribute, value) + object = JS('args[0]') + attribute = JS('args[1]') + value = JS('args[2]') + return set_attribute(object, attribute, value) From 5334d203ec1b5eb74e330245a924ef5b49640d09 Mon Sep 17 00:00:00 2001 From: Amirouche Boubekki Date: Sun, 12 May 2013 16:36:48 +0200 Subject: [PATCH 002/860] bump to 0.6.1 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 7458a2f..5f60420 100755 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ setup( name='PythonScriptTranslator', - version='0.6', + version='0.6.1', description='Python translator for the browser', author='Amirouche Boubekki', author_email='amirouche.boubekki@gmail.com', From 94fc5638ddddde095cf0c09dc8f9c65fc1a24ed7 Mon Sep 17 00:00:00 2001 From: Amirouche Boubekki Date: Sun, 12 May 2013 16:39:56 +0200 Subject: [PATCH 003/860] add requirements for doc building --- doc/requirements.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/requirements.txt diff --git a/doc/requirements.txt b/doc/requirements.txt new file mode 100644 index 0000000..c09cc34 --- /dev/null +++ b/doc/requirements.txt @@ -0,0 +1 @@ +sphinxcontrib-blockdiag From ad847907fd36445ef94a86d6d5838f081673e6f1 Mon Sep 17 00:00:00 2001 From: Amirouche Boubekki Date: Sun, 12 May 2013 16:41:05 +0200 Subject: [PATCH 004/860] update README for 0.6.1 --- README.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.rst b/README.rst index 28668aa..a8cfe6a 100644 --- a/README.rst +++ b/README.rst @@ -30,6 +30,11 @@ Demos Changelog ========= +0.6.1 - 13/05/12 - Open up +-------------------------- + +- added ``getattr`` and ``setattr`` + 0.6 - 13/05/09 - Dispatch ------------------------- From b9437b1aa5a00b52a572eeee5882b6240556f57e Mon Sep 17 00:00:00 2001 From: Amirouche Boubekki Date: Sun, 12 May 2013 16:44:25 +0200 Subject: [PATCH 005/860] rebuild... --- pythonscript.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/pythonscript.js b/pythonscript.js index 94f833e..f492de8 100644 --- a/pythonscript.js +++ b/pythonscript.js @@ -1,6 +1,5 @@ var jsrange = function(num) { -var i; -var r; +var i, r; i = 0; r = []; while(i < num) { @@ -398,6 +397,21 @@ attrs = args[2]; return create_class(class_name, parents, attrs); } +var getattr = function(args, kwargs) { +var object, attribute; +object = args[0]; +attribute = args[1]; +return get_attribute(object, attribute); +} + +var setattr = function(args, kwargs) { +var object, attribute, value; +object = args[0]; +attribute = args[1]; +value = args[2]; +return set_attribute(object, attribute, value); +} + var range = function(args, kwargs) { var signature = {"kwargs": {}, "args": create_array("num")}; var arguments = get_arguments(signature, args, kwargs); From f9e305f750edd628cc430f90efa384db1ac723c1 Mon Sep 17 00:00:00 2001 From: Amirouche Boubekki Date: Sun, 12 May 2013 16:45:38 +0200 Subject: [PATCH 006/860] remove useless extensions from doc --- doc/source/conf.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 0a1b136..3fc8da7 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -31,10 +31,6 @@ 'sphinx.ext.viewcode', # contrib 'sphinxcontrib.blockdiag', - 'sphinxcontrib.seqdiag', - 'sphinxcontrib.nwdiag', - 'sphinxcontrib.actdiag', - ] # Add any paths that contain templates here, relative to this directory. From 71f516024833964a408c5403eb90c268645c0849 Mon Sep 17 00:00:00 2001 From: Amirouche Boubekki Date: Sun, 12 May 2013 22:37:09 +0200 Subject: [PATCH 007/860] weblib has it's own repository --- Makefile | 3 --- 1 file changed, 3 deletions(-) diff --git a/Makefile b/Makefile index 808a300..70c5e6c 100644 --- a/Makefile +++ b/Makefile @@ -3,9 +3,6 @@ all: jquery pythonscript jquery: ./pythonscript/main.py < bindings/jquery.py > bindings/jquery.py.js -weblib.py: - ./pythonscript/main.py < weblib/main.py > weblib.py.js - builtins: ./pythonscript/main.py < builtins.py > builtins.py.js From baa0abc3591f8f2d35e331605aa0570c1eb45cde Mon Sep 17 00:00:00 2001 From: Amirouche Boubekki Date: Sun, 12 May 2013 22:59:25 +0200 Subject: [PATCH 008/860] Support of ``is`` operator --- pythonscript/pythonjs.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pythonscript/pythonjs.py b/pythonscript/pythonjs.py index c3a05e9..abc9bed 100755 --- a/pythonscript/pythonjs.py +++ b/pythonscript/pythonjs.py @@ -179,6 +179,9 @@ def visit_NotEq(self, node): def visit_Num(self, node): return str(node.n) + def visit_Is(self, node): + return '===' + def visit_Compare(self, node): left = self.visit(node.left) ops = self.visit(node.ops[0]) From 88d128552b3dced5be29ec9d70f2e617e5ae27f4 Mon Sep 17 00:00:00 2001 From: Amirouche Boubekki Date: Tue, 14 May 2013 01:33:09 +0200 Subject: [PATCH 009/860] added isinstance & issubclass with tests --- pythonscript.js | 44 ++++++++++++ pythonscript/pythonjs.py | 4 +- pythonscript/pythonpythonjs.py | 23 +++++++ tests.html | 4 ++ tests.py | 89 ++++++++++++++++++++++++ tests.py.js | 122 +++++++++++++++++++++++++++++++++ 6 files changed, 284 insertions(+), 2 deletions(-) create mode 100644 tests.html create mode 100644 tests.py create mode 100644 tests.py.js diff --git a/pythonscript.js b/pythonscript.js index f492de8..388b855 100644 --- a/pythonscript.js +++ b/pythonscript.js @@ -412,6 +412,50 @@ value = args[2]; return set_attribute(object, attribute, value); } +var issubclass = function(args, kwargs) { +var C, B, base; +C = args[0]; +B = args[1]; +if(C === B) { +return true; +} +else { + +} + +var iter = jsrange(C.bases.length); +for (var index=0; index < iter.length; index++) { +var backup = index; +index = iter[index]; +base = C.bases[index]; +if(issubclass([base, B], {})) { +return true; +} +else { + +} + +index = backup; +} + +return false; +} + +var isinstance = function(args, kwargs) { +var object_class, object, klass; +object = args[0]; +klass = args[1]; +object_class = object.__class__; +if(object_class === undefined) { +return false; +} +else { + +} + +return issubclass(create_array(object_class, klass)); +} + var range = function(args, kwargs) { var signature = {"kwargs": {}, "args": create_array("num")}; var arguments = get_arguments(signature, args, kwargs); diff --git a/pythonscript/pythonjs.py b/pythonscript/pythonjs.py index abc9bed..1dc379b 100755 --- a/pythonscript/pythonjs.py +++ b/pythonscript/pythonjs.py @@ -208,9 +208,9 @@ def visit_For(self, node): # iter is the python iterator init_iter = 'var iter = %s;\n' % iter # backup iterator and affect value of the next element to the target - pre = 'var backup = %s;\ni = iter[%s];\n' % (target, target) + pre = 'var backup = %s;\n%s = iter[%s];\n' % (target, target, target) # replace the replace target with the javascript iterator - post = 'i = backup;\n' + post = '%s = backup;\n' % target body = '\n'.join(map(self.visit, node.body)) + '\n' body = pre + body + post for_block = init_iter + 'for (var %s=0; %s < iter.length; %s++) {\n%s}\n' % (target, target, target, body) diff --git a/pythonscript/pythonpythonjs.py b/pythonscript/pythonpythonjs.py index 2d4b04f..1908e88 100644 --- a/pythonscript/pythonpythonjs.py +++ b/pythonscript/pythonpythonjs.py @@ -225,3 +225,26 @@ def setattr(args, kwargs): attribute = JS('args[1]') value = JS('args[2]') return set_attribute(object, attribute, value) + + +def issubclass(args, kwargs): + var(C, B, base) + C = JS('args[0]') + B = JS('args[1]') + if C is B: + return True + for index in jsrange(C.bases.length): + base = JS('C.bases[index]') + if issubclass(JS('[base, B]'), JS('{}')): + return True + return False + + +def isinstance(args, kwargs): + var(object_class, object, klass) + object = JS('args[0]') + klass = JS('args[1]') + object_class = object.__class__ + if object_class is None: + return False + return issubclass(create_array(object_class, klass)) diff --git a/tests.html b/tests.html new file mode 100644 index 0000000..7187def --- /dev/null +++ b/tests.html @@ -0,0 +1,4 @@ +

PythonScript Tests

+

Please hit Ctrl+Shift+J

+ + diff --git a/tests.py b/tests.py new file mode 100644 index 0000000..61fe555 --- /dev/null +++ b/tests.py @@ -0,0 +1,89 @@ +def test_equal(a, b, message): + if a == b: + print message + else: + print message, 'failed' + + +def test_true(a, message): + if a: + print message + else: + print message, 'failed' + + +def test_false(a, message): + if not a: + print message + else: + print message, 'failed' + + +tests = list() + + +def test_issubclass(): + class A: + pass + + class B(A): + pass + + class C(B): + pass + + class D: + pass + + class E(C, D): + pass + + test_true(issubclass(C, C), 'C is a subclass of C') + test_true(issubclass(C, B), 'C is a subclass of B') + test_true(issubclass(C, A), 'C is a subclass of A') + test_true(issubclass(B, B), 'B is a subclass of B') + test_true(issubclass(B, A), 'B is a subclass of A') + test_true(issubclass(A, A), 'A is a subclass of A') + + test_false(issubclass(A, B), 'A is not a subclass of B') + test_false(issubclass(B, C), 'B is not a subclass of C') + + test_false(issubclass(D, A), 'D is not a subclass of A') + test_false(issubclass(D, C), 'D is not a subclass of C') + + test_true(issubclass(E, E), 'E is subclass of E') + test_true(issubclass(E, D), 'E is subclass of D') + test_true(issubclass(E, C), 'E is subclass of C') + test_true(issubclass(E, B), 'E is subclass of B') + test_true(issubclass(E, A), 'E is subclass of A') + +tests.append(test_issubclass) + + +def test_isinstance(): + class A: + pass + + class B(A): + pass + + class X: + pass + + class Y(X): + pass + + test_true(isinstance(A(), A), 'A() is an instance of A') + test_true(isinstance(B(), A), 'B() is an instance of A') + test_true(isinstance(B(), A), 'B() is an instance of B') + test_false(isinstance(B, B), 'B is not an instance of B') + test_false(isinstance(B, A), 'B is not an instance of A') + test_false(isinstance(B(), X), 'B() is not an instance of X') + test_false(isinstance(B(), Y), 'B() is not an instance of Y') + + +tests.append(test_isinstance) + + +for test in tests: + test() diff --git a/tests.py.js b/tests.py.js new file mode 100644 index 0000000..f7ca73f --- /dev/null +++ b/tests.py.js @@ -0,0 +1,122 @@ +var test_equal = function(args, kwargs) { +var signature = {"kwargs": {}, "args": create_array("a", "b", "message")}; +var arguments = get_arguments(signature, args, kwargs); +var a = arguments["a"]; +var b = arguments["b"]; +var message = arguments["message"]; +if(a == b) { +console.log(message); +} +else { +console.log(message, "failed"); +} + +} + +var test_true = function(args, kwargs) { +var signature = {"kwargs": {}, "args": create_array("a", "message")}; +var arguments = get_arguments(signature, args, kwargs); +var a = arguments["a"]; +var message = arguments["message"]; +if(a) { +console.log(message); +} +else { +console.log(message, "failed"); +} + +} + +var test_false = function(args, kwargs) { +var signature = {"kwargs": {}, "args": create_array("a", "message")}; +var arguments = get_arguments(signature, args, kwargs); +var a = arguments["a"]; +var message = arguments["message"]; +if(!a) { +console.log(message); +} +else { +console.log(message, "failed"); +} + +} + +tests = get_attribute(list, "__call__")(create_array(), {}); +var test_issubclass = function(args, kwargs) { +var signature = {"kwargs": {}, "args": create_array()}; +var arguments = get_arguments(signature, args, kwargs); +A = {}; +parents = create_array(); +A = create_class("A", parents, A); +B = {}; +parents = create_array(); +parents.push(A); +B = create_class("B", parents, B); +C = {}; +parents = create_array(); +parents.push(B); +C = create_class("C", parents, C); +D = {}; +parents = create_array(); +D = create_class("D", parents, D); +E = {}; +parents = create_array(); +parents.push(C, D); +E = create_class("E", parents, E); +get_attribute(test_true, "__call__")(create_array(get_attribute(issubclass, "__call__")(create_array(C, C), {}), "C is a subclass of C"), {}); +get_attribute(test_true, "__call__")(create_array(get_attribute(issubclass, "__call__")(create_array(C, B), {}), "C is a subclass of B"), {}); +get_attribute(test_true, "__call__")(create_array(get_attribute(issubclass, "__call__")(create_array(C, A), {}), "C is a subclass of A"), {}); +get_attribute(test_true, "__call__")(create_array(get_attribute(issubclass, "__call__")(create_array(B, B), {}), "B is a subclass of B"), {}); +get_attribute(test_true, "__call__")(create_array(get_attribute(issubclass, "__call__")(create_array(B, A), {}), "B is a subclass of A"), {}); +get_attribute(test_true, "__call__")(create_array(get_attribute(issubclass, "__call__")(create_array(A, A), {}), "A is a subclass of A"), {}); +get_attribute(test_false, "__call__")(create_array(get_attribute(issubclass, "__call__")(create_array(A, B), {}), "A is not a subclass of B"), {}); +get_attribute(test_false, "__call__")(create_array(get_attribute(issubclass, "__call__")(create_array(B, C), {}), "B is not a subclass of C"), {}); +get_attribute(test_false, "__call__")(create_array(get_attribute(issubclass, "__call__")(create_array(D, A), {}), "D is not a subclass of A"), {}); +get_attribute(test_false, "__call__")(create_array(get_attribute(issubclass, "__call__")(create_array(D, C), {}), "D is not a subclass of C"), {}); +get_attribute(test_true, "__call__")(create_array(get_attribute(issubclass, "__call__")(create_array(E, E), {}), "E is subclass of E"), {}); +get_attribute(test_true, "__call__")(create_array(get_attribute(issubclass, "__call__")(create_array(E, D), {}), "E is subclass of D"), {}); +get_attribute(test_true, "__call__")(create_array(get_attribute(issubclass, "__call__")(create_array(E, C), {}), "E is subclass of C"), {}); +get_attribute(test_true, "__call__")(create_array(get_attribute(issubclass, "__call__")(create_array(E, B), {}), "E is subclass of B"), {}); +get_attribute(test_true, "__call__")(create_array(get_attribute(issubclass, "__call__")(create_array(E, A), {}), "E is subclass of A"), {}); +} + +get_attribute(get_attribute(tests, "append"), "__call__")(create_array(test_issubclass), {}); +var test_isinstance = function(args, kwargs) { +var signature = {"kwargs": {}, "args": create_array()}; +var arguments = get_arguments(signature, args, kwargs); +A = {}; +parents = create_array(); +A = create_class("A", parents, A); +B = {}; +parents = create_array(); +parents.push(A); +B = create_class("B", parents, B); +X = {}; +parents = create_array(); +X = create_class("X", parents, X); +Y = {}; +parents = create_array(); +parents.push(X); +Y = create_class("Y", parents, Y); +get_attribute(test_true, "__call__")(create_array(get_attribute(isinstance, "__call__")(create_array(get_attribute(A, "__call__")(create_array(), {}), A), {}), "A() is an instance of A"), {}); +get_attribute(test_true, "__call__")(create_array(get_attribute(isinstance, "__call__")(create_array(get_attribute(B, "__call__")(create_array(), {}), A), {}), "B() is an instance of A"), {}); +get_attribute(test_true, "__call__")(create_array(get_attribute(isinstance, "__call__")(create_array(get_attribute(B, "__call__")(create_array(), {}), A), {}), "B() is an instance of B"), {}); +get_attribute(test_false, "__call__")(create_array(get_attribute(isinstance, "__call__")(create_array(B, B), {}), "B is not an instance of B"), {}); +get_attribute(test_false, "__call__")(create_array(get_attribute(isinstance, "__call__")(create_array(B, A), {}), "B is not an instance of A"), {}); +get_attribute(test_false, "__call__")(create_array(get_attribute(isinstance, "__call__")(create_array(get_attribute(B, "__call__")(create_array(), {}), X), {}), "B() is not an instance of X"), {}); +get_attribute(test_false, "__call__")(create_array(get_attribute(isinstance, "__call__")(create_array(get_attribute(B, "__call__")(create_array(), {}), Y), {}), "B() is not an instance of Y"), {}); +} + +get_attribute(get_attribute(tests, "append"), "__call__")(create_array(test_isinstance), {}); +var __iterator__ = get_attribute(tests, "__iter__")(create_array(), {}); +try { +var test = get_attribute(__iterator__, "next")(create_array(), {}); +while(true) { +get_attribute(test, "__call__")(create_array(), {}); +var test = get_attribute(__iterator__, "next")(create_array(), {}); +} +} +catch(__exception__) { + +} + From 8cb61685700f580c391ecf3747c82a6429020e5c Mon Sep 17 00:00:00 2001 From: Amirouche Boubekki Date: Sat, 18 May 2013 01:39:13 +0200 Subject: [PATCH 010/860] moved runtime files to runtime directory --- builtins.py => runtime/builtins.py | 0 {pythonscript => runtime}/pythonpythonjs.py | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename builtins.py => runtime/builtins.py (100%) rename {pythonscript => runtime}/pythonpythonjs.py (100%) diff --git a/builtins.py b/runtime/builtins.py similarity index 100% rename from builtins.py rename to runtime/builtins.py diff --git a/pythonscript/pythonpythonjs.py b/runtime/pythonpythonjs.py similarity index 100% rename from pythonscript/pythonpythonjs.py rename to runtime/pythonpythonjs.py From 30a2a00f64c24ef64909194ccdfba77bc634fbf6 Mon Sep 17 00:00:00 2001 From: Amirouche Boubekki Date: Sat, 18 May 2013 01:40:23 +0200 Subject: [PATCH 011/860] move runtime tests to tests/runtime/ --- Makefile | 6 +++--- tests.html => tests/runtime/tests.html | 0 tests.py => tests/runtime/tests.py | 0 tests.py.js => tests/runtime/tests.py.js | 0 4 files changed, 3 insertions(+), 3 deletions(-) rename tests.html => tests/runtime/tests.html (100%) rename tests.py => tests/runtime/tests.py (100%) rename tests.py.js => tests/runtime/tests.py.js (100%) diff --git a/Makefile b/Makefile index 70c5e6c..3ce7901 100644 --- a/Makefile +++ b/Makefile @@ -4,10 +4,10 @@ jquery: ./pythonscript/main.py < bindings/jquery.py > bindings/jquery.py.js builtins: - ./pythonscript/main.py < builtins.py > builtins.py.js + ./pythonscript/main.py < runtime/builtins.py > builtins.py.js python: - ./pythonscript/pythonjs.py < pythonscript/pythonpythonjs.py > python.js + ./pythonscript/pythonjs.py < runtime/pythonpythonjs.py > python.js pythonscript: python builtins cat python.js builtins.py.js > pythonscript.js @@ -16,4 +16,4 @@ clean: rm python.js builtins.py.js pythonscript.js bindings/*py.js tests: - ./pythonscript/main.py < tests.py > tests.py.js + ./pythonscript/main.py < tests/runtime/tests.py > tests/runtime/tests.py.js diff --git a/tests.html b/tests/runtime/tests.html similarity index 100% rename from tests.html rename to tests/runtime/tests.html diff --git a/tests.py b/tests/runtime/tests.py similarity index 100% rename from tests.py rename to tests/runtime/tests.py diff --git a/tests.py.js b/tests/runtime/tests.py.js similarity index 100% rename from tests.py.js rename to tests/runtime/tests.py.js From 1084b61423cbf1a1ec2e548a57ce9b6eb68eafb8 Mon Sep 17 00:00:00 2001 From: Amirouche Boubekki Date: Sat, 18 May 2013 01:51:15 +0200 Subject: [PATCH 012/860] fix empty else in if with empty else generation --- pythonscript/pythonjs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pythonscript/pythonjs.py b/pythonscript/pythonjs.py index 1dc379b..e727749 100755 --- a/pythonscript/pythonjs.py +++ b/pythonscript/pythonjs.py @@ -198,7 +198,7 @@ def visit_If(self, node): test = self.visit(node.test) body = '\n'.join(map(self.visit, node.body)) + '\n' orelse = '\n'.join(map(self.visit, node.orelse)) + '\n' - if orelse: + if not orelse.isspace(): return 'if(%s) {\n%s}\nelse {\n%s}\n' % (test, body, orelse) return 'if(%s) {\n%s}\n' % (test, body) From a78b6808c3ac10096d9be1a4f78f41bb4dbd0f53 Mon Sep 17 00:00:00 2001 From: Amirouche Boubekki Date: Sat, 18 May 2013 02:08:16 +0200 Subject: [PATCH 013/860] naming and filtering exception is now possible but pythonjs code that use exception must defined a ``isinstance`` function --- pythonscript/pythonjs.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pythonscript/pythonjs.py b/pythonscript/pythonjs.py index e727749..40bf745 100755 --- a/pythonscript/pythonjs.py +++ b/pythonscript/pythonjs.py @@ -34,7 +34,15 @@ def visit_Raise(self, node): return 'throw %s;' % self.visit(node.type) def visit_ExceptHandler(self, node): - return '\n'.join(map(self.visit, node.body)) + out = '' + if node.type: + out = 'if (__exception__ == %s || isinstance(__exception__, %s)) {\n' % (self.visit(node.type), self.visit(node.type)) + if node.name: + out += 'var %s = __exception__;\n' % self.visit(node.name) + out += '\n'.join(map(self.visit, node.body)) + '\n' + if node.type: + out += '}\n' + return out def visit_FunctionDef(self, node): args = self.visit(node.args) From b510ade8afeb76e1cf520ebcea06cb14853e18e0 Mon Sep 17 00:00:00 2001 From: Amirouche Boubekki Date: Sat, 18 May 2013 02:12:26 +0200 Subject: [PATCH 014/860] added a set of reference translations from python to js --- tests/python-to-js/JS_assign.py | 1 + tests/python-to-js/JS_assign.py.js | 1 + tests/python-to-js/JS_expr.py | 1 + tests/python-to-js/JS_expr.py.js | 1 + tests/python-to-js/comparaisons.py | 8 ++++++++ tests/python-to-js/comparaisons.py.js | 8 ++++++++ tests/python-to-js/function.py | 3 +++ tests/python-to-js/function.py.js | 11 +++++++++++ tests/python-to-js/if.py | 3 +++ tests/python-to-js/if.py.js | 5 +++++ tests/python-to-js/ifelse.py | 5 +++++ tests/python-to-js/ifelse.py.js | 8 ++++++++ tests/python-to-js/print.py | 1 + tests/python-to-js/print.py.js | 1 + tests/python-to-js/raise.py | 1 + tests/python-to-js/raise.py.js | 1 + tests/python-to-js/tryexcept.py | 4 ++++ tests/python-to-js/tryexcept.py.js | 7 +++++++ tests/python-to-js/tryexceptnamed.py | 6 ++++++ tests/python-to-js/tryexceptnamed.py.js | 13 +++++++++++++ tests/python-to-js/tryexcepttyped.py | 6 ++++++ tests/python-to-js/tryexcepttyped.py.js | 12 ++++++++++++ tests/python-to-js/tryexcepttypedchained.py | 9 +++++++++ tests/python-to-js/tryexcepttypedchained.py.js | 17 +++++++++++++++++ tests/python-to-js/var.py | 1 + tests/python-to-js/var.py.js | 1 + 26 files changed, 135 insertions(+) create mode 100644 tests/python-to-js/JS_assign.py create mode 100644 tests/python-to-js/JS_assign.py.js create mode 100644 tests/python-to-js/JS_expr.py create mode 100644 tests/python-to-js/JS_expr.py.js create mode 100644 tests/python-to-js/comparaisons.py create mode 100644 tests/python-to-js/comparaisons.py.js create mode 100644 tests/python-to-js/function.py create mode 100644 tests/python-to-js/function.py.js create mode 100644 tests/python-to-js/if.py create mode 100644 tests/python-to-js/if.py.js create mode 100644 tests/python-to-js/ifelse.py create mode 100644 tests/python-to-js/ifelse.py.js create mode 100644 tests/python-to-js/print.py create mode 100644 tests/python-to-js/print.py.js create mode 100644 tests/python-to-js/raise.py create mode 100644 tests/python-to-js/raise.py.js create mode 100644 tests/python-to-js/tryexcept.py create mode 100644 tests/python-to-js/tryexcept.py.js create mode 100644 tests/python-to-js/tryexceptnamed.py create mode 100644 tests/python-to-js/tryexceptnamed.py.js create mode 100644 tests/python-to-js/tryexcepttyped.py create mode 100644 tests/python-to-js/tryexcepttyped.py.js create mode 100644 tests/python-to-js/tryexcepttypedchained.py create mode 100644 tests/python-to-js/tryexcepttypedchained.py.js create mode 100644 tests/python-to-js/var.py create mode 100644 tests/python-to-js/var.py.js diff --git a/tests/python-to-js/JS_assign.py b/tests/python-to-js/JS_assign.py new file mode 100644 index 0000000..cc2a272 --- /dev/null +++ b/tests/python-to-js/JS_assign.py @@ -0,0 +1 @@ +a = JS('value') diff --git a/tests/python-to-js/JS_assign.py.js b/tests/python-to-js/JS_assign.py.js new file mode 100644 index 0000000..4fc3214 --- /dev/null +++ b/tests/python-to-js/JS_assign.py.js @@ -0,0 +1 @@ +a = value; diff --git a/tests/python-to-js/JS_expr.py b/tests/python-to-js/JS_expr.py new file mode 100644 index 0000000..d8fc551 --- /dev/null +++ b/tests/python-to-js/JS_expr.py @@ -0,0 +1 @@ +JS('testing something improbable') diff --git a/tests/python-to-js/JS_expr.py.js b/tests/python-to-js/JS_expr.py.js new file mode 100644 index 0000000..a2c3158 --- /dev/null +++ b/tests/python-to-js/JS_expr.py.js @@ -0,0 +1 @@ +testing something improbable; diff --git a/tests/python-to-js/comparaisons.py b/tests/python-to-js/comparaisons.py new file mode 100644 index 0000000..42a8b7d --- /dev/null +++ b/tests/python-to-js/comparaisons.py @@ -0,0 +1,8 @@ +print True == 1 +print False != 1 +print None is None +print 1 < 2 +print 2 > 1 +print 1 >= 1 +print 2 <= 2 +print not True diff --git a/tests/python-to-js/comparaisons.py.js b/tests/python-to-js/comparaisons.py.js new file mode 100644 index 0000000..e9424e3 --- /dev/null +++ b/tests/python-to-js/comparaisons.py.js @@ -0,0 +1,8 @@ +console.log(true == 1); +console.log(false != 1); +console.log(undefined === undefined); +console.log(1 < 2); +console.log(2 > 1); +console.log(1 >= 1); +console.log(2 <= 2); +console.log(!true); diff --git a/tests/python-to-js/function.py b/tests/python-to-js/function.py new file mode 100644 index 0000000..1a2cb43 --- /dev/null +++ b/tests/python-to-js/function.py @@ -0,0 +1,3 @@ +def function(a, b, c, d): + return a + b + c + d +print function(1, 2, 3, 4) diff --git a/tests/python-to-js/function.py.js b/tests/python-to-js/function.py.js new file mode 100644 index 0000000..cc8c505 --- /dev/null +++ b/tests/python-to-js/function.py.js @@ -0,0 +1,11 @@ +var function = function(args, kwargs) { +var signature = {"kwargs": {}, "args": create_array("a", "b", "c", "d")}; +var arguments = get_arguments(signature, args, kwargs); +var d = arguments["d"]; +var c = arguments["c"]; +var b = arguments["b"]; +var a = arguments["a"]; +return a + b + c + d; +} + +console.log(get_attribute(function, "__call__")(create_array(1, 2, 3, 4), {})); diff --git a/tests/python-to-js/if.py b/tests/python-to-js/if.py new file mode 100644 index 0000000..3166403 --- /dev/null +++ b/tests/python-to-js/if.py @@ -0,0 +1,3 @@ +a = 1 +if a == 1: + print True diff --git a/tests/python-to-js/if.py.js b/tests/python-to-js/if.py.js new file mode 100644 index 0000000..eef9bc6 --- /dev/null +++ b/tests/python-to-js/if.py.js @@ -0,0 +1,5 @@ +a = 1; +if(a == 1) { +console.log(true); +} + diff --git a/tests/python-to-js/ifelse.py b/tests/python-to-js/ifelse.py new file mode 100644 index 0000000..239b30f --- /dev/null +++ b/tests/python-to-js/ifelse.py @@ -0,0 +1,5 @@ +a = 1 +if not a: + print False +else: + print True diff --git a/tests/python-to-js/ifelse.py.js b/tests/python-to-js/ifelse.py.js new file mode 100644 index 0000000..6c3486d --- /dev/null +++ b/tests/python-to-js/ifelse.py.js @@ -0,0 +1,8 @@ +a = 1; +if(!a) { +console.log(false); +} +else { +console.log(true); +} + diff --git a/tests/python-to-js/print.py b/tests/python-to-js/print.py new file mode 100644 index 0000000..34b813d --- /dev/null +++ b/tests/python-to-js/print.py @@ -0,0 +1 @@ +print 'foo' diff --git a/tests/python-to-js/print.py.js b/tests/python-to-js/print.py.js new file mode 100644 index 0000000..85ce559 --- /dev/null +++ b/tests/python-to-js/print.py.js @@ -0,0 +1 @@ +console.log("foo"); diff --git a/tests/python-to-js/raise.py b/tests/python-to-js/raise.py new file mode 100644 index 0000000..d681950 --- /dev/null +++ b/tests/python-to-js/raise.py @@ -0,0 +1 @@ +raise Spamamamama diff --git a/tests/python-to-js/raise.py.js b/tests/python-to-js/raise.py.js new file mode 100644 index 0000000..6bdc359 --- /dev/null +++ b/tests/python-to-js/raise.py.js @@ -0,0 +1 @@ +throw Spamamamama; diff --git a/tests/python-to-js/tryexcept.py b/tests/python-to-js/tryexcept.py new file mode 100644 index 0000000..25de1c1 --- /dev/null +++ b/tests/python-to-js/tryexcept.py @@ -0,0 +1,4 @@ +try: + anything +except: + print True diff --git a/tests/python-to-js/tryexcept.py.js b/tests/python-to-js/tryexcept.py.js new file mode 100644 index 0000000..8d83e45 --- /dev/null +++ b/tests/python-to-js/tryexcept.py.js @@ -0,0 +1,7 @@ +try { +anything; +} +catch(__exception__) { +console.log(true); +} + diff --git a/tests/python-to-js/tryexceptnamed.py b/tests/python-to-js/tryexceptnamed.py new file mode 100644 index 0000000..02dff8b --- /dev/null +++ b/tests/python-to-js/tryexceptnamed.py @@ -0,0 +1,6 @@ +var(Exception) +Exception = JSObject() +try: + foo +except Exception, babar: + print True diff --git a/tests/python-to-js/tryexceptnamed.py.js b/tests/python-to-js/tryexceptnamed.py.js new file mode 100644 index 0000000..3cae6d2 --- /dev/null +++ b/tests/python-to-js/tryexceptnamed.py.js @@ -0,0 +1,13 @@ +var Exception; +Exception = {}; +try { +throw Exception; +} +catch(__exception__) { +if (__exception__ == Exception || isinstance(__exception__, Exception)) { +var babar = __exception__; +console.log(true); +} + +} + diff --git a/tests/python-to-js/tryexcepttyped.py b/tests/python-to-js/tryexcepttyped.py new file mode 100644 index 0000000..591b5d8 --- /dev/null +++ b/tests/python-to-js/tryexcepttyped.py @@ -0,0 +1,6 @@ +var(Exception) +Exception = JSObject() +try: + raise Exception +except Exception: + print True diff --git a/tests/python-to-js/tryexcepttyped.py.js b/tests/python-to-js/tryexcepttyped.py.js new file mode 100644 index 0000000..e5506e5 --- /dev/null +++ b/tests/python-to-js/tryexcepttyped.py.js @@ -0,0 +1,12 @@ +var Exception; +Exception = {}; +try { +throw Exception; +} +catch(__exception__) { +if (__exception__ == Exception || isinstance(__exception__, Exception)) { +console.log(true); +} + +} + diff --git a/tests/python-to-js/tryexcepttypedchained.py b/tests/python-to-js/tryexcepttypedchained.py new file mode 100644 index 0000000..5c174ec --- /dev/null +++ b/tests/python-to-js/tryexcepttypedchained.py @@ -0,0 +1,9 @@ +var(Exception1, Exception2) +Exception1 = JSObject() +Exception2 = JSObject() +try: + raise Exception2 +except Exception1: + print False +except Exception2: + print True diff --git a/tests/python-to-js/tryexcepttypedchained.py.js b/tests/python-to-js/tryexcepttypedchained.py.js new file mode 100644 index 0000000..e1ef854 --- /dev/null +++ b/tests/python-to-js/tryexcepttypedchained.py.js @@ -0,0 +1,17 @@ +var Exception1, Exception2; +Exception1 = {}; +Exception2 = {}; +try { +throw Exception2; +} +catch(__exception__) { +if (__exception__ == Exception1 || isinstance(__exception__, Exception1)) { +console.log(false); +} + +if (__exception__ == Exception2 || isinstance(__exception__, Exception2)) { +console.log(true); +} + +} + diff --git a/tests/python-to-js/var.py b/tests/python-to-js/var.py new file mode 100644 index 0000000..6bcbf16 --- /dev/null +++ b/tests/python-to-js/var.py @@ -0,0 +1 @@ +var(spam, eggs) diff --git a/tests/python-to-js/var.py.js b/tests/python-to-js/var.py.js new file mode 100644 index 0000000..f0b14ed --- /dev/null +++ b/tests/python-to-js/var.py.js @@ -0,0 +1 @@ +var spam, eggs; From 529d69f5ca81da60ed6ea42ea33bc6e7bd4b3630 Mon Sep 17 00:00:00 2001 From: Amirouche Boubekki Date: Sat, 18 May 2013 02:19:23 +0200 Subject: [PATCH 015/860] missing transaltion for classes and improved function example --- tests/python-to-js/class.py | 9 +++++++++ tests/python-to-js/class.py.js | 20 ++++++++++++++++++++ tests/python-to-js/function.py | 5 +++-- tests/python-to-js/function.py.js | 13 ++++++++----- 4 files changed, 40 insertions(+), 7 deletions(-) create mode 100644 tests/python-to-js/class.py create mode 100644 tests/python-to-js/class.py.js diff --git a/tests/python-to-js/class.py b/tests/python-to-js/class.py new file mode 100644 index 0000000..17994ae --- /dev/null +++ b/tests/python-to-js/class.py @@ -0,0 +1,9 @@ +class A(B, C): + + def METHOD(self, a, b, c, d=4, e=5): + return a + b + c + d + e + + +a = A() +print a.METHOD(1, 2, 3) +print a.METHOD(1, 2, 3, 6, 7) diff --git a/tests/python-to-js/class.py.js b/tests/python-to-js/class.py.js new file mode 100644 index 0000000..b0fee98 --- /dev/null +++ b/tests/python-to-js/class.py.js @@ -0,0 +1,20 @@ +A = {}; +parents = create_array(); +parents.push(B, C); +var A__METHOD = function(args, kwargs) { + var signature = {"kwargs": {"d": 4, "e": 5}, "args": create_array("self", "a", "b", "c", "d", "e")}; + var arguments = get_arguments(signature, args, kwargs); + var self = arguments["self"]; + var a = arguments["a"]; + var b = arguments["b"]; + var c = arguments["c"]; + var d = arguments["d"]; + var e = arguments["e"]; + return a + b + c + d + e; +} + +A.METHOD = A__METHOD; +A = create_class("A", parents, A); +a = get_attribute(A, "__call__")(create_array(), {}); +console.log(get_attribute(get_attribute(a, "METHOD"), "__call__")(create_array(1, 2, 3), {})); +console.log(get_attribute(get_attribute(a, "METHOD"), "__call__")(create_array(1, 2, 3, 6, 7), {})); diff --git a/tests/python-to-js/function.py b/tests/python-to-js/function.py index 1a2cb43..f2afab9 100644 --- a/tests/python-to-js/function.py +++ b/tests/python-to-js/function.py @@ -1,3 +1,4 @@ -def function(a, b, c, d): - return a + b + c + d +def function(a, b, c, d, e=5, f=6): + return a + b + c + d + e + f print function(1, 2, 3, 4) +print function(1, 2, 3, 4, 7, 8) diff --git a/tests/python-to-js/function.py.js b/tests/python-to-js/function.py.js index cc8c505..5fc4eb7 100644 --- a/tests/python-to-js/function.py.js +++ b/tests/python-to-js/function.py.js @@ -1,11 +1,14 @@ var function = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("a", "b", "c", "d")}; +var signature = {"kwargs": {"e": 5, "f": 6}, "args": create_array("a", "b", "c", "d", "e", "f")}; var arguments = get_arguments(signature, args, kwargs); -var d = arguments["d"]; -var c = arguments["c"]; -var b = arguments["b"]; var a = arguments["a"]; -return a + b + c + d; +var b = arguments["b"]; +var c = arguments["c"]; +var d = arguments["d"]; +var e = arguments["e"]; +var f = arguments["f"]; +return a + b + c + d + e + f; } console.log(get_attribute(function, "__call__")(create_array(1, 2, 3, 4), {})); +console.log(get_attribute(function, "__call__")(create_array(1, 2, 3, 4, 7, 8), {})); From fa53e9f73ec86898b0dccb967bc8593e63a88480 Mon Sep 17 00:00:00 2001 From: Amirouche Boubekki Date: Sun, 19 May 2013 11:53:12 +0200 Subject: [PATCH 016/860] debug & improved Makefile and new pythonscript command (same behavior) --- .gitignore | 1 - Makefile | 8 +- bindings/jquery.py.js | 1954 ++++++++++++++++------------ pythonscript.js | 660 +++++----- pythonscript/python_to_pythonjs.py | 453 +++---- pythonscript/pythonscript.py | 24 + setup.py | 6 +- tests/python-to-js/tests.py | 22 + 8 files changed, 1692 insertions(+), 1436 deletions(-) mode change 100644 => 100755 pythonscript/python_to_pythonjs.py create mode 100755 pythonscript/pythonscript.py create mode 100644 tests/python-to-js/tests.py diff --git a/.gitignore b/.gitignore index b61cb6f..cf5fe5f 100644 --- a/.gitignore +++ b/.gitignore @@ -10,7 +10,6 @@ dist build eggs parts -bin var sdist develop-eggs diff --git a/Makefile b/Makefile index 3ce7901..9dc972e 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,12 @@ +CMD=pythonscript/pythonscript.py + all: jquery pythonscript jquery: - ./pythonscript/main.py < bindings/jquery.py > bindings/jquery.py.js + $(CMD) < bindings/jquery.py > bindings/jquery.py.js builtins: - ./pythonscript/main.py < runtime/builtins.py > builtins.py.js + $(CMD) < runtime/builtins.py > builtins.py.js python: ./pythonscript/pythonjs.py < runtime/pythonpythonjs.py > python.js @@ -16,4 +18,4 @@ clean: rm python.js builtins.py.js pythonscript.js bindings/*py.js tests: - ./pythonscript/main.py < tests/runtime/tests.py > tests/runtime/tests.py.js + $(CMD) < tests/runtime/tests.py > tests/runtime/tests.py.js diff --git a/bindings/jquery.py.js b/bindings/jquery.py.js index 124b42f..63ff1b6 100644 --- a/bindings/jquery.py.js +++ b/bindings/jquery.py.js @@ -1,921 +1,1221 @@ -J = {}; -parents = create_array(); -var J____init__ = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "arg")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var arg = arguments["arg"]; -set_attribute(self, "j", jQuery(arg)); -} - -J.__init__ = J____init__; -var J__add = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "arg")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var arg = arguments["arg"]; -j = get_attribute(self, "j"); +var J, __J_attrs, __J_parents; +__J_attrs = {}; +__J_parents = create_array(); +var __J____init__ = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "arg")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var arg = arguments['arg']; +set_attribute(self, j, jQuery(arg)); +} + +J.__init__ = __J____init__; +var __J__add = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "arg")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var arg = arguments['arg']; +j = get_attribute(self, j); o = j.add(arg); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.add = J__add; -var J__addClass = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "klass")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var klass = arguments["klass"]; -j = get_attribute(self, "j"); +var __args_0, __kwargs_0; +__args_0 = create_array(o); +__kwargs_0 = {}; +return get_attribute(J, "__call__")(__args_0, __kwargs_0); +} + +J.add = __J__add; +var __J__addClass = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "klass")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var klass = arguments['klass']; +j = get_attribute(self, j); o = j.addClass(klass); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.addClass = J__addClass; -var J__after = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "arg")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var arg = arguments["arg"]; -j = get_attribute(self, "j"); +var __args_1, __kwargs_1; +__args_1 = create_array(o); +__kwargs_1 = {}; +return get_attribute(J, "__call__")(__args_1, __kwargs_1); +} + +J.addClass = __J__addClass; +var __J__after = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "arg")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var arg = arguments['arg']; +j = get_attribute(self, j); o = j.after(arg); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.after = J__after; -var J__animate = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "properties", "duration", "easing", "complete")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var properties = arguments["properties"]; -var duration = arguments["duration"]; -var easing = arguments["easing"]; -var complete = arguments["complete"]; -j = get_attribute(self, "j"); +var __args_2, __kwargs_2; +__args_2 = create_array(o); +__kwargs_2 = {}; +return get_attribute(J, "__call__")(__args_2, __kwargs_2); +} + +J.after = __J__after; +var __J__animate = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "properties", "duration", "easing", "complete")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var properties = arguments['properties']; +var duration = arguments['duration']; +var easing = arguments['easing']; +var complete = arguments['complete']; +j = get_attribute(self, j); o = j.animate(properties, duration, easing, complete); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.animate = J__animate; -var J__append = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "arg")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var arg = arguments["arg"]; -j = get_attribute(self, "j"); +var __args_3, __kwargs_3; +__args_3 = create_array(o); +__kwargs_3 = {}; +return get_attribute(J, "__call__")(__args_3, __kwargs_3); +} + +J.animate = __J__animate; +var __J__append = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "arg")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var arg = arguments['arg']; +j = get_attribute(self, j); o = j.append(arg); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.append = J__append; -var J__appendTo = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "arg")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var arg = arguments["arg"]; -j = get_attribute(self, "j"); +var __args_4, __kwargs_4; +__args_4 = create_array(o); +__kwargs_4 = {}; +return get_attribute(J, "__call__")(__args_4, __kwargs_4); +} + +J.append = __J__append; +var __J__appendTo = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "arg")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var arg = arguments['arg']; +j = get_attribute(self, j); o = j.appendTo(arg); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.appendTo = J__appendTo; -var J__attr = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "key", "value")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var key = arguments["key"]; -var value = arguments["value"]; -j = get_attribute(self, "j"); -if(value == undefined) { +var __args_5, __kwargs_5; +__args_5 = create_array(o); +__kwargs_5 = {}; +return get_attribute(J, "__call__")(__args_5, __kwargs_5); +} + +J.appendTo = __J__appendTo; +var __J__attr = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "key", "value")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var key = arguments['key']; +var value = arguments['value']; +j = get_attribute(self, j); j.attr(key); -} -else { j.attr(key, value); } -} - -J.attr = J__attr; -var J__before = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "arg")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var arg = arguments["arg"]; -j = get_attribute(self, "j"); +J.attr = __J__attr; +var __J__before = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "arg")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var arg = arguments['arg']; +j = get_attribute(self, j); o = j.before(arg); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.before = J__before; -var J__bind = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "event_type", "event_data", "handler")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var event_type = arguments["event_type"]; -var event_data = arguments["event_data"]; -var handler = arguments["handler"]; -j = get_attribute(self, "j"); +var __args_6, __kwargs_6; +__args_6 = create_array(o); +__kwargs_6 = {}; +return get_attribute(J, "__call__")(__args_6, __kwargs_6); +} + +J.before = __J__before; +var __J__bind = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "event_type", "event_data", "handler")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var event_type = arguments['event_type']; +var event_data = arguments['event_data']; +var handler = arguments['handler']; +j = get_attribute(self, j); o = j.bind(event_type, event_data, adapt_arguments(handler)); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.bind = J__bind; -var J__blur = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "handler")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var handler = arguments["handler"]; -j = get_attribute(self, "j"); +var __args_7, __kwargs_7; +__args_7 = create_array(o); +__kwargs_7 = {}; +return get_attribute(J, "__call__")(__args_7, __kwargs_7); +} + +J.bind = __J__bind; +var __J__blur = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "handler")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var handler = arguments['handler']; +j = get_attribute(self, j); o = j.blur(adapt_arguments(handler)); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.blur = J__blur; -var J__change = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "handler")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var handler = arguments["handler"]; -j = get_attribute(self, "j"); +var __args_8, __kwargs_8; +__args_8 = create_array(o); +__kwargs_8 = {}; +return get_attribute(J, "__call__")(__args_8, __kwargs_8); +} + +J.blur = __J__blur; +var __J__change = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "handler")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var handler = arguments['handler']; +j = get_attribute(self, j); o = j.change(adapt_arguments(handler)); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.change = J__change; -var J__children = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "selector")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var selector = arguments["selector"]; -j = get_attribute(self, "j"); +var __args_9, __kwargs_9; +__args_9 = create_array(o); +__kwargs_9 = {}; +return get_attribute(J, "__call__")(__args_9, __kwargs_9); +} + +J.change = __J__change; +var __J__children = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "selector")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var selector = arguments['selector']; +j = get_attribute(self, j); o = j.children(selector); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.children = J__children; -var J__click = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "handler")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var handler = arguments["handler"]; -j = get_attribute(self, "j"); +var __args_10, __kwargs_10; +__args_10 = create_array(o); +__kwargs_10 = {}; +return get_attribute(J, "__call__")(__args_10, __kwargs_10); +} + +J.children = __J__children; +var __J__click = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "handler")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var handler = arguments['handler']; +j = get_attribute(self, j); o = j.click(adapt_arguments(handler)); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.click = J__click; -var J__clone = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "with_data_and_events")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var with_data_and_events = arguments["with_data_and_events"]; -j = get_attribute(self, "j"); +var __args_11, __kwargs_11; +__args_11 = create_array(o); +__kwargs_11 = {}; +return get_attribute(J, "__call__")(__args_11, __kwargs_11); +} + +J.click = __J__click; +var __J__clone = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "with_data_and_events")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var with_data_and_events = arguments['with_data_and_events']; +j = get_attribute(self, j); o = j.clone(with_data_and_events); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.clone = J__clone; -var J__contents = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -j = get_attribute(self, "j"); +var __args_12, __kwargs_12; +__args_12 = create_array(o); +__kwargs_12 = {}; +return get_attribute(J, "__call__")(__args_12, __kwargs_12); +} + +J.clone = __J__clone; +var __J__contents = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +j = get_attribute(self, j); o = j.contents(); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.contents = J__contents; -var J__css = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "name", "value")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var name = arguments["name"]; -var value = arguments["value"]; -j = get_attribute(self, "j"); +var __args_13, __kwargs_13; +__args_13 = create_array(o); +__kwargs_13 = {}; +return get_attribute(J, "__call__")(__args_13, __kwargs_13); +} + +J.contents = __J__contents; +var __J__css = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "name", "value")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var name = arguments['name']; +var value = arguments['value']; +j = get_attribute(self, j); o = j.css(name, value); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.css = J__css; -var J__data = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "key", "value")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var key = arguments["key"]; -var value = arguments["value"]; -j = get_attribute(self, "j"); +var __args_14, __kwargs_14; +__args_14 = create_array(o); +__kwargs_14 = {}; +return get_attribute(J, "__call__")(__args_14, __kwargs_14); +} + +J.css = __J__css; +var __J__data = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "key", "value")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var key = arguments['key']; +var value = arguments['value']; +j = get_attribute(self, j); o = j.data(key, value); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.data = J__data; -var J__double_click = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "handler")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var handler = arguments["handler"]; -j = get_attribute(self, "j"); +var __args_15, __kwargs_15; +__args_15 = create_array(o); +__kwargs_15 = {}; +return get_attribute(J, "__call__")(__args_15, __kwargs_15); +} + +J.data = __J__data; +var __J__double_click = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "handler")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var handler = arguments['handler']; +j = get_attribute(self, j); o = j.dbclick(adapt_arguments(handler)); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.double_click = J__double_click; -var J__delay = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "time", "queue_name")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var time = arguments["time"]; -var queue_name = arguments["queue_name"]; -j = get_attribute(self, "j"); +var __args_16, __kwargs_16; +__args_16 = create_array(o); +__kwargs_16 = {}; +return get_attribute(J, "__call__")(__args_16, __kwargs_16); +} + +J.double_click = __J__double_click; +var __J__delay = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "time", "queue_name")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var time = arguments['time']; +var queue_name = arguments['queue_name']; +j = get_attribute(self, j); o = j.delay(time, queue_name); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.delay = J__delay; -var J__dequeue = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "queue_name")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var queue_name = arguments["queue_name"]; -j = get_attribute(self, "j"); +var __args_17, __kwargs_17; +__args_17 = create_array(o); +__kwargs_17 = {}; +return get_attribute(J, "__call__")(__args_17, __kwargs_17); +} + +J.delay = __J__delay; +var __J__dequeue = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "queue_name")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var queue_name = arguments['queue_name']; +j = get_attribute(self, j); o = j.dequeue(queue_name); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.dequeue = J__dequeue; -var J__detach = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "selector")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var selector = arguments["selector"]; -j = get_attribute(self, "j"); +var __args_18, __kwargs_18; +__args_18 = create_array(o); +__kwargs_18 = {}; +return get_attribute(J, "__call__")(__args_18, __kwargs_18); +} + +J.dequeue = __J__dequeue; +var __J__detach = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "selector")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var selector = arguments['selector']; +j = get_attribute(self, j); o = j.detach(selector); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.detach = J__detach; -var J__each = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "handler")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var handler = arguments["handler"]; -j = get_attribute(self, "j"); +var __args_19, __kwargs_19; +__args_19 = create_array(o); +__kwargs_19 = {}; +return get_attribute(J, "__call__")(__args_19, __kwargs_19); +} + +J.detach = __J__detach; +var __J__each = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "handler")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var handler = arguments['handler']; +j = get_attribute(self, j); o = j.each(adapt_arguments(handler)); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.each = J__each; -var J__end = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "handler")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var handler = arguments["handler"]; -j = get_attribute(self, "j"); +var __args_20, __kwargs_20; +__args_20 = create_array(o); +__kwargs_20 = {}; +return get_attribute(J, "__call__")(__args_20, __kwargs_20); +} + +J.each = __J__each; +var __J__end = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "handler")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var handler = arguments['handler']; +j = get_attribute(self, j); o = j.end(handler); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.end = J__end; -var J__eq = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "index")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var index = arguments["index"]; -j = get_attribute(self, "j"); +var __args_21, __kwargs_21; +__args_21 = create_array(o); +__kwargs_21 = {}; +return get_attribute(J, "__call__")(__args_21, __kwargs_21); +} + +J.end = __J__end; +var __J__eq = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "index")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var index = arguments['index']; +j = get_attribute(self, j); o = j.eq(index); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.eq = J__eq; -var J__error = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "handler")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var handler = arguments["handler"]; -j = get_attribute(self, "j"); +var __args_22, __kwargs_22; +__args_22 = create_array(o); +__kwargs_22 = {}; +return get_attribute(J, "__call__")(__args_22, __kwargs_22); +} + +J.eq = __J__eq; +var __J__error = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "handler")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var handler = arguments['handler']; +j = get_attribute(self, j); o = j.error(adapt_arguments(handler)); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.error = J__error; -var J__fade_in = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "duration", "complete")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var duration = arguments["duration"]; -var complete = arguments["complete"]; -j = get_attribute(self, "j"); +var __args_23, __kwargs_23; +__args_23 = create_array(o); +__kwargs_23 = {}; +return get_attribute(J, "__call__")(__args_23, __kwargs_23); +} + +J.error = __J__error; +var __J__fade_in = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "duration", "complete")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var duration = arguments['duration']; +var complete = arguments['complete']; +j = get_attribute(self, j); o = j.fadeIn(duration, complete); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.fade_in = J__fade_in; -var J__fade_out = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "duration", "complete")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var duration = arguments["duration"]; -var complete = arguments["complete"]; -j = get_attribute(self, "j"); +var __args_24, __kwargs_24; +__args_24 = create_array(o); +__kwargs_24 = {}; +return get_attribute(J, "__call__")(__args_24, __kwargs_24); +} + +J.fade_in = __J__fade_in; +var __J__fade_out = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "duration", "complete")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var duration = arguments['duration']; +var complete = arguments['complete']; +j = get_attribute(self, j); o = j.fadeOut(duration, adapt_arguments(complete)); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.fade_out = J__fade_out; -var J__fadeTo = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "duration", "opacity", "complete")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var duration = arguments["duration"]; -var opacity = arguments["opacity"]; -var complete = arguments["complete"]; -j = get_attribute(self, "j"); +var __args_25, __kwargs_25; +__args_25 = create_array(o); +__kwargs_25 = {}; +return get_attribute(J, "__call__")(__args_25, __kwargs_25); +} + +J.fade_out = __J__fade_out; +var __J__fadeTo = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "duration", "opacity", "complete")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var duration = arguments['duration']; +var opacity = arguments['opacity']; +var complete = arguments['complete']; +j = get_attribute(self, j); o = j.fade_to(duration, opacity, adapt_arguments(complete)); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.fadeTo = J__fadeTo; -var J__fade_toggle = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "duration", "easing", "complete")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var duration = arguments["duration"]; -var easing = arguments["easing"]; -var complete = arguments["complete"]; -j = get_attribute(self, "j"); +var __args_26, __kwargs_26; +__args_26 = create_array(o); +__kwargs_26 = {}; +return get_attribute(J, "__call__")(__args_26, __kwargs_26); +} + +J.fadeTo = __J__fadeTo; +var __J__fade_toggle = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "duration", "easing", "complete")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var duration = arguments['duration']; +var easing = arguments['easing']; +var complete = arguments['complete']; +j = get_attribute(self, j); o = j.fade_toggle(duration, easing, complete); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.fade_toggle = J__fade_toggle; -var J__filter = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "selector")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var selector = arguments["selector"]; -j = get_attribute(self, "j"); +var __args_27, __kwargs_27; +__args_27 = create_array(o); +__kwargs_27 = {}; +return get_attribute(J, "__call__")(__args_27, __kwargs_27); +} + +J.fade_toggle = __J__fade_toggle; +var __J__filter = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "selector")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var selector = arguments['selector']; +j = get_attribute(self, j); o = j.filter(selector); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.filter = J__filter; -var J__finish = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "queue")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var queue = arguments["queue"]; -j = get_attribute(self, "j"); +var __args_28, __kwargs_28; +__args_28 = create_array(o); +__kwargs_28 = {}; +return get_attribute(J, "__call__")(__args_28, __kwargs_28); +} + +J.filter = __J__filter; +var __J__finish = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "queue")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var queue = arguments['queue']; +j = get_attribute(self, j); o = j.finish(queue); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.finish = J__finish; -var J__first = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -j = get_attribute(self, "j"); +var __args_29, __kwargs_29; +__args_29 = create_array(o); +__kwargs_29 = {}; +return get_attribute(J, "__call__")(__args_29, __kwargs_29); +} + +J.finish = __J__finish; +var __J__first = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +j = get_attribute(self, j); o = j.first(); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.first = J__first; -var J__focus = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "handler")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var handler = arguments["handler"]; -j = get_attribute(self, "j"); +var __args_30, __kwargs_30; +__args_30 = create_array(o); +__kwargs_30 = {}; +return get_attribute(J, "__call__")(__args_30, __kwargs_30); +} + +J.first = __J__first; +var __J__focus = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "handler")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var handler = arguments['handler']; +j = get_attribute(self, j); o = j.focus(adapt_arguments(handler)); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.focus = J__focus; -var J__focus_in = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "handler")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var handler = arguments["handler"]; -j = get_attribute(self, "j"); +var __args_31, __kwargs_31; +__args_31 = create_array(o); +__kwargs_31 = {}; +return get_attribute(J, "__call__")(__args_31, __kwargs_31); +} + +J.focus = __J__focus; +var __J__focus_in = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "handler")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var handler = arguments['handler']; +j = get_attribute(self, j); o = j.focusIn(adapt_arguments(handler)); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.focus_in = J__focus_in; -var J__focus_out = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "handler")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var handler = arguments["handler"]; -j = get_attribute(self, "j"); +var __args_32, __kwargs_32; +__args_32 = create_array(o); +__kwargs_32 = {}; +return get_attribute(J, "__call__")(__args_32, __kwargs_32); +} + +J.focus_in = __J__focus_in; +var __J__focus_out = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "handler")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var handler = arguments['handler']; +j = get_attribute(self, j); o = j.focusOut(adapt_arguments(handler)); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.focus_out = J__focus_out; -var J__get = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "index")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var index = arguments["index"]; -j = get_attribute(self, "j"); +var __args_33, __kwargs_33; +__args_33 = create_array(o); +__kwargs_33 = {}; +return get_attribute(J, "__call__")(__args_33, __kwargs_33); +} + +J.focus_out = __J__focus_out; +var __J__get = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "index")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var index = arguments['index']; +j = get_attribute(self, j); o = j.get(index); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.get = J__get; -var J__has_class = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "name")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var name = arguments["name"]; -j = get_attribute(self, "j"); +var __args_34, __kwargs_34; +__args_34 = create_array(o); +__kwargs_34 = {}; +return get_attribute(J, "__call__")(__args_34, __kwargs_34); +} + +J.get = __J__get; +var __J__has_class = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "name")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var name = arguments['name']; +j = get_attribute(self, j); o = j.has_class(selector); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.has_class = J__has_class; -var J__height = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "value")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var value = arguments["value"]; -j = get_attribute(self, "j"); +var __args_35, __kwargs_35; +__args_35 = create_array(o); +__kwargs_35 = {}; +return get_attribute(J, "__call__")(__args_35, __kwargs_35); +} + +J.has_class = __J__has_class; +var __J__height = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "value")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var value = arguments['value']; +j = get_attribute(self, j); o = j.height(value); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.height = J__height; -var J__hide = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "duration", "complete")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var duration = arguments["duration"]; -var complete = arguments["complete"]; -j = get_attribute(self, "j"); +var __args_36, __kwargs_36; +__args_36 = create_array(o); +__kwargs_36 = {}; +return get_attribute(J, "__call__")(__args_36, __kwargs_36); +} + +J.height = __J__height; +var __J__hide = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "duration", "complete")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var duration = arguments['duration']; +var complete = arguments['complete']; +j = get_attribute(self, j); o = j.hide(duration, complete); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.hide = J__hide; -var J__hover = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "handler")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var handler = arguments["handler"]; -j = get_attribute(self, "j"); +var __args_37, __kwargs_37; +__args_37 = create_array(o); +__kwargs_37 = {}; +return get_attribute(J, "__call__")(__args_37, __kwargs_37); +} + +J.hide = __J__hide; +var __J__hover = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "handler")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var handler = arguments['handler']; +j = get_attribute(self, j); o = j.hover(adapt_arguments(handler)); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.hover = J__hover; -var J__html = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "value")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var value = arguments["value"]; -j = get_attribute(self, "j"); -if(value != undefined) { +var __args_38, __kwargs_38; +__args_38 = create_array(o); +__kwargs_38 = {}; +return get_attribute(J, "__call__")(__args_38, __kwargs_38); +} + +J.hover = __J__hover; +var __J__html = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "value")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var value = arguments['value']; +j = get_attribute(self, j); o = j.html(value); -} -else { o = j.html(); -} - return o; } -J.html = J__html; -var J__index = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "selector")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var selector = arguments["selector"]; -j = get_attribute(self, "j"); +J.html = __J__html; +var __J__index = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "selector")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var selector = arguments['selector']; +j = get_attribute(self, j); o = j.index(selector); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.index = J__index; -var J__inner_height = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -j = get_attribute(self, "j"); +var __args_39, __kwargs_39; +__args_39 = create_array(o); +__kwargs_39 = {}; +return get_attribute(J, "__call__")(__args_39, __kwargs_39); +} + +J.index = __J__index; +var __J__inner_height = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +j = get_attribute(self, j); o = j.innerHeight(); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.inner_height = J__inner_height; -var J__inner_width = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -j = get_attribute(self, "j"); +var __args_40, __kwargs_40; +__args_40 = create_array(o); +__kwargs_40 = {}; +return get_attribute(J, "__call__")(__args_40, __kwargs_40); +} + +J.inner_height = __J__inner_height; +var __J__inner_width = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +j = get_attribute(self, j); o = j.innerWidth(); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.inner_width = J__inner_width; -var J__insert_after = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "target")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var target = arguments["target"]; -j = get_attribute(self, "j"); +var __args_41, __kwargs_41; +__args_41 = create_array(o); +__kwargs_41 = {}; +return get_attribute(J, "__call__")(__args_41, __kwargs_41); +} + +J.inner_width = __J__inner_width; +var __J__insert_after = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "target")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var target = arguments['target']; +j = get_attribute(self, j); o = j.insertAfter(target); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.insert_after = J__insert_after; -var J__insert_before = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "target")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var target = arguments["target"]; -j = get_attribute(self, "j"); +var __args_42, __kwargs_42; +__args_42 = create_array(o); +__kwargs_42 = {}; +return get_attribute(J, "__call__")(__args_42, __kwargs_42); +} + +J.insert_after = __J__insert_after; +var __J__insert_before = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "target")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var target = arguments['target']; +j = get_attribute(self, j); o = j.insertBefore(selector); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.insert_before = J__insert_before; -var J__is_ = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "name")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var name = arguments["name"]; -j = get_attribute(self, "j"); +var __args_43, __kwargs_43; +__args_43 = create_array(o); +__kwargs_43 = {}; +return get_attribute(J, "__call__")(__args_43, __kwargs_43); +} + +J.insert_before = __J__insert_before; +var __J__is_ = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "name")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var name = arguments['name']; +j = get_attribute(self, j); o = j.is(selector); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.is_ = J__is_; -var J__keydown = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "handler")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var handler = arguments["handler"]; -j = get_attribute(self, "j"); +var __args_44, __kwargs_44; +__args_44 = create_array(o); +__kwargs_44 = {}; +return get_attribute(J, "__call__")(__args_44, __kwargs_44); +} + +J.is_ = __J__is_; +var __J__keydown = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "handler")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var handler = arguments['handler']; +j = get_attribute(self, j); o = j.keydown(adapt_arguments(handler)); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.keydown = J__keydown; -var J__keypress = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "handler")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var handler = arguments["handler"]; -j = get_attribute(self, "j"); +var __args_45, __kwargs_45; +__args_45 = create_array(o); +__kwargs_45 = {}; +return get_attribute(J, "__call__")(__args_45, __kwargs_45); +} + +J.keydown = __J__keydown; +var __J__keypress = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "handler")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var handler = arguments['handler']; +j = get_attribute(self, j); o = j.keypress(adapt_arguments(handler)); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.keypress = J__keypress; -var J__keyup = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "handler")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var handler = arguments["handler"]; -j = get_attribute(self, "j"); +var __args_46, __kwargs_46; +__args_46 = create_array(o); +__kwargs_46 = {}; +return get_attribute(J, "__call__")(__args_46, __kwargs_46); +} + +J.keypress = __J__keypress; +var __J__keyup = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "handler")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var handler = arguments['handler']; +j = get_attribute(self, j); o = j.keyup(adapt_arguments(handler)); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.keyup = J__keyup; -var J__last = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "handler")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var handler = arguments["handler"]; -j = get_attribute(self, "j"); +var __args_47, __kwargs_47; +__args_47 = create_array(o); +__kwargs_47 = {}; +return get_attribute(J, "__call__")(__args_47, __kwargs_47); +} + +J.keyup = __J__keyup; +var __J__last = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "handler")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var handler = arguments['handler']; +j = get_attribute(self, j); o = j.last(adapt_arguments(handler)); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.last = J__last; -var J__on = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "event", "handler")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var event = arguments["event"]; -var handler = arguments["handler"]; -j = get_attribute(self, "j"); +var __args_48, __kwargs_48; +__args_48 = create_array(o); +__kwargs_48 = {}; +return get_attribute(J, "__call__")(__args_48, __kwargs_48); +} + +J.last = __J__last; +var __J__on = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "event", "handler")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var event = arguments['event']; +var handler = arguments['handler']; +j = get_attribute(self, j); o = j.on(event, adapt_arguments(handler)); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.on = J__on; -var J__load = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "url", "data", "complete")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var url = arguments["url"]; -var data = arguments["data"]; -var complete = arguments["complete"]; -j = get_attribute(self, "j"); +var __args_49, __kwargs_49; +__args_49 = create_array(o); +__kwargs_49 = {}; +return get_attribute(J, "__call__")(__args_49, __kwargs_49); +} + +J.on = __J__on; +var __J__load = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "url", "data", "complete")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var url = arguments['url']; +var data = arguments['data']; +var complete = arguments['complete']; +j = get_attribute(self, j); o = j.load(url, data, complete); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.load = J__load; -var J__select = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "handler")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var handler = arguments["handler"]; -j = get_attribute(self, "j"); +var __args_50, __kwargs_50; +__args_50 = create_array(o); +__kwargs_50 = {}; +return get_attribute(J, "__call__")(__args_50, __kwargs_50); +} + +J.load = __J__load; +var __J__select = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "handler")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var handler = arguments['handler']; +j = get_attribute(self, j); o = j.select(adapt_arguments(handler)); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.select = J__select; -var J__show = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "duration", "complete")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var duration = arguments["duration"]; -var complete = arguments["complete"]; -j = get_attribute(self, "j"); +var __args_51, __kwargs_51; +__args_51 = create_array(o); +__kwargs_51 = {}; +return get_attribute(J, "__call__")(__args_51, __kwargs_51); +} + +J.select = __J__select; +var __J__show = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "duration", "complete")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var duration = arguments['duration']; +var complete = arguments['complete']; +j = get_attribute(self, j); o = j.show(duration, complete); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.show = J__show; -var J__siblings = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "selector")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var selector = arguments["selector"]; -j = get_attribute(self, "j"); +var __args_52, __kwargs_52; +__args_52 = create_array(o); +__kwargs_52 = {}; +return get_attribute(J, "__call__")(__args_52, __kwargs_52); +} + +J.show = __J__show; +var __J__siblings = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "selector")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var selector = arguments['selector']; +j = get_attribute(self, j); o = j.select(adapt_arguments(handler)); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.siblings = J__siblings; -var J__size = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -j = get_attribute(self, "j"); +var __args_53, __kwargs_53; +__args_53 = create_array(o); +__kwargs_53 = {}; +return get_attribute(J, "__call__")(__args_53, __kwargs_53); +} + +J.siblings = __J__siblings; +var __J__size = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +j = get_attribute(self, j); o = j.size(); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.size = J__size; -var J__slice = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "start", "end")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var start = arguments["start"]; -var end = arguments["end"]; -j = get_attribute(self, "j"); +var __args_54, __kwargs_54; +__args_54 = create_array(o); +__kwargs_54 = {}; +return get_attribute(J, "__call__")(__args_54, __kwargs_54); +} + +J.size = __J__size; +var __J__slice = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "start", "end")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var start = arguments['start']; +var end = arguments['end']; +j = get_attribute(self, j); o = j.slice(start, end); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.slice = J__slice; -var J__slide_down = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "duration", "complete")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var duration = arguments["duration"]; -var complete = arguments["complete"]; -j = get_attribute(self, "j"); +var __args_55, __kwargs_55; +__args_55 = create_array(o); +__kwargs_55 = {}; +return get_attribute(J, "__call__")(__args_55, __kwargs_55); +} + +J.slice = __J__slice; +var __J__slide_down = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "duration", "complete")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var duration = arguments['duration']; +var complete = arguments['complete']; +j = get_attribute(self, j); o = j.slideDown(duration, adapt_arguments(complete)); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.slide_down = J__slide_down; -var J__slide_toggle = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "duration", "complete")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var duration = arguments["duration"]; -var complete = arguments["complete"]; -j = get_attribute(self, "j"); +var __args_56, __kwargs_56; +__args_56 = create_array(o); +__kwargs_56 = {}; +return get_attribute(J, "__call__")(__args_56, __kwargs_56); +} + +J.slide_down = __J__slide_down; +var __J__slide_toggle = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "duration", "complete")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var duration = arguments['duration']; +var complete = arguments['complete']; +j = get_attribute(self, j); o = j.slideToggle(duration, adapt_arguments(complete)); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.slide_toggle = J__slide_toggle; -var J__slide_up = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "duration", "complete")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var duration = arguments["duration"]; -var complete = arguments["complete"]; -j = get_attribute(self, "j"); +var __args_57, __kwargs_57; +__args_57 = create_array(o); +__kwargs_57 = {}; +return get_attribute(J, "__call__")(__args_57, __kwargs_57); +} + +J.slide_toggle = __J__slide_toggle; +var __J__slide_up = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "duration", "complete")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var duration = arguments['duration']; +var complete = arguments['complete']; +j = get_attribute(self, j); o = j.slideUp(duration, adapt_arguments(complete)); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.slide_up = J__slide_up; -var J__stop = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "clear_queue", "jump_to_end")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var clear_queue = arguments["clear_queue"]; -var jump_to_end = arguments["jump_to_end"]; -j = get_attribute(self, "j"); +var __args_58, __kwargs_58; +__args_58 = create_array(o); +__kwargs_58 = {}; +return get_attribute(J, "__call__")(__args_58, __kwargs_58); +} + +J.slide_up = __J__slide_up; +var __J__stop = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "clear_queue", "jump_to_end")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var clear_queue = arguments['clear_queue']; +var jump_to_end = arguments['jump_to_end']; +j = get_attribute(self, j); o = j.stop(clear_queue, jump_to_end); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.stop = J__stop; -var J__submit = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "clear_queue", "jump_to_end")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var clear_queue = arguments["clear_queue"]; -var jump_to_end = arguments["jump_to_end"]; -j = get_attribute(self, "j"); +var __args_59, __kwargs_59; +__args_59 = create_array(o); +__kwargs_59 = {}; +return get_attribute(J, "__call__")(__args_59, __kwargs_59); +} + +J.stop = __J__stop; +var __J__submit = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "clear_queue", "jump_to_end")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var clear_queue = arguments['clear_queue']; +var jump_to_end = arguments['jump_to_end']; +j = get_attribute(self, j); o = j.submit(clear_queue, jump_to_end); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.submit = J__submit; -var J__text = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "text")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var text = arguments["text"]; -j = get_attribute(self, "j"); +var __args_60, __kwargs_60; +__args_60 = create_array(o); +__kwargs_60 = {}; +return get_attribute(J, "__call__")(__args_60, __kwargs_60); +} + +J.submit = __J__submit; +var __J__text = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "text")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var text = arguments['text']; +j = get_attribute(self, j); o = j.text(text); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.text = J__text; -var J__toggle = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "duration", "complete")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var duration = arguments["duration"]; -var complete = arguments["complete"]; -j = get_attribute(self, "j"); +var __args_61, __kwargs_61; +__args_61 = create_array(o); +__kwargs_61 = {}; +return get_attribute(J, "__call__")(__args_61, __kwargs_61); +} + +J.text = __J__text; +var __J__toggle = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "duration", "complete")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var duration = arguments['duration']; +var complete = arguments['complete']; +j = get_attribute(self, j); o = j.toggle(duration, complete); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.toggle = J__toggle; -var J__toggle_class = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "class_name")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var class_name = arguments["class_name"]; -j = get_attribute(self, "j"); +var __args_62, __kwargs_62; +__args_62 = create_array(o); +__kwargs_62 = {}; +return get_attribute(J, "__call__")(__args_62, __kwargs_62); +} + +J.toggle = __J__toggle; +var __J__toggle_class = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "class_name")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var class_name = arguments['class_name']; +j = get_attribute(self, j); o = j.toggleClass(class_name); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.toggle_class = J__toggle_class; -var J__trigger = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "event")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var event = arguments["event"]; -j = get_attribute(self, "j"); +var __args_63, __kwargs_63; +__args_63 = create_array(o); +__kwargs_63 = {}; +return get_attribute(J, "__call__")(__args_63, __kwargs_63); +} + +J.toggle_class = __J__toggle_class; +var __J__trigger = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "event")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var event = arguments['event']; +j = get_attribute(self, j); o = j.trigger(event); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.trigger = J__trigger; -var J__unbind = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "event", "handler")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var event = arguments["event"]; -var handler = arguments["handler"]; -j = get_attribute(self, "j"); +var __args_64, __kwargs_64; +__args_64 = create_array(o); +__kwargs_64 = {}; +return get_attribute(J, "__call__")(__args_64, __kwargs_64); +} + +J.trigger = __J__trigger; +var __J__unbind = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "event", "handler")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var event = arguments['event']; +var handler = arguments['handler']; +j = get_attribute(self, j); o = j.unbind(event, adapt_arguments(handler)); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.unbind = J__unbind; -var J__value = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "value")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var value = arguments["value"]; -j = get_attribute(self, "j"); +var __args_65, __kwargs_65; +__args_65 = create_array(o); +__kwargs_65 = {}; +return get_attribute(J, "__call__")(__args_65, __kwargs_65); +} + +J.unbind = __J__unbind; +var __J__value = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "value")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var value = arguments['value']; +j = get_attribute(self, j); o = j.val(value); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.value = J__value; -var J__width = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "value")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var value = arguments["value"]; -j = get_attribute(self, "j"); +var __args_66, __kwargs_66; +__args_66 = create_array(o); +__kwargs_66 = {}; +return get_attribute(J, "__call__")(__args_66, __kwargs_66); +} + +J.value = __J__value; +var __J__width = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "value")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var value = arguments['value']; +j = get_attribute(self, j); o = j.width(value); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.width = J__width; -var J__length = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -j = get_attribute(self, "j"); +var __args_67, __kwargs_67; +__args_67 = create_array(o); +__kwargs_67 = {}; +return get_attribute(J, "__call__")(__args_67, __kwargs_67); +} + +J.width = __J__width; +var __J__length = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +j = get_attribute(self, j); return j.length(); } -J.length = J__length; -var J__map = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "func")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var func = arguments["func"]; -j = get_attribute(self, "j"); +J.length = __J__length; +var __J__map = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "func")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var func = arguments['func']; +j = get_attribute(self, j); o = j.map(func); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.map = J__map; -var J__mousedown = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "handler")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var handler = arguments["handler"]; -j = get_attribute(self, "j"); +var __args_68, __kwargs_68; +__args_68 = create_array(o); +__kwargs_68 = {}; +return get_attribute(J, "__call__")(__args_68, __kwargs_68); +} + +J.map = __J__map; +var __J__mousedown = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "handler")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var handler = arguments['handler']; +j = get_attribute(self, j); o = j.mousedown(adapt_arguments(handler)); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.mousedown = J__mousedown; -var J__mouseenter = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "handler")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var handler = arguments["handler"]; -j = get_attribute(self, "j"); +var __args_69, __kwargs_69; +__args_69 = create_array(o); +__kwargs_69 = {}; +return get_attribute(J, "__call__")(__args_69, __kwargs_69); +} + +J.mousedown = __J__mousedown; +var __J__mouseenter = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "handler")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var handler = arguments['handler']; +j = get_attribute(self, j); o = j.mouseenter(adapt_arguments(handler)); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.mouseenter = J__mouseenter; -var J__mouseleave = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "handler")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var handler = arguments["handler"]; -j = get_attribute(self, "j"); +var __args_70, __kwargs_70; +__args_70 = create_array(o); +__kwargs_70 = {}; +return get_attribute(J, "__call__")(__args_70, __kwargs_70); +} + +J.mouseenter = __J__mouseenter; +var __J__mouseleave = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "handler")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var handler = arguments['handler']; +j = get_attribute(self, j); o = j.mouseleave(adapt_arguments(handler)); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.mouseleave = J__mouseleave; -var J__mousemove = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "handler")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var handler = arguments["handler"]; -j = get_attribute(self, "j"); +var __args_71, __kwargs_71; +__args_71 = create_array(o); +__kwargs_71 = {}; +return get_attribute(J, "__call__")(__args_71, __kwargs_71); +} + +J.mouseleave = __J__mouseleave; +var __J__mousemove = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "handler")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var handler = arguments['handler']; +j = get_attribute(self, j); o = j.mousemove(adapt_arguments(handler)); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.mousemove = J__mousemove; -var J__mouseout = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "handler")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var handler = arguments["handler"]; -j = get_attribute(self, "j"); +var __args_72, __kwargs_72; +__args_72 = create_array(o); +__kwargs_72 = {}; +return get_attribute(J, "__call__")(__args_72, __kwargs_72); +} + +J.mousemove = __J__mousemove; +var __J__mouseout = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "handler")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var handler = arguments['handler']; +j = get_attribute(self, j); o = j.mouseout(adapt_arguments(handler)); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.mouseout = J__mouseout; -var J__mouseover = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "handler")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var handler = arguments["handler"]; -j = get_attribute(self, "j"); +var __args_73, __kwargs_73; +__args_73 = create_array(o); +__kwargs_73 = {}; +return get_attribute(J, "__call__")(__args_73, __kwargs_73); +} + +J.mouseout = __J__mouseout; +var __J__mouseover = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "handler")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var handler = arguments['handler']; +j = get_attribute(self, j); o = j.mouseover(adapt_arguments(handler)); -return get_attribute(J, "__call__")(create_array(o), {}); -} - -J.mouseover = J__mouseover; -var J__mouseup = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "handler")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var handler = arguments["handler"]; -j = get_attribute(self, "j"); +var __args_74, __kwargs_74; +__args_74 = create_array(o); +__kwargs_74 = {}; +return get_attribute(J, "__call__")(__args_74, __kwargs_74); +} + +J.mouseover = __J__mouseover; +var __J__mouseup = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "handler")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var handler = arguments['handler']; +j = get_attribute(self, j); o = j.mouseup(adapt_arguments(handler)); -return get_attribute(J, "__call__")(create_array(o), {}); +var __args_75, __kwargs_75; +__args_75 = create_array(o); +__kwargs_75 = {}; +return get_attribute(J, "__call__")(__args_75, __kwargs_75); } -J.mouseup = J__mouseup; -J = create_class("J", parents, J); +J.mouseup = __J__mouseup; +J = create_class("J", __J_parents, __J__attrs); var ajax = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("url", "settings")}; -var arguments = get_arguments(signature, args, kwargs); -var url = arguments["url"]; -var settings = arguments["settings"]; +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("url", "settings")}; +arguments = get_arguments(signature, args, kwargs); +var url = arguments['url']; +var settings = arguments['settings']; return jQuery.ajax(url, settings); } diff --git a/pythonscript.js b/pythonscript.js index 388b855..afb0fa0 100644 --- a/pythonscript.js +++ b/pythonscript.js @@ -36,9 +36,6 @@ var metaclass; metaclass = attrs.__metaclass__; attrs.__metaclass__ = undefined; return metaclass([class_name, parents, attrs]); -} -else { - } var klass; @@ -55,9 +52,6 @@ var init; init = get_attribute(object, "__init__"); if(init) { init.apply(undefined, arguments); -} -else { - } return object; @@ -72,12 +66,6 @@ if(attribute == "__call__") { if({}.toString.call(object) === '[object Function]') { return object; } -else { - -} - -} -else { } @@ -85,9 +73,6 @@ var attr; attr = object[attribute]; if(attr) { return attr; -} -else { - } var __class__, __dict__, __get__, bases; @@ -100,12 +85,6 @@ __get__ = get_attribute(attr, "__get__"); if(__get__) { return __get__([object, __class__]); } -else { - -} - -} -else { } @@ -122,21 +101,12 @@ __get__ = get_attribute(attr, "__get__"); if(__get__) { return __get__([object, __class__]); } -else { - -} - -} -else { } i = backup; } -} -else { - } __dict__ = object.__dict__; @@ -148,24 +118,12 @@ if(bases) { __get__ = get_attribute(attr, "__get__"); if(__get__) { return __get__([undefined, __class__]); -} -else { - } -} -else { - } return attr; } -else { - -} - -} -else { } @@ -182,21 +140,12 @@ __get__ = get_attribute(attr, "__get__"); if(__get__) { return __get__([object, __class__]); } -else { - -} - -} -else { } i = backup; } -} -else { - } if(__class__) { @@ -218,15 +167,9 @@ return attr.apply(undefined, args); } return method; -} -else { - } return attr; -} -else { - } bases = __class__.bases; @@ -251,23 +194,14 @@ return attr.apply(undefined, args); } return method; -} -else { - } return attr; -} -else { - } i = backup; } -} -else { - } return undefined; @@ -286,12 +220,6 @@ if(__set__) { __set__([object, value]); return undefined; } -else { - -} - -} -else { } @@ -309,21 +237,12 @@ if(__set__) { __set__([object, value]); return undefined; } -else { - -} - -} -else { } i = backup; } -} -else { - } __dict__ = object.__dict__; @@ -374,16 +293,10 @@ i = backup; args = args.slice(j); if(signature.vararg) { out[signature.vararg] = args; -} -else { - } if(signature.varkwarg) { out[signature.varkwarg] = kwargs; -} -else { - } return out; @@ -418,9 +331,6 @@ C = args[0]; B = args[1]; if(C === B) { return true; -} -else { - } var iter = jsrange(C.bases.length); @@ -430,9 +340,6 @@ index = iter[index]; base = C.bases[index]; if(issubclass([base, B], {})) { return true; -} -else { - } index = backup; @@ -448,381 +355,440 @@ klass = args[1]; object_class = object.__class__; if(object_class === undefined) { return false; -} -else { - } return issubclass(create_array(object_class, klass)); } var range = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("num")}; -var arguments = get_arguments(signature, args, kwargs); -var num = arguments["num"]; +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("num")}; +arguments = get_arguments(signature, args, kwargs); +var num = arguments['num']; var i; var r; i = 0; -r = get_attribute(list, "__call__")(create_array(), {}); -while(i < num) { -get_attribute(get_attribute(r, "append"), "__call__")(create_array(i), {}); +var __args_0, __kwargs_0; +__args_0 = create_array(); +__kwargs_0 = {}; +r = get_attribute(list, "__call__")(__args_0, __kwargs_0); +var __args_1, __kwargs_1; +__args_1 = create_array(i); +__kwargs_1 = {}; +get_attribute(get_attribute(r, append), "__call__")(__args_1, __kwargs_1); i = i + 1; -} return r; } -StopIteration = {}; -parents = create_array(); -StopIteration = create_class("StopIteration", parents, StopIteration); +var StopIteration, __StopIteration_attrs, __StopIteration_parents; +__StopIteration_attrs = {}; +__StopIteration_parents = create_array(); +StopIteration = create_class("StopIteration", __StopIteration_parents, __StopIteration__attrs); var len = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("obj")}; -var arguments = get_arguments(signature, args, kwargs); -var obj = arguments["obj"]; -return get_attribute(get_attribute(obj, "__len__"), "__call__")(create_array(), {}); +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("obj")}; +arguments = get_arguments(signature, args, kwargs); +var obj = arguments['obj']; +var __args_2, __kwargs_2; +__args_2 = create_array(); +__kwargs_2 = {}; +return get_attribute(get_attribute(obj, __len__), "__call__")(__args_2, __kwargs_2); } var next = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("obj")}; -var arguments = get_arguments(signature, args, kwargs); -var obj = arguments["obj"]; -return get_attribute(get_attribute(obj, "next"), "__call__")(create_array(), {}); +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("obj")}; +arguments = get_arguments(signature, args, kwargs); +var obj = arguments['obj']; +var __args_3, __kwargs_3; +__args_3 = create_array(); +__kwargs_3 = {}; +return get_attribute(get_attribute(obj, next), "__call__")(__args_3, __kwargs_3); } var map = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("func", "objs")}; -var arguments = get_arguments(signature, args, kwargs); -var func = arguments["func"]; -var objs = arguments["objs"]; -out = get_attribute(list, "__call__")(create_array(), {}); -set_attribute(out, "js_object", get_attribute(map, "__call__")(create_array(func, get_attribute(objs, "js_object")), {})); +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("func", "objs")}; +arguments = get_arguments(signature, args, kwargs); +var func = arguments['func']; +var objs = arguments['objs']; +var __args_4, __kwargs_4; +__args_4 = create_array(); +__kwargs_4 = {}; +out = get_attribute(list, "__call__")(__args_4, __kwargs_4); +var __args_5, __kwargs_5; +__args_5 = create_array(func, get_attribute(objs, js_object)); +__kwargs_5 = {}; +set_attribute(out, js_object, get_attribute(map, "__call__")(__args_5, __kwargs_5)); return out; } -Iterator = {}; -parents = create_array(); -var Iterator____init__ = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "obj", "index")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var obj = arguments["obj"]; -var index = arguments["index"]; -set_attribute(self, "obj", obj); -set_attribute(self, "index", index); -} - -Iterator.__init__ = Iterator____init__; -var Iterator__next = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -index = get_attribute(self, "index"); -length = get_attribute(len, "__call__")(create_array(get_attribute(self, "obj")), {}); -if(index == length) { -throw StopIteration; -} -else { - -} - -item = get_attribute(get_attribute(get_attribute(self, "obj"), "get"), "__call__")(create_array(get_attribute(self, "index")), {}); -set_attribute(self, "index", get_attribute(self, "index") + 1); +var Iterator, __Iterator_attrs, __Iterator_parents; +__Iterator_attrs = {}; +__Iterator_parents = create_array(); +var __Iterator____init__ = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "obj", "index")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var obj = arguments['obj']; +var index = arguments['index']; +set_attribute(self, obj, obj); +set_attribute(self, index, index); +} + +Iterator.__init__ = __Iterator____init__; +var __Iterator__next = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +index = get_attribute(self, index); +var __args_6, __kwargs_6; +__args_6 = create_array(get_attribute(self, obj)); +__kwargs_6 = {}; +length = get_attribute(len, "__call__")(__args_6, __kwargs_6); +var __args_7, __kwargs_7; +__args_7 = create_array(get_attribute(self, index)); +__kwargs_7 = {}; +item = get_attribute(get_attribute(get_attribute(self, obj), get), "__call__")(__args_7, __kwargs_7); +set_attribute(self, index, get_attribute(self, index) + 1); return item; } -Iterator.next = Iterator__next; -Iterator = create_class("Iterator", parents, Iterator); -list = {}; -parents = create_array(); -var list____init__ = function(args, kwargs) { -var signature = {"kwargs": {"js_object": undefined}, "args": create_array("self", "js_object")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var js_object = arguments["js_object"]; -if(js_object) { -set_attribute(self, "js_object", js_object); -} -else { -set_attribute(self, "js_object", create_array()); -} - -} - -list.__init__ = list____init__; -var list__append = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "obj")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var obj = arguments["obj"]; +Iterator.next = __Iterator__next; +Iterator = create_class("Iterator", __Iterator_parents, __Iterator__attrs); +var list, __list_attrs, __list_parents; +__list_attrs = {}; +__list_parents = create_array(); +var __list____init__ = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {"js_object": undefined}, "args": create_array("self", "js_object")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var js_object = arguments['js_object']; +set_attribute(self, js_object, js_object); +set_attribute(self, js_object, create_array()); +} + +list.__init__ = __list____init__; +var __list__append = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "obj")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var obj = arguments['obj']; var __array; -__array = get_attribute(self, "js_object"); +__array = get_attribute(self, js_object); __array.push(obj); } -list.append = list__append; -var list__extend = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "other")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var other = arguments["other"]; -var __iterator__ = get_attribute(other, "__iter__")(create_array(), {}); +list.append = __list__append; +var __list__extend = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "other")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var other = arguments['other']; +var __iterator__, obj; +__iterator__ = get_attribute(other, "__iter__"); try { -var obj = get_attribute(__iterator__, "next")(create_array(), {}); +obj = get_attribute(__iterator__, "next")(); while(true) { -get_attribute(get_attribute(self, "append"), "__call__")(create_array(obj), {}); -var obj = get_attribute(__iterator__, "next")(create_array(), {}); +var __args_8, __kwargs_8; +__args_8 = create_array(obj); +__kwargs_8 = {}; +get_attribute(get_attribute(self, append), "__call__")(__args_8, __kwargs_8); +undefined; +obj = get_attribute(__iterator__, "next")(); } } catch(__exception__) { +if (__exception__ == StopIteration || isinstance(__exception__, StopIteration)) { + +} } } -list.extend = list__extend; -var list__insert = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "index", "obj")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var index = arguments["index"]; -var obj = arguments["obj"]; +list.extend = __list__extend; +var __list__insert = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "index", "obj")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var index = arguments['index']; +var obj = arguments['obj']; var __array; -__array = get_attribute(self, "js_object"); +__array = get_attribute(self, js_object); __array.splice(index, 0, obj); } -list.insert = list__insert; -var list__remove = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "obj")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var obj = arguments["obj"]; +list.insert = __list__insert; +var __list__remove = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "obj")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var obj = arguments['obj']; var __array; -index = get_attribute(get_attribute(self, "index"), "__call__")(create_array(obj), {}); -__array = get_attribute(self, "js_object"); +var __args_9, __kwargs_9; +__args_9 = create_array(obj); +__kwargs_9 = {}; +index = get_attribute(get_attribute(self, index), "__call__")(__args_9, __kwargs_9); +__array = get_attribute(self, js_object); __array.splice(index, 1); } -list.remove = list__remove; -var list__pop = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; +list.remove = __list__remove; +var __list__pop = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; var __array; -__array = get_attribute(self, "js_object"); +__array = get_attribute(self, js_object); return __array.pop(); } -list.pop = list__pop; -var list__index = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "obj")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var obj = arguments["obj"]; +list.pop = __list__pop; +var __list__index = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "obj")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var obj = arguments['obj']; var __array; -__array = get_attribute(self, "js_object"); +__array = get_attribute(self, js_object); return __array.indexOf(obj); } -list.index = list__index; -var list__count = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "obj")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var obj = arguments["obj"]; +list.index = __list__index; +var __list__count = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "obj")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var obj = arguments['obj']; i = 0; -var __iterator__ = get_attribute(self, "__iter__")(create_array(), {}); +var __iterator__, other; +__iterator__ = get_attribute(self, "__iter__"); try { -var other = get_attribute(__iterator__, "next")(create_array(), {}); +other = get_attribute(__iterator__, "next")(); while(true) { -if(other == obj) { i = i + 1; +undefined; +other = get_attribute(__iterator__, "next")(); } -else { - } +catch(__exception__) { +if (__exception__ == StopIteration || isinstance(__exception__, StopIteration)) { -var other = get_attribute(__iterator__, "next")(create_array(), {}); -} } -catch(__exception__) { } return i; } -list.count = list__count; -var list__reverse = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; +list.count = __list__count; +var __list__reverse = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; var __array; -__array = get_attribute(self, "js_object"); -set_attribute(self, "js_object", __array.reverse()); +__array = get_attribute(self, js_object); +set_attribute(self, js_object, __array.reverse()); } -list.reverse = list__reverse; -var list__shift = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; +list.reverse = __list__reverse; +var __list__shift = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; var __array; -__array = get_attribute(self, "js_object"); +__array = get_attribute(self, js_object); return __array.shift(); } -list.shift = list__shift; -var list__slice = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "start", "end")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var start = arguments["start"]; -var end = arguments["end"]; +list.shift = __list__shift; +var __list__slice = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "start", "end")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var start = arguments['start']; +var end = arguments['end']; var __array; -__array = get_attribute(self, "js_object"); +__array = get_attribute(self, js_object); return __array.slice(start, end); } -list.slice = list__slice; -var list____iter__ = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -return get_attribute(Iterator, "__call__")(create_array(self, 0), {}); -} - -list.__iter__ = list____iter__; -var list__get = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "index")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var index = arguments["index"]; +list.slice = __list__slice; +var __list____iter__ = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var __args_10, __kwargs_10; +__args_10 = create_array(self, 0); +__kwargs_10 = {}; +return get_attribute(Iterator, "__call__")(__args_10, __kwargs_10); +} + +list.__iter__ = __list____iter__; +var __list__get = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "index")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var index = arguments['index']; var __array; -__array = get_attribute(self, "js_object"); +__array = get_attribute(self, js_object); return __array[index]; } -list.get = list__get; -var list__set = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "index", "value")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var index = arguments["index"]; -var value = arguments["value"]; +list.get = __list__get; +var __list__set = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "index", "value")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var index = arguments['index']; +var value = arguments['value']; var __array; -__array = get_attribute(self, "js_object"); +__array = get_attribute(self, js_object); __array[index] = value; } -list.set = list__set; -var list____len__ = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; +list.set = __list__set; +var __list____len__ = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; var __array; -__array = get_attribute(self, "js_object"); +__array = get_attribute(self, js_object); return __array.length; } -list.__len__ = list____len__; -list = create_class("list", parents, list); -dict = {}; -parents = create_array(); -var dict____init__ = function(args, kwargs) { -var signature = {"kwargs": {"js_object": undefined}, "args": create_array("self", "js_object")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var js_object = arguments["js_object"]; -if(js_object) { -set_attribute(self, "js_object", js_object); -} -else { -set_attribute(self, "js_object", {}); -} - -} - -dict.__init__ = dict____init__; -var dict__get = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "key", "d")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var key = arguments["key"]; -var d = arguments["d"]; +list.__len__ = __list____len__; +list = create_class("list", __list_parents, __list__attrs); +var dict, __dict_attrs, __dict_parents; +__dict_attrs = {}; +__dict_parents = create_array(); +var __dict____init__ = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {"js_object": undefined}, "args": create_array("self", "js_object")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var js_object = arguments['js_object']; +set_attribute(self, js_object, js_object); +set_attribute(self, js_object, {}); +} + +dict.__init__ = __dict____init__; +var __dict__get = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "key", "d")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var key = arguments['key']; +var d = arguments['d']; var __dict; -__dict = get_attribute(self, "js_object"); -if(__dict[key]) { +__dict = get_attribute(self, js_object); return __dict[key]; -} -else { - -} - return d; } -dict.get = dict__get; -var dict__set = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "key", "value")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var key = arguments["key"]; -var value = arguments["value"]; +dict.get = __dict__get; +var __dict__set = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "key", "value")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var key = arguments['key']; +var value = arguments['value']; var __dict; -__dict = get_attribute(self, "js_object"); +__dict = get_attribute(self, js_object); __dict[key] = value; } -dict.set = dict__set; -var dict____len__ = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; +dict.set = __dict__set; +var __dict____len__ = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; var __dict; -__dict = get_attribute(self, "js_object"); +__dict = get_attribute(self, js_object); return Object.keys(__dict).length; } -dict.__len__ = dict____len__; -var dict__keys = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; +dict.__len__ = __dict____len__; +var __dict__keys = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; var __dict; -__dict = get_attribute(self, "js_object"); +__dict = get_attribute(self, js_object); __keys = Object.keys(__dict); var out; -out = get_attribute(list, "__call__")(create_array(), {}); -set_attribute(out, "js_object", __keys); +var __args_11, __kwargs_11; +__args_11 = create_array(); +__kwargs_11 = {}; +out = get_attribute(list, "__call__")(__args_11, __kwargs_11); +set_attribute(out, js_object, __keys); return out; } -dict.keys = dict__keys; -dict = create_class("dict", parents, dict); -str = {}; -parents = create_array(); -parents.push(list); -var str____init__ = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("self", "jsstring")}; -var arguments = get_arguments(signature, args, kwargs); -var self = arguments["self"]; -var jsstring = arguments["jsstring"]; -get_attribute(get_attribute(list, "__init__"), "__call__")(create_array(self), {}); +dict.keys = __dict__keys; +dict = create_class("dict", __dict_parents, __dict__attrs); +var str, __str_attrs, __str_parents; +__str_attrs = {}; +__str_parents = create_array(); +__str_parents.push(list); +var __str____init__ = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("self", "jsstring")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var jsstring = arguments['jsstring']; +var __args_12, __kwargs_12; +__args_12 = create_array(self); +__kwargs_12 = {}; +get_attribute(get_attribute(list, __init__), "__call__")(__args_12, __kwargs_12); var char; -var __iterator__ = get_attribute(get_attribute(range, "__call__")(create_array(jsstring.length), {}), "__iter__")(create_array(), {}); +var __iterator__, i; +var __args_13, __kwargs_13; +__args_13 = create_array(jsstring.length); +__kwargs_13 = {}; +__iterator__ = get_attribute(get_attribute(range, "__call__")(__args_13, __kwargs_13), "__iter__"); try { -var i = get_attribute(__iterator__, "next")(create_array(), {}); +i = get_attribute(__iterator__, "next")(); while(true) { char = jsstring.charAt(i); -get_attribute(get_attribute(self, "append"), "__call__")(create_array(char), {}); -var i = get_attribute(__iterator__, "next")(create_array(), {}); +var __args_14, __kwargs_14; +__args_14 = create_array(char); +__kwargs_14 = {}; +get_attribute(get_attribute(self, append), "__call__")(__args_14, __kwargs_14); +undefined; +undefined; +i = get_attribute(__iterator__, "next")(); } } catch(__exception__) { +if (__exception__ == StopIteration || isinstance(__exception__, StopIteration)) { + +} } } -str.__init__ = str____init__; -str = create_class("str", parents, str); +str.__init__ = __str____init__; +str = create_class("str", __str_parents, __str__attrs); diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py old mode 100644 new mode 100755 index 3c47d49..6d7a0bf --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -1,3 +1,6 @@ +#!/usr/bin/env python +import sys + from ast import Str from ast import Expr from ast import Call @@ -9,101 +12,185 @@ from ast import TryExcept from ast import Attribute from ast import FunctionDef -from ast import NodeTransformer +from ast import parse +from ast import NodeVisitor + + +class Writer(object): + + def __init__(self): + self.level = 0 + self.buffers = list() + + def push(self): + self.level += 1 + + def pull(self): + self.level -= 1 + + def append(self, code): + self.buffers.append(code) + + def write(self, code): + for buffer in self.buffers: + self._write(buffer) + self.buffers = list() + self._write(code) + + def _write(self, code): + indentation = self.level * 4 * ' ' + print '%s%s' % (indentation, code) -class PythonToPythonJS(NodeTransformer): + +writer = Writer() + + +class PythonToPythonJS(NodeVisitor): + + identifier = 0 def visit_ClassDef(self, node): - name = Name(node.name, None) - yield Expr(Assign([name], Call(Name('JSObject', None), None, None, None, None))) - yield Expr(Assign([Name('parents', None)], Call(Name('JSArray', Name), None, None, None, None))) - if node.bases: - yield Expr( - Call( - Attribute( - Name('parents', None), - 'push', - None - ), - node.bases, - None, - None, - None - ) - ) + name = node.name + writer.write('var(%s, __%s_attrs, __%s_parents)' % (name, name, name)) + writer.write('__%s_attrs = JSObject()' % name) + writer.write('__%s_parents = JSArray()' % name) + for base in node.bases: + code = '__%s_parents.push(%s)' % (name, self.visit(base)) + writer.write(code) for item in node.body: if isinstance(item, FunctionDef): item_name = item.name - item.name = closure_name = '%s__%s' % (node.name, item_name) - for i in self.visit(item): - yield i - yield Expr(Assign([Attribute(name, item_name, None)], Name(closure_name, None))) + item.name = '__%s__%s' % (name, item_name) + self.visit(item) # this will output the code for the function + writer.write('%s.%s = %s' % (name, item_name, item.name)) elif isinstance(item, Assign): item_name = item.targets[0].id - item.targets[0].id = closure_name = '%s__%s' % (name.id, item_name) - yield self.visit(item) - yield Expr(Assign([Attribute(name, item_name, None)], Name(closure_name, None))) - yield Expr(Assign([name], Call(Name('create_class', None), [Str(node.name), Name('parents', None), Name(name.id, None)], None, None, None))) + item.targets[0].id = '__%s__%s' % (name.id, item_name) + self.visit(item) # this will output the code for the assign + writer.write('%s.%s = %s' % (name, item_name, item.targets[0].id)) + writer.write('%s = create_class("%s", __%s_parents, __%s__attrs)' % (name, name, name, name)) - def visit_Attribute(self, node): - return Call(Name('get_attribute', None), [self.visit(node.value), Str(node.attr)], None, None, None) + def visit_Name(self, node): + return node.id + + def visit_Num(self, node): + return str(node.n) + + def visit_Return(self, node): + if node.value: + return writer.write('return %s' % self.visit(node.value)) + return writer.write('return undefined') - def visit_Expr(self, node): # FIXME: is it useful - return Expr(self.visit(node.value)) + def visit_Pass(self, node): + return '' + + def visit_BinOp(self, node): + left = self.visit(node.left) + op = self.visit(node.op) + right = self.visit(node.right) + return '%s %s %s' % (left, op, right) + + def visit_Eq(self, node): + return '==' + + def visit_NotEq(self, node): + return '!=' + + def visit_Is(self, node): + return '===' + + def visit_Add(self, node): + return '+' + + def visit_Sub(self, node): + return '-' + + def visit_Lt(self, node): + return '<' + + def visit_Gt(self, node): + return '>' + + def visit_GtE(self, node): + return '>=' + + def visit_LtE(self, node): + return '<=' + + def visit_Compare(self, node): + left = self.visit(node.left) + ops = self.visit(node.ops[0]) + comparator = self.visit(node.comparators[0]) + return '%s %s %s' % (left, ops, comparator) + + def visit_Not(self, node): + return '!' + + def visit_UnaryOp(self, node): + return self.visit(node.op) + self.visit(node.operand) + + def visit_Attribute(self, node): + return 'get_attribute(%s, %s)' % (self.visit(node.value), node.attr) def visit_Assign(self, node): attr = node.targets[0] if isinstance(attr, Attribute): - return Expr(Call(Name('set_attribute', None), [attr.value, Str(attr.attr), self.visit(node.value)], None, None, None)) + code = 'set_attribute(%s, %s, %s)' % ( + self.visit(attr.value), + attr.attr, + self.visit(node.value) + ) + writer.write(code) else: - return Expr(self.generic_visit(node)) + writer.write('%s = %s' % (node.targets[0].id, self.visit(node.value))) + + def visit_Print(self, node): + writer.write('print %s' % ', '.join(map(self.visit, node.values))) + + def visit_Str(self, node): + return '"%s"' % node.s + + def visit_Expr(self, node): + writer.write(self.visit(node.value)) def visit_Call(self, node): if hasattr(node.func, 'id') and node.func.id in ('JS', 'toString', 'JSObject', 'JSArray', 'var'): - return self.generic_visit(node) - return Call( - Call( - Name('get_attribute', None), - [self.visit(node.func), Str('__call__')], - None, - None, - None, - ), - [ - Call( - Name('JSArray', None), - map(self.visit, node.args), - None, - None, - None - ), - Call( - Name('JSObject', None), - None, - map(lambda x: keyword(Name(x.arg, None), self.visit(x.value)), node.keywords), - None, - None - ), - ], - None, - None, - None, - ) + args = map(self.visit, node.args) + kwargs = map(lambda x: '%s=%s' % (x.arg, self.visit(x.value)), node.keywords) + args.extend(kwargs) + args = ', '.join(args) + return '%s(%s)' % (node.func.id, args) + else: + args = ', '.join(map(self.visit, node.args)) + kwargs = ', '.join(map(lambda x: '%s=%s' % (x.arg, self.visit(x.value)), node.keywords)) + args_name = '__args_%s' % self.identifier + kwargs_name = '__kwargs_%s' % self.identifier + writer.append('var(%s, %s)' % (args_name, kwargs_name)) + self.identifier += 1 + writer.append('%s = JSArray(%s)' % (args_name, args)) + if node.starargs: + writer.append('%s.push.apply(%s, %s)' % (args_name, args_name, self.visit(node.starargs))) + writer.append('%s = JSObject(%s)' % (kwargs_name, kwargs)) + if node.kwargs: + kwargs = self.visit(node.kwargs) + code = "JS('for (var name in %s) { %s[name] = %s[name]; }')" % (kwargs, kwargs_name, kwargs) + writer.append(code) + return 'get_attribute(%s, "__call__")(%s, %s)' % (self.visit(node.func), args_name, kwargs_name) def visit_FunctionDef(self, node): - # new body is old body processed by PythonToPythonJS - # prepended by the python arguments handling - body = map(self.visit, node.body) + writer.write('def %s(args, kwargs):' % node.name) + writer.push() + # new pythonjs' python function arguments handling # create the structure representing the functions arguments # first create the defaultkwargs JSObject - l = len(node.args.defaults) - - kwargsdefault = map(lambda x: keyword(x[0], x[1]), zip(node.args.args[-l:], node.args.defaults)) + writer.write('var(signature, arguments)') + L = len(node.args.defaults) + kwargsdefault = map(lambda x: keyword(self.visit(x[0]), x[1]), zip(node.args.args[-L:], node.args.defaults)) kwargsdefault = Call( Name('JSObject', None), - None, + [], kwargsdefault, None, None @@ -111,7 +198,7 @@ def visit_FunctionDef(self, node): args = Call( Name('JSArray', None), map(lambda x: Str(x.id), node.args.args), - None, + [], None, None ) @@ -127,201 +214,55 @@ def visit_FunctionDef(self, node): prebody = list() # create a JS Object to store the value of each parameter - prebody.append( - Expr( - Assign( - [Name('var signature', None)], - Call( - Name('JSObject', None), - None, - keywords, - None, - None - ) - ) - ) - ) - # retrieve the actual value for each argument, cf. pythonpythonjs - prebody.append( - Expr( - Assign( - [Name('var arguments', None)], - Call( - Name('get_arguments', None), - [Name('signature', None), Name('args', None), Name('kwargs', None)], - None, - None, - None - ) - ) - ) - ) - # then for each argument assign its value + signature = ', '.join(map(lambda x: '%s=%s' % (self.visit(x.arg), self.visit(x.value)), keywords)) + writer.write('signature = JSObject(%s)' % signature) + writer.write('arguments = get_arguments(signature, args, kwargs)') + # # then for each argument assign its value for arg in node.args.args: - prebody.append( - Expr( - Assign( - [Name('var ' + arg.id, None)], - Call( - Name('JS', None), - [Str('arguments["%s"]' % arg.id)], - None, - None, - None - ) - ) - ) - ) + writer.write("""JS("var %s = arguments['%s']")""" % (arg.id, arg.id)) if node.args.vararg: - prebody.append( - Expr( - Call( - Name('JS', None), - [Str('var %s = arguments["%s"]' % (node.args.vararg, node.args.vararg))], - None, - None, - None - ) - ) - ) + writer.write("""JS("var %s arguments['%s']")""" % (node.args.vararg, node.args.vararg)) # turn it into a list expr = '%s = get_attribute(list, "__call__")(create_array(%s), {});' expr = expr % (node.args.vararg, node.args.vararg) - prebody.append(Name(expr, None)) + writer.write(expr) if node.args.kwarg: - prebody.append( - Expr( - Call( - Name('JS', None), - [Str('var %s = arguments["%s"]' % (node.args.kwarg, node.args.kwarg))], - None, - None, - None - ) - ) - ) + writer.write("""var %s = arguments["%s"]""" % (node.args.kwarg, node.args.kwarg)) expr = '%s = get_attribute(dict, "__call__")(create_array(%s), {});' expr = expr % (node.args.kwarg, node.args.kwarg) - prebody.append(Name(expr, None)) - prebody.extend(body) - body = prebody - # process arguments to build python keyword arguments handling - # in pythonjs, python functions takes two parameters args and kwargs - args = arguments([Name('args', None), Name('kwargs', None)], None, None, None) - yield FunctionDef( - node.name, - args, - body, - None - ) + writer.write(expr) + map(self.visit, node.body) + writer.pull() + + # apply decorators for decorator in reversed(node.decorator_list): - yield Assign( - [Name(node.name, None)], - Call( - decorator, - [ - Call( - Name('JS', None), - [Str('create_array(%s)' % node.name)], - None, - None, - None - ) - ], - None, - None, - None - ) - ) + writer.write('%s = %s(create_array(%s))' % (node.name, self.visit(decorator), node.name)) def visit_For(self, node): - yield Assign( - [Name('var __iterator__', None)], - Call( - Call(Name('get_attribute', None), [self.visit(node.iter), Str('__iter__')], None, None, None), - [ - Call( - Name('JSArray', None), - None, - None, - None, - None - ), - Call( - Name('JSObject', None), - None, - None, - None, - None - ), - ], - None, - None, - None - ) - ) - node.body = map(self.visit, node.body) - node.body.append( - Assign( - [Name('var %s' % node.target.id, None)], - Call( - Call(Name('get_attribute', None), [Name('__iterator__', None), Str('next')], None, None, None), - [ - Call( - Name('JSArray', None), - None, - None, - None, - None - ), - Call( - Name('JSObject', None), - None, - None, - None, - None - ), - ], - None, - None, - None - ) - ) - ) - tryexcept_body = [ - Assign( - [Name('var %s' % node.target.id, None)], - Call( - Call(Name('get_attribute', None), [Name('__iterator__', None), Str('next')], None, None, None), - [ - Call( - Name('JSArray', None), - None, - None, - None, - None - ), - Call( - Name('JSObject', None), - None, - None, - None, - None - ), - ], - None, - None, - None - ) - ), - While(Name('true', None), node.body, None) - ] - yield TryExcept( - tryexcept_body, - [], # FIXME: there is no handlers any exception - # will throw us out the the for loop - # XXX: at least at console.log - [], - ) - + writer.write('var(__iterator__, %s)' % node.target.id) + writer.write('__iterator__ = get_attribute(%s, "__iter__")' % self.visit(node.iter)) + + writer.write('try:') + writer.push() + writer.write('%s = get_attribute(__iterator__, "next")()' % node.target.id) + writer.write('while True:') + writer.push() + map(writer.write, map(self.visit, node.body)) + writer.write('%s = get_attribute(__iterator__, "next")()' % node.target.id) + writer.pull() + writer.pull() + writer.write('except StopIteration:') + writer.push() + writer.write('pass') + writer.pull() + return '' + +def main(): + input = parse(sys.stdin.read()) + tree = parse(input) + PythonToPythonJS().visit(tree) + + +if __name__ == '__main__': + main() diff --git a/pythonscript/pythonscript.py b/pythonscript/pythonscript.py new file mode 100755 index 0000000..9789274 --- /dev/null +++ b/pythonscript/pythonscript.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python +import sys + +from StringIO import StringIO + +from python_to_pythonjs import PythonToPythonJS +from pythonjs import JSGenerator +from ast import parse + + +def main(): + input = parse(sys.stdin.read()) + tree = parse(input) + stdout = sys.stdout + s = StringIO() + sys.stdout = s + PythonToPythonJS().visit(tree) + tree = parse(s.getvalue()) + sys.stdout = stdout + print JSGenerator().visit(tree) + + +if __name__ == '__main__': + main() diff --git a/setup.py b/setup.py index 5f60420..b781626 100755 --- a/setup.py +++ b/setup.py @@ -12,7 +12,9 @@ packages=['pythonscript'], entry_points=""" [console_scripts] - pythonscript=pythonscript.main:main pythonjs=pythonscript.pythonjs:main - """ + pythonscript=pythonscript.pythonscript:main + python_to_pythonjs=pythonscript.python_to_pythonjs:main + """, + install_script='bin/pythonscript', ) diff --git a/tests/python-to-js/tests.py b/tests/python-to-js/tests.py new file mode 100644 index 0000000..3f22694 --- /dev/null +++ b/tests/python-to-js/tests.py @@ -0,0 +1,22 @@ +class A(B,C): + pass + +a.b = c.d + +JS('var a = new Object()') +var(object, args, str) +object = JSObject(spam=7, egg=8) +args = JSArray(5, 6) +str = toString(egg) + +# function(1, 2, 3, 4, *args, **kwargs) + +@deco_a +@deco_b +def function(a, b, c=3, d=4, *args, **kwargs): + print a, b, c, d + sum = a + b + c + d + print sum + for arg in args: + print args + print kwargs From 0c66ef7115f403decf3f1ed03783a29d9c87d286 Mon Sep 17 00:00:00 2001 From: Amirouche Boubekki Date: Sun, 19 May 2013 15:44:57 +0200 Subject: [PATCH 017/860] debug --- .gitignore | 5 +- Makefile | 3 - bindings/jquery.py.js | 492 +++++++++--------- pythonscript.js | 221 ++++---- pythonscript/python_to_pythonjs.py | 74 ++- pythonscript/pythonjs.py | 4 +- runtime/builtins.py | 5 +- runtime/pythonpythonjs.py | 4 + tests/python-to-js/class.py.js | 60 ++- tests/python-to-js/comparaisons.py.js | 2 +- tests/python-to-js/function.py | 5 +- tests/python-to-js/ifelse.py.js | 2 +- tests/python-to-js/tests.py | 19 +- tests/python-to-js/tryexcept.py.js | 1 + tests/python-to-js/tryexceptnamed.py.js | 4 +- tests/python-to-js/tryexcepttyped.py.js | 2 +- tests/python-to-js/tryexcepttypedchained.py | 2 + .../python-to-js/tryexcepttypedchained.py.js | 4 +- 18 files changed, 511 insertions(+), 398 deletions(-) diff --git a/.gitignore b/.gitignore index cf5fe5f..1a846fe 100644 --- a/.gitignore +++ b/.gitignore @@ -39,4 +39,7 @@ python.js builtins.py.js pythonscript/test.py pythonscript/test.py.js -tmp/ \ No newline at end of file +tmp/ +index.html +test.py +test.py.js \ No newline at end of file diff --git a/Makefile b/Makefile index 9dc972e..77e7dfc 100644 --- a/Makefile +++ b/Makefile @@ -16,6 +16,3 @@ pythonscript: python builtins clean: rm python.js builtins.py.js pythonscript.js bindings/*py.js - -tests: - $(CMD) < tests/runtime/tests.py > tests/runtime/tests.py.js diff --git a/bindings/jquery.py.js b/bindings/jquery.py.js index 63ff1b6..2f6ddd9 100644 --- a/bindings/jquery.py.js +++ b/bindings/jquery.py.js @@ -1,23 +1,23 @@ var J, __J_attrs, __J_parents; __J_attrs = {}; __J_parents = create_array(); -var __J____init__ = function(args, kwargs) { +var __J___init__ = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "arg")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var arg = arguments['arg']; -set_attribute(self, j, jQuery(arg)); +set_attribute(self, "j", jQuery(arg)); } -J.__init__ = __J____init__; -var __J__add = function(args, kwargs) { +__J_attrs.__init__ = __J___init__; +var __J_add = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "arg")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var arg = arguments['arg']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.add(arg); var __args_0, __kwargs_0; __args_0 = create_array(o); @@ -25,14 +25,14 @@ __kwargs_0 = {}; return get_attribute(J, "__call__")(__args_0, __kwargs_0); } -J.add = __J__add; -var __J__addClass = function(args, kwargs) { +__J_attrs.add = __J_add; +var __J_addClass = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "klass")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var klass = arguments['klass']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.addClass(klass); var __args_1, __kwargs_1; __args_1 = create_array(o); @@ -40,14 +40,14 @@ __kwargs_1 = {}; return get_attribute(J, "__call__")(__args_1, __kwargs_1); } -J.addClass = __J__addClass; -var __J__after = function(args, kwargs) { +__J_attrs.addClass = __J_addClass; +var __J_after = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "arg")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var arg = arguments['arg']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.after(arg); var __args_2, __kwargs_2; __args_2 = create_array(o); @@ -55,8 +55,8 @@ __kwargs_2 = {}; return get_attribute(J, "__call__")(__args_2, __kwargs_2); } -J.after = __J__after; -var __J__animate = function(args, kwargs) { +__J_attrs.after = __J_after; +var __J_animate = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "properties", "duration", "easing", "complete")}; arguments = get_arguments(signature, args, kwargs); @@ -65,7 +65,7 @@ var properties = arguments['properties']; var duration = arguments['duration']; var easing = arguments['easing']; var complete = arguments['complete']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.animate(properties, duration, easing, complete); var __args_3, __kwargs_3; __args_3 = create_array(o); @@ -73,14 +73,14 @@ __kwargs_3 = {}; return get_attribute(J, "__call__")(__args_3, __kwargs_3); } -J.animate = __J__animate; -var __J__append = function(args, kwargs) { +__J_attrs.animate = __J_animate; +var __J_append = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "arg")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var arg = arguments['arg']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.append(arg); var __args_4, __kwargs_4; __args_4 = create_array(o); @@ -88,14 +88,14 @@ __kwargs_4 = {}; return get_attribute(J, "__call__")(__args_4, __kwargs_4); } -J.append = __J__append; -var __J__appendTo = function(args, kwargs) { +__J_attrs.append = __J_append; +var __J_appendTo = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "arg")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var arg = arguments['arg']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.appendTo(arg); var __args_5, __kwargs_5; __args_5 = create_array(o); @@ -103,27 +103,32 @@ __kwargs_5 = {}; return get_attribute(J, "__call__")(__args_5, __kwargs_5); } -J.appendTo = __J__appendTo; -var __J__attr = function(args, kwargs) { +__J_attrs.appendTo = __J_appendTo; +var __J_attr = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "key", "value")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var key = arguments['key']; var value = arguments['value']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); +if(value == undefined) { j.attr(key); +} +else { j.attr(key, value); } -J.attr = __J__attr; -var __J__before = function(args, kwargs) { +} + +__J_attrs.attr = __J_attr; +var __J_before = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "arg")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var arg = arguments['arg']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.before(arg); var __args_6, __kwargs_6; __args_6 = create_array(o); @@ -131,8 +136,8 @@ __kwargs_6 = {}; return get_attribute(J, "__call__")(__args_6, __kwargs_6); } -J.before = __J__before; -var __J__bind = function(args, kwargs) { +__J_attrs.before = __J_before; +var __J_bind = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "event_type", "event_data", "handler")}; arguments = get_arguments(signature, args, kwargs); @@ -140,7 +145,7 @@ var self = arguments['self']; var event_type = arguments['event_type']; var event_data = arguments['event_data']; var handler = arguments['handler']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.bind(event_type, event_data, adapt_arguments(handler)); var __args_7, __kwargs_7; __args_7 = create_array(o); @@ -148,14 +153,14 @@ __kwargs_7 = {}; return get_attribute(J, "__call__")(__args_7, __kwargs_7); } -J.bind = __J__bind; -var __J__blur = function(args, kwargs) { +__J_attrs.bind = __J_bind; +var __J_blur = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "handler")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.blur(adapt_arguments(handler)); var __args_8, __kwargs_8; __args_8 = create_array(o); @@ -163,14 +168,14 @@ __kwargs_8 = {}; return get_attribute(J, "__call__")(__args_8, __kwargs_8); } -J.blur = __J__blur; -var __J__change = function(args, kwargs) { +__J_attrs.blur = __J_blur; +var __J_change = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "handler")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.change(adapt_arguments(handler)); var __args_9, __kwargs_9; __args_9 = create_array(o); @@ -178,14 +183,14 @@ __kwargs_9 = {}; return get_attribute(J, "__call__")(__args_9, __kwargs_9); } -J.change = __J__change; -var __J__children = function(args, kwargs) { +__J_attrs.change = __J_change; +var __J_children = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "selector")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var selector = arguments['selector']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.children(selector); var __args_10, __kwargs_10; __args_10 = create_array(o); @@ -193,14 +198,14 @@ __kwargs_10 = {}; return get_attribute(J, "__call__")(__args_10, __kwargs_10); } -J.children = __J__children; -var __J__click = function(args, kwargs) { +__J_attrs.children = __J_children; +var __J_click = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "handler")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.click(adapt_arguments(handler)); var __args_11, __kwargs_11; __args_11 = create_array(o); @@ -208,14 +213,14 @@ __kwargs_11 = {}; return get_attribute(J, "__call__")(__args_11, __kwargs_11); } -J.click = __J__click; -var __J__clone = function(args, kwargs) { +__J_attrs.click = __J_click; +var __J_clone = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "with_data_and_events")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var with_data_and_events = arguments['with_data_and_events']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.clone(with_data_and_events); var __args_12, __kwargs_12; __args_12 = create_array(o); @@ -223,13 +228,13 @@ __kwargs_12 = {}; return get_attribute(J, "__call__")(__args_12, __kwargs_12); } -J.clone = __J__clone; -var __J__contents = function(args, kwargs) { +__J_attrs.clone = __J_clone; +var __J_contents = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.contents(); var __args_13, __kwargs_13; __args_13 = create_array(o); @@ -237,15 +242,15 @@ __kwargs_13 = {}; return get_attribute(J, "__call__")(__args_13, __kwargs_13); } -J.contents = __J__contents; -var __J__css = function(args, kwargs) { +__J_attrs.contents = __J_contents; +var __J_css = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "name", "value")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var name = arguments['name']; var value = arguments['value']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.css(name, value); var __args_14, __kwargs_14; __args_14 = create_array(o); @@ -253,15 +258,15 @@ __kwargs_14 = {}; return get_attribute(J, "__call__")(__args_14, __kwargs_14); } -J.css = __J__css; -var __J__data = function(args, kwargs) { +__J_attrs.css = __J_css; +var __J_data = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "key", "value")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var key = arguments['key']; var value = arguments['value']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.data(key, value); var __args_15, __kwargs_15; __args_15 = create_array(o); @@ -269,14 +274,14 @@ __kwargs_15 = {}; return get_attribute(J, "__call__")(__args_15, __kwargs_15); } -J.data = __J__data; -var __J__double_click = function(args, kwargs) { +__J_attrs.data = __J_data; +var __J_double_click = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "handler")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.dbclick(adapt_arguments(handler)); var __args_16, __kwargs_16; __args_16 = create_array(o); @@ -284,15 +289,15 @@ __kwargs_16 = {}; return get_attribute(J, "__call__")(__args_16, __kwargs_16); } -J.double_click = __J__double_click; -var __J__delay = function(args, kwargs) { +__J_attrs.double_click = __J_double_click; +var __J_delay = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "time", "queue_name")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var time = arguments['time']; var queue_name = arguments['queue_name']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.delay(time, queue_name); var __args_17, __kwargs_17; __args_17 = create_array(o); @@ -300,14 +305,14 @@ __kwargs_17 = {}; return get_attribute(J, "__call__")(__args_17, __kwargs_17); } -J.delay = __J__delay; -var __J__dequeue = function(args, kwargs) { +__J_attrs.delay = __J_delay; +var __J_dequeue = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "queue_name")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var queue_name = arguments['queue_name']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.dequeue(queue_name); var __args_18, __kwargs_18; __args_18 = create_array(o); @@ -315,14 +320,14 @@ __kwargs_18 = {}; return get_attribute(J, "__call__")(__args_18, __kwargs_18); } -J.dequeue = __J__dequeue; -var __J__detach = function(args, kwargs) { +__J_attrs.dequeue = __J_dequeue; +var __J_detach = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "selector")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var selector = arguments['selector']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.detach(selector); var __args_19, __kwargs_19; __args_19 = create_array(o); @@ -330,14 +335,14 @@ __kwargs_19 = {}; return get_attribute(J, "__call__")(__args_19, __kwargs_19); } -J.detach = __J__detach; -var __J__each = function(args, kwargs) { +__J_attrs.detach = __J_detach; +var __J_each = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "handler")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.each(adapt_arguments(handler)); var __args_20, __kwargs_20; __args_20 = create_array(o); @@ -345,14 +350,14 @@ __kwargs_20 = {}; return get_attribute(J, "__call__")(__args_20, __kwargs_20); } -J.each = __J__each; -var __J__end = function(args, kwargs) { +__J_attrs.each = __J_each; +var __J_end = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "handler")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.end(handler); var __args_21, __kwargs_21; __args_21 = create_array(o); @@ -360,14 +365,14 @@ __kwargs_21 = {}; return get_attribute(J, "__call__")(__args_21, __kwargs_21); } -J.end = __J__end; -var __J__eq = function(args, kwargs) { +__J_attrs.end = __J_end; +var __J_eq = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "index")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var index = arguments['index']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.eq(index); var __args_22, __kwargs_22; __args_22 = create_array(o); @@ -375,14 +380,14 @@ __kwargs_22 = {}; return get_attribute(J, "__call__")(__args_22, __kwargs_22); } -J.eq = __J__eq; -var __J__error = function(args, kwargs) { +__J_attrs.eq = __J_eq; +var __J_error = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "handler")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.error(adapt_arguments(handler)); var __args_23, __kwargs_23; __args_23 = create_array(o); @@ -390,15 +395,15 @@ __kwargs_23 = {}; return get_attribute(J, "__call__")(__args_23, __kwargs_23); } -J.error = __J__error; -var __J__fade_in = function(args, kwargs) { +__J_attrs.error = __J_error; +var __J_fade_in = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "duration", "complete")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var duration = arguments['duration']; var complete = arguments['complete']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.fadeIn(duration, complete); var __args_24, __kwargs_24; __args_24 = create_array(o); @@ -406,15 +411,15 @@ __kwargs_24 = {}; return get_attribute(J, "__call__")(__args_24, __kwargs_24); } -J.fade_in = __J__fade_in; -var __J__fade_out = function(args, kwargs) { +__J_attrs.fade_in = __J_fade_in; +var __J_fade_out = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "duration", "complete")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var duration = arguments['duration']; var complete = arguments['complete']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.fadeOut(duration, adapt_arguments(complete)); var __args_25, __kwargs_25; __args_25 = create_array(o); @@ -422,8 +427,8 @@ __kwargs_25 = {}; return get_attribute(J, "__call__")(__args_25, __kwargs_25); } -J.fade_out = __J__fade_out; -var __J__fadeTo = function(args, kwargs) { +__J_attrs.fade_out = __J_fade_out; +var __J_fadeTo = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "duration", "opacity", "complete")}; arguments = get_arguments(signature, args, kwargs); @@ -431,7 +436,7 @@ var self = arguments['self']; var duration = arguments['duration']; var opacity = arguments['opacity']; var complete = arguments['complete']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.fade_to(duration, opacity, adapt_arguments(complete)); var __args_26, __kwargs_26; __args_26 = create_array(o); @@ -439,8 +444,8 @@ __kwargs_26 = {}; return get_attribute(J, "__call__")(__args_26, __kwargs_26); } -J.fadeTo = __J__fadeTo; -var __J__fade_toggle = function(args, kwargs) { +__J_attrs.fadeTo = __J_fadeTo; +var __J_fade_toggle = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "duration", "easing", "complete")}; arguments = get_arguments(signature, args, kwargs); @@ -448,7 +453,7 @@ var self = arguments['self']; var duration = arguments['duration']; var easing = arguments['easing']; var complete = arguments['complete']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.fade_toggle(duration, easing, complete); var __args_27, __kwargs_27; __args_27 = create_array(o); @@ -456,14 +461,14 @@ __kwargs_27 = {}; return get_attribute(J, "__call__")(__args_27, __kwargs_27); } -J.fade_toggle = __J__fade_toggle; -var __J__filter = function(args, kwargs) { +__J_attrs.fade_toggle = __J_fade_toggle; +var __J_filter = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "selector")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var selector = arguments['selector']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.filter(selector); var __args_28, __kwargs_28; __args_28 = create_array(o); @@ -471,14 +476,14 @@ __kwargs_28 = {}; return get_attribute(J, "__call__")(__args_28, __kwargs_28); } -J.filter = __J__filter; -var __J__finish = function(args, kwargs) { +__J_attrs.filter = __J_filter; +var __J_finish = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "queue")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var queue = arguments['queue']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.finish(queue); var __args_29, __kwargs_29; __args_29 = create_array(o); @@ -486,13 +491,13 @@ __kwargs_29 = {}; return get_attribute(J, "__call__")(__args_29, __kwargs_29); } -J.finish = __J__finish; -var __J__first = function(args, kwargs) { +__J_attrs.finish = __J_finish; +var __J_first = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.first(); var __args_30, __kwargs_30; __args_30 = create_array(o); @@ -500,14 +505,14 @@ __kwargs_30 = {}; return get_attribute(J, "__call__")(__args_30, __kwargs_30); } -J.first = __J__first; -var __J__focus = function(args, kwargs) { +__J_attrs.first = __J_first; +var __J_focus = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "handler")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.focus(adapt_arguments(handler)); var __args_31, __kwargs_31; __args_31 = create_array(o); @@ -515,14 +520,14 @@ __kwargs_31 = {}; return get_attribute(J, "__call__")(__args_31, __kwargs_31); } -J.focus = __J__focus; -var __J__focus_in = function(args, kwargs) { +__J_attrs.focus = __J_focus; +var __J_focus_in = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "handler")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.focusIn(adapt_arguments(handler)); var __args_32, __kwargs_32; __args_32 = create_array(o); @@ -530,14 +535,14 @@ __kwargs_32 = {}; return get_attribute(J, "__call__")(__args_32, __kwargs_32); } -J.focus_in = __J__focus_in; -var __J__focus_out = function(args, kwargs) { +__J_attrs.focus_in = __J_focus_in; +var __J_focus_out = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "handler")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.focusOut(adapt_arguments(handler)); var __args_33, __kwargs_33; __args_33 = create_array(o); @@ -545,14 +550,14 @@ __kwargs_33 = {}; return get_attribute(J, "__call__")(__args_33, __kwargs_33); } -J.focus_out = __J__focus_out; -var __J__get = function(args, kwargs) { +__J_attrs.focus_out = __J_focus_out; +var __J_get = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "index")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var index = arguments['index']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.get(index); var __args_34, __kwargs_34; __args_34 = create_array(o); @@ -560,14 +565,14 @@ __kwargs_34 = {}; return get_attribute(J, "__call__")(__args_34, __kwargs_34); } -J.get = __J__get; -var __J__has_class = function(args, kwargs) { +__J_attrs.get = __J_get; +var __J_has_class = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "name")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var name = arguments['name']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.has_class(selector); var __args_35, __kwargs_35; __args_35 = create_array(o); @@ -575,14 +580,14 @@ __kwargs_35 = {}; return get_attribute(J, "__call__")(__args_35, __kwargs_35); } -J.has_class = __J__has_class; -var __J__height = function(args, kwargs) { +__J_attrs.has_class = __J_has_class; +var __J_height = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "value")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var value = arguments['value']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.height(value); var __args_36, __kwargs_36; __args_36 = create_array(o); @@ -590,15 +595,15 @@ __kwargs_36 = {}; return get_attribute(J, "__call__")(__args_36, __kwargs_36); } -J.height = __J__height; -var __J__hide = function(args, kwargs) { +__J_attrs.height = __J_height; +var __J_hide = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "duration", "complete")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var duration = arguments['duration']; var complete = arguments['complete']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.hide(duration, complete); var __args_37, __kwargs_37; __args_37 = create_array(o); @@ -606,14 +611,14 @@ __kwargs_37 = {}; return get_attribute(J, "__call__")(__args_37, __kwargs_37); } -J.hide = __J__hide; -var __J__hover = function(args, kwargs) { +__J_attrs.hide = __J_hide; +var __J_hover = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "handler")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.hover(adapt_arguments(handler)); var __args_38, __kwargs_38; __args_38 = create_array(o); @@ -621,27 +626,32 @@ __kwargs_38 = {}; return get_attribute(J, "__call__")(__args_38, __kwargs_38); } -J.hover = __J__hover; -var __J__html = function(args, kwargs) { +__J_attrs.hover = __J_hover; +var __J_html = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "value")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var value = arguments['value']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); +if(value != undefined) { o = j.html(value); +} +else { o = j.html(); +} + return o; } -J.html = __J__html; -var __J__index = function(args, kwargs) { +__J_attrs.html = __J_html; +var __J_index = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "selector")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var selector = arguments['selector']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.index(selector); var __args_39, __kwargs_39; __args_39 = create_array(o); @@ -649,13 +659,13 @@ __kwargs_39 = {}; return get_attribute(J, "__call__")(__args_39, __kwargs_39); } -J.index = __J__index; -var __J__inner_height = function(args, kwargs) { +__J_attrs.index = __J_index; +var __J_inner_height = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.innerHeight(); var __args_40, __kwargs_40; __args_40 = create_array(o); @@ -663,13 +673,13 @@ __kwargs_40 = {}; return get_attribute(J, "__call__")(__args_40, __kwargs_40); } -J.inner_height = __J__inner_height; -var __J__inner_width = function(args, kwargs) { +__J_attrs.inner_height = __J_inner_height; +var __J_inner_width = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.innerWidth(); var __args_41, __kwargs_41; __args_41 = create_array(o); @@ -677,14 +687,14 @@ __kwargs_41 = {}; return get_attribute(J, "__call__")(__args_41, __kwargs_41); } -J.inner_width = __J__inner_width; -var __J__insert_after = function(args, kwargs) { +__J_attrs.inner_width = __J_inner_width; +var __J_insert_after = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "target")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var target = arguments['target']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.insertAfter(target); var __args_42, __kwargs_42; __args_42 = create_array(o); @@ -692,14 +702,14 @@ __kwargs_42 = {}; return get_attribute(J, "__call__")(__args_42, __kwargs_42); } -J.insert_after = __J__insert_after; -var __J__insert_before = function(args, kwargs) { +__J_attrs.insert_after = __J_insert_after; +var __J_insert_before = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "target")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var target = arguments['target']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.insertBefore(selector); var __args_43, __kwargs_43; __args_43 = create_array(o); @@ -707,14 +717,14 @@ __kwargs_43 = {}; return get_attribute(J, "__call__")(__args_43, __kwargs_43); } -J.insert_before = __J__insert_before; -var __J__is_ = function(args, kwargs) { +__J_attrs.insert_before = __J_insert_before; +var __J_is_ = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "name")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var name = arguments['name']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.is(selector); var __args_44, __kwargs_44; __args_44 = create_array(o); @@ -722,14 +732,14 @@ __kwargs_44 = {}; return get_attribute(J, "__call__")(__args_44, __kwargs_44); } -J.is_ = __J__is_; -var __J__keydown = function(args, kwargs) { +__J_attrs.is_ = __J_is_; +var __J_keydown = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "handler")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.keydown(adapt_arguments(handler)); var __args_45, __kwargs_45; __args_45 = create_array(o); @@ -737,14 +747,14 @@ __kwargs_45 = {}; return get_attribute(J, "__call__")(__args_45, __kwargs_45); } -J.keydown = __J__keydown; -var __J__keypress = function(args, kwargs) { +__J_attrs.keydown = __J_keydown; +var __J_keypress = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "handler")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.keypress(adapt_arguments(handler)); var __args_46, __kwargs_46; __args_46 = create_array(o); @@ -752,14 +762,14 @@ __kwargs_46 = {}; return get_attribute(J, "__call__")(__args_46, __kwargs_46); } -J.keypress = __J__keypress; -var __J__keyup = function(args, kwargs) { +__J_attrs.keypress = __J_keypress; +var __J_keyup = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "handler")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.keyup(adapt_arguments(handler)); var __args_47, __kwargs_47; __args_47 = create_array(o); @@ -767,14 +777,14 @@ __kwargs_47 = {}; return get_attribute(J, "__call__")(__args_47, __kwargs_47); } -J.keyup = __J__keyup; -var __J__last = function(args, kwargs) { +__J_attrs.keyup = __J_keyup; +var __J_last = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "handler")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.last(adapt_arguments(handler)); var __args_48, __kwargs_48; __args_48 = create_array(o); @@ -782,15 +792,15 @@ __kwargs_48 = {}; return get_attribute(J, "__call__")(__args_48, __kwargs_48); } -J.last = __J__last; -var __J__on = function(args, kwargs) { +__J_attrs.last = __J_last; +var __J_on = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "event", "handler")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var event = arguments['event']; var handler = arguments['handler']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.on(event, adapt_arguments(handler)); var __args_49, __kwargs_49; __args_49 = create_array(o); @@ -798,8 +808,8 @@ __kwargs_49 = {}; return get_attribute(J, "__call__")(__args_49, __kwargs_49); } -J.on = __J__on; -var __J__load = function(args, kwargs) { +__J_attrs.on = __J_on; +var __J_load = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "url", "data", "complete")}; arguments = get_arguments(signature, args, kwargs); @@ -807,7 +817,7 @@ var self = arguments['self']; var url = arguments['url']; var data = arguments['data']; var complete = arguments['complete']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.load(url, data, complete); var __args_50, __kwargs_50; __args_50 = create_array(o); @@ -815,14 +825,14 @@ __kwargs_50 = {}; return get_attribute(J, "__call__")(__args_50, __kwargs_50); } -J.load = __J__load; -var __J__select = function(args, kwargs) { +__J_attrs.load = __J_load; +var __J_select = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "handler")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.select(adapt_arguments(handler)); var __args_51, __kwargs_51; __args_51 = create_array(o); @@ -830,15 +840,15 @@ __kwargs_51 = {}; return get_attribute(J, "__call__")(__args_51, __kwargs_51); } -J.select = __J__select; -var __J__show = function(args, kwargs) { +__J_attrs.select = __J_select; +var __J_show = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "duration", "complete")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var duration = arguments['duration']; var complete = arguments['complete']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.show(duration, complete); var __args_52, __kwargs_52; __args_52 = create_array(o); @@ -846,14 +856,14 @@ __kwargs_52 = {}; return get_attribute(J, "__call__")(__args_52, __kwargs_52); } -J.show = __J__show; -var __J__siblings = function(args, kwargs) { +__J_attrs.show = __J_show; +var __J_siblings = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "selector")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var selector = arguments['selector']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.select(adapt_arguments(handler)); var __args_53, __kwargs_53; __args_53 = create_array(o); @@ -861,13 +871,13 @@ __kwargs_53 = {}; return get_attribute(J, "__call__")(__args_53, __kwargs_53); } -J.siblings = __J__siblings; -var __J__size = function(args, kwargs) { +__J_attrs.siblings = __J_siblings; +var __J_size = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.size(); var __args_54, __kwargs_54; __args_54 = create_array(o); @@ -875,15 +885,15 @@ __kwargs_54 = {}; return get_attribute(J, "__call__")(__args_54, __kwargs_54); } -J.size = __J__size; -var __J__slice = function(args, kwargs) { +__J_attrs.size = __J_size; +var __J_slice = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "start", "end")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var start = arguments['start']; var end = arguments['end']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.slice(start, end); var __args_55, __kwargs_55; __args_55 = create_array(o); @@ -891,15 +901,15 @@ __kwargs_55 = {}; return get_attribute(J, "__call__")(__args_55, __kwargs_55); } -J.slice = __J__slice; -var __J__slide_down = function(args, kwargs) { +__J_attrs.slice = __J_slice; +var __J_slide_down = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "duration", "complete")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var duration = arguments['duration']; var complete = arguments['complete']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.slideDown(duration, adapt_arguments(complete)); var __args_56, __kwargs_56; __args_56 = create_array(o); @@ -907,15 +917,15 @@ __kwargs_56 = {}; return get_attribute(J, "__call__")(__args_56, __kwargs_56); } -J.slide_down = __J__slide_down; -var __J__slide_toggle = function(args, kwargs) { +__J_attrs.slide_down = __J_slide_down; +var __J_slide_toggle = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "duration", "complete")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var duration = arguments['duration']; var complete = arguments['complete']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.slideToggle(duration, adapt_arguments(complete)); var __args_57, __kwargs_57; __args_57 = create_array(o); @@ -923,15 +933,15 @@ __kwargs_57 = {}; return get_attribute(J, "__call__")(__args_57, __kwargs_57); } -J.slide_toggle = __J__slide_toggle; -var __J__slide_up = function(args, kwargs) { +__J_attrs.slide_toggle = __J_slide_toggle; +var __J_slide_up = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "duration", "complete")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var duration = arguments['duration']; var complete = arguments['complete']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.slideUp(duration, adapt_arguments(complete)); var __args_58, __kwargs_58; __args_58 = create_array(o); @@ -939,15 +949,15 @@ __kwargs_58 = {}; return get_attribute(J, "__call__")(__args_58, __kwargs_58); } -J.slide_up = __J__slide_up; -var __J__stop = function(args, kwargs) { +__J_attrs.slide_up = __J_slide_up; +var __J_stop = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "clear_queue", "jump_to_end")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var clear_queue = arguments['clear_queue']; var jump_to_end = arguments['jump_to_end']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.stop(clear_queue, jump_to_end); var __args_59, __kwargs_59; __args_59 = create_array(o); @@ -955,15 +965,15 @@ __kwargs_59 = {}; return get_attribute(J, "__call__")(__args_59, __kwargs_59); } -J.stop = __J__stop; -var __J__submit = function(args, kwargs) { +__J_attrs.stop = __J_stop; +var __J_submit = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "clear_queue", "jump_to_end")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var clear_queue = arguments['clear_queue']; var jump_to_end = arguments['jump_to_end']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.submit(clear_queue, jump_to_end); var __args_60, __kwargs_60; __args_60 = create_array(o); @@ -971,14 +981,14 @@ __kwargs_60 = {}; return get_attribute(J, "__call__")(__args_60, __kwargs_60); } -J.submit = __J__submit; -var __J__text = function(args, kwargs) { +__J_attrs.submit = __J_submit; +var __J_text = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "text")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var text = arguments['text']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.text(text); var __args_61, __kwargs_61; __args_61 = create_array(o); @@ -986,15 +996,15 @@ __kwargs_61 = {}; return get_attribute(J, "__call__")(__args_61, __kwargs_61); } -J.text = __J__text; -var __J__toggle = function(args, kwargs) { +__J_attrs.text = __J_text; +var __J_toggle = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "duration", "complete")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var duration = arguments['duration']; var complete = arguments['complete']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.toggle(duration, complete); var __args_62, __kwargs_62; __args_62 = create_array(o); @@ -1002,14 +1012,14 @@ __kwargs_62 = {}; return get_attribute(J, "__call__")(__args_62, __kwargs_62); } -J.toggle = __J__toggle; -var __J__toggle_class = function(args, kwargs) { +__J_attrs.toggle = __J_toggle; +var __J_toggle_class = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "class_name")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var class_name = arguments['class_name']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.toggleClass(class_name); var __args_63, __kwargs_63; __args_63 = create_array(o); @@ -1017,14 +1027,14 @@ __kwargs_63 = {}; return get_attribute(J, "__call__")(__args_63, __kwargs_63); } -J.toggle_class = __J__toggle_class; -var __J__trigger = function(args, kwargs) { +__J_attrs.toggle_class = __J_toggle_class; +var __J_trigger = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "event")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var event = arguments['event']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.trigger(event); var __args_64, __kwargs_64; __args_64 = create_array(o); @@ -1032,15 +1042,15 @@ __kwargs_64 = {}; return get_attribute(J, "__call__")(__args_64, __kwargs_64); } -J.trigger = __J__trigger; -var __J__unbind = function(args, kwargs) { +__J_attrs.trigger = __J_trigger; +var __J_unbind = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "event", "handler")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var event = arguments['event']; var handler = arguments['handler']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.unbind(event, adapt_arguments(handler)); var __args_65, __kwargs_65; __args_65 = create_array(o); @@ -1048,14 +1058,14 @@ __kwargs_65 = {}; return get_attribute(J, "__call__")(__args_65, __kwargs_65); } -J.unbind = __J__unbind; -var __J__value = function(args, kwargs) { +__J_attrs.unbind = __J_unbind; +var __J_value = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "value")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var value = arguments['value']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.val(value); var __args_66, __kwargs_66; __args_66 = create_array(o); @@ -1063,14 +1073,14 @@ __kwargs_66 = {}; return get_attribute(J, "__call__")(__args_66, __kwargs_66); } -J.value = __J__value; -var __J__width = function(args, kwargs) { +__J_attrs.value = __J_value; +var __J_width = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "value")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var value = arguments['value']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.width(value); var __args_67, __kwargs_67; __args_67 = create_array(o); @@ -1078,24 +1088,24 @@ __kwargs_67 = {}; return get_attribute(J, "__call__")(__args_67, __kwargs_67); } -J.width = __J__width; -var __J__length = function(args, kwargs) { +__J_attrs.width = __J_width; +var __J_length = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); return j.length(); } -J.length = __J__length; -var __J__map = function(args, kwargs) { +__J_attrs.length = __J_length; +var __J_map = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "func")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var func = arguments['func']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.map(func); var __args_68, __kwargs_68; __args_68 = create_array(o); @@ -1103,14 +1113,14 @@ __kwargs_68 = {}; return get_attribute(J, "__call__")(__args_68, __kwargs_68); } -J.map = __J__map; -var __J__mousedown = function(args, kwargs) { +__J_attrs.map = __J_map; +var __J_mousedown = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "handler")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.mousedown(adapt_arguments(handler)); var __args_69, __kwargs_69; __args_69 = create_array(o); @@ -1118,14 +1128,14 @@ __kwargs_69 = {}; return get_attribute(J, "__call__")(__args_69, __kwargs_69); } -J.mousedown = __J__mousedown; -var __J__mouseenter = function(args, kwargs) { +__J_attrs.mousedown = __J_mousedown; +var __J_mouseenter = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "handler")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.mouseenter(adapt_arguments(handler)); var __args_70, __kwargs_70; __args_70 = create_array(o); @@ -1133,14 +1143,14 @@ __kwargs_70 = {}; return get_attribute(J, "__call__")(__args_70, __kwargs_70); } -J.mouseenter = __J__mouseenter; -var __J__mouseleave = function(args, kwargs) { +__J_attrs.mouseenter = __J_mouseenter; +var __J_mouseleave = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "handler")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.mouseleave(adapt_arguments(handler)); var __args_71, __kwargs_71; __args_71 = create_array(o); @@ -1148,14 +1158,14 @@ __kwargs_71 = {}; return get_attribute(J, "__call__")(__args_71, __kwargs_71); } -J.mouseleave = __J__mouseleave; -var __J__mousemove = function(args, kwargs) { +__J_attrs.mouseleave = __J_mouseleave; +var __J_mousemove = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "handler")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.mousemove(adapt_arguments(handler)); var __args_72, __kwargs_72; __args_72 = create_array(o); @@ -1163,14 +1173,14 @@ __kwargs_72 = {}; return get_attribute(J, "__call__")(__args_72, __kwargs_72); } -J.mousemove = __J__mousemove; -var __J__mouseout = function(args, kwargs) { +__J_attrs.mousemove = __J_mousemove; +var __J_mouseout = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "handler")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.mouseout(adapt_arguments(handler)); var __args_73, __kwargs_73; __args_73 = create_array(o); @@ -1178,14 +1188,14 @@ __kwargs_73 = {}; return get_attribute(J, "__call__")(__args_73, __kwargs_73); } -J.mouseout = __J__mouseout; -var __J__mouseover = function(args, kwargs) { +__J_attrs.mouseout = __J_mouseout; +var __J_mouseover = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "handler")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.mouseover(adapt_arguments(handler)); var __args_74, __kwargs_74; __args_74 = create_array(o); @@ -1193,14 +1203,14 @@ __kwargs_74 = {}; return get_attribute(J, "__call__")(__args_74, __kwargs_74); } -J.mouseover = __J__mouseover; -var __J__mouseup = function(args, kwargs) { +__J_attrs.mouseover = __J_mouseover; +var __J_mouseup = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "handler")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; -j = get_attribute(self, j); +j = get_attribute(self, "j"); o = j.mouseup(adapt_arguments(handler)); var __args_75, __kwargs_75; __args_75 = create_array(o); @@ -1208,8 +1218,8 @@ __kwargs_75 = {}; return get_attribute(J, "__call__")(__args_75, __kwargs_75); } -J.mouseup = __J__mouseup; -J = create_class("J", __J_parents, __J__attrs); +__J_attrs.mouseup = __J_mouseup; +J = create_class("J", __J_parents, __J_attrs); var ajax = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("url", "settings")}; diff --git a/pythonscript.js b/pythonscript.js index afb0fa0..f8ce0f6 100644 --- a/pythonscript.js +++ b/pythonscript.js @@ -256,6 +256,14 @@ object[attribute] = value; } var get_arguments = function(signature, args, kwargs) { +if(args === undefined) { +args = create_array(); +} + +if(kwargs === undefined) { +kwargs = {}; +} + out = {}; if(signature.args.length) { argslength = signature.args.length; @@ -365,25 +373,26 @@ var signature, arguments; signature = {"kwargs": {}, "args": create_array("num")}; arguments = get_arguments(signature, args, kwargs); var num = arguments['num']; -var i; -var r; +var i, r; i = 0; var __args_0, __kwargs_0; __args_0 = create_array(); __kwargs_0 = {}; r = get_attribute(list, "__call__")(__args_0, __kwargs_0); +while(i < num) { var __args_1, __kwargs_1; __args_1 = create_array(i); __kwargs_1 = {}; -get_attribute(get_attribute(r, append), "__call__")(__args_1, __kwargs_1); +get_attribute(get_attribute(r, "append"), "__call__")(__args_1, __kwargs_1); i = i + 1; +} return r; } var StopIteration, __StopIteration_attrs, __StopIteration_parents; __StopIteration_attrs = {}; __StopIteration_parents = create_array(); -StopIteration = create_class("StopIteration", __StopIteration_parents, __StopIteration__attrs); +StopIteration = create_class("StopIteration", __StopIteration_parents, __StopIteration_attrs); var len = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("obj")}; @@ -392,7 +401,7 @@ var obj = arguments['obj']; var __args_2, __kwargs_2; __args_2 = create_array(); __kwargs_2 = {}; -return get_attribute(get_attribute(obj, __len__), "__call__")(__args_2, __kwargs_2); +return get_attribute(get_attribute(obj, "__len__"), "__call__")(__args_2, __kwargs_2); } var next = function(args, kwargs) { @@ -403,7 +412,7 @@ var obj = arguments['obj']; var __args_3, __kwargs_3; __args_3 = create_array(); __kwargs_3 = {}; -return get_attribute(get_attribute(obj, next), "__call__")(__args_3, __kwargs_3); +return get_attribute(get_attribute(obj, "next"), "__call__")(__args_3, __kwargs_3); } var map = function(args, kwargs) { @@ -417,94 +426,103 @@ __args_4 = create_array(); __kwargs_4 = {}; out = get_attribute(list, "__call__")(__args_4, __kwargs_4); var __args_5, __kwargs_5; -__args_5 = create_array(func, get_attribute(objs, js_object)); +__args_5 = create_array(func, get_attribute(objs, "js_object")); __kwargs_5 = {}; -set_attribute(out, js_object, get_attribute(map, "__call__")(__args_5, __kwargs_5)); +set_attribute(out, "js_object", get_attribute(map, "__call__")(__args_5, __kwargs_5)); return out; } var Iterator, __Iterator_attrs, __Iterator_parents; __Iterator_attrs = {}; __Iterator_parents = create_array(); -var __Iterator____init__ = function(args, kwargs) { +var __Iterator___init__ = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "obj", "index")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var obj = arguments['obj']; var index = arguments['index']; -set_attribute(self, obj, obj); -set_attribute(self, index, index); +set_attribute(self, "obj", obj); +set_attribute(self, "index", index); } -Iterator.__init__ = __Iterator____init__; -var __Iterator__next = function(args, kwargs) { +__Iterator_attrs.__init__ = __Iterator___init__; +var __Iterator_next = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; -index = get_attribute(self, index); +index = get_attribute(self, "index"); var __args_6, __kwargs_6; -__args_6 = create_array(get_attribute(self, obj)); +__args_6 = create_array(get_attribute(self, "obj")); __kwargs_6 = {}; length = get_attribute(len, "__call__")(__args_6, __kwargs_6); +if(index == length) { +throw StopIteration; +} + var __args_7, __kwargs_7; -__args_7 = create_array(get_attribute(self, index)); +__args_7 = create_array(get_attribute(self, "index")); __kwargs_7 = {}; -item = get_attribute(get_attribute(get_attribute(self, obj), get), "__call__")(__args_7, __kwargs_7); -set_attribute(self, index, get_attribute(self, index) + 1); +item = get_attribute(get_attribute(get_attribute(self, "obj"), "get"), "__call__")(__args_7, __kwargs_7); +set_attribute(self, "index", get_attribute(self, "index") + 1); return item; } -Iterator.next = __Iterator__next; -Iterator = create_class("Iterator", __Iterator_parents, __Iterator__attrs); +__Iterator_attrs.next = __Iterator_next; +Iterator = create_class("Iterator", __Iterator_parents, __Iterator_attrs); var list, __list_attrs, __list_parents; __list_attrs = {}; __list_parents = create_array(); -var __list____init__ = function(args, kwargs) { +var __list___init__ = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {"js_object": undefined}, "args": create_array("self", "js_object")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var js_object = arguments['js_object']; -set_attribute(self, js_object, js_object); -set_attribute(self, js_object, create_array()); +if(js_object) { +set_attribute(self, "js_object", js_object); +} +else { +set_attribute(self, "js_object", create_array()); } -list.__init__ = __list____init__; -var __list__append = function(args, kwargs) { +} + +__list_attrs.__init__ = __list___init__; +var __list_append = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "obj")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var obj = arguments['obj']; var __array; -__array = get_attribute(self, js_object); +__array = get_attribute(self, "js_object"); __array.push(obj); } -list.append = __list__append; -var __list__extend = function(args, kwargs) { +__list_attrs.append = __list_append; +var __list_extend = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "other")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var other = arguments['other']; var __iterator__, obj; -__iterator__ = get_attribute(other, "__iter__"); +__iterator__ = get_attribute(get_attribute(other, "__iter__"), "__call__")(); try { obj = get_attribute(__iterator__, "next")(); while(true) { var __args_8, __kwargs_8; __args_8 = create_array(obj); __kwargs_8 = {}; -get_attribute(get_attribute(self, append), "__call__")(__args_8, __kwargs_8); +get_attribute(get_attribute(self, "append"), "__call__")(__args_8, __kwargs_8); undefined; obj = get_attribute(__iterator__, "next")(); } } catch(__exception__) { -if (__exception__ == StopIteration || isinstance(__exception__, StopIteration)) { +if (__exception__ == StopIteration || isinstance([__exception__, StopIteration])) { } @@ -512,8 +530,8 @@ if (__exception__ == StopIteration || isinstance(__exception__, StopIteration)) } -list.extend = __list__extend; -var __list__insert = function(args, kwargs) { +__list_attrs.extend = __list_extend; +var __list_insert = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "index", "obj")}; arguments = get_arguments(signature, args, kwargs); @@ -521,12 +539,12 @@ var self = arguments['self']; var index = arguments['index']; var obj = arguments['obj']; var __array; -__array = get_attribute(self, js_object); +__array = get_attribute(self, "js_object"); __array.splice(index, 0, obj); } -list.insert = __list__insert; -var __list__remove = function(args, kwargs) { +__list_attrs.insert = __list_insert; +var __list_remove = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "obj")}; arguments = get_arguments(signature, args, kwargs); @@ -536,36 +554,36 @@ var __array; var __args_9, __kwargs_9; __args_9 = create_array(obj); __kwargs_9 = {}; -index = get_attribute(get_attribute(self, index), "__call__")(__args_9, __kwargs_9); -__array = get_attribute(self, js_object); +index = get_attribute(get_attribute(self, "index"), "__call__")(__args_9, __kwargs_9); +__array = get_attribute(self, "js_object"); __array.splice(index, 1); } -list.remove = __list__remove; -var __list__pop = function(args, kwargs) { +__list_attrs.remove = __list_remove; +var __list_pop = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var __array; -__array = get_attribute(self, js_object); +__array = get_attribute(self, "js_object"); return __array.pop(); } -list.pop = __list__pop; -var __list__index = function(args, kwargs) { +__list_attrs.pop = __list_pop; +var __list_index = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "obj")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var obj = arguments['obj']; var __array; -__array = get_attribute(self, js_object); +__array = get_attribute(self, "js_object"); return __array.indexOf(obj); } -list.index = __list__index; -var __list__count = function(args, kwargs) { +__list_attrs.index = __list_index; +var __list_count = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "obj")}; arguments = get_arguments(signature, args, kwargs); @@ -573,17 +591,20 @@ var self = arguments['self']; var obj = arguments['obj']; i = 0; var __iterator__, other; -__iterator__ = get_attribute(self, "__iter__"); +__iterator__ = get_attribute(get_attribute(self, "__iter__"), "__call__")(); try { other = get_attribute(__iterator__, "next")(); while(true) { +if(other == obj) { i = i + 1; +} + undefined; other = get_attribute(__iterator__, "next")(); } } catch(__exception__) { -if (__exception__ == StopIteration || isinstance(__exception__, StopIteration)) { +if (__exception__ == StopIteration || isinstance([__exception__, StopIteration])) { } @@ -592,30 +613,30 @@ if (__exception__ == StopIteration || isinstance(__exception__, StopIteration)) return i; } -list.count = __list__count; -var __list__reverse = function(args, kwargs) { +__list_attrs.count = __list_count; +var __list_reverse = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var __array; -__array = get_attribute(self, js_object); -set_attribute(self, js_object, __array.reverse()); +__array = get_attribute(self, "js_object"); +set_attribute(self, "js_object", __array.reverse()); } -list.reverse = __list__reverse; -var __list__shift = function(args, kwargs) { +__list_attrs.reverse = __list_reverse; +var __list_shift = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var __array; -__array = get_attribute(self, js_object); +__array = get_attribute(self, "js_object"); return __array.shift(); } -list.shift = __list__shift; -var __list__slice = function(args, kwargs) { +__list_attrs.shift = __list_shift; +var __list_slice = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "start", "end")}; arguments = get_arguments(signature, args, kwargs); @@ -623,12 +644,12 @@ var self = arguments['self']; var start = arguments['start']; var end = arguments['end']; var __array; -__array = get_attribute(self, js_object); +__array = get_attribute(self, "js_object"); return __array.slice(start, end); } -list.slice = __list__slice; -var __list____iter__ = function(args, kwargs) { +__list_attrs.slice = __list_slice; +var __list___iter__ = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); @@ -639,20 +660,20 @@ __kwargs_10 = {}; return get_attribute(Iterator, "__call__")(__args_10, __kwargs_10); } -list.__iter__ = __list____iter__; -var __list__get = function(args, kwargs) { +__list_attrs.__iter__ = __list___iter__; +var __list_get = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "index")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var index = arguments['index']; var __array; -__array = get_attribute(self, js_object); +__array = get_attribute(self, "js_object"); return __array[index]; } -list.get = __list__get; -var __list__set = function(args, kwargs) { +__list_attrs.get = __list_get; +var __list_set = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "index", "value")}; arguments = get_arguments(signature, args, kwargs); @@ -660,38 +681,43 @@ var self = arguments['self']; var index = arguments['index']; var value = arguments['value']; var __array; -__array = get_attribute(self, js_object); +__array = get_attribute(self, "js_object"); __array[index] = value; } -list.set = __list__set; -var __list____len__ = function(args, kwargs) { +__list_attrs.set = __list_set; +var __list___len__ = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var __array; -__array = get_attribute(self, js_object); +__array = get_attribute(self, "js_object"); return __array.length; } -list.__len__ = __list____len__; -list = create_class("list", __list_parents, __list__attrs); +__list_attrs.__len__ = __list___len__; +list = create_class("list", __list_parents, __list_attrs); var dict, __dict_attrs, __dict_parents; __dict_attrs = {}; __dict_parents = create_array(); -var __dict____init__ = function(args, kwargs) { +var __dict___init__ = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {"js_object": undefined}, "args": create_array("self", "js_object")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var js_object = arguments['js_object']; -set_attribute(self, js_object, js_object); -set_attribute(self, js_object, {}); +if(js_object) { +set_attribute(self, "js_object", js_object); +} +else { +set_attribute(self, "js_object", {}); +} + } -dict.__init__ = __dict____init__; -var __dict__get = function(args, kwargs) { +__dict_attrs.__init__ = __dict___init__; +var __dict_get = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "key", "d")}; arguments = get_arguments(signature, args, kwargs); @@ -699,13 +725,16 @@ var self = arguments['self']; var key = arguments['key']; var d = arguments['d']; var __dict; -__dict = get_attribute(self, js_object); +__dict = get_attribute(self, "js_object"); +if(__dict[key]) { return __dict[key]; +} + return d; } -dict.get = __dict__get; -var __dict__set = function(args, kwargs) { +__dict_attrs.get = __dict_get; +var __dict_set = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "key", "value")}; arguments = get_arguments(signature, args, kwargs); @@ -713,46 +742,46 @@ var self = arguments['self']; var key = arguments['key']; var value = arguments['value']; var __dict; -__dict = get_attribute(self, js_object); +__dict = get_attribute(self, "js_object"); __dict[key] = value; } -dict.set = __dict__set; -var __dict____len__ = function(args, kwargs) { +__dict_attrs.set = __dict_set; +var __dict___len__ = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var __dict; -__dict = get_attribute(self, js_object); +__dict = get_attribute(self, "js_object"); return Object.keys(__dict).length; } -dict.__len__ = __dict____len__; -var __dict__keys = function(args, kwargs) { +__dict_attrs.__len__ = __dict___len__; +var __dict_keys = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var __dict; -__dict = get_attribute(self, js_object); +__dict = get_attribute(self, "js_object"); __keys = Object.keys(__dict); var out; var __args_11, __kwargs_11; __args_11 = create_array(); __kwargs_11 = {}; out = get_attribute(list, "__call__")(__args_11, __kwargs_11); -set_attribute(out, js_object, __keys); +set_attribute(out, "js_object", __keys); return out; } -dict.keys = __dict__keys; -dict = create_class("dict", __dict_parents, __dict__attrs); +__dict_attrs.keys = __dict_keys; +dict = create_class("dict", __dict_parents, __dict_attrs); var str, __str_attrs, __str_parents; __str_attrs = {}; __str_parents = create_array(); __str_parents.push(list); -var __str____init__ = function(args, kwargs) { +var __str___init__ = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {}, "args": create_array("self", "jsstring")}; arguments = get_arguments(signature, args, kwargs); @@ -761,13 +790,13 @@ var jsstring = arguments['jsstring']; var __args_12, __kwargs_12; __args_12 = create_array(self); __kwargs_12 = {}; -get_attribute(get_attribute(list, __init__), "__call__")(__args_12, __kwargs_12); +get_attribute(get_attribute(list, "__init__"), "__call__")(__args_12, __kwargs_12); var char; var __iterator__, i; var __args_13, __kwargs_13; __args_13 = create_array(jsstring.length); __kwargs_13 = {}; -__iterator__ = get_attribute(get_attribute(range, "__call__")(__args_13, __kwargs_13), "__iter__"); +__iterator__ = get_attribute(get_attribute(get_attribute(range, "__call__")(__args_13, __kwargs_13), "__iter__"), "__call__")(); try { i = get_attribute(__iterator__, "next")(); while(true) { @@ -775,14 +804,14 @@ char = jsstring.charAt(i); var __args_14, __kwargs_14; __args_14 = create_array(char); __kwargs_14 = {}; -get_attribute(get_attribute(self, append), "__call__")(__args_14, __kwargs_14); +get_attribute(get_attribute(self, "append"), "__call__")(__args_14, __kwargs_14); undefined; undefined; i = get_attribute(__iterator__, "next")(); } } catch(__exception__) { -if (__exception__ == StopIteration || isinstance(__exception__, StopIteration)) { +if (__exception__ == StopIteration || isinstance([__exception__, StopIteration])) { } @@ -790,5 +819,5 @@ if (__exception__ == StopIteration || isinstance(__exception__, StopIteration)) } -str.__init__ = __str____init__; -str = create_class("str", __str_parents, __str__attrs); +__str_attrs.__init__ = __str___init__; +str = create_class("str", __str_parents, __str_attrs); diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index 6d7a0bf..c02d802 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -61,15 +61,50 @@ def visit_ClassDef(self, node): for item in node.body: if isinstance(item, FunctionDef): item_name = item.name - item.name = '__%s__%s' % (name, item_name) + item.name = '__%s_%s' % (name, item_name) self.visit(item) # this will output the code for the function - writer.write('%s.%s = %s' % (name, item_name, item.name)) + writer.write('__%s_attrs.%s = %s' % (name, item_name, item.name)) elif isinstance(item, Assign): item_name = item.targets[0].id - item.targets[0].id = '__%s__%s' % (name.id, item_name) + item.targets[0].id = '__%s_%s' % (name.id, item_name) self.visit(item) # this will output the code for the assign - writer.write('%s.%s = %s' % (name, item_name, item.targets[0].id)) - writer.write('%s = create_class("%s", __%s_parents, __%s__attrs)' % (name, name, name, name)) + writer.write('%s_attrs.%s = %s' % (name, item_name, item.targets[0].id)) + writer.write('%s = create_class("%s", __%s_parents, __%s_attrs)' % (name, name, name, name)) + + def visit_If(self, node): + writer.write('if %s:' % self.visit(node.test)) + writer.push() + map(self.visit, node.body) + writer.pull() + if node.orelse: + writer.write('else:') + writer.push() + map(self.visit, node.orelse) + writer.pull() + + def visit_TryExcept(self, node): + writer.write('try:') + writer.push() + map(self.visit, node.body) + writer.pull() + map(self.visit, node.handlers) + + def visit_Raise(self, node): + writer.write('raise %s' % self.visit(node.type)) + + def visit_ExceptHandler(self, node): + if node.type and node.name: + writer.write('except %s, %s:' % (self.visit(node.type), self.visit(node.name))) + elif node.type and not node.name: + writer.write('except %s:' % self.visit(node.type)) + else: + writer.write('except:') + writer.push() + map(self.visit, node.body) + writer.pull() + + def visit_Pass(self, node): + writer.write('pass') def visit_Name(self, node): return node.id @@ -82,9 +117,6 @@ def visit_Return(self, node): return writer.write('return %s' % self.visit(node.value)) return writer.write('return undefined') - def visit_Pass(self, node): - return '' - def visit_BinOp(self, node): left = self.visit(node.left) op = self.visit(node.op) @@ -98,7 +130,7 @@ def visit_NotEq(self, node): return '!=' def visit_Is(self, node): - return '===' + return 'is' def visit_Add(self, node): return '+' @@ -125,18 +157,18 @@ def visit_Compare(self, node): return '%s %s %s' % (left, ops, comparator) def visit_Not(self, node): - return '!' + return ' not ' def visit_UnaryOp(self, node): return self.visit(node.op) + self.visit(node.operand) def visit_Attribute(self, node): - return 'get_attribute(%s, %s)' % (self.visit(node.value), node.attr) + return 'get_attribute(%s, "%s")' % (self.visit(node.value), node.attr) def visit_Assign(self, node): attr = node.targets[0] if isinstance(attr, Attribute): - code = 'set_attribute(%s, %s, %s)' % ( + code = 'set_attribute(%s, "%s", %s)' % ( self.visit(attr.value), attr.attr, self.visit(node.value) @@ -146,7 +178,7 @@ def visit_Assign(self, node): writer.write('%s = %s' % (node.targets[0].id, self.visit(node.value))) def visit_Print(self, node): - writer.write('print %s' % ', '.join(map(self.visit, node.values))) + return 'print %s' % ', '.join(map(self.visit, node.values)) def visit_Str(self, node): return '"%s"' % node.s @@ -227,7 +259,7 @@ def visit_FunctionDef(self, node): expr = expr % (node.args.vararg, node.args.vararg) writer.write(expr) if node.args.kwarg: - writer.write("""var %s = arguments["%s"]""" % (node.args.kwarg, node.args.kwarg)) + writer.write("""JS('var %s = arguments["%s"]')""" % (node.args.kwarg, node.args.kwarg)) expr = '%s = get_attribute(dict, "__call__")(create_array(%s), {});' expr = expr % (node.args.kwarg, node.args.kwarg) writer.write(expr) @@ -241,15 +273,14 @@ def visit_FunctionDef(self, node): def visit_For(self, node): writer.write('var(__iterator__, %s)' % node.target.id) - writer.write('__iterator__ = get_attribute(%s, "__iter__")' % self.visit(node.iter)) - + writer.write('__iterator__ = get_attribute(get_attribute(%s, "__iter__"), "__call__")(JSArray(), JSObject())' % self.visit(node.iter)) writer.write('try:') writer.push() - writer.write('%s = get_attribute(__iterator__, "next")()' % node.target.id) + writer.write('%s = get_attribute(__iterator__, "next")(JSArray(), JSObject())' % node.target.id) writer.write('while True:') writer.push() map(writer.write, map(self.visit, node.body)) - writer.write('%s = get_attribute(__iterator__, "next")()' % node.target.id) + writer.write('%s = get_attribute(__iterator__, "next")(JSArray(), JSObject())' % node.target.id) writer.pull() writer.pull() writer.write('except StopIteration:') @@ -258,6 +289,13 @@ def visit_For(self, node): writer.pull() return '' + def visit_While(self, node): + writer.write('while %s:' % self.visit(node.test)) + writer.push() + map(self.visit, node.body) + writer.pull() + + def main(): input = parse(sys.stdin.read()) tree = parse(input) diff --git a/pythonscript/pythonjs.py b/pythonscript/pythonjs.py index 40bf745..1eb090f 100755 --- a/pythonscript/pythonjs.py +++ b/pythonscript/pythonjs.py @@ -36,7 +36,7 @@ def visit_Raise(self, node): def visit_ExceptHandler(self, node): out = '' if node.type: - out = 'if (__exception__ == %s || isinstance(__exception__, %s)) {\n' % (self.visit(node.type), self.visit(node.type)) + out = 'if (__exception__ == %s || isinstance([__exception__, %s])) {\n' % (self.visit(node.type), self.visit(node.type)) if node.name: out += 'var %s = __exception__;\n' % self.visit(node.name) out += '\n'.join(map(self.visit, node.body)) + '\n' @@ -121,7 +121,7 @@ def visit_Call(self, node): else: if node.args: args = [self.visit(e) for e in node.args] - args = ', '.join(args) + args = ', '.join([e for e in args if e]) else: args = '' return '%s(%s)' % (name, args) diff --git a/runtime/builtins.py b/runtime/builtins.py index 7e1dc76..82e6fed 100644 --- a/runtime/builtins.py +++ b/runtime/builtins.py @@ -1,7 +1,6 @@ def range(num): """Emulates Python's range function""" - JS('var i') - JS('var r') + var(i, r) i = 0 r = list() while i < num: @@ -53,7 +52,7 @@ def __init__(self, js_object=None): self.js_object = JSArray() def append(self, obj): - JS('var __array') + var(__array) __array = self.js_object JS('__array.push(obj)') diff --git a/runtime/pythonpythonjs.py b/runtime/pythonpythonjs.py index 1908e88..2780ca0 100644 --- a/runtime/pythonpythonjs.py +++ b/runtime/pythonpythonjs.py @@ -177,6 +177,10 @@ def get_arguments(signature, args, kwargs): This will set default keyword arguments and retrieve positional arguments in kwargs if their called as such""" + if args is None: + args = JSArray() + if kwargs is None: + kwargs = JSObject() out = JSObject() if signature.args.length: argslength = signature.args.length diff --git a/tests/python-to-js/class.py.js b/tests/python-to-js/class.py.js index b0fee98..d9a4baa 100644 --- a/tests/python-to-js/class.py.js +++ b/tests/python-to-js/class.py.js @@ -1,20 +1,44 @@ -A = {}; -parents = create_array(); -parents.push(B, C); -var A__METHOD = function(args, kwargs) { - var signature = {"kwargs": {"d": 4, "e": 5}, "args": create_array("self", "a", "b", "c", "d", "e")}; - var arguments = get_arguments(signature, args, kwargs); - var self = arguments["self"]; - var a = arguments["a"]; - var b = arguments["b"]; - var c = arguments["c"]; - var d = arguments["d"]; - var e = arguments["e"]; - return a + b + c + d + e; +['B'] +['C'] +['signature', 'args', 'kwargs'] +['"A"', '__A_parents', '__A_attrs'] +['A', '"__call__"'] +['__args_0', '__kwargs_0'] +['a', '"METHOD"'] +['get_attribute(a, "METHOD")', '"__call__"'] +['__args_1', '__kwargs_1'] +['a', '"METHOD"'] +['get_attribute(a, "METHOD")', '"__call__"'] +['__args_2', '__kwargs_2'] +var A, __A_attrs, __A_parents; +__A_attrs = {}; +__A_parents = create_array(); +__A_parents.push(B); +__A_parents.push(C); +var __A_METHOD = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {"d": 4, "e": 5}, "args": create_array("self", "a", "b", "c", "d", "e")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var a = arguments['a']; +var b = arguments['b']; +var c = arguments['c']; +var d = arguments['d']; +var e = arguments['e']; +return a + b + c + d + e; } -A.METHOD = A__METHOD; -A = create_class("A", parents, A); -a = get_attribute(A, "__call__")(create_array(), {}); -console.log(get_attribute(get_attribute(a, "METHOD"), "__call__")(create_array(1, 2, 3), {})); -console.log(get_attribute(get_attribute(a, "METHOD"), "__call__")(create_array(1, 2, 3, 6, 7), {})); +__A_attrs.METHOD = __A_METHOD; +A = create_class("A", __A_parents, __A_attrs); +var __args_0, __kwargs_0; +__args_0 = create_array(); +__kwargs_0 = {}; +a = get_attribute(A, "__call__")(__args_0, __kwargs_0); +var __args_1, __kwargs_1; +__args_1 = create_array(1, 2, 3); +__kwargs_1 = {}; +console.log(get_attribute(get_attribute(a, "METHOD"), "__call__")(__args_1, __kwargs_1)); +var __args_2, __kwargs_2; +__args_2 = create_array(1, 2, 3, 6, 7); +__kwargs_2 = {}; +console.log(get_attribute(get_attribute(a, "METHOD"), "__call__")(__args_2, __kwargs_2)); diff --git a/tests/python-to-js/comparaisons.py.js b/tests/python-to-js/comparaisons.py.js index e9424e3..1f06e32 100644 --- a/tests/python-to-js/comparaisons.py.js +++ b/tests/python-to-js/comparaisons.py.js @@ -5,4 +5,4 @@ console.log(1 < 2); console.log(2 > 1); console.log(1 >= 1); console.log(2 <= 2); -console.log(!true); +console.log(notTrue); diff --git a/tests/python-to-js/function.py b/tests/python-to-js/function.py index f2afab9..8b13789 100644 --- a/tests/python-to-js/function.py +++ b/tests/python-to-js/function.py @@ -1,4 +1 @@ -def function(a, b, c, d, e=5, f=6): - return a + b + c + d + e + f -print function(1, 2, 3, 4) -print function(1, 2, 3, 4, 7, 8) + diff --git a/tests/python-to-js/ifelse.py.js b/tests/python-to-js/ifelse.py.js index 6c3486d..8479436 100644 --- a/tests/python-to-js/ifelse.py.js +++ b/tests/python-to-js/ifelse.py.js @@ -1,5 +1,5 @@ a = 1; -if(!a) { +if(nota) { console.log(false); } else { diff --git a/tests/python-to-js/tests.py b/tests/python-to-js/tests.py index 3f22694..cc85c02 100644 --- a/tests/python-to-js/tests.py +++ b/tests/python-to-js/tests.py @@ -1,15 +1,21 @@ -class A(B,C): +class B: pass -a.b = c.d -JS('var a = new Object()') -var(object, args, str) +class C: + pass + + +class A(B, C): + pass + + +var(a, object, args, str) +JS('a = new Object()') object = JSObject(spam=7, egg=8) args = JSArray(5, 6) str = toString(egg) -# function(1, 2, 3, 4, *args, **kwargs) @deco_a @deco_b @@ -20,3 +26,6 @@ def function(a, b, c=3, d=4, *args, **kwargs): for arg in args: print args print kwargs + + +function(1, 2, 3, 4, *args, **kwargs) diff --git a/tests/python-to-js/tryexcept.py.js b/tests/python-to-js/tryexcept.py.js index 8d83e45..71772b5 100644 --- a/tests/python-to-js/tryexcept.py.js +++ b/tests/python-to-js/tryexcept.py.js @@ -3,5 +3,6 @@ anything; } catch(__exception__) { console.log(true); + } diff --git a/tests/python-to-js/tryexceptnamed.py.js b/tests/python-to-js/tryexceptnamed.py.js index 3cae6d2..c5b1507 100644 --- a/tests/python-to-js/tryexceptnamed.py.js +++ b/tests/python-to-js/tryexceptnamed.py.js @@ -1,10 +1,10 @@ var Exception; Exception = {}; try { -throw Exception; +foo; } catch(__exception__) { -if (__exception__ == Exception || isinstance(__exception__, Exception)) { +if (__exception__ == Exception || isinstance([__exception__, Exception])) { var babar = __exception__; console.log(true); } diff --git a/tests/python-to-js/tryexcepttyped.py.js b/tests/python-to-js/tryexcepttyped.py.js index e5506e5..6ce07df 100644 --- a/tests/python-to-js/tryexcepttyped.py.js +++ b/tests/python-to-js/tryexcepttyped.py.js @@ -4,7 +4,7 @@ try { throw Exception; } catch(__exception__) { -if (__exception__ == Exception || isinstance(__exception__, Exception)) { +if (__exception__ == Exception || isinstance([__exception__, Exception])) { console.log(true); } diff --git a/tests/python-to-js/tryexcepttypedchained.py b/tests/python-to-js/tryexcepttypedchained.py index 5c174ec..cf30c17 100644 --- a/tests/python-to-js/tryexcepttypedchained.py +++ b/tests/python-to-js/tryexcepttypedchained.py @@ -1,6 +1,8 @@ var(Exception1, Exception2) + Exception1 = JSObject() Exception2 = JSObject() + try: raise Exception2 except Exception1: diff --git a/tests/python-to-js/tryexcepttypedchained.py.js b/tests/python-to-js/tryexcepttypedchained.py.js index e1ef854..afd56ed 100644 --- a/tests/python-to-js/tryexcepttypedchained.py.js +++ b/tests/python-to-js/tryexcepttypedchained.py.js @@ -5,11 +5,11 @@ try { throw Exception2; } catch(__exception__) { -if (__exception__ == Exception1 || isinstance(__exception__, Exception1)) { +if (__exception__ == Exception1 || isinstance([__exception__, Exception1])) { console.log(false); } -if (__exception__ == Exception2 || isinstance(__exception__, Exception2)) { +if (__exception__ == Exception2 || isinstance([__exception__, Exception2])) { console.log(true); } From 04b51daa59a2597bd84b82dc151386a9ccf2239e Mon Sep 17 00:00:00 2001 From: Amirouche Boubekki Date: Sun, 19 May 2013 15:45:34 +0200 Subject: [PATCH 018/860] does it load without errors ? --- tests/load_test.html | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 tests/load_test.html diff --git a/tests/load_test.html b/tests/load_test.html new file mode 100644 index 0000000..338bae1 --- /dev/null +++ b/tests/load_test.html @@ -0,0 +1,2 @@ + + From a03924ac4fbef7439faa961b7fa76c45653b4232 Mon Sep 17 00:00:00 2001 From: Amirouche Boubekki Date: Sun, 19 May 2013 15:45:56 +0200 Subject: [PATCH 019/860] missing tests.py.js --- tests/python-to-js/tests.py.js | 85 ++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 tests/python-to-js/tests.py.js diff --git a/tests/python-to-js/tests.py.js b/tests/python-to-js/tests.py.js new file mode 100644 index 0000000..623e0e1 --- /dev/null +++ b/tests/python-to-js/tests.py.js @@ -0,0 +1,85 @@ +['"B"', '__B_parents', '__B_attrs'] +['"C"', '__C_parents', '__C_attrs'] +['B'] +['C'] +['"A"', '__A_parents', '__A_attrs'] +['egg'] +['signature', 'args', 'kwargs'] +['list', '"__call__"'] +['args'] +['create_array(args)', None] +['dict', '"__call__"'] +['kwargs'] +['create_array(kwargs)', None] +['args', '"__iter__"'] +['__iterator__', '"next"'] +['__iterator__', '"next"'] +['function'] +['create_array(function)'] +['function'] +['create_array(function)'] +['__args_0', 'args'] +['function', '"__call__"'] +['__args_0', '__kwargs_0'] +var B, __B_attrs, __B_parents; +__B_attrs = {}; +__B_parents = create_array(); +B = create_class("B", __B_parents, __B_attrs); +var C, __C_attrs, __C_parents; +__C_attrs = {}; +__C_parents = create_array(); +C = create_class("C", __C_parents, __C_attrs); +var A, __A_attrs, __A_parents; +__A_attrs = {}; +__A_parents = create_array(); +__A_parents.push(B); +__A_parents.push(C); +A = create_class("A", __A_parents, __A_attrs); +var a, object, args, str; +a = new Object(); +object = {"spam": 7, "egg": 8}; +args = create_array(5, 6); +str = toString(egg); +var function = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {"c": 3, "d": 4}, "args": create_array("a", "b", "c", "d"), "vararg": "args", "varkwarg": "kwargs"}; +arguments = get_arguments(signature, args, kwargs); +var a = arguments['a']; +var b = arguments['b']; +var c = arguments['c']; +var d = arguments['d']; +var args arguments['args']; +args = get_attribute(list, "__call__")(create_array(args)); +var kwargs = arguments["kwargs"]; +kwargs = get_attribute(dict, "__call__")(create_array(kwargs)); +console.log(a, b, c, d); +sum = a + b + c + d; +console.log(sum); +var __iterator__, arg; +__iterator__ = get_attribute(args, "__iter__"); +try { +arg = get_attribute(__iterator__, "next")(); +while(true) { +console.log(args); +undefined; +arg = get_attribute(__iterator__, "next")(); +} +} +catch(__exception__) { +if (__exception__ == StopIteration || isinstance([__exception__, StopIteration])) { + +} + +} + +console.log(kwargs); +} + +function = deco_b(create_array(function)); +function = deco_a(create_array(function)); +var __args_0, __kwargs_0; +__args_0 = create_array(1, 2, 3, 4); +__args_0.push.apply(__args_0, args); +__kwargs_0 = {}; +for (var name in kwargs) { __kwargs_0[name] = kwargs[name]; }; +get_attribute(function, "__call__")(__args_0, __kwargs_0); From e8280e15b858f3c5728eb7a09048645707759329 Mon Sep 17 00:00:00 2001 From: Amirouche Boubekki Date: Sun, 19 May 2013 15:50:22 +0200 Subject: [PATCH 020/860] rebuild --- pythonscript.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pythonscript.js b/pythonscript.js index f8ce0f6..7d20260 100644 --- a/pythonscript.js +++ b/pythonscript.js @@ -509,16 +509,16 @@ arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var other = arguments['other']; var __iterator__, obj; -__iterator__ = get_attribute(get_attribute(other, "__iter__"), "__call__")(); +__iterator__ = get_attribute(get_attribute(other, "__iter__"), "__call__")(create_array(), {}); try { -obj = get_attribute(__iterator__, "next")(); +obj = get_attribute(__iterator__, "next")(create_array(), {}); while(true) { var __args_8, __kwargs_8; __args_8 = create_array(obj); __kwargs_8 = {}; get_attribute(get_attribute(self, "append"), "__call__")(__args_8, __kwargs_8); undefined; -obj = get_attribute(__iterator__, "next")(); +obj = get_attribute(__iterator__, "next")(create_array(), {}); } } catch(__exception__) { @@ -591,16 +591,16 @@ var self = arguments['self']; var obj = arguments['obj']; i = 0; var __iterator__, other; -__iterator__ = get_attribute(get_attribute(self, "__iter__"), "__call__")(); +__iterator__ = get_attribute(get_attribute(self, "__iter__"), "__call__")(create_array(), {}); try { -other = get_attribute(__iterator__, "next")(); +other = get_attribute(__iterator__, "next")(create_array(), {}); while(true) { if(other == obj) { i = i + 1; } undefined; -other = get_attribute(__iterator__, "next")(); +other = get_attribute(__iterator__, "next")(create_array(), {}); } } catch(__exception__) { @@ -796,9 +796,9 @@ var __iterator__, i; var __args_13, __kwargs_13; __args_13 = create_array(jsstring.length); __kwargs_13 = {}; -__iterator__ = get_attribute(get_attribute(get_attribute(range, "__call__")(__args_13, __kwargs_13), "__iter__"), "__call__")(); +__iterator__ = get_attribute(get_attribute(get_attribute(range, "__call__")(__args_13, __kwargs_13), "__iter__"), "__call__")(create_array(), {}); try { -i = get_attribute(__iterator__, "next")(); +i = get_attribute(__iterator__, "next")(create_array(), {}); while(true) { char = jsstring.charAt(i); var __args_14, __kwargs_14; @@ -807,7 +807,7 @@ __kwargs_14 = {}; get_attribute(get_attribute(self, "append"), "__call__")(__args_14, __kwargs_14); undefined; undefined; -i = get_attribute(__iterator__, "next")(); +i = get_attribute(__iterator__, "next")(create_array(), {}); } } catch(__exception__) { From ab341ba6fe878c2db0f2ada252d5ee77747e96a5 Mon Sep 17 00:00:00 2001 From: Amirouche Boubekki Date: Sun, 19 May 2013 15:50:29 +0200 Subject: [PATCH 021/860] bump to 0.7 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index b781626..e2288ef 100755 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ setup( name='PythonScriptTranslator', - version='0.6.1', + version='0.7', description='Python translator for the browser', author='Amirouche Boubekki', author_email='amirouche.boubekki@gmail.com', From dc0f24de4534053543b21c1cabc316f2a22d88d3 Mon Sep 17 00:00:00 2001 From: Amirouche Boubekki Date: Sun, 19 May 2013 23:14:13 +0200 Subject: [PATCH 022/860] avoid using stdin inside function --- pythonscript/python_to_pythonjs.py | 13 ++++++++----- pythonscript/pythonjs.py | 8 ++++---- pythonscript/pythonscript.py | 21 +++++---------------- 3 files changed, 17 insertions(+), 25 deletions(-) diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index c02d802..9efdbb9 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -16,12 +16,15 @@ from ast import parse from ast import NodeVisitor +from cStringIO import StringIO as StringIO + class Writer(object): def __init__(self): self.level = 0 self.buffers = list() + self.output = StringIO() def push(self): self.level += 1 @@ -40,7 +43,7 @@ def write(self, code): def _write(self, code): indentation = self.level * 4 * ' ' - print '%s%s' % (indentation, code) + self.output.write('%s%s\n' % (indentation, code)) writer = Writer() @@ -296,11 +299,11 @@ def visit_While(self, node): writer.pull() -def main(): - input = parse(sys.stdin.read()) +def main(script): + input = parse(script) tree = parse(input) PythonToPythonJS().visit(tree) - + return writer.output.getvalue() if __name__ == '__main__': - main() + print main(sys.stdin.read()) diff --git a/pythonscript/pythonjs.py b/pythonscript/pythonjs.py index 1eb090f..8d73188 100755 --- a/pythonscript/pythonjs.py +++ b/pythonscript/pythonjs.py @@ -225,11 +225,11 @@ def visit_For(self, node): return for_block -def main(): - input = parse(sys.stdin.read()) +def main(script): + input = parse(script) tree = parse(input) - print JSGenerator().visit(tree) + return JSGenerator().visit(tree) if __name__ == '__main__': - main() + print main(sys.stdin.read()) diff --git a/pythonscript/pythonscript.py b/pythonscript/pythonscript.py index 9789274..e568f4c 100755 --- a/pythonscript/pythonscript.py +++ b/pythonscript/pythonscript.py @@ -1,24 +1,13 @@ #!/usr/bin/env python import sys -from StringIO import StringIO +from python_to_pythonjs import main as python_to_pythonjs +from pythonjs import main as pythonjs -from python_to_pythonjs import PythonToPythonJS -from pythonjs import JSGenerator -from ast import parse - -def main(): - input = parse(sys.stdin.read()) - tree = parse(input) - stdout = sys.stdout - s = StringIO() - sys.stdout = s - PythonToPythonJS().visit(tree) - tree = parse(s.getvalue()) - sys.stdout = stdout - print JSGenerator().visit(tree) +def main(script): + return pythonjs(python_to_pythonjs(script)) if __name__ == '__main__': - main() + print main(sys.stdin.read()) From 91ab7414814b840dea5e42f9a4e807b8b4ae7178 Mon Sep 17 00:00:00 2001 From: Amirouche Boubekki Date: Sun, 19 May 2013 23:21:19 +0200 Subject: [PATCH 023/860] bump to 0.7.1 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index e2288ef..9f9dc59 100755 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ setup( name='PythonScriptTranslator', - version='0.7', + version='0.7.1', description='Python translator for the browser', author='Amirouche Boubekki', author_email='amirouche.boubekki@gmail.com', From 0277336aa1668faebf0643774a2085b459656b12 Mon Sep 17 00:00:00 2001 From: Amirouche Boubekki Date: Sat, 25 May 2013 00:40:01 +0200 Subject: [PATCH 024/860] fix main script and bump to 7.2 --- README.rst | 23 +++++++++++++++++++++++ pythonscript/python_to_pythonjs.py | 7 ++++++- pythonscript/pythonscript.py | 6 +++--- setup.py | 2 +- 4 files changed, 33 insertions(+), 5 deletions(-) diff --git a/README.rst b/README.rst index a8cfe6a..a238be0 100644 --- a/README.rst +++ b/README.rst @@ -30,6 +30,29 @@ Demos Changelog ========= + +0.7.2 - Urban species +--------------------- + +- fixed ``pythonscript`` which was broken by last release + +0.7.1 - Morcheeba +----------------- + +- rework the way script are executed to be possible to call them from Python easly + +0.7 - 13/05/12 - Electric Guest +------------------------------- + +- move weblib to its own repository +- add support for ``is`` +- added ``isinstance`` and ``issubclass`` +- rework the translation for python to pythonjs +- improved generated code +- full support of exception (typed and named) +- added a set of reference transaltion ``tests/python-to-js/`` + + 0.6.1 - 13/05/12 - Open up -------------------------- diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index 9efdbb9..af3dadd 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -305,5 +305,10 @@ def main(script): PythonToPythonJS().visit(tree) return writer.output.getvalue() -if __name__ == '__main__': + +def command(): print main(sys.stdin.read()) + + +if __name__ == '__main__': + command() diff --git a/pythonscript/pythonscript.py b/pythonscript/pythonscript.py index e568f4c..864a38f 100755 --- a/pythonscript/pythonscript.py +++ b/pythonscript/pythonscript.py @@ -5,9 +5,9 @@ from pythonjs import main as pythonjs -def main(script): - return pythonjs(python_to_pythonjs(script)) +def main(): + return pythonjs(python_to_pythonjs(sys.stdin.read())) if __name__ == '__main__': - print main(sys.stdin.read()) + print main() diff --git a/setup.py b/setup.py index 9f9dc59..ed85c60 100755 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ setup( name='PythonScriptTranslator', - version='0.7.1', + version='0.7.2', description='Python translator for the browser', author='Amirouche Boubekki', author_email='amirouche.boubekki@gmail.com', From 08ae618030b62b700086b98476be9f794700228c Mon Sep 17 00:00:00 2001 From: Amirouche Boubekki Date: Sat, 25 May 2013 12:58:13 +0200 Subject: [PATCH 025/860] fixed the commands again --- pythonscript/pythonjs.py | 5 ++++- pythonscript/pythonscript.py | 4 ++-- setup.py | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/pythonscript/pythonjs.py b/pythonscript/pythonjs.py index 8d73188..dc4195e 100755 --- a/pythonscript/pythonjs.py +++ b/pythonscript/pythonjs.py @@ -231,5 +231,8 @@ def main(script): return JSGenerator().visit(tree) -if __name__ == '__main__': +def command(): print main(sys.stdin.read()) + +if __name__ == '__main__': + command() diff --git a/pythonscript/pythonscript.py b/pythonscript/pythonscript.py index 864a38f..ab32699 100755 --- a/pythonscript/pythonscript.py +++ b/pythonscript/pythonscript.py @@ -6,8 +6,8 @@ def main(): - return pythonjs(python_to_pythonjs(sys.stdin.read())) + print pythonjs(python_to_pythonjs(sys.stdin.read())) if __name__ == '__main__': - print main() + main() diff --git a/setup.py b/setup.py index ed85c60..cdfe65f 100755 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ [console_scripts] pythonjs=pythonscript.pythonjs:main pythonscript=pythonscript.pythonscript:main - python_to_pythonjs=pythonscript.python_to_pythonjs:main + python_to_pythonjs=pythonscript.python_to_pythonjs:command """, install_script='bin/pythonscript', ) From b5d5875f4e6b832264018576a1c479fb1e87dc49 Mon Sep 17 00:00:00 2001 From: Amirouche Boubekki Date: Sat, 25 May 2013 12:58:21 +0200 Subject: [PATCH 026/860] improved documentation --- doc/foundation/static/css/app.css | 23 ++++++++++++ doc/foundation/static/img/subtle_carbon.png | Bin 138 -> 112 bytes doc/source/howtos.rst | 37 ++++++++++---------- doc/source/internals.rst | 15 ++++---- pythonscript/main.py | 17 --------- 5 files changed, 50 insertions(+), 42 deletions(-) delete mode 100755 pythonscript/main.py diff --git a/doc/foundation/static/css/app.css b/doc/foundation/static/css/app.css index 7d74e9d..24cd60f 100644 --- a/doc/foundation/static/css/app.css +++ b/doc/foundation/static/css/app.css @@ -41,4 +41,27 @@ h1, h2, h3, h4, h5, .top-bar .name h1 a { .container .row { background-color: rgba(0, 0, 0, 0.3); +} + +.note { + border: 1px solid #2BA6CB; + background-color: rgba(46, 166, 203, 0.3); +} + +.hightlight { + margin-bottom: 1em; +} + +.versionchanged { + border: 1px solid white; + background-color: rgba(255, 255, 255, 0.3); + padding: 5px; +} + +.versionmodified { + font-weight: bold; +} + +.pre { + color: #E44D26; } \ No newline at end of file diff --git a/doc/foundation/static/img/subtle_carbon.png b/doc/foundation/static/img/subtle_carbon.png index e72d575af496cb613ee78605336df1a7f2fcc52b..f2bb16d0cea474d13472d19cc2e1cbd1753e1b76 100644 GIT binary patch literal 112 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh1SBVD?P>#3=AJH&AsQ2t6C9Y7l$3Vt$Oy7% zxxn&K!r_3;nzY9uj^0;qF#fbVtkiLz;ZWbf=PEvTuY|RG^E0p*a1<(}JbDH+g2B_( K&t;ucLK6UBXCk`* literal 138 zcmeAS@N?(olHy`uVBq!ia0vp^LO{&V!NkD8DEQdoGLR!#;u=vBoS#-wo>-L1;Fyx1 zl&avFo0y&&l$w}QS$Hzl2B=8K)5S4F<9zajNt2QeFcokt_E5a?AkcTo!iux%mnwcq mTZf!cIjmP@mHfh5h+&5@r|Q3+16P3h7(8A5T-G@yGywn+s4MFL diff --git a/doc/source/howtos.rst b/doc/source/howtos.rst index 21e6ca6..0bac517 100644 --- a/doc/source/howtos.rst +++ b/doc/source/howtos.rst @@ -4,27 +4,30 @@ How to write Python in PythonScript How to use PythonScript ? ------------------------- -Install PythonScriptTranslator:: +Install PythonScriptTranslator: + +.. code-block:: sh pip install PythonScriptTranslator And download the latest version on the master branch of `pythonscript.js `_. -Prepare a app.html file that can look like the following: +Prepare a ``app.html`` file that can look like the following: .. code-block:: html -That is all, ``app.py.js`` is the result of the compilation of a ``app.py`` with the following command:: +That is all, ``app.py.js`` is the result of the compilation of a ``app.py`` with the following command: - pythonscript < app.py > app.py.js +.. code-block:: sh + pythonscript < app.py > app.py.js .. note:: The following tests can be done in the `online editor `_. -.. note:: Or you can use the mini `deli Django project `_. +.. note:: Or you can use the mini `demo Django project `_. .. note:: Whatever route you go you will need `firebug `_. @@ -36,7 +39,7 @@ The old ``print`` statement will be converted to Javascript ``console.log`` whic Dealing with variables ---------------------- -This is very important! Just like in Javascript you **must** «declare» the variables using the ``var`` function. For instance ``var(spam)``. It can take several arguments ``var(spam, egg, bottle)``. This is because PythonScript use the underlying Javascript variable scope and in Javascript a variable is by default global. The partical consequence is that you **must** declare every usage of a variable *except* if you want to use a global (which seldom happens). Typical code in PythonScript looks like: +This is very important! Just like in Javascript you **must** «declare» the variables using the ``var`` function. For instance ``var(spam)``. It can take several arguments ``var(spam, egg, bottle)``. This is because PythonScript use the underlying Javascript variable scope and in Javascript a variable is by default global. The pratical consequence is that you **must** declare every usage of a variable *except* if you want to use a global (which seldom happens). Typical code in PythonScript looks like: .. code-block:: python @@ -58,7 +61,9 @@ A function is defined just like in Python: my_function(1,2,3,4,5,spam=6,egg=7) -The above code will print in a browser console the following:: +The above code will print in a browser console the following: + +.. code-block:: javascript 1 2 3 Object { __class__={...}, __dict__={...}} Object { __class__={...}, __dict__={...}} @@ -81,7 +86,9 @@ Let's define a function that is more verbose: my_function(1,2,3,4,5,spam=6,egg=7) -It will print in the browser console the following:: +It will print in the browser console the following: + +.. code-block:: javascript foo @@ -111,23 +118,15 @@ What we expected. Also, as in Python, functions are objects so you can use them as such. -**Becarful**, ``*args`` and ``**kwargs`` are supported in definition but not in calling, this means that the following: - -.. code-block:: python - - args = list() - kwargs = dict() - my_function(*args, **kwargs) - -Will **not** work. - +.. versionchanged:: 0.7 + Added support for ``*`` and ``**`` in calling, pratically it means that given ``args`` a ``list`` and ``kwargs`` a ``dict`` you can use the following call ``function(*args, **kwargs)``. How to work with classes? ------------------------- Once functions are done, classes are just a piece of cake, except there is yet no ``__get_attribute__`` or ``__getattr__`` hook it similar to CPython. Data descriptors works the same way. And metaclass is explained in the following paragraph. -.. warning:: You don't have to inherit ``object`` actually there is no ``object`` object in PythonScript yet. +.. warning:: You don't have to inherit ``object`` actually there is no ``object`` object in PythonScript. How to use ``__metaclass__`` property? diff --git a/doc/source/internals.rst b/doc/source/internals.rst index 665d498..859307a 100644 --- a/doc/source/internals.rst +++ b/doc/source/internals.rst @@ -18,7 +18,11 @@ Compilation JSGenerator -> "Javascript" [folded]; } -This is the description of ``pythonscript`` command. Mind the fact that there is no actual ``pythontopythonjs`` command this is done on the fly. +This is the description of ``pythonscript`` command. + +.. versionchanged:: 0.7 + There is now ``python_to_pythonjs`` command that allow you to review the python code generated before it's converted to javascript + Execution --------- @@ -50,12 +54,12 @@ In the following we will see in order: ``pythonjs`` ------------ -``pythonjs`` knows how to translate: +``pythonjs`` command knows how to translate: -- Python functions to Javascript ones +- Restricted Python functions to Javascript - It handles attribute access e.g. ``spam.egg.foobarbaz`` - Add brackets and semi-colons -- ``print(*args)`` are converted to ``console.log(*args)`` +- ``print(foo, bar, flower)`` are converted to ``console.log(foo, bar, flower)`` - ``for i in jsrange(int)`` are converted to Javascript for loops It also support two special functions ``JS(str)`` and ``var(*args)``: @@ -78,7 +82,7 @@ Will be translated to the following Javascript code: d = new Array(); d.push(1) -This makes it possible to: +This makes possible to: - Support Javascript syntax that is not supported by Python. - Bypass translation process as it will be shown later. @@ -128,7 +132,6 @@ Create an array of integers that can be iterated over by the ``for`` loop genera ``create_array`` will create a Javascript array with ``args``. This function circunvent a behavior in Javascript where ``new Array(42)`` and ``new Array(42, 24)`` behaves differently. - ``adapt_arguments()`` ~~~~~~~~~~~~~~~~~~~~~ diff --git a/pythonscript/main.py b/pythonscript/main.py deleted file mode 100755 index 62a004d..0000000 --- a/pythonscript/main.py +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env python -import sys -from ast import parse - -from pythonjs import JSGenerator -from python_to_pythonjs import PythonToPythonJS - - -def main(): - input = parse(sys.stdin.read()) - pythonscript = PythonToPythonJS().visit(input) - jsgenerator = JSGenerator() - print jsgenerator.visit(pythonscript) - - -if __name__ == '__main__': - main() From 5516bfea8aece6e792565c77793d6d08d5d83f21 Mon Sep 17 00:00:00 2001 From: Amirouche Boubekki Date: Sat, 25 May 2013 13:13:16 +0200 Subject: [PATCH 027/860] moved changelog to documentation and improved README.rst --- README.rst | 81 ++------------------------------- doc/source/changelog.rst | 98 ++++++++++++++++++++++++++++++++++++++++ doc/source/index.rst | 9 +--- 3 files changed, 102 insertions(+), 86 deletions(-) create mode 100644 doc/source/changelog.rst diff --git a/README.rst b/README.rst index a238be0..5ee2253 100644 --- a/README.rst +++ b/README.rst @@ -2,11 +2,13 @@ PythonScript ############ :dependency: Python 2.7 +:documentaiton: `PythonScript `_ +:try: `apppyjs `_ Kesaco ====== -A Python to Javascript translator in Python. It converts a subset of Python to a subset of Javascript, making availabele enough Javascript in Python to do many things useful among which (at least I think) a full Python interpreter. **Right now pythonscript command is a compiler. +A Python to Javascript translator in Python. It converts a subset of Python to a subset of Javascript, making availabele enough Javascript in Python to do many things useful among which (at least I think) a full Python interpreter. Getting started --------------- @@ -26,83 +28,6 @@ Demos - `sudo python `_ - -Changelog -========= - - -0.7.2 - Urban species ---------------------- - -- fixed ``pythonscript`` which was broken by last release - -0.7.1 - Morcheeba ------------------ - -- rework the way script are executed to be possible to call them from Python easly - -0.7 - 13/05/12 - Electric Guest -------------------------------- - -- move weblib to its own repository -- add support for ``is`` -- added ``isinstance`` and ``issubclass`` -- rework the translation for python to pythonjs -- improved generated code -- full support of exception (typed and named) -- added a set of reference transaltion ``tests/python-to-js/`` - - -0.6.1 - 13/05/12 - Open up --------------------------- - -- added ``getattr`` and ``setattr`` - -0.6 - 13/05/09 - Dispatch -------------------------- - -- added data descriptors -- added metaclasses functions and ``type`` as a class contructor -- args and kwargs in called are respectively list and dictionary instead of javascript objects - -0.5 - 13/04/01 - Lazy labor ---------------------------- - -- improvements in jquery bindings -- add minimal support for exceptions -- better support for loops -- introduce a builtins.py file -- renamed the compiled python runtime file to pythonscript.js -- booleans -- minimal list/dict/str but not fully compatible with CPython -- ``get_attribute`` support now inhertance but still not as CPython -- new special function ``var(spam, egg)`` that is translated to ``var spam, egg;`` -- new ``range`` that is compatible with for loop -- several fixes in the compilation -- `sudo python `_ - -0.4 - tldr ----------- - -- lazy for loop implementation (only used in pythonjs now) -- while loops -- fixing some callbacks in jquery bindings with ``adapt_arguments`` - -0.3 - 13/03/31 --------------- - -- support of python(positional, arguments, key=word, *args, **kwargs), it doesn't work in callbacks - -0.2 - acid lemon ----------------- - -- positional arguments -- inheritance with custom mro - - -0.1 - happy hacking -------------------- - See also ======== diff --git a/doc/source/changelog.rst b/doc/source/changelog.rst new file mode 100644 index 0000000..cd89b09 --- /dev/null +++ b/doc/source/changelog.rst @@ -0,0 +1,98 @@ +Changelog +######### + +0.7.3 - Tricky +-------------- + +- Fixed ``pythnonjs`` and ``python_to_pythonjs`` commands to be runnable. + +0.7.2 - Urban species +--------------------- + +- fixed ``pythonscript`` which was broken by last release + +0.7.1 - Morcheeba +----------------- + +- rework the way script are executed to be possible to call them from Python easly + +0.7 - 13/05/12 - Electric Guest +------------------------------- + +- move weblib to its own repository +- add support for ``is`` +- added ``isinstance`` and ``issubclass`` +- rework the translation for python to pythonjs +- improved generated code +- full support of exception (typed and named) +- added a set of reference transaltion ``tests/python-to-js/`` + + +0.6.1 - 13/05/12 - Open up +-------------------------- + +- added ``getattr`` and ``setattr`` + +0.6 - 13/05/09 - Dispatch +------------------------- + +- added data descriptors +- added metaclasses functions and ``type`` as a class contructor +- args and kwargs in called are respectively list and dictionary instead of javascript objects + +0.5 - 13/04/01 - Lazy labor +--------------------------- + +- improvements in jquery bindings +- add minimal support for exceptions +- better support for loops +- introduce a builtins.py file +- renamed the compiled python runtime file to pythonscript.js +- booleans +- minimal list/dict/str but not fully compatible with CPython +- ``get_attribute`` support now inhertance but still not as CPython +- new special function ``var(spam, egg)`` that is translated to ``var spam, egg;`` +- new ``range`` that is compatible with for loop +- several fixes in the compilation +- `sudo python `_ + +0.4 - tldr +---------- + +- lazy for loop implementation (only used in pythonjs now) +- while loops +- fixing some callbacks in jquery bindings with ``adapt_arguments`` + +0.3 - 13/03/31 +-------------- + +- support of python(positional, arguments, key=word, *args, **kwargs), it doesn't work in callbacks + +0.2 - acid lemon +---------------- + +- positional arguments +- inheritance with custom mro + + +0.1 - happy hacking +------------------- + +Sometime ago I started a quest to find the best solution to do Python in the browser. My +`first idea `_ was to create a browser in Python thinking +that it would be easy to embedded Python in a Python browser but it's actually there is no trivial way +to sandbox Python. Building a HTML renderer is not trivial too. Then I started to dig what existed and +discovered that most of the implementation were using javascript to bridge the gap between Python's +object oriented semantic and Javascript's one, whatever the mode: compiled or interpreted. Not happy +with what was available I started `an implementation `_ +following the same route, I think I tried it twice. First time I started with Google Closure then +using requirejs and Classy. The good news is I know javascript better the bad news was none really +worked. Then Brython came, I started again to think about the problem. Do I really need to write it in +Javascript ? I've ditched PyPy before because RPython targets typed languages so it wasn't good for +Javascript, but the method still holds, after reading again +:download:`one of the best ressource regarding PyPy ` +I've started a new implementation that called `PythonScript `_. It's +intersting enough because the core is fully written in Python and it quite easier to write than the +other solutions, I've put less the first release took me less than 25 hours. + +Right now is rough around the edge. Abstract syntax tree API aka. ``ast`` module beauty as no other, but it works enough. diff --git a/doc/source/index.rst b/doc/source/index.rst index ba10b93..e13f93a 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -22,12 +22,5 @@ No. You don't need to understand how it works to use it, but since it's buggy (b :maxdepth: 2 internals - - -Indices and tables -================== - -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` + changelog From 1936ffda6c6c5c6298b29aa00d849a897952485a Mon Sep 17 00:00:00 2001 From: Amirouche Boubekki Date: Sat, 25 May 2013 20:12:11 +0200 Subject: [PATCH 028/860] fix pythonscript command --- pythonscript/pythonscript.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pythonscript/pythonscript.py b/pythonscript/pythonscript.py index ab32699..0bc3388 100755 --- a/pythonscript/pythonscript.py +++ b/pythonscript/pythonscript.py @@ -5,8 +5,12 @@ from pythonjs import main as pythonjs -def main(): - print pythonjs(python_to_pythonjs(sys.stdin.read())) +def main(script): + print pythonjs(python_to_pythonjs(script)) + + +def command(): + main(sys.stdin.read()) if __name__ == '__main__': From 4db7b368be3ee84e440e49cdfcf832f455aff47e Mon Sep 17 00:00:00 2001 From: Amirouche Boubekki Date: Sat, 25 May 2013 20:12:26 +0200 Subject: [PATCH 029/860] fix pythonscript command --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index cdfe65f..87d6d48 100755 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ entry_points=""" [console_scripts] pythonjs=pythonscript.pythonjs:main - pythonscript=pythonscript.pythonscript:main + pythonscript=pythonscript.main:command python_to_pythonjs=pythonscript.python_to_pythonjs:command """, install_script='bin/pythonscript', From c2334f53644ac390f7e56e877e42482428d53eb3 Mon Sep 17 00:00:00 2001 From: Amirouche Boubekki Date: Sat, 25 May 2013 20:12:45 +0200 Subject: [PATCH 030/860] add django doc --- doc/source/django.rst | 45 +++++++++++++++++++++++++++++++++++++++++++ doc/source/index.rst | 1 + 2 files changed, 46 insertions(+) create mode 100644 doc/source/django.rst diff --git a/doc/source/django.rst b/doc/source/django.rst new file mode 100644 index 0000000..c4cd4d0 --- /dev/null +++ b/doc/source/django.rst @@ -0,0 +1,45 @@ +How to use PythonScript with Django +################################### + +PythonScript is compatible with Django and more precisly with Django compressor which takes great advantage of its support of preprocessors + +So what you need is Django and django-compressor: + +.. code-block:: sh + + pip install PythonScriptTranslator django django_compressor + +Following `django compressor documentation `_ +you need to add ``compressor`` to the list of installed apps: + +.. code-block:: python + + INSTALLED_APPS = ( + # other apps + "compressor", + ) + +In case you use Django’s staticfiles contrib app (or its standalone counterpart django-staticfiles) you have to add Django Compressor’s file finder to the ``STATICFILES_FINDERS`` setting, for example with ``django.contrib.staticfiles``: + +.. code-block:: python + + STATICFILES_FINDERS = ( + 'django.contrib.staticfiles.finders.FileSystemFinder', + 'django.contrib.staticfiles.finders.AppDirectoriesFinder', + # other finders.. + 'compressor.finders.CompressorFinder', + ) + +Once this is done configure ``COMPRESS_PRECOMPILERS`` like it is explained `the documentation `_ with ``pythonscript`` command. You will end up with something similar to the following: + +.. code-block:: python + + COMPRESS_PRECOMPILERS = ( ('text/pythonscript', 'pythonscript < {infile} > {outfile}'), ) + +Then you can include pythonscript files in the templates using a snippet similar to the following: + +.. code-block:: html + + {% compress %} From 25d558f8874ea77afa49e2bd0ddf647a85f064d8 Mon Sep 17 00:00:00 2001 From: Amirouche Boubekki Date: Sun, 2 Jun 2013 22:01:55 +0200 Subject: [PATCH 057/860] =?UTF-8?q?fix=20regression=20where=20=C2=ABreturn?= =?UTF-8?q?=20foo.bar=C2=BB=20was=20turned=20into=20=C2=ABreturn=20undefin?= =?UTF-8?q?ed=C2=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pythonscript/pythonjs.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pythonscript/pythonjs.py b/pythonscript/pythonjs.py index b0a455b..98b5e72 100755 --- a/pythonscript/pythonjs.py +++ b/pythonscript/pythonjs.py @@ -6,6 +6,7 @@ from ast import Name from ast import Tuple from ast import parse +from ast import Attribute from ast import NodeVisitor @@ -184,7 +185,7 @@ def visit_Expr(self, node): return s def visit_Return(self, node): - if isinstance(node.value, Name): + if isinstance(node.value, Name) or isinstance(node.value, Attribute): return 'return %s;' % self.visit(node.value) elif isinstance(node.value, Tuple): return 'return [%s];' % ', '.join(map(self.visit, node.value.elts)) From b5b59f16ef20ebfcc90dac10c84cb33516265707 Mon Sep 17 00:00:00 2001 From: Amirouche Boubekki Date: Sun, 2 Jun 2013 23:45:09 +0200 Subject: [PATCH 058/860] actually Return node value can be a lot of things --- pythonscript.js | 5 +- pythonscript/pythonjs.py | 6 +- setup.py | 2 +- tests/runtime/tests.html | 2 +- tests/runtime/tests.py.js | 334 +++++++++++++++++++++++++++++--------- 5 files changed, 263 insertions(+), 86 deletions(-) diff --git a/pythonscript.js b/pythonscript.js index 20b3987..3c62647 100644 --- a/pythonscript.js +++ b/pythonscript.js @@ -3,11 +3,10 @@ - var jsrange = function(num) { var i, r; i = 0; -r = create_array(); +r = []; while(i < num) { r.push(i); i = i + 1; @@ -17,7 +16,7 @@ return r; var create_array = function() { var array; -array = create_array(); +array = []; var iter = jsrange(arguments.length); for (var i=0; i < iter.length; i++) { var backup = i; diff --git a/pythonscript/pythonjs.py b/pythonscript/pythonjs.py index 98b5e72..8ec7a0f 100755 --- a/pythonscript/pythonjs.py +++ b/pythonscript/pythonjs.py @@ -185,10 +185,10 @@ def visit_Expr(self, node): return s def visit_Return(self, node): - if isinstance(node.value, Name) or isinstance(node.value, Attribute): - return 'return %s;' % self.visit(node.value) - elif isinstance(node.value, Tuple): + if isinstance(node.value, Tuple): return 'return [%s];' % ', '.join(map(self.visit, node.value.elts)) + if node.value: + return 'return %s;' % self.visit(node.value) return 'return undefined;' def visit_Pass(self, node): diff --git a/setup.py b/setup.py index 1020eea..4fc3315 100755 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ setup( name='PythonScriptTranslator', - version='0.7.3', + version='0.8.0', description='Python translator for the browser', author='Amirouche Boubekki', author_email='amirouche.boubekki@gmail.com', diff --git a/tests/runtime/tests.html b/tests/runtime/tests.html index 3fc38cb..712ab22 100644 --- a/tests/runtime/tests.html +++ b/tests/runtime/tests.html @@ -1,4 +1,4 @@

PythonScript Tests

Please hit Ctrl+Shift+J or F12

- + diff --git a/tests/runtime/tests.py.js b/tests/runtime/tests.py.js index f7ca73f..643ab99 100644 --- a/tests/runtime/tests.py.js +++ b/tests/runtime/tests.py.js @@ -1,9 +1,10 @@ var test_equal = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("a", "b", "message")}; -var arguments = get_arguments(signature, args, kwargs); -var a = arguments["a"]; -var b = arguments["b"]; -var message = arguments["message"]; +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("a", "b", "message")}; +arguments = get_arguments(signature, args, kwargs); +var a = arguments['a']; +var b = arguments['b']; +var message = arguments['message']; if(a == b) { console.log(message); } @@ -14,10 +15,11 @@ console.log(message, "failed"); } var test_true = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("a", "message")}; -var arguments = get_arguments(signature, args, kwargs); -var a = arguments["a"]; -var message = arguments["message"]; +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("a", "message")}; +arguments = get_arguments(signature, args, kwargs); +var a = arguments['a']; +var message = arguments['message']; if(a) { console.log(message); } @@ -28,10 +30,11 @@ console.log(message, "failed"); } var test_false = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array("a", "message")}; -var arguments = get_arguments(signature, args, kwargs); -var a = arguments["a"]; -var message = arguments["message"]; +var signature, arguments; +signature = {"kwargs": {}, "args": create_array("a", "message")}; +arguments = get_arguments(signature, args, kwargs); +var a = arguments['a']; +var message = arguments['message']; if(!a) { console.log(message); } @@ -41,82 +44,257 @@ console.log(message, "failed"); } -tests = get_attribute(list, "__call__")(create_array(), {}); +var __args_0, __kwargs_0; +__args_0 = create_array(); +__kwargs_0 = {}; +tests = get_attribute(list, "__call__")(__args_0, __kwargs_0); var test_issubclass = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array()}; -var arguments = get_arguments(signature, args, kwargs); -A = {}; -parents = create_array(); -A = create_class("A", parents, A); -B = {}; -parents = create_array(); -parents.push(A); -B = create_class("B", parents, B); -C = {}; -parents = create_array(); -parents.push(B); -C = create_class("C", parents, C); -D = {}; -parents = create_array(); -D = create_class("D", parents, D); -E = {}; -parents = create_array(); -parents.push(C, D); -E = create_class("E", parents, E); -get_attribute(test_true, "__call__")(create_array(get_attribute(issubclass, "__call__")(create_array(C, C), {}), "C is a subclass of C"), {}); -get_attribute(test_true, "__call__")(create_array(get_attribute(issubclass, "__call__")(create_array(C, B), {}), "C is a subclass of B"), {}); -get_attribute(test_true, "__call__")(create_array(get_attribute(issubclass, "__call__")(create_array(C, A), {}), "C is a subclass of A"), {}); -get_attribute(test_true, "__call__")(create_array(get_attribute(issubclass, "__call__")(create_array(B, B), {}), "B is a subclass of B"), {}); -get_attribute(test_true, "__call__")(create_array(get_attribute(issubclass, "__call__")(create_array(B, A), {}), "B is a subclass of A"), {}); -get_attribute(test_true, "__call__")(create_array(get_attribute(issubclass, "__call__")(create_array(A, A), {}), "A is a subclass of A"), {}); -get_attribute(test_false, "__call__")(create_array(get_attribute(issubclass, "__call__")(create_array(A, B), {}), "A is not a subclass of B"), {}); -get_attribute(test_false, "__call__")(create_array(get_attribute(issubclass, "__call__")(create_array(B, C), {}), "B is not a subclass of C"), {}); -get_attribute(test_false, "__call__")(create_array(get_attribute(issubclass, "__call__")(create_array(D, A), {}), "D is not a subclass of A"), {}); -get_attribute(test_false, "__call__")(create_array(get_attribute(issubclass, "__call__")(create_array(D, C), {}), "D is not a subclass of C"), {}); -get_attribute(test_true, "__call__")(create_array(get_attribute(issubclass, "__call__")(create_array(E, E), {}), "E is subclass of E"), {}); -get_attribute(test_true, "__call__")(create_array(get_attribute(issubclass, "__call__")(create_array(E, D), {}), "E is subclass of D"), {}); -get_attribute(test_true, "__call__")(create_array(get_attribute(issubclass, "__call__")(create_array(E, C), {}), "E is subclass of C"), {}); -get_attribute(test_true, "__call__")(create_array(get_attribute(issubclass, "__call__")(create_array(E, B), {}), "E is subclass of B"), {}); -get_attribute(test_true, "__call__")(create_array(get_attribute(issubclass, "__call__")(create_array(E, A), {}), "E is subclass of A"), {}); +var signature, arguments; +signature = {"kwargs": {}, "args": create_array()}; +arguments = get_arguments(signature, args, kwargs); +var A, __A_attrs, __A_parents; +__A_attrs = {}; +__A_parents = create_array(); +A = create_class("A", __A_parents, __A_attrs); +var B, __B_attrs, __B_parents; +__B_attrs = {}; +__B_parents = create_array(); +__B_parents.push(A); +B = create_class("B", __B_parents, __B_attrs); +var C, __C_attrs, __C_parents; +__C_attrs = {}; +__C_parents = create_array(); +__C_parents.push(B); +C = create_class("C", __C_parents, __C_attrs); +var D, __D_attrs, __D_parents; +__D_attrs = {}; +__D_parents = create_array(); +D = create_class("D", __D_parents, __D_attrs); +var E, __E_attrs, __E_parents; +__E_attrs = {}; +__E_parents = create_array(); +__E_parents.push(C); +__E_parents.push(D); +E = create_class("E", __E_parents, __E_attrs); +var __args_1, __kwargs_1; +__args_1 = create_array(C, C); +__kwargs_1 = {}; +var __args_2, __kwargs_2; +__args_2 = create_array(get_attribute(issubclass, "__call__")(__args_1, __kwargs_1), "C is a subclass of C"); +__kwargs_2 = {}; +get_attribute(test_true, "__call__")(__args_2, __kwargs_2); +var __args_3, __kwargs_3; +__args_3 = create_array(C, B); +__kwargs_3 = {}; +var __args_4, __kwargs_4; +__args_4 = create_array(get_attribute(issubclass, "__call__")(__args_3, __kwargs_3), "C is a subclass of B"); +__kwargs_4 = {}; +get_attribute(test_true, "__call__")(__args_4, __kwargs_4); +var __args_5, __kwargs_5; +__args_5 = create_array(C, A); +__kwargs_5 = {}; +var __args_6, __kwargs_6; +__args_6 = create_array(get_attribute(issubclass, "__call__")(__args_5, __kwargs_5), "C is a subclass of A"); +__kwargs_6 = {}; +get_attribute(test_true, "__call__")(__args_6, __kwargs_6); +var __args_7, __kwargs_7; +__args_7 = create_array(B, B); +__kwargs_7 = {}; +var __args_8, __kwargs_8; +__args_8 = create_array(get_attribute(issubclass, "__call__")(__args_7, __kwargs_7), "B is a subclass of B"); +__kwargs_8 = {}; +get_attribute(test_true, "__call__")(__args_8, __kwargs_8); +var __args_9, __kwargs_9; +__args_9 = create_array(B, A); +__kwargs_9 = {}; +var __args_10, __kwargs_10; +__args_10 = create_array(get_attribute(issubclass, "__call__")(__args_9, __kwargs_9), "B is a subclass of A"); +__kwargs_10 = {}; +get_attribute(test_true, "__call__")(__args_10, __kwargs_10); +var __args_11, __kwargs_11; +__args_11 = create_array(A, A); +__kwargs_11 = {}; +var __args_12, __kwargs_12; +__args_12 = create_array(get_attribute(issubclass, "__call__")(__args_11, __kwargs_11), "A is a subclass of A"); +__kwargs_12 = {}; +get_attribute(test_true, "__call__")(__args_12, __kwargs_12); +var __args_13, __kwargs_13; +__args_13 = create_array(A, B); +__kwargs_13 = {}; +var __args_14, __kwargs_14; +__args_14 = create_array(get_attribute(issubclass, "__call__")(__args_13, __kwargs_13), "A is not a subclass of B"); +__kwargs_14 = {}; +get_attribute(test_false, "__call__")(__args_14, __kwargs_14); +var __args_15, __kwargs_15; +__args_15 = create_array(B, C); +__kwargs_15 = {}; +var __args_16, __kwargs_16; +__args_16 = create_array(get_attribute(issubclass, "__call__")(__args_15, __kwargs_15), "B is not a subclass of C"); +__kwargs_16 = {}; +get_attribute(test_false, "__call__")(__args_16, __kwargs_16); +var __args_17, __kwargs_17; +__args_17 = create_array(D, A); +__kwargs_17 = {}; +var __args_18, __kwargs_18; +__args_18 = create_array(get_attribute(issubclass, "__call__")(__args_17, __kwargs_17), "D is not a subclass of A"); +__kwargs_18 = {}; +get_attribute(test_false, "__call__")(__args_18, __kwargs_18); +var __args_19, __kwargs_19; +__args_19 = create_array(D, C); +__kwargs_19 = {}; +var __args_20, __kwargs_20; +__args_20 = create_array(get_attribute(issubclass, "__call__")(__args_19, __kwargs_19), "D is not a subclass of C"); +__kwargs_20 = {}; +get_attribute(test_false, "__call__")(__args_20, __kwargs_20); +var __args_21, __kwargs_21; +__args_21 = create_array(E, E); +__kwargs_21 = {}; +var __args_22, __kwargs_22; +__args_22 = create_array(get_attribute(issubclass, "__call__")(__args_21, __kwargs_21), "E is subclass of E"); +__kwargs_22 = {}; +get_attribute(test_true, "__call__")(__args_22, __kwargs_22); +var __args_23, __kwargs_23; +__args_23 = create_array(E, D); +__kwargs_23 = {}; +var __args_24, __kwargs_24; +__args_24 = create_array(get_attribute(issubclass, "__call__")(__args_23, __kwargs_23), "E is subclass of D"); +__kwargs_24 = {}; +get_attribute(test_true, "__call__")(__args_24, __kwargs_24); +var __args_25, __kwargs_25; +__args_25 = create_array(E, C); +__kwargs_25 = {}; +var __args_26, __kwargs_26; +__args_26 = create_array(get_attribute(issubclass, "__call__")(__args_25, __kwargs_25), "E is subclass of C"); +__kwargs_26 = {}; +get_attribute(test_true, "__call__")(__args_26, __kwargs_26); +var __args_27, __kwargs_27; +__args_27 = create_array(E, B); +__kwargs_27 = {}; +var __args_28, __kwargs_28; +__args_28 = create_array(get_attribute(issubclass, "__call__")(__args_27, __kwargs_27), "E is subclass of B"); +__kwargs_28 = {}; +get_attribute(test_true, "__call__")(__args_28, __kwargs_28); +var __args_29, __kwargs_29; +__args_29 = create_array(E, A); +__kwargs_29 = {}; +var __args_30, __kwargs_30; +__args_30 = create_array(get_attribute(issubclass, "__call__")(__args_29, __kwargs_29), "E is subclass of A"); +__kwargs_30 = {}; +get_attribute(test_true, "__call__")(__args_30, __kwargs_30); } -get_attribute(get_attribute(tests, "append"), "__call__")(create_array(test_issubclass), {}); +var __args_31, __kwargs_31; +__args_31 = create_array(test_issubclass); +__kwargs_31 = {}; +get_attribute(get_attribute(tests, "append"), "__call__")(__args_31, __kwargs_31); var test_isinstance = function(args, kwargs) { -var signature = {"kwargs": {}, "args": create_array()}; -var arguments = get_arguments(signature, args, kwargs); -A = {}; -parents = create_array(); -A = create_class("A", parents, A); -B = {}; -parents = create_array(); -parents.push(A); -B = create_class("B", parents, B); -X = {}; -parents = create_array(); -X = create_class("X", parents, X); -Y = {}; -parents = create_array(); -parents.push(X); -Y = create_class("Y", parents, Y); -get_attribute(test_true, "__call__")(create_array(get_attribute(isinstance, "__call__")(create_array(get_attribute(A, "__call__")(create_array(), {}), A), {}), "A() is an instance of A"), {}); -get_attribute(test_true, "__call__")(create_array(get_attribute(isinstance, "__call__")(create_array(get_attribute(B, "__call__")(create_array(), {}), A), {}), "B() is an instance of A"), {}); -get_attribute(test_true, "__call__")(create_array(get_attribute(isinstance, "__call__")(create_array(get_attribute(B, "__call__")(create_array(), {}), A), {}), "B() is an instance of B"), {}); -get_attribute(test_false, "__call__")(create_array(get_attribute(isinstance, "__call__")(create_array(B, B), {}), "B is not an instance of B"), {}); -get_attribute(test_false, "__call__")(create_array(get_attribute(isinstance, "__call__")(create_array(B, A), {}), "B is not an instance of A"), {}); -get_attribute(test_false, "__call__")(create_array(get_attribute(isinstance, "__call__")(create_array(get_attribute(B, "__call__")(create_array(), {}), X), {}), "B() is not an instance of X"), {}); -get_attribute(test_false, "__call__")(create_array(get_attribute(isinstance, "__call__")(create_array(get_attribute(B, "__call__")(create_array(), {}), Y), {}), "B() is not an instance of Y"), {}); +var signature, arguments; +signature = {"kwargs": {}, "args": create_array()}; +arguments = get_arguments(signature, args, kwargs); +var A, __A_attrs, __A_parents; +__A_attrs = {}; +__A_parents = create_array(); +A = create_class("A", __A_parents, __A_attrs); +var B, __B_attrs, __B_parents; +__B_attrs = {}; +__B_parents = create_array(); +__B_parents.push(A); +B = create_class("B", __B_parents, __B_attrs); +var X, __X_attrs, __X_parents; +__X_attrs = {}; +__X_parents = create_array(); +X = create_class("X", __X_parents, __X_attrs); +var Y, __Y_attrs, __Y_parents; +__Y_attrs = {}; +__Y_parents = create_array(); +__Y_parents.push(X); +Y = create_class("Y", __Y_parents, __Y_attrs); +var __args_32, __kwargs_32; +__args_32 = create_array(); +__kwargs_32 = {}; +var __args_33, __kwargs_33; +__args_33 = create_array(get_attribute(A, "__call__")(__args_32, __kwargs_32), A); +__kwargs_33 = {}; +var __args_34, __kwargs_34; +__args_34 = create_array(get_attribute(isinstance, "__call__")(__args_33, __kwargs_33), "A() is an instance of A"); +__kwargs_34 = {}; +get_attribute(test_true, "__call__")(__args_34, __kwargs_34); +var __args_35, __kwargs_35; +__args_35 = create_array(); +__kwargs_35 = {}; +var __args_36, __kwargs_36; +__args_36 = create_array(get_attribute(B, "__call__")(__args_35, __kwargs_35), A); +__kwargs_36 = {}; +var __args_37, __kwargs_37; +__args_37 = create_array(get_attribute(isinstance, "__call__")(__args_36, __kwargs_36), "B() is an instance of A"); +__kwargs_37 = {}; +get_attribute(test_true, "__call__")(__args_37, __kwargs_37); +var __args_38, __kwargs_38; +__args_38 = create_array(); +__kwargs_38 = {}; +var __args_39, __kwargs_39; +__args_39 = create_array(get_attribute(B, "__call__")(__args_38, __kwargs_38), A); +__kwargs_39 = {}; +var __args_40, __kwargs_40; +__args_40 = create_array(get_attribute(isinstance, "__call__")(__args_39, __kwargs_39), "B() is an instance of B"); +__kwargs_40 = {}; +get_attribute(test_true, "__call__")(__args_40, __kwargs_40); +var __args_41, __kwargs_41; +__args_41 = create_array(B, B); +__kwargs_41 = {}; +var __args_42, __kwargs_42; +__args_42 = create_array(get_attribute(isinstance, "__call__")(__args_41, __kwargs_41), "B is not an instance of B"); +__kwargs_42 = {}; +get_attribute(test_false, "__call__")(__args_42, __kwargs_42); +var __args_43, __kwargs_43; +__args_43 = create_array(B, A); +__kwargs_43 = {}; +var __args_44, __kwargs_44; +__args_44 = create_array(get_attribute(isinstance, "__call__")(__args_43, __kwargs_43), "B is not an instance of A"); +__kwargs_44 = {}; +get_attribute(test_false, "__call__")(__args_44, __kwargs_44); +var __args_45, __kwargs_45; +__args_45 = create_array(); +__kwargs_45 = {}; +var __args_46, __kwargs_46; +__args_46 = create_array(get_attribute(B, "__call__")(__args_45, __kwargs_45), X); +__kwargs_46 = {}; +var __args_47, __kwargs_47; +__args_47 = create_array(get_attribute(isinstance, "__call__")(__args_46, __kwargs_46), "B() is not an instance of X"); +__kwargs_47 = {}; +get_attribute(test_false, "__call__")(__args_47, __kwargs_47); +var __args_48, __kwargs_48; +__args_48 = create_array(); +__kwargs_48 = {}; +var __args_49, __kwargs_49; +__args_49 = create_array(get_attribute(B, "__call__")(__args_48, __kwargs_48), Y); +__kwargs_49 = {}; +var __args_50, __kwargs_50; +__args_50 = create_array(get_attribute(isinstance, "__call__")(__args_49, __kwargs_49), "B() is not an instance of Y"); +__kwargs_50 = {}; +get_attribute(test_false, "__call__")(__args_50, __kwargs_50); } -get_attribute(get_attribute(tests, "append"), "__call__")(create_array(test_isinstance), {}); -var __iterator__ = get_attribute(tests, "__iter__")(create_array(), {}); +var __args_51, __kwargs_51; +__args_51 = create_array(test_isinstance); +__kwargs_51 = {}; +get_attribute(get_attribute(tests, "append"), "__call__")(__args_51, __kwargs_51); +var __iterator__, test; +__iterator__ = get_attribute(get_attribute(tests, "__iter__"), "__call__")(create_array(), {}); try { -var test = get_attribute(__iterator__, "next")(create_array(), {}); +test = get_attribute(__iterator__, "next")(create_array(), {}); while(true) { -get_attribute(test, "__call__")(create_array(), {}); -var test = get_attribute(__iterator__, "next")(create_array(), {}); +var __args_52, __kwargs_52; +__args_52 = create_array(); +__kwargs_52 = {}; +get_attribute(test, "__call__")(__args_52, __kwargs_52); +test = get_attribute(__iterator__, "next")(create_array(), {}); } } catch(__exception__) { +if (__exception__ == StopIteration || isinstance([__exception__, StopIteration])) { + +} } From 10f31c1bbe6c781b1ea1e83e68651fea0b5913d6 Mon Sep 17 00:00:00 2001 From: Amirouche Boubekki Date: Thu, 5 Sep 2013 23:52:36 +0200 Subject: [PATCH 059/860] added json_to_pythonscript function --- bindings/jquery.py.js | 320 +++++++++++++++++++------------------- pythonscript.js | 164 +++++++++++-------- pythonscript/pythonjs.py | 4 +- runtime/pythonpythonjs.py | 25 +++ 4 files changed, 290 insertions(+), 223 deletions(-) diff --git a/bindings/jquery.py.js b/bindings/jquery.py.js index be18685..f8792c3 100644 --- a/bindings/jquery.py.js +++ b/bindings/jquery.py.js @@ -1,9 +1,9 @@ var J, __J_attrs, __J_parents; -__J_attrs = {}; +__J_attrs = Object(); __J_parents = create_array(); var __J___init__ = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "arg")}; +signature = {"kwargs": Object(), "args": create_array("self", "arg")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var arg = arguments['arg']; @@ -13,7 +13,7 @@ set_attribute(self, "j", jQuery(arg)); __J_attrs.__init__ = __J___init__; var __J_add = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "arg")}; +signature = {"kwargs": Object(), "args": create_array("self", "arg")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var arg = arguments['arg']; @@ -21,14 +21,14 @@ j = get_attribute(self, "j"); o = j.add(arg); var __args_0, __kwargs_0; __args_0 = create_array(o); -__kwargs_0 = {}; +__kwargs_0 = Object(); return get_attribute(J, "__call__")(__args_0, __kwargs_0); } __J_attrs.add = __J_add; var __J_addClass = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "klass")}; +signature = {"kwargs": Object(), "args": create_array("self", "klass")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var klass = arguments['klass']; @@ -36,14 +36,14 @@ j = get_attribute(self, "j"); o = j.addClass(klass); var __args_1, __kwargs_1; __args_1 = create_array(o); -__kwargs_1 = {}; +__kwargs_1 = Object(); return get_attribute(J, "__call__")(__args_1, __kwargs_1); } __J_attrs.addClass = __J_addClass; var __J_after = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "arg")}; +signature = {"kwargs": Object(), "args": create_array("self", "arg")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var arg = arguments['arg']; @@ -51,14 +51,14 @@ j = get_attribute(self, "j"); o = j.after(arg); var __args_2, __kwargs_2; __args_2 = create_array(o); -__kwargs_2 = {}; +__kwargs_2 = Object(); return get_attribute(J, "__call__")(__args_2, __kwargs_2); } __J_attrs.after = __J_after; var __J_animate = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "properties", "duration", "easing", "complete")}; +signature = {"kwargs": Object(), "args": create_array("self", "properties", "duration", "easing", "complete")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var properties = arguments['properties']; @@ -69,14 +69,14 @@ j = get_attribute(self, "j"); o = j.animate(properties, duration, easing, complete); var __args_3, __kwargs_3; __args_3 = create_array(o); -__kwargs_3 = {}; +__kwargs_3 = Object(); return get_attribute(J, "__call__")(__args_3, __kwargs_3); } __J_attrs.animate = __J_animate; var __J_append = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "arg")}; +signature = {"kwargs": Object(), "args": create_array("self", "arg")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var arg = arguments['arg']; @@ -84,14 +84,14 @@ j = get_attribute(self, "j"); o = j.append(arg); var __args_4, __kwargs_4; __args_4 = create_array(o); -__kwargs_4 = {}; +__kwargs_4 = Object(); return get_attribute(J, "__call__")(__args_4, __kwargs_4); } __J_attrs.append = __J_append; var __J_appendTo = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "arg")}; +signature = {"kwargs": Object(), "args": create_array("self", "arg")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var arg = arguments['arg']; @@ -99,14 +99,14 @@ j = get_attribute(self, "j"); o = j.appendTo(arg); var __args_5, __kwargs_5; __args_5 = create_array(o); -__kwargs_5 = {}; +__kwargs_5 = Object(); return get_attribute(J, "__call__")(__args_5, __kwargs_5); } __J_attrs.appendTo = __J_appendTo; var __J_attr = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "key", "value")}; +signature = {"kwargs": Object(), "args": create_array("self", "key", "value")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var key = arguments['key']; @@ -124,7 +124,7 @@ j.attr(key, value); __J_attrs.attr = __J_attr; var __J_before = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "arg")}; +signature = {"kwargs": Object(), "args": create_array("self", "arg")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var arg = arguments['arg']; @@ -132,14 +132,14 @@ j = get_attribute(self, "j"); o = j.before(arg); var __args_6, __kwargs_6; __args_6 = create_array(o); -__kwargs_6 = {}; +__kwargs_6 = Object(); return get_attribute(J, "__call__")(__args_6, __kwargs_6); } __J_attrs.before = __J_before; var __J_bind = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "event_type", "event_data", "handler")}; +signature = {"kwargs": Object(), "args": create_array("self", "event_type", "event_data", "handler")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var event_type = arguments['event_type']; @@ -149,14 +149,14 @@ j = get_attribute(self, "j"); o = j.bind(event_type, event_data, adapt_arguments(handler)); var __args_7, __kwargs_7; __args_7 = create_array(o); -__kwargs_7 = {}; +__kwargs_7 = Object(); return get_attribute(J, "__call__")(__args_7, __kwargs_7); } __J_attrs.bind = __J_bind; var __J_blur = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "handler")}; +signature = {"kwargs": Object(), "args": create_array("self", "handler")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; @@ -164,14 +164,14 @@ j = get_attribute(self, "j"); o = j.blur(adapt_arguments(handler)); var __args_8, __kwargs_8; __args_8 = create_array(o); -__kwargs_8 = {}; +__kwargs_8 = Object(); return get_attribute(J, "__call__")(__args_8, __kwargs_8); } __J_attrs.blur = __J_blur; var __J_change = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "handler")}; +signature = {"kwargs": Object(), "args": create_array("self", "handler")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; @@ -179,14 +179,14 @@ j = get_attribute(self, "j"); o = j.change(adapt_arguments(handler)); var __args_9, __kwargs_9; __args_9 = create_array(o); -__kwargs_9 = {}; +__kwargs_9 = Object(); return get_attribute(J, "__call__")(__args_9, __kwargs_9); } __J_attrs.change = __J_change; var __J_children = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "selector")}; +signature = {"kwargs": Object(), "args": create_array("self", "selector")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var selector = arguments['selector']; @@ -194,14 +194,14 @@ j = get_attribute(self, "j"); o = j.children(selector); var __args_10, __kwargs_10; __args_10 = create_array(o); -__kwargs_10 = {}; +__kwargs_10 = Object(); return get_attribute(J, "__call__")(__args_10, __kwargs_10); } __J_attrs.children = __J_children; var __J_click = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "handler")}; +signature = {"kwargs": Object(), "args": create_array("self", "handler")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; @@ -209,14 +209,14 @@ j = get_attribute(self, "j"); o = j.click(adapt_arguments(handler)); var __args_11, __kwargs_11; __args_11 = create_array(o); -__kwargs_11 = {}; +__kwargs_11 = Object(); return get_attribute(J, "__call__")(__args_11, __kwargs_11); } __J_attrs.click = __J_click; var __J_clone = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "with_data_and_events")}; +signature = {"kwargs": Object(), "args": create_array("self", "with_data_and_events")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var with_data_and_events = arguments['with_data_and_events']; @@ -224,14 +224,14 @@ j = get_attribute(self, "j"); o = j.clone(with_data_and_events); var __args_12, __kwargs_12; __args_12 = create_array(o); -__kwargs_12 = {}; +__kwargs_12 = Object(); return get_attribute(J, "__call__")(__args_12, __kwargs_12); } __J_attrs.clone = __J_clone; var __J_contents = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "e")}; +signature = {"kwargs": Object(), "args": create_array("self", "e")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var e = arguments['e']; @@ -239,14 +239,14 @@ j = get_attribute(self, "j"); o = j.contents(); var __args_13, __kwargs_13; __args_13 = create_array(o); -__kwargs_13 = {}; +__kwargs_13 = Object(); return get_attribute(J, "__call__")(__args_13, __kwargs_13); } __J_attrs.contents = __J_contents; var __J_css = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "name", "value")}; +signature = {"kwargs": Object(), "args": create_array("self", "name", "value")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var name = arguments['name']; @@ -255,14 +255,14 @@ j = get_attribute(self, "j"); o = j.css(name, value); var __args_14, __kwargs_14; __args_14 = create_array(o); -__kwargs_14 = {}; +__kwargs_14 = Object(); return get_attribute(J, "__call__")(__args_14, __kwargs_14); } __J_attrs.css = __J_css; var __J_data = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "key", "value")}; +signature = {"kwargs": Object(), "args": create_array("self", "key", "value")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var key = arguments['key']; @@ -271,14 +271,14 @@ j = get_attribute(self, "j"); o = j.data(key, value); var __args_15, __kwargs_15; __args_15 = create_array(o); -__kwargs_15 = {}; +__kwargs_15 = Object(); return get_attribute(J, "__call__")(__args_15, __kwargs_15); } __J_attrs.data = __J_data; var __J_double_click = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "handler")}; +signature = {"kwargs": Object(), "args": create_array("self", "handler")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; @@ -286,14 +286,14 @@ j = get_attribute(self, "j"); o = j.dbclick(adapt_arguments(handler)); var __args_16, __kwargs_16; __args_16 = create_array(o); -__kwargs_16 = {}; +__kwargs_16 = Object(); return get_attribute(J, "__call__")(__args_16, __kwargs_16); } __J_attrs.double_click = __J_double_click; var __J_delay = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "time", "queue_name")}; +signature = {"kwargs": Object(), "args": create_array("self", "time", "queue_name")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var time = arguments['time']; @@ -302,14 +302,14 @@ j = get_attribute(self, "j"); o = j.delay(time, queue_name); var __args_17, __kwargs_17; __args_17 = create_array(o); -__kwargs_17 = {}; +__kwargs_17 = Object(); return get_attribute(J, "__call__")(__args_17, __kwargs_17); } __J_attrs.delay = __J_delay; var __J_dequeue = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "queue_name")}; +signature = {"kwargs": Object(), "args": create_array("self", "queue_name")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var queue_name = arguments['queue_name']; @@ -317,14 +317,14 @@ j = get_attribute(self, "j"); o = j.dequeue(queue_name); var __args_18, __kwargs_18; __args_18 = create_array(o); -__kwargs_18 = {}; +__kwargs_18 = Object(); return get_attribute(J, "__call__")(__args_18, __kwargs_18); } __J_attrs.dequeue = __J_dequeue; var __J_detach = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "selector")}; +signature = {"kwargs": Object(), "args": create_array("self", "selector")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var selector = arguments['selector']; @@ -332,14 +332,14 @@ j = get_attribute(self, "j"); o = j.detach(selector); var __args_19, __kwargs_19; __args_19 = create_array(o); -__kwargs_19 = {}; +__kwargs_19 = Object(); return get_attribute(J, "__call__")(__args_19, __kwargs_19); } __J_attrs.detach = __J_detach; var __J_each = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "handler")}; +signature = {"kwargs": Object(), "args": create_array("self", "handler")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; @@ -347,14 +347,14 @@ j = get_attribute(self, "j"); o = j.each(adapt_arguments(handler)); var __args_20, __kwargs_20; __args_20 = create_array(o); -__kwargs_20 = {}; +__kwargs_20 = Object(); return get_attribute(J, "__call__")(__args_20, __kwargs_20); } __J_attrs.each = __J_each; var __J_end = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "handler")}; +signature = {"kwargs": Object(), "args": create_array("self", "handler")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; @@ -362,14 +362,14 @@ j = get_attribute(self, "j"); o = j.end(handler); var __args_21, __kwargs_21; __args_21 = create_array(o); -__kwargs_21 = {}; +__kwargs_21 = Object(); return get_attribute(J, "__call__")(__args_21, __kwargs_21); } __J_attrs.end = __J_end; var __J_eq = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "index")}; +signature = {"kwargs": Object(), "args": create_array("self", "index")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var index = arguments['index']; @@ -377,14 +377,14 @@ j = get_attribute(self, "j"); o = j.eq(index); var __args_22, __kwargs_22; __args_22 = create_array(o); -__kwargs_22 = {}; +__kwargs_22 = Object(); return get_attribute(J, "__call__")(__args_22, __kwargs_22); } __J_attrs.eq = __J_eq; var __J_error = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "handler")}; +signature = {"kwargs": Object(), "args": create_array("self", "handler")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; @@ -392,14 +392,14 @@ j = get_attribute(self, "j"); o = j.error(adapt_arguments(handler)); var __args_23, __kwargs_23; __args_23 = create_array(o); -__kwargs_23 = {}; +__kwargs_23 = Object(); return get_attribute(J, "__call__")(__args_23, __kwargs_23); } __J_attrs.error = __J_error; var __J_fade_in = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "duration", "complete")}; +signature = {"kwargs": Object(), "args": create_array("self", "duration", "complete")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var duration = arguments['duration']; @@ -408,14 +408,14 @@ j = get_attribute(self, "j"); o = j.fadeIn(duration, complete); var __args_24, __kwargs_24; __args_24 = create_array(o); -__kwargs_24 = {}; +__kwargs_24 = Object(); return get_attribute(J, "__call__")(__args_24, __kwargs_24); } __J_attrs.fade_in = __J_fade_in; var __J_fade_out = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "duration", "complete")}; +signature = {"kwargs": Object(), "args": create_array("self", "duration", "complete")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var duration = arguments['duration']; @@ -424,14 +424,14 @@ j = get_attribute(self, "j"); o = j.fadeOut(duration, adapt_arguments(complete)); var __args_25, __kwargs_25; __args_25 = create_array(o); -__kwargs_25 = {}; +__kwargs_25 = Object(); return get_attribute(J, "__call__")(__args_25, __kwargs_25); } __J_attrs.fade_out = __J_fade_out; var __J_fadeTo = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "duration", "opacity", "complete")}; +signature = {"kwargs": Object(), "args": create_array("self", "duration", "opacity", "complete")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var duration = arguments['duration']; @@ -441,14 +441,14 @@ j = get_attribute(self, "j"); o = j.fade_to(duration, opacity, adapt_arguments(complete)); var __args_26, __kwargs_26; __args_26 = create_array(o); -__kwargs_26 = {}; +__kwargs_26 = Object(); return get_attribute(J, "__call__")(__args_26, __kwargs_26); } __J_attrs.fadeTo = __J_fadeTo; var __J_fade_toggle = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "duration", "easing", "complete")}; +signature = {"kwargs": Object(), "args": create_array("self", "duration", "easing", "complete")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var duration = arguments['duration']; @@ -458,14 +458,14 @@ j = get_attribute(self, "j"); o = j.fade_toggle(duration, easing, complete); var __args_27, __kwargs_27; __args_27 = create_array(o); -__kwargs_27 = {}; +__kwargs_27 = Object(); return get_attribute(J, "__call__")(__args_27, __kwargs_27); } __J_attrs.fade_toggle = __J_fade_toggle; var __J_filter = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "selector")}; +signature = {"kwargs": Object(), "args": create_array("self", "selector")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var selector = arguments['selector']; @@ -473,14 +473,14 @@ j = get_attribute(self, "j"); o = j.filter(selector); var __args_28, __kwargs_28; __args_28 = create_array(o); -__kwargs_28 = {}; +__kwargs_28 = Object(); return get_attribute(J, "__call__")(__args_28, __kwargs_28); } __J_attrs.filter = __J_filter; var __J_finish = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "queue")}; +signature = {"kwargs": Object(), "args": create_array("self", "queue")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var queue = arguments['queue']; @@ -488,14 +488,14 @@ j = get_attribute(self, "j"); o = j.finish(queue); var __args_29, __kwargs_29; __args_29 = create_array(o); -__kwargs_29 = {}; +__kwargs_29 = Object(); return get_attribute(J, "__call__")(__args_29, __kwargs_29); } __J_attrs.finish = __J_finish; var __J_find = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "selector")}; +signature = {"kwargs": Object(), "args": create_array("self", "selector")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var selector = arguments['selector']; @@ -504,28 +504,28 @@ j = get_attribute(self, "j"); o = j.find(selector); var __args_30, __kwargs_30; __args_30 = create_array(o); -__kwargs_30 = {}; +__kwargs_30 = Object(); return get_attribute(J, "__call__")(__args_30, __kwargs_30); } __J_attrs.find = __J_find; var __J_first = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self")}; +signature = {"kwargs": Object(), "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; j = get_attribute(self, "j"); o = j.first(); var __args_31, __kwargs_31; __args_31 = create_array(o); -__kwargs_31 = {}; +__kwargs_31 = Object(); return get_attribute(J, "__call__")(__args_31, __kwargs_31); } __J_attrs.first = __J_first; var __J_focus = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "handler")}; +signature = {"kwargs": Object(), "args": create_array("self", "handler")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; @@ -533,14 +533,14 @@ j = get_attribute(self, "j"); o = j.focus(adapt_arguments(handler)); var __args_32, __kwargs_32; __args_32 = create_array(o); -__kwargs_32 = {}; +__kwargs_32 = Object(); return get_attribute(J, "__call__")(__args_32, __kwargs_32); } __J_attrs.focus = __J_focus; var __J_focus_in = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "handler")}; +signature = {"kwargs": Object(), "args": create_array("self", "handler")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; @@ -548,14 +548,14 @@ j = get_attribute(self, "j"); o = j.focusIn(adapt_arguments(handler)); var __args_33, __kwargs_33; __args_33 = create_array(o); -__kwargs_33 = {}; +__kwargs_33 = Object(); return get_attribute(J, "__call__")(__args_33, __kwargs_33); } __J_attrs.focus_in = __J_focus_in; var __J_focus_out = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "handler")}; +signature = {"kwargs": Object(), "args": create_array("self", "handler")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; @@ -563,14 +563,14 @@ j = get_attribute(self, "j"); o = j.focusOut(adapt_arguments(handler)); var __args_34, __kwargs_34; __args_34 = create_array(o); -__kwargs_34 = {}; +__kwargs_34 = Object(); return get_attribute(J, "__call__")(__args_34, __kwargs_34); } __J_attrs.focus_out = __J_focus_out; var __J_get = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "index")}; +signature = {"kwargs": Object(), "args": create_array("self", "index")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var index = arguments['index']; @@ -578,14 +578,14 @@ j = get_attribute(self, "j"); o = j.get(index); var __args_35, __kwargs_35; __args_35 = create_array(o); -__kwargs_35 = {}; +__kwargs_35 = Object(); return get_attribute(J, "__call__")(__args_35, __kwargs_35); } __J_attrs.get = __J_get; var __J_has_class = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "name")}; +signature = {"kwargs": Object(), "args": create_array("self", "name")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var name = arguments['name']; @@ -593,14 +593,14 @@ j = get_attribute(self, "j"); o = j.has_class(selector); var __args_36, __kwargs_36; __args_36 = create_array(o); -__kwargs_36 = {}; +__kwargs_36 = Object(); return get_attribute(J, "__call__")(__args_36, __kwargs_36); } __J_attrs.has_class = __J_has_class; var __J_height = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "value")}; +signature = {"kwargs": Object(), "args": create_array("self", "value")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var value = arguments['value']; @@ -608,14 +608,14 @@ j = get_attribute(self, "j"); o = j.height(value); var __args_37, __kwargs_37; __args_37 = create_array(o); -__kwargs_37 = {}; +__kwargs_37 = Object(); return get_attribute(J, "__call__")(__args_37, __kwargs_37); } __J_attrs.height = __J_height; var __J_hide = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "duration", "complete")}; +signature = {"kwargs": Object(), "args": create_array("self", "duration", "complete")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var duration = arguments['duration']; @@ -624,14 +624,14 @@ j = get_attribute(self, "j"); o = j.hide(duration, complete); var __args_38, __kwargs_38; __args_38 = create_array(o); -__kwargs_38 = {}; +__kwargs_38 = Object(); return get_attribute(J, "__call__")(__args_38, __kwargs_38); } __J_attrs.hide = __J_hide; var __J_hover = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "handler")}; +signature = {"kwargs": Object(), "args": create_array("self", "handler")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; @@ -639,14 +639,14 @@ j = get_attribute(self, "j"); o = j.hover(adapt_arguments(handler)); var __args_39, __kwargs_39; __args_39 = create_array(o); -__kwargs_39 = {}; +__kwargs_39 = Object(); return get_attribute(J, "__call__")(__args_39, __kwargs_39); } __J_attrs.hover = __J_hover; var __J_html = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "value")}; +signature = {"kwargs": Object(), "args": create_array("self", "value")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var value = arguments['value']; @@ -664,7 +664,7 @@ return o; __J_attrs.html = __J_html; var __J_index = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "selector")}; +signature = {"kwargs": Object(), "args": create_array("self", "selector")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var selector = arguments['selector']; @@ -672,42 +672,42 @@ j = get_attribute(self, "j"); o = j.index(selector); var __args_40, __kwargs_40; __args_40 = create_array(o); -__kwargs_40 = {}; +__kwargs_40 = Object(); return get_attribute(J, "__call__")(__args_40, __kwargs_40); } __J_attrs.index = __J_index; var __J_inner_height = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self")}; +signature = {"kwargs": Object(), "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; j = get_attribute(self, "j"); o = j.innerHeight(); var __args_41, __kwargs_41; __args_41 = create_array(o); -__kwargs_41 = {}; +__kwargs_41 = Object(); return get_attribute(J, "__call__")(__args_41, __kwargs_41); } __J_attrs.inner_height = __J_inner_height; var __J_inner_width = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self")}; +signature = {"kwargs": Object(), "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; j = get_attribute(self, "j"); o = j.innerWidth(); var __args_42, __kwargs_42; __args_42 = create_array(o); -__kwargs_42 = {}; +__kwargs_42 = Object(); return get_attribute(J, "__call__")(__args_42, __kwargs_42); } __J_attrs.inner_width = __J_inner_width; var __J_insert_after = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "target")}; +signature = {"kwargs": Object(), "args": create_array("self", "target")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var target = arguments['target']; @@ -715,14 +715,14 @@ j = get_attribute(self, "j"); o = j.insertAfter(target); var __args_43, __kwargs_43; __args_43 = create_array(o); -__kwargs_43 = {}; +__kwargs_43 = Object(); return get_attribute(J, "__call__")(__args_43, __kwargs_43); } __J_attrs.insert_after = __J_insert_after; var __J_insert_before = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "target")}; +signature = {"kwargs": Object(), "args": create_array("self", "target")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var target = arguments['target']; @@ -730,14 +730,14 @@ j = get_attribute(self, "j"); o = j.insertBefore(selector); var __args_44, __kwargs_44; __args_44 = create_array(o); -__kwargs_44 = {}; +__kwargs_44 = Object(); return get_attribute(J, "__call__")(__args_44, __kwargs_44); } __J_attrs.insert_before = __J_insert_before; var __J_is_ = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "name")}; +signature = {"kwargs": Object(), "args": create_array("self", "name")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var name = arguments['name']; @@ -745,14 +745,14 @@ j = get_attribute(self, "j"); o = j.is(selector); var __args_45, __kwargs_45; __args_45 = create_array(o); -__kwargs_45 = {}; +__kwargs_45 = Object(); return get_attribute(J, "__call__")(__args_45, __kwargs_45); } __J_attrs.is_ = __J_is_; var __J_keydown = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "handler")}; +signature = {"kwargs": Object(), "args": create_array("self", "handler")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; @@ -760,14 +760,14 @@ j = get_attribute(self, "j"); o = j.keydown(adapt_arguments(handler)); var __args_46, __kwargs_46; __args_46 = create_array(o); -__kwargs_46 = {}; +__kwargs_46 = Object(); return get_attribute(J, "__call__")(__args_46, __kwargs_46); } __J_attrs.keydown = __J_keydown; var __J_keypress = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "handler")}; +signature = {"kwargs": Object(), "args": create_array("self", "handler")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; @@ -775,14 +775,14 @@ j = get_attribute(self, "j"); o = j.keypress(adapt_arguments(handler)); var __args_47, __kwargs_47; __args_47 = create_array(o); -__kwargs_47 = {}; +__kwargs_47 = Object(); return get_attribute(J, "__call__")(__args_47, __kwargs_47); } __J_attrs.keypress = __J_keypress; var __J_keyup = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "handler")}; +signature = {"kwargs": Object(), "args": create_array("self", "handler")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; @@ -790,14 +790,14 @@ j = get_attribute(self, "j"); o = j.keyup(adapt_arguments(handler)); var __args_48, __kwargs_48; __args_48 = create_array(o); -__kwargs_48 = {}; +__kwargs_48 = Object(); return get_attribute(J, "__call__")(__args_48, __kwargs_48); } __J_attrs.keyup = __J_keyup; var __J_last = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "handler")}; +signature = {"kwargs": Object(), "args": create_array("self", "handler")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; @@ -805,14 +805,14 @@ j = get_attribute(self, "j"); o = j.last(adapt_arguments(handler)); var __args_49, __kwargs_49; __args_49 = create_array(o); -__kwargs_49 = {}; +__kwargs_49 = Object(); return get_attribute(J, "__call__")(__args_49, __kwargs_49); } __J_attrs.last = __J_last; var __J_on = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "event", "handler")}; +signature = {"kwargs": Object(), "args": create_array("self", "event", "handler")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var event = arguments['event']; @@ -821,14 +821,14 @@ j = get_attribute(self, "j"); o = j.on(event, adapt_arguments(handler)); var __args_50, __kwargs_50; __args_50 = create_array(o); -__kwargs_50 = {}; +__kwargs_50 = Object(); return get_attribute(J, "__call__")(__args_50, __kwargs_50); } __J_attrs.on = __J_on; var __J_load = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "url", "data", "complete")}; +signature = {"kwargs": Object(), "args": create_array("self", "url", "data", "complete")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var url = arguments['url']; @@ -838,14 +838,14 @@ j = get_attribute(self, "j"); o = j.load(url, data, complete); var __args_51, __kwargs_51; __args_51 = create_array(o); -__kwargs_51 = {}; +__kwargs_51 = Object(); return get_attribute(J, "__call__")(__args_51, __kwargs_51); } __J_attrs.load = __J_load; var __J_select = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "handler")}; +signature = {"kwargs": Object(), "args": create_array("self", "handler")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; @@ -853,14 +853,14 @@ j = get_attribute(self, "j"); o = j.select(adapt_arguments(handler)); var __args_52, __kwargs_52; __args_52 = create_array(o); -__kwargs_52 = {}; +__kwargs_52 = Object(); return get_attribute(J, "__call__")(__args_52, __kwargs_52); } __J_attrs.select = __J_select; var __J_show = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "duration", "complete")}; +signature = {"kwargs": Object(), "args": create_array("self", "duration", "complete")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var duration = arguments['duration']; @@ -869,14 +869,14 @@ j = get_attribute(self, "j"); o = j.show(duration, complete); var __args_53, __kwargs_53; __args_53 = create_array(o); -__kwargs_53 = {}; +__kwargs_53 = Object(); return get_attribute(J, "__call__")(__args_53, __kwargs_53); } __J_attrs.show = __J_show; var __J_siblings = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "selector")}; +signature = {"kwargs": Object(), "args": create_array("self", "selector")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var selector = arguments['selector']; @@ -884,28 +884,28 @@ j = get_attribute(self, "j"); o = j.select(adapt_arguments(handler)); var __args_54, __kwargs_54; __args_54 = create_array(o); -__kwargs_54 = {}; +__kwargs_54 = Object(); return get_attribute(J, "__call__")(__args_54, __kwargs_54); } __J_attrs.siblings = __J_siblings; var __J_size = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self")}; +signature = {"kwargs": Object(), "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; j = get_attribute(self, "j"); o = j.size(); var __args_55, __kwargs_55; __args_55 = create_array(o); -__kwargs_55 = {}; +__kwargs_55 = Object(); return get_attribute(J, "__call__")(__args_55, __kwargs_55); } __J_attrs.size = __J_size; var __J_slice = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "start", "end")}; +signature = {"kwargs": Object(), "args": create_array("self", "start", "end")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var start = arguments['start']; @@ -914,14 +914,14 @@ j = get_attribute(self, "j"); o = j.slice(start, end); var __args_56, __kwargs_56; __args_56 = create_array(o); -__kwargs_56 = {}; +__kwargs_56 = Object(); return get_attribute(J, "__call__")(__args_56, __kwargs_56); } __J_attrs.slice = __J_slice; var __J_slide_down = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "duration", "complete")}; +signature = {"kwargs": Object(), "args": create_array("self", "duration", "complete")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var duration = arguments['duration']; @@ -930,14 +930,14 @@ j = get_attribute(self, "j"); o = j.slideDown(duration, adapt_arguments(complete)); var __args_57, __kwargs_57; __args_57 = create_array(o); -__kwargs_57 = {}; +__kwargs_57 = Object(); return get_attribute(J, "__call__")(__args_57, __kwargs_57); } __J_attrs.slide_down = __J_slide_down; var __J_slide_toggle = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "duration", "complete")}; +signature = {"kwargs": Object(), "args": create_array("self", "duration", "complete")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var duration = arguments['duration']; @@ -946,14 +946,14 @@ j = get_attribute(self, "j"); o = j.slideToggle(duration, adapt_arguments(complete)); var __args_58, __kwargs_58; __args_58 = create_array(o); -__kwargs_58 = {}; +__kwargs_58 = Object(); return get_attribute(J, "__call__")(__args_58, __kwargs_58); } __J_attrs.slide_toggle = __J_slide_toggle; var __J_slide_up = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "duration", "complete")}; +signature = {"kwargs": Object(), "args": create_array("self", "duration", "complete")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var duration = arguments['duration']; @@ -962,14 +962,14 @@ j = get_attribute(self, "j"); o = j.slideUp(duration, adapt_arguments(complete)); var __args_59, __kwargs_59; __args_59 = create_array(o); -__kwargs_59 = {}; +__kwargs_59 = Object(); return get_attribute(J, "__call__")(__args_59, __kwargs_59); } __J_attrs.slide_up = __J_slide_up; var __J_stop = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "clear_queue", "jump_to_end")}; +signature = {"kwargs": Object(), "args": create_array("self", "clear_queue", "jump_to_end")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var clear_queue = arguments['clear_queue']; @@ -978,14 +978,14 @@ j = get_attribute(self, "j"); o = j.stop(clear_queue, jump_to_end); var __args_60, __kwargs_60; __args_60 = create_array(o); -__kwargs_60 = {}; +__kwargs_60 = Object(); return get_attribute(J, "__call__")(__args_60, __kwargs_60); } __J_attrs.stop = __J_stop; var __J_submit = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "clear_queue", "jump_to_end")}; +signature = {"kwargs": Object(), "args": create_array("self", "clear_queue", "jump_to_end")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var clear_queue = arguments['clear_queue']; @@ -994,14 +994,14 @@ j = get_attribute(self, "j"); o = j.submit(clear_queue, jump_to_end); var __args_61, __kwargs_61; __args_61 = create_array(o); -__kwargs_61 = {}; +__kwargs_61 = Object(); return get_attribute(J, "__call__")(__args_61, __kwargs_61); } __J_attrs.submit = __J_submit; var __J_text = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "text")}; +signature = {"kwargs": Object(), "args": create_array("self", "text")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var text = arguments['text']; @@ -1009,14 +1009,14 @@ j = get_attribute(self, "j"); o = j.text(text); var __args_62, __kwargs_62; __args_62 = create_array(o); -__kwargs_62 = {}; +__kwargs_62 = Object(); return get_attribute(J, "__call__")(__args_62, __kwargs_62); } __J_attrs.text = __J_text; var __J_toggle = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "duration", "complete")}; +signature = {"kwargs": Object(), "args": create_array("self", "duration", "complete")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var duration = arguments['duration']; @@ -1025,14 +1025,14 @@ j = get_attribute(self, "j"); o = j.toggle(duration, complete); var __args_63, __kwargs_63; __args_63 = create_array(o); -__kwargs_63 = {}; +__kwargs_63 = Object(); return get_attribute(J, "__call__")(__args_63, __kwargs_63); } __J_attrs.toggle = __J_toggle; var __J_toggle_class = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "class_name")}; +signature = {"kwargs": Object(), "args": create_array("self", "class_name")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var class_name = arguments['class_name']; @@ -1040,14 +1040,14 @@ j = get_attribute(self, "j"); o = j.toggleClass(class_name); var __args_64, __kwargs_64; __args_64 = create_array(o); -__kwargs_64 = {}; +__kwargs_64 = Object(); return get_attribute(J, "__call__")(__args_64, __kwargs_64); } __J_attrs.toggle_class = __J_toggle_class; var __J_trigger = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "event")}; +signature = {"kwargs": Object(), "args": create_array("self", "event")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var event = arguments['event']; @@ -1055,14 +1055,14 @@ j = get_attribute(self, "j"); o = j.trigger(event); var __args_65, __kwargs_65; __args_65 = create_array(o); -__kwargs_65 = {}; +__kwargs_65 = Object(); return get_attribute(J, "__call__")(__args_65, __kwargs_65); } __J_attrs.trigger = __J_trigger; var __J_unbind = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "event", "handler")}; +signature = {"kwargs": Object(), "args": create_array("self", "event", "handler")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var event = arguments['event']; @@ -1071,14 +1071,14 @@ j = get_attribute(self, "j"); o = j.unbind(event, adapt_arguments(handler)); var __args_66, __kwargs_66; __args_66 = create_array(o); -__kwargs_66 = {}; +__kwargs_66 = Object(); return get_attribute(J, "__call__")(__args_66, __kwargs_66); } __J_attrs.unbind = __J_unbind; var __J_value = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "value")}; +signature = {"kwargs": Object(), "args": create_array("self", "value")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var value = arguments['value']; @@ -1086,14 +1086,14 @@ j = get_attribute(self, "j"); o = j.val(value); var __args_67, __kwargs_67; __args_67 = create_array(o); -__kwargs_67 = {}; +__kwargs_67 = Object(); return get_attribute(J, "__call__")(__args_67, __kwargs_67); } __J_attrs.value = __J_value; var __J_width = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "value")}; +signature = {"kwargs": Object(), "args": create_array("self", "value")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var value = arguments['value']; @@ -1101,14 +1101,14 @@ j = get_attribute(self, "j"); o = j.width(value); var __args_68, __kwargs_68; __args_68 = create_array(o); -__kwargs_68 = {}; +__kwargs_68 = Object(); return get_attribute(J, "__call__")(__args_68, __kwargs_68); } __J_attrs.width = __J_width; var __J_length = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self")}; +signature = {"kwargs": Object(), "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; j = get_attribute(self, "j"); @@ -1118,7 +1118,7 @@ return j.length(); __J_attrs.length = __J_length; var __J_map = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "func")}; +signature = {"kwargs": Object(), "args": create_array("self", "func")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var func = arguments['func']; @@ -1126,14 +1126,14 @@ j = get_attribute(self, "j"); o = j.map(func); var __args_69, __kwargs_69; __args_69 = create_array(o); -__kwargs_69 = {}; +__kwargs_69 = Object(); return get_attribute(J, "__call__")(__args_69, __kwargs_69); } __J_attrs.map = __J_map; var __J_mousedown = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "handler")}; +signature = {"kwargs": Object(), "args": create_array("self", "handler")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; @@ -1141,14 +1141,14 @@ j = get_attribute(self, "j"); o = j.mousedown(adapt_arguments(handler)); var __args_70, __kwargs_70; __args_70 = create_array(o); -__kwargs_70 = {}; +__kwargs_70 = Object(); return get_attribute(J, "__call__")(__args_70, __kwargs_70); } __J_attrs.mousedown = __J_mousedown; var __J_mouseenter = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "handler")}; +signature = {"kwargs": Object(), "args": create_array("self", "handler")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; @@ -1156,14 +1156,14 @@ j = get_attribute(self, "j"); o = j.mouseenter(adapt_arguments(handler)); var __args_71, __kwargs_71; __args_71 = create_array(o); -__kwargs_71 = {}; +__kwargs_71 = Object(); return get_attribute(J, "__call__")(__args_71, __kwargs_71); } __J_attrs.mouseenter = __J_mouseenter; var __J_mouseleave = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "handler")}; +signature = {"kwargs": Object(), "args": create_array("self", "handler")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; @@ -1171,14 +1171,14 @@ j = get_attribute(self, "j"); o = j.mouseleave(adapt_arguments(handler)); var __args_72, __kwargs_72; __args_72 = create_array(o); -__kwargs_72 = {}; +__kwargs_72 = Object(); return get_attribute(J, "__call__")(__args_72, __kwargs_72); } __J_attrs.mouseleave = __J_mouseleave; var __J_mousemove = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "handler")}; +signature = {"kwargs": Object(), "args": create_array("self", "handler")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; @@ -1186,14 +1186,14 @@ j = get_attribute(self, "j"); o = j.mousemove(adapt_arguments(handler)); var __args_73, __kwargs_73; __args_73 = create_array(o); -__kwargs_73 = {}; +__kwargs_73 = Object(); return get_attribute(J, "__call__")(__args_73, __kwargs_73); } __J_attrs.mousemove = __J_mousemove; var __J_mouseout = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "handler")}; +signature = {"kwargs": Object(), "args": create_array("self", "handler")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; @@ -1201,14 +1201,14 @@ j = get_attribute(self, "j"); o = j.mouseout(adapt_arguments(handler)); var __args_74, __kwargs_74; __args_74 = create_array(o); -__kwargs_74 = {}; +__kwargs_74 = Object(); return get_attribute(J, "__call__")(__args_74, __kwargs_74); } __J_attrs.mouseout = __J_mouseout; var __J_mouseover = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "handler")}; +signature = {"kwargs": Object(), "args": create_array("self", "handler")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; @@ -1216,14 +1216,14 @@ j = get_attribute(self, "j"); o = j.mouseover(adapt_arguments(handler)); var __args_75, __kwargs_75; __args_75 = create_array(o); -__kwargs_75 = {}; +__kwargs_75 = Object(); return get_attribute(J, "__call__")(__args_75, __kwargs_75); } __J_attrs.mouseover = __J_mouseover; var __J_mouseup = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "handler")}; +signature = {"kwargs": Object(), "args": create_array("self", "handler")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; @@ -1231,7 +1231,7 @@ j = get_attribute(self, "j"); o = j.mouseup(adapt_arguments(handler)); var __args_76, __kwargs_76; __args_76 = create_array(o); -__kwargs_76 = {}; +__kwargs_76 = Object(); return get_attribute(J, "__call__")(__args_76, __kwargs_76); } @@ -1239,7 +1239,7 @@ __J_attrs.mouseup = __J_mouseup; J = create_class("J", __J_parents, __J_attrs); var ajax = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("url", "settings")}; +signature = {"kwargs": Object(), "args": create_array("url", "settings")}; arguments = get_arguments(signature, args, kwargs); var url = arguments['url']; var settings = arguments['settings']; diff --git a/pythonscript.js b/pythonscript.js index 3c62647..0f6ffa7 100644 --- a/pythonscript.js +++ b/pythonscript.js @@ -45,15 +45,15 @@ return metaclass([class_name, parents, attrs]); } var klass; -klass = {}; +klass = Object(); klass.bases = parents; klass.__name__ = class_name; klass.__dict__ = attrs; var __call__ = function() { var object; -object = {}; +object = Object(); object.__class__ = klass; -object.__dict__ = {}; +object.__dict__ = Object(); var init; init = get_attribute(object, "__init__"); if(init) { @@ -270,10 +270,10 @@ args = []; } if(kwargs === undefined) { -kwargs = {}; +kwargs = Object(); } -out = {}; +out = Object(); if(signature.args.length) { argslength = signature.args.length; } @@ -354,7 +354,7 @@ for (var index=0; index < iter.length; index++) { var backup = index; index = iter[index]; base = C.bases[index]; -if(issubclass([base, B], {})) { +if(issubclass([base, B], Object())) { return true; } @@ -376,21 +376,63 @@ return false; return issubclass(create_array(object_class, klass)); } +var json_to_pythonscript = function(json) { +var jstype, item, output; +jstype = typeof json; +if(jstype == "number") { +return json; +} + +if(jstype == "string") { +return json; +} + +if(Object.prototype.toString.call(json) === '[object Array]') { +output = list.__call__([]); +var append; +var iter = json; +for (var item=0; item < iter.length; item++) { +var backup = item; +item = iter[item]; +append = get_attribute(output, "append"); +append([json_to_pythonscript(item)]); +item = backup; +} + +return output; +} + +output = dict.__call__([]); +var iter = Object.keys(json); +for (var key=0; key < iter.length; key++) { +var backup = key; +key = iter[key]; +console.log("!"); +console.log(key); +console.log(json[key]); +set = get_attribute(output, "set"); +set([key, json_to_pythonscript(json[key])]); +key = backup; +} + +return output; +} + var range = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("num")}; +signature = {"kwargs": Object(), "args": create_array("num")}; arguments = get_arguments(signature, args, kwargs); var num = arguments['num']; var i, r; i = 0; var __args_0, __kwargs_0; __args_0 = create_array(); -__kwargs_0 = {}; +__kwargs_0 = Object(); r = get_attribute(list, "__call__")(__args_0, __kwargs_0); while(i < num) { var __args_1, __kwargs_1; __args_1 = create_array(i); -__kwargs_1 = {}; +__kwargs_1 = Object(); get_attribute(get_attribute(r, "append"), "__call__")(__args_1, __kwargs_1); i = i + 1; } @@ -398,54 +440,54 @@ return r; } var StopIteration, __StopIteration_attrs, __StopIteration_parents; -__StopIteration_attrs = {}; +__StopIteration_attrs = Object(); __StopIteration_parents = create_array(); StopIteration = create_class("StopIteration", __StopIteration_parents, __StopIteration_attrs); var len = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("obj")}; +signature = {"kwargs": Object(), "args": create_array("obj")}; arguments = get_arguments(signature, args, kwargs); var obj = arguments['obj']; var __args_2, __kwargs_2; __args_2 = create_array(); -__kwargs_2 = {}; +__kwargs_2 = Object(); return get_attribute(get_attribute(obj, "__len__"), "__call__")(__args_2, __kwargs_2); } var next = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("obj")}; +signature = {"kwargs": Object(), "args": create_array("obj")}; arguments = get_arguments(signature, args, kwargs); var obj = arguments['obj']; var __args_3, __kwargs_3; __args_3 = create_array(); -__kwargs_3 = {}; +__kwargs_3 = Object(); return get_attribute(get_attribute(obj, "next"), "__call__")(__args_3, __kwargs_3); } var map = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("func", "objs")}; +signature = {"kwargs": Object(), "args": create_array("func", "objs")}; arguments = get_arguments(signature, args, kwargs); var func = arguments['func']; var objs = arguments['objs']; var __args_4, __kwargs_4; __args_4 = create_array(); -__kwargs_4 = {}; +__kwargs_4 = Object(); out = get_attribute(list, "__call__")(__args_4, __kwargs_4); var __args_5, __kwargs_5; __args_5 = create_array(func, get_attribute(objs, "js_object")); -__kwargs_5 = {}; +__kwargs_5 = Object(); set_attribute(out, "js_object", get_attribute(map, "__call__")(__args_5, __kwargs_5)); return out; } var Iterator, __Iterator_attrs, __Iterator_parents; -__Iterator_attrs = {}; +__Iterator_attrs = Object(); __Iterator_parents = create_array(); var __Iterator___init__ = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "obj", "index")}; +signature = {"kwargs": Object(), "args": create_array("self", "obj", "index")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var obj = arguments['obj']; @@ -457,13 +499,13 @@ set_attribute(self, "index", index); __Iterator_attrs.__init__ = __Iterator___init__; var __Iterator_next = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self")}; +signature = {"kwargs": Object(), "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; index = get_attribute(self, "index"); var __args_6, __kwargs_6; __args_6 = create_array(get_attribute(self, "obj")); -__kwargs_6 = {}; +__kwargs_6 = Object(); length = get_attribute(len, "__call__")(__args_6, __kwargs_6); if(index == length) { throw StopIteration; @@ -471,7 +513,7 @@ throw StopIteration; var __args_7, __kwargs_7; __args_7 = create_array(get_attribute(self, "index")); -__kwargs_7 = {}; +__kwargs_7 = Object(); item = get_attribute(get_attribute(get_attribute(self, "obj"), "get"), "__call__")(__args_7, __kwargs_7); set_attribute(self, "index", get_attribute(self, "index") + 1); return item; @@ -480,7 +522,7 @@ return item; __Iterator_attrs.next = __Iterator_next; Iterator = create_class("Iterator", __Iterator_parents, __Iterator_attrs); var list, __list_attrs, __list_parents; -__list_attrs = {}; +__list_attrs = Object(); __list_parents = create_array(); var __list___init__ = function(args, kwargs) { var signature, arguments; @@ -500,7 +542,7 @@ set_attribute(self, "js_object", create_array()); __list_attrs.__init__ = __list___init__; var __list_append = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "obj")}; +signature = {"kwargs": Object(), "args": create_array("self", "obj")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var obj = arguments['obj']; @@ -512,20 +554,20 @@ __array.push(obj); __list_attrs.append = __list_append; var __list_extend = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "other")}; +signature = {"kwargs": Object(), "args": create_array("self", "other")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var other = arguments['other']; var __iterator__, obj; -__iterator__ = get_attribute(get_attribute(other, "__iter__"), "__call__")(create_array(), {}); +__iterator__ = get_attribute(get_attribute(other, "__iter__"), "__call__")(create_array(), Object()); try { -obj = get_attribute(__iterator__, "next")(create_array(), {}); +obj = get_attribute(__iterator__, "next")(create_array(), Object()); while(true) { var __args_8, __kwargs_8; __args_8 = create_array(obj); -__kwargs_8 = {}; +__kwargs_8 = Object(); get_attribute(get_attribute(self, "append"), "__call__")(__args_8, __kwargs_8); -obj = get_attribute(__iterator__, "next")(create_array(), {}); +obj = get_attribute(__iterator__, "next")(create_array(), Object()); } } catch(__exception__) { @@ -540,7 +582,7 @@ if (__exception__ == StopIteration || isinstance([__exception__, StopIteration]) __list_attrs.extend = __list_extend; var __list_insert = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "index", "obj")}; +signature = {"kwargs": Object(), "args": create_array("self", "index", "obj")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var index = arguments['index']; @@ -553,14 +595,14 @@ __array.splice(index, 0, obj); __list_attrs.insert = __list_insert; var __list_remove = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "obj")}; +signature = {"kwargs": Object(), "args": create_array("self", "obj")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var obj = arguments['obj']; var __array; var __args_9, __kwargs_9; __args_9 = create_array(obj); -__kwargs_9 = {}; +__kwargs_9 = Object(); index = get_attribute(get_attribute(self, "index"), "__call__")(__args_9, __kwargs_9); __array = get_attribute(self, "js_object"); __array.splice(index, 1); @@ -569,7 +611,7 @@ __array.splice(index, 1); __list_attrs.remove = __list_remove; var __list_pop = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self")}; +signature = {"kwargs": Object(), "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var __array; @@ -580,7 +622,7 @@ return __array.pop(); __list_attrs.pop = __list_pop; var __list_index = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "obj")}; +signature = {"kwargs": Object(), "args": create_array("self", "obj")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var obj = arguments['obj']; @@ -592,21 +634,21 @@ return __array.indexOf(obj); __list_attrs.index = __list_index; var __list_count = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "obj")}; +signature = {"kwargs": Object(), "args": create_array("self", "obj")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var obj = arguments['obj']; i = 0; var __iterator__, other; -__iterator__ = get_attribute(get_attribute(self, "__iter__"), "__call__")(create_array(), {}); +__iterator__ = get_attribute(get_attribute(self, "__iter__"), "__call__")(create_array(), Object()); try { -other = get_attribute(__iterator__, "next")(create_array(), {}); +other = get_attribute(__iterator__, "next")(create_array(), Object()); while(true) { if(other == obj) { i = i + 1; } -other = get_attribute(__iterator__, "next")(create_array(), {}); +other = get_attribute(__iterator__, "next")(create_array(), Object()); } } catch(__exception__) { @@ -622,7 +664,7 @@ return i; __list_attrs.count = __list_count; var __list_reverse = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self")}; +signature = {"kwargs": Object(), "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var __array; @@ -633,7 +675,7 @@ set_attribute(self, "js_object", __array.reverse()); __list_attrs.reverse = __list_reverse; var __list_shift = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self")}; +signature = {"kwargs": Object(), "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var __array; @@ -644,7 +686,7 @@ return __array.shift(); __list_attrs.shift = __list_shift; var __list_slice = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "start", "end")}; +signature = {"kwargs": Object(), "args": create_array("self", "start", "end")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var start = arguments['start']; @@ -657,19 +699,19 @@ return __array.slice(start, end); __list_attrs.slice = __list_slice; var __list___iter__ = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self")}; +signature = {"kwargs": Object(), "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var __args_10, __kwargs_10; __args_10 = create_array(self, 0); -__kwargs_10 = {}; +__kwargs_10 = Object(); return get_attribute(Iterator, "__call__")(__args_10, __kwargs_10); } __list_attrs.__iter__ = __list___iter__; var __list_get = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "index")}; +signature = {"kwargs": Object(), "args": create_array("self", "index")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var index = arguments['index']; @@ -681,7 +723,7 @@ return __array[index]; __list_attrs.get = __list_get; var __list_set = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "index", "value")}; +signature = {"kwargs": Object(), "args": create_array("self", "index", "value")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var index = arguments['index']; @@ -694,7 +736,7 @@ __array[index] = value; __list_attrs.set = __list_set; var __list___len__ = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self")}; +signature = {"kwargs": Object(), "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var __array; @@ -705,7 +747,7 @@ return __array.length; __list_attrs.__len__ = __list___len__; list = create_class("list", __list_parents, __list_attrs); var dict, __dict_attrs, __dict_parents; -__dict_attrs = {}; +__dict_attrs = Object(); __dict_parents = create_array(); var __dict___init__ = function(args, kwargs) { var signature, arguments; @@ -717,7 +759,7 @@ if(js_object) { set_attribute(self, "js_object", js_object); } else { -set_attribute(self, "js_object", {}); +set_attribute(self, "js_object", Object()); } } @@ -725,7 +767,7 @@ set_attribute(self, "js_object", {}); __dict_attrs.__init__ = __dict___init__; var __dict_get = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "key", "d")}; +signature = {"kwargs": Object(), "args": create_array("self", "key", "d")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var key = arguments['key']; @@ -742,7 +784,7 @@ return d; __dict_attrs.get = __dict_get; var __dict_set = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "key", "value")}; +signature = {"kwargs": Object(), "args": create_array("self", "key", "value")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var key = arguments['key']; @@ -755,7 +797,7 @@ __dict[key] = value; __dict_attrs.set = __dict_set; var __dict___len__ = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self")}; +signature = {"kwargs": Object(), "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var __dict; @@ -766,7 +808,7 @@ return Object.keys(__dict).length; __dict_attrs.__len__ = __dict___len__; var __dict_keys = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self")}; +signature = {"kwargs": Object(), "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var __dict, out; @@ -774,7 +816,7 @@ __dict = get_attribute(self, "js_object"); __keys = Object.keys(__dict); var __args_11, __kwargs_11; __args_11 = create_array(); -__kwargs_11 = {}; +__kwargs_11 = Object(); out = get_attribute(list, "__call__")(__args_11, __kwargs_11); set_attribute(out, "js_object", __keys); return out; @@ -783,34 +825,34 @@ return out; __dict_attrs.keys = __dict_keys; dict = create_class("dict", __dict_parents, __dict_attrs); var str, __str_attrs, __str_parents; -__str_attrs = {}; +__str_attrs = Object(); __str_parents = create_array(); __str_parents.push(list); var __str___init__ = function(args, kwargs) { var signature, arguments; -signature = {"kwargs": {}, "args": create_array("self", "jsstring")}; +signature = {"kwargs": Object(), "args": create_array("self", "jsstring")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var jsstring = arguments['jsstring']; var __args_12, __kwargs_12; __args_12 = create_array(self); -__kwargs_12 = {}; +__kwargs_12 = Object(); get_attribute(get_attribute(list, "__init__"), "__call__")(__args_12, __kwargs_12); var char; var __iterator__, i; var __args_13, __kwargs_13; __args_13 = create_array(jsstring.length); -__kwargs_13 = {}; -__iterator__ = get_attribute(get_attribute(get_attribute(range, "__call__")(__args_13, __kwargs_13), "__iter__"), "__call__")(create_array(), {}); +__kwargs_13 = Object(); +__iterator__ = get_attribute(get_attribute(get_attribute(range, "__call__")(__args_13, __kwargs_13), "__iter__"), "__call__")(create_array(), Object()); try { -i = get_attribute(__iterator__, "next")(create_array(), {}); +i = get_attribute(__iterator__, "next")(create_array(), Object()); while(true) { char = jsstring.charAt(i); var __args_14, __kwargs_14; __args_14 = create_array(char); -__kwargs_14 = {}; +__kwargs_14 = Object(); get_attribute(get_attribute(self, "append"), "__call__")(__args_14, __kwargs_14); -i = get_attribute(__iterator__, "next")(create_array(), {}); +i = get_attribute(__iterator__, "next")(create_array(), Object()); } } catch(__exception__) { diff --git a/pythonscript/pythonjs.py b/pythonscript/pythonjs.py index 8ec7a0f..e777a55 100755 --- a/pythonscript/pythonjs.py +++ b/pythonscript/pythonjs.py @@ -111,9 +111,9 @@ def visit_Call(self, node): kwargs = map(self.visit, node.keywords) f = lambda x: '"%s": %s' % (x[0], x[1]) out = ', '.join(map(f, kwargs)) + return '{%s}' % out else: - out = '' - return '{%s}' % out + return 'Object()' if name == 'var': args = map(self.visit, node.args) out = ', '.join(args) diff --git a/runtime/pythonpythonjs.py b/runtime/pythonpythonjs.py index a65680a..e93b010 100644 --- a/runtime/pythonpythonjs.py +++ b/runtime/pythonpythonjs.py @@ -262,3 +262,28 @@ def isinstance(args, kwargs): if object_class is None: return False return issubclass(create_array(object_class, klass)) + + +# not part of Python, but it's here because it's easier to write +# in PythonJS + +def json_to_pythonscript(json): + var(jstype, item, output) + jstype = JS('typeof json') + if jstype == 'number': + return json + if jstype == 'string': + return json + if JS("Object.prototype.toString.call(json) === '[object Array]'"): + output = list.__call__([]) + var(append) + for item in json: + append = get_attribute(output, 'append') + append([json_to_pythonscript(item)]) + return output + # else it's a map + output = dict.__call__([]) + for key in JS('Object.keys(json)'): + set = get_attribute(output, 'set') + set([key, json_to_pythonscript(json[key])]) + return output From 7b37946f947a9c8c1fa25bd947195ab40e631069 Mon Sep 17 00:00:00 2001 From: Amirouche Boubekki Date: Wed, 11 Sep 2013 22:07:48 +0200 Subject: [PATCH 060/860] typofix (critical) --- pythonscript/python_to_pythonjs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index 9c0dfcf..00b89d2 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -299,7 +299,7 @@ def visit_FunctionDef(self, node): for arg in node.args.args: writer.write("""JS("var %s = arguments['%s']")""" % (arg.id, arg.id)) if node.args.vararg: - writer.write("""JS("var %s arguments['%s']")""" % (node.args.vararg, node.args.vararg)) + writer.write("""JS("var %s = arguments['%s']")""" % (node.args.vararg, node.args.vararg)) # turn it into a list expr = '%s = get_attribute(list, "__call__")(create_array(%s), {});' expr = expr % (node.args.vararg, node.args.vararg) From f0b6276d1cefbfc9f88e0d03e5866db76e758232 Mon Sep 17 00:00:00 2001 From: Amirouche Boubekki Date: Thu, 12 Sep 2013 20:48:50 +0200 Subject: [PATCH 061/860] Several fixes in jQuery bindings renamed appendTo -> append_to, addClass -> add_class fix J.text to work with and without args (like jQuery.text) Fix similarly J.value Fix J.map --- bindings/jquery.py | 21 ++++++--- bindings/jquery.py.js | 105 +++++++++++++++++++++++------------------- pythonscript.js | 43 +++++------------ runtime/builtins.py | 11 ++--- setup.py | 4 +- 5 files changed, 90 insertions(+), 94 deletions(-) diff --git a/bindings/jquery.py b/bindings/jquery.py index e25e479..b190ac3 100644 --- a/bindings/jquery.py +++ b/bindings/jquery.py @@ -8,7 +8,7 @@ def add(self, arg): o = JS('j.add(arg)') return J(o) - def addClass(self, klass): + def add_class(self, klass): j = self.j o = JS('j.addClass(klass)') return J(o) @@ -28,7 +28,7 @@ def append(self, arg): o = JS('j.append(arg)') return J(o) - def appendTo(self, arg): + def append_to(self, arg): j = self.j o = JS('j.appendTo(arg)') return J(o) @@ -111,6 +111,7 @@ def detach(self, selector): return J(o) def each(self, handler): + """Iterate over a jQuery object, executing a function for each matched element that takes index and element (js object) as argument""" j = self.j o = JS('j.each(adapt_arguments(handler))') return J(o) @@ -331,8 +332,11 @@ def submit(self, clear_queue, jump_to_end): def text(self, text): j = self.j - o = JS('j.text(text)') - return J(o) + if text != None: + o = J(JS('j.text(text)')) + else: + o = JS('j.text()') + return o def toggle(self, duration, complete): j = self.j @@ -356,8 +360,11 @@ def unbind(self, event, handler): def value(self, value): j = self.j - o = JS('j.val(value)') - return J(o) + if value is None: + o = JS('j.val()') + else: + o = JS('j.val(value)') + return o def width(self, value): j = self.j @@ -370,7 +377,7 @@ def length(self): def map(self, func): j = self.j - o = JS('j.map(func)') + o = JS('j.map(adapt_arguments(func))') return J(o) def mousedown(self, handler): diff --git a/bindings/jquery.py.js b/bindings/jquery.py.js index f8792c3..ce8614a 100644 --- a/bindings/jquery.py.js +++ b/bindings/jquery.py.js @@ -26,7 +26,7 @@ return get_attribute(J, "__call__")(__args_0, __kwargs_0); } __J_attrs.add = __J_add; -var __J_addClass = function(args, kwargs) { +var __J_add_class = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "klass")}; arguments = get_arguments(signature, args, kwargs); @@ -40,7 +40,7 @@ __kwargs_1 = Object(); return get_attribute(J, "__call__")(__args_1, __kwargs_1); } -__J_attrs.addClass = __J_addClass; +__J_attrs.add_class = __J_add_class; var __J_after = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "arg")}; @@ -89,7 +89,7 @@ return get_attribute(J, "__call__")(__args_4, __kwargs_4); } __J_attrs.append = __J_append; -var __J_appendTo = function(args, kwargs) { +var __J_append_to = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "arg")}; arguments = get_arguments(signature, args, kwargs); @@ -103,7 +103,7 @@ __kwargs_5 = Object(); return get_attribute(J, "__call__")(__args_5, __kwargs_5); } -__J_attrs.appendTo = __J_appendTo; +__J_attrs.append_to = __J_append_to; var __J_attr = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "key", "value")}; @@ -1006,11 +1006,17 @@ arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var text = arguments['text']; j = get_attribute(self, "j"); -o = j.text(text); +if(text != undefined) { var __args_62, __kwargs_62; -__args_62 = create_array(o); +__args_62 = create_array(j.text(text)); __kwargs_62 = Object(); -return get_attribute(J, "__call__")(__args_62, __kwargs_62); +o = get_attribute(J, "__call__")(__args_62, __kwargs_62); +} +else { +o = j.text(); +} + +return o; } __J_attrs.text = __J_text; @@ -1083,11 +1089,14 @@ arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var value = arguments['value']; j = get_attribute(self, "j"); +if(value === undefined) { +o = j.val(); +} +else { o = j.val(value); -var __args_67, __kwargs_67; -__args_67 = create_array(o); -__kwargs_67 = Object(); -return get_attribute(J, "__call__")(__args_67, __kwargs_67); +} + +return o; } __J_attrs.value = __J_value; @@ -1099,10 +1108,10 @@ var self = arguments['self']; var value = arguments['value']; j = get_attribute(self, "j"); o = j.width(value); -var __args_68, __kwargs_68; -__args_68 = create_array(o); -__kwargs_68 = Object(); -return get_attribute(J, "__call__")(__args_68, __kwargs_68); +var __args_67, __kwargs_67; +__args_67 = create_array(o); +__kwargs_67 = Object(); +return get_attribute(J, "__call__")(__args_67, __kwargs_67); } __J_attrs.width = __J_width; @@ -1123,11 +1132,11 @@ arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var func = arguments['func']; j = get_attribute(self, "j"); -o = j.map(func); -var __args_69, __kwargs_69; -__args_69 = create_array(o); -__kwargs_69 = Object(); -return get_attribute(J, "__call__")(__args_69, __kwargs_69); +o = j.map(adapt_arguments(func)); +var __args_68, __kwargs_68; +__args_68 = create_array(o); +__kwargs_68 = Object(); +return get_attribute(J, "__call__")(__args_68, __kwargs_68); } __J_attrs.map = __J_map; @@ -1139,10 +1148,10 @@ var self = arguments['self']; var handler = arguments['handler']; j = get_attribute(self, "j"); o = j.mousedown(adapt_arguments(handler)); -var __args_70, __kwargs_70; -__args_70 = create_array(o); -__kwargs_70 = Object(); -return get_attribute(J, "__call__")(__args_70, __kwargs_70); +var __args_69, __kwargs_69; +__args_69 = create_array(o); +__kwargs_69 = Object(); +return get_attribute(J, "__call__")(__args_69, __kwargs_69); } __J_attrs.mousedown = __J_mousedown; @@ -1154,10 +1163,10 @@ var self = arguments['self']; var handler = arguments['handler']; j = get_attribute(self, "j"); o = j.mouseenter(adapt_arguments(handler)); -var __args_71, __kwargs_71; -__args_71 = create_array(o); -__kwargs_71 = Object(); -return get_attribute(J, "__call__")(__args_71, __kwargs_71); +var __args_70, __kwargs_70; +__args_70 = create_array(o); +__kwargs_70 = Object(); +return get_attribute(J, "__call__")(__args_70, __kwargs_70); } __J_attrs.mouseenter = __J_mouseenter; @@ -1169,10 +1178,10 @@ var self = arguments['self']; var handler = arguments['handler']; j = get_attribute(self, "j"); o = j.mouseleave(adapt_arguments(handler)); -var __args_72, __kwargs_72; -__args_72 = create_array(o); -__kwargs_72 = Object(); -return get_attribute(J, "__call__")(__args_72, __kwargs_72); +var __args_71, __kwargs_71; +__args_71 = create_array(o); +__kwargs_71 = Object(); +return get_attribute(J, "__call__")(__args_71, __kwargs_71); } __J_attrs.mouseleave = __J_mouseleave; @@ -1184,10 +1193,10 @@ var self = arguments['self']; var handler = arguments['handler']; j = get_attribute(self, "j"); o = j.mousemove(adapt_arguments(handler)); -var __args_73, __kwargs_73; -__args_73 = create_array(o); -__kwargs_73 = Object(); -return get_attribute(J, "__call__")(__args_73, __kwargs_73); +var __args_72, __kwargs_72; +__args_72 = create_array(o); +__kwargs_72 = Object(); +return get_attribute(J, "__call__")(__args_72, __kwargs_72); } __J_attrs.mousemove = __J_mousemove; @@ -1199,10 +1208,10 @@ var self = arguments['self']; var handler = arguments['handler']; j = get_attribute(self, "j"); o = j.mouseout(adapt_arguments(handler)); -var __args_74, __kwargs_74; -__args_74 = create_array(o); -__kwargs_74 = Object(); -return get_attribute(J, "__call__")(__args_74, __kwargs_74); +var __args_73, __kwargs_73; +__args_73 = create_array(o); +__kwargs_73 = Object(); +return get_attribute(J, "__call__")(__args_73, __kwargs_73); } __J_attrs.mouseout = __J_mouseout; @@ -1214,10 +1223,10 @@ var self = arguments['self']; var handler = arguments['handler']; j = get_attribute(self, "j"); o = j.mouseover(adapt_arguments(handler)); -var __args_75, __kwargs_75; -__args_75 = create_array(o); -__kwargs_75 = Object(); -return get_attribute(J, "__call__")(__args_75, __kwargs_75); +var __args_74, __kwargs_74; +__args_74 = create_array(o); +__kwargs_74 = Object(); +return get_attribute(J, "__call__")(__args_74, __kwargs_74); } __J_attrs.mouseover = __J_mouseover; @@ -1229,10 +1238,10 @@ var self = arguments['self']; var handler = arguments['handler']; j = get_attribute(self, "j"); o = j.mouseup(adapt_arguments(handler)); -var __args_76, __kwargs_76; -__args_76 = create_array(o); -__kwargs_76 = Object(); -return get_attribute(J, "__call__")(__args_76, __kwargs_76); +var __args_75, __kwargs_75; +__args_75 = create_array(o); +__kwargs_75 = Object(); +return get_attribute(J, "__call__")(__args_75, __kwargs_75); } __J_attrs.mouseup = __J_mouseup; diff --git a/pythonscript.js b/pythonscript.js index 0f6ffa7..73a6271 100644 --- a/pythonscript.js +++ b/pythonscript.js @@ -407,9 +407,6 @@ var iter = Object.keys(json); for (var key=0; key < iter.length; key++) { var backup = key; key = iter[key]; -console.log("!"); -console.log(key); -console.log(json[key]); set = get_attribute(output, "set"); set([key, json_to_pythonscript(json[key])]); key = backup; @@ -827,42 +824,26 @@ dict = create_class("dict", __dict_parents, __dict_attrs); var str, __str_attrs, __str_parents; __str_attrs = Object(); __str_parents = create_array(); -__str_parents.push(list); var __str___init__ = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "jsstring")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var jsstring = arguments['jsstring']; -var __args_12, __kwargs_12; -__args_12 = create_array(self); -__kwargs_12 = Object(); -get_attribute(get_attribute(list, "__init__"), "__call__")(__args_12, __kwargs_12); -var char; -var __iterator__, i; -var __args_13, __kwargs_13; -__args_13 = create_array(jsstring.length); -__kwargs_13 = Object(); -__iterator__ = get_attribute(get_attribute(get_attribute(range, "__call__")(__args_13, __kwargs_13), "__iter__"), "__call__")(create_array(), Object()); -try { -i = get_attribute(__iterator__, "next")(create_array(), Object()); -while(true) { -char = jsstring.charAt(i); -var __args_14, __kwargs_14; -__args_14 = create_array(char); -__kwargs_14 = Object(); -get_attribute(get_attribute(self, "append"), "__call__")(__args_14, __kwargs_14); -i = get_attribute(__iterator__, "next")(create_array(), Object()); -} -} -catch(__exception__) { -if (__exception__ == StopIteration || isinstance([__exception__, StopIteration])) { - -} - +set_attribute(self, "jsstring", jsstring); } +__str_attrs.__init__ = __str___init__; +var __str___iter__ = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": Object(), "args": create_array("self")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var __args_12, __kwargs_12; +__args_12 = create_array(get_attribute(self, "jsstring"), 0); +__kwargs_12 = Object(); +return get_attribute(Iterator, "__call__")(__args_12, __kwargs_12); } -__str_attrs.__init__ = __str___init__; +__str_attrs.__iter__ = __str___iter__; str = create_class("str", __str_parents, __str_attrs); diff --git a/runtime/builtins.py b/runtime/builtins.py index 54b9ec4..3bbd29f 100644 --- a/runtime/builtins.py +++ b/runtime/builtins.py @@ -162,11 +162,10 @@ def keys(self): return out -class str(list): +class str: def __init__(self, jsstring): - list.__init__(self) - var(char) - for i in range(JS('jsstring.length')): - char = JS('jsstring.charAt(i)') - self.append(char) + self.jsstring = jsstring + + def __iter__(self): + return Iterator(self.jsstring, 0) diff --git a/setup.py b/setup.py index 4fc3315..c4e3255 100755 --- a/setup.py +++ b/setup.py @@ -12,8 +12,8 @@ packages=['pythonscript'], entry_points=""" [console_scripts] - pythonjs=pythonscript.pythonjs:main - pythonscript=pythonscript.main:command + pythonjs=pythonscript.pythonjs:command + pythonscript=pythonscript.pythonscript:command python_to_pythonjs=pythonscript.python_to_pythonjs:command """, install_script='bin/pythonscript', From bc2cd5d8f7cdd0ecf80ce85cf2b0b12abfd3f09d Mon Sep 17 00:00:00 2001 From: hartsantler Date: Wed, 18 Sep 2013 03:15:54 -0700 Subject: [PATCH 062/860] starting to make compatible with python2 and python3 --- pythonscript/python_to_pythonjs.py | 8 ++++++-- pythonscript/pythonjs.py | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index 00b89d2..9d73e0e 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -14,7 +14,11 @@ from ast import parse from ast import NodeVisitor -from cStringIO import StringIO as StringIO +if sys.version_info.major == 3: + import io + StringIO = io.StringIO +else: + from cStringIO import StringIO as StringIO class Writer(object): @@ -349,7 +353,7 @@ def main(script): def command(): - print main(sys.stdin.read()) + print( main(sys.stdin.read()) ) if __name__ == '__main__': diff --git a/pythonscript/pythonjs.py b/pythonscript/pythonjs.py index e777a55..ba2703c 100755 --- a/pythonscript/pythonjs.py +++ b/pythonscript/pythonjs.py @@ -248,7 +248,7 @@ def main(script): def command(): - print main(sys.stdin.read()) + print( main(sys.stdin.read()) ) if __name__ == '__main__': command() From 5185ce1c133610ac892d43d2734797cd24ac9cc0 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Thu, 19 Sep 2013 04:39:34 -0700 Subject: [PATCH 063/860] wrapped map call with list so its compatible with old style py2 map. --- pythonscript/python_to_pythonjs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index 9d73e0e..67ac59e 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -238,7 +238,7 @@ def visit_Expr(self, node): def visit_Call(self, node): if hasattr(node.func, 'id') and node.func.id in ('JS', 'toString', 'JSObject', 'JSArray', 'var'): - args = map(self.visit, node.args) + args = list( map(self.visit, node.args) ) ## map in py3 returns an iterator not a list kwargs = map(lambda x: '%s=%s' % (x.arg, self.visit(x.value)), node.keywords) args.extend(kwargs) args = ', '.join(args) From 277cd3d374ba8b85b5f7cbf9b3db23d2e591cc25 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Sat, 21 Sep 2013 20:31:30 -0700 Subject: [PATCH 064/860] added inplace assigment to python_to_pythonjs.py visit_AugAssign --- pythonscript/python_to_pythonjs.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index 67ac59e..e08e216 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -59,6 +59,10 @@ class PythonToPythonJS(NodeVisitor): identifier = 0 + def visit_AugAssign(self, node): + a = '%s %s= %s' %(self.visit(node.target), self.visit(node.op), self.visit(node.value)) + writer.write(a) + def visit_ImportFrom(self, node): # ignore "import from" # print node.module From 0b8f0644f433dc4866e528cfb1efa0cca52b194b Mon Sep 17 00:00:00 2001 From: hartsantler Date: Sat, 21 Sep 2013 20:37:51 -0700 Subject: [PATCH 065/860] added inplace assignment support to pythonjs.py visit_AugAssign --- pythonscript/pythonjs.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pythonscript/pythonjs.py b/pythonscript/pythonjs.py index ba2703c..18dd51a 100755 --- a/pythonscript/pythonjs.py +++ b/pythonscript/pythonjs.py @@ -11,6 +11,9 @@ class JSGenerator(NodeVisitor): + def visit_AugAssign(self, node): + a = '%s %s= %s' %(self.visit(node.target), self.visit(node.op), self.visit(node.value)) + return a def visit_Module(self, node): return '\n'.join(map(self.visit, node.body)) From d1ff6847608dd0dfd098c30c7c8df6748025ec88 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Mon, 23 Sep 2013 00:03:10 -0700 Subject: [PATCH 066/860] adding simple operator overloading, __getattr__ --- pythonscript/python_to_pythonjs.py | 34 ++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index e08e216..95736d4 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -59,6 +59,12 @@ class PythonToPythonJS(NodeVisitor): identifier = 0 + def __init__(self): + super(PythonToPythonJS, self).__init__() + self._classes = dict() ## class name : [method names] + self._names = set() + self._instances = dict() ## instance name : class name + def visit_AugAssign(self, node): a = '%s %s= %s' %(self.visit(node.target), self.visit(node.op), self.visit(node.value)) writer.write(a) @@ -75,6 +81,8 @@ def visit_Yield(self, node): def visit_ClassDef(self, node): name = node.name + self._classes[ name ] = list() ## method names + writer.write('var(%s, __%s_attrs, __%s_parents)' % (name, name, name)) writer.write('__%s_attrs = JSObject()' % name) writer.write('__%s_parents = JSArray()' % name) @@ -83,6 +91,7 @@ def visit_ClassDef(self, node): writer.write(code) for item in node.body: if isinstance(item, FunctionDef): + self._classes[ name ].append( item.name ) item_name = item.name item.name = '__%s_%s' % (name, item_name) self.visit(item) # this will output the code for the function @@ -186,7 +195,15 @@ def visit_UnaryOp(self, node): return self.visit(node.op) + self.visit(node.operand) def visit_Attribute(self, node): - return 'get_attribute(%s, "%s")' % (self.visit(node.value), node.attr) + name = self.visit(node.value) + if name in self._instances: ## support '.' operator overloading + klass = self._instances[ name ] + if '__getattr__' in self._classes[ klass ]: + return '__%s___getattr__( [%s, "%s"] )' % (klass, name, node.attr) + else: + return 'get_attribute(%s, "%s")' % (name, node.attr) + else: + return 'get_attribute(%s, "%s")' % (name, node.attr) def visit_Subscript(self, node): return 'get_attribute(%s, "__getitem__")([%s], JSObject())' % ( @@ -212,7 +229,15 @@ def visit_Assign(self, node): ) writer.write(code) elif isinstance(target, Name): + + if isinstance(node.value, Call) and hasattr(node.value.func, 'id') and node.value.func.id in self._classes: + writer.write('## creating class: %s ' %node.value.func.id) + self._instances[ target.id ] = node.value.func.id ## keep track of instances + elif target.id in self._instances: + self._instances.pop( target.id ) + writer.write('%s = %s' % (target.id, self.visit(node.value))) + else: # it's a Tuple id = self.identifier self.identifier += 1 @@ -262,7 +287,12 @@ def visit_Call(self, node): kwargs = self.visit(node.kwargs) code = "JS('for (var name in %s) { %s[name] = %s[name]; }')" % (kwargs, kwargs_name, kwargs) writer.append(code) - return 'get_attribute(%s, "__call__")(%s, %s)' % (self.visit(node.func), args_name, kwargs_name) + + name = self.visit(node.func) + if name in self._classes: + return 'get_attribute(%s, "__call__")(%s, %s) #create class instance#' % (name, args_name, kwargs_name) + else: + return 'get_attribute(%s, "__call__")(%s, %s) #function call#' % (name, args_name, kwargs_name) def visit_FunctionDef(self, node): writer.write('def %s(args, kwargs):' % node.name) From e3e61088498a581b7359719d5cbd01073a81e865 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Mon, 23 Sep 2013 00:48:05 -0700 Subject: [PATCH 067/860] added support for [] subscript operator overloading ( __getitem__ ). --- pythonscript/python_to_pythonjs.py | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index 95736d4..87fbe1c 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -205,11 +205,25 @@ def visit_Attribute(self, node): else: return 'get_attribute(%s, "%s")' % (name, node.attr) + def visit_Index(self, node): + return self.visit(node.value) + def visit_Subscript(self, node): - return 'get_attribute(%s, "__getitem__")([%s], JSObject())' % ( - self.visit(node.value), - self.visit(node.slice), - ) + name = self.visit(node.value) + if name in self._instances: ## support x[y] operator overloading + klass = self._instances[ name ] + if '__getitem__' in self._classes[ klass ]: + return '__%s___getitem__( [%s, %s] )' % (klass, name, self.visit(node.slice)) + else: + return 'get_attribute(%s, "__getitem__")([%s], JSObject())' % ( + self.visit(node.value), + self.visit(node.slice), + ) + else: + return 'get_attribute(%s, "__getitem__")([%s], JSObject())' % ( + self.visit(node.value), + self.visit(node.slice), + ) def visit_Slice(self, node): return "get_attribute(Slice, '__call__')([%s, %s, %s], JSObject())" % (self.visit(node.lower), self.visit(node.upper), self.visit(node.step)) From 6b4ebdb006571e3a823d5d465a268e103023e04d Mon Sep 17 00:00:00 2001 From: hartsantler Date: Mon, 23 Sep 2013 14:24:33 -0700 Subject: [PATCH 068/860] keep track of references to instances by simple assignment. --- pythonscript/python_to_pythonjs.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index 87fbe1c..9c878be 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -250,7 +250,12 @@ def visit_Assign(self, node): elif target.id in self._instances: self._instances.pop( target.id ) - writer.write('%s = %s' % (target.id, self.visit(node.value))) + if isinstance(node.value, Name): + name = self.visit(node.value) + if name in self._instances: self._instances[ target.id ] = self._instances[ name ] + writer.write('%s = %s' % (target.id, name)) + else: + writer.write('%s = %s' % (target.id, self.visit(node.value))) else: # it's a Tuple id = self.identifier From 27bb869e7c115f85ef9a385c1d8a248bd74bbb9d Mon Sep 17 00:00:00 2001 From: hartsantler Date: Mon, 23 Sep 2013 22:59:44 -0700 Subject: [PATCH 069/860] hijacking "assert isinstance( someinstance, SomeClass )" as a hackish type-system. --- pythonscript/python_to_pythonjs.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index 9c878be..ff69671 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -65,6 +65,13 @@ def __init__(self): self._names = set() self._instances = dict() ## instance name : class name + def visit_Assert(self, node): + ## hijacking "assert isinstance(a,A)" as a type system ## + if isinstance( node.test, Call ) and node.test.func.id == 'isinstance': + a,b = node.test.args + if b.id in self._classes: + self._instances[ a.id ] = b.id + def visit_AugAssign(self, node): a = '%s %s= %s' %(self.visit(node.target), self.visit(node.op), self.visit(node.value)) writer.write(a) From e05311e9fb080166dd4b8a4586909bd49a889c45 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Tue, 24 Sep 2013 03:50:34 -0700 Subject: [PATCH 070/860] added "in" to test if something is in an dictionary (visit_In) this works in javascript on objects, self.__dict__ is an object, but this will fail on a javascript array. --- pythonscript/python_to_pythonjs.py | 3 +++ pythonscript/pythonjs.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index ff69671..d2526f9 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -72,6 +72,9 @@ def visit_Assert(self, node): if b.id in self._classes: self._instances[ a.id ] = b.id + def visit_In(self, node): + return ' in ' + def visit_AugAssign(self, node): a = '%s %s= %s' %(self.visit(node.target), self.visit(node.op), self.visit(node.value)) writer.write(a) diff --git a/pythonscript/pythonjs.py b/pythonscript/pythonjs.py index 18dd51a..03a184e 100755 --- a/pythonscript/pythonjs.py +++ b/pythonscript/pythonjs.py @@ -11,6 +11,9 @@ class JSGenerator(NodeVisitor): + def visit_In(self, node): + return ' in ' + def visit_AugAssign(self, node): a = '%s %s= %s' %(self.visit(node.target), self.visit(node.op), self.visit(node.value)) return a From 25beaed7c7aa370b4bfaac9ae91a636dc58aa76f Mon Sep 17 00:00:00 2001 From: hartsantler Date: Tue, 24 Sep 2013 04:08:04 -0700 Subject: [PATCH 071/860] fixed list literals --- pythonscript/python_to_pythonjs.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index d2526f9..38e560f 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -72,6 +72,9 @@ def visit_Assert(self, node): if b.id in self._classes: self._instances[ a.id ] = b.id + def visit_List(self, node): + return '[%s]' % ', '.join(map(self.visit, node.elts)) + def visit_In(self, node): return ' in ' From 958d11d1b16b04636ff64a65f09a151ba8ea5674 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Tue, 24 Sep 2013 04:52:33 -0700 Subject: [PATCH 072/860] really fixed list literals --- pythonscript/python_to_pythonjs.py | 10 +++++++--- pythonscript/pythonjs.py | 3 +++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index 38e560f..1ad53ab 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -72,8 +72,12 @@ def visit_Assert(self, node): if b.id in self._classes: self._instances[ a.id ] = b.id + def visit_Tuple(self, node): + ## TODO how to deal with tuples + return '(%s)' % ', '.join(map(self.visit, node.elts)) + def visit_List(self, node): - return '[%s]' % ', '.join(map(self.visit, node.elts)) + return 'get_attribute(list, "__call__")(create_array([%s]), Object())' % ', '.join(map(self.visit, node.elts)) def visit_In(self, node): return ' in ' @@ -322,9 +326,9 @@ def visit_Call(self, node): name = self.visit(node.func) if name in self._classes: - return 'get_attribute(%s, "__call__")(%s, %s) #create class instance#' % (name, args_name, kwargs_name) + return 'get_attribute(%s, "__call__")(%s, %s)' % (name, args_name, kwargs_name) else: - return 'get_attribute(%s, "__call__")(%s, %s) #function call#' % (name, args_name, kwargs_name) + return 'get_attribute(%s, "__call__")(%s, %s)' % (name, args_name, kwargs_name) def visit_FunctionDef(self, node): writer.write('def %s(args, kwargs):' % node.name) diff --git a/pythonscript/pythonjs.py b/pythonscript/pythonjs.py index 03a184e..514ebc5 100755 --- a/pythonscript/pythonjs.py +++ b/pythonscript/pythonjs.py @@ -21,6 +21,9 @@ def visit_AugAssign(self, node): def visit_Module(self, node): return '\n'.join(map(self.visit, node.body)) + def visit_Tuple(self, node): + return '[%s]' % ', '.join(map(self.visit, node.elts)) + def visit_List(self, node): return '[%s]' % ', '.join(map(self.visit, node.elts)) From 678361c49f4111574a683f1842bdbf9fd5c20592 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Tue, 24 Sep 2013 06:07:32 -0700 Subject: [PATCH 073/860] added mini standard library, "from time import time" inserts javascript wrapper to "new Date().getTime()" --- pythonscript/python_to_pythonjs.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index 1ad53ab..1eb474c 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -54,7 +54,11 @@ def getvalue(self): writer = Writer() - +MINI_STDLIB = { + 'time': { + 'time': 'function time() { return new Date().getTime(); }' + } +} class PythonToPythonJS(NodeVisitor): identifier = 0 @@ -87,11 +91,10 @@ def visit_AugAssign(self, node): writer.write(a) def visit_ImportFrom(self, node): - # ignore "import from" - # print node.module - # print node.names[0].name - # print node.level - pass + if node.module in MINI_STDLIB: + for n in node.names: + if n.name in MINI_STDLIB[ node.module ]: + writer.write( 'JS("%s")' %MINI_STDLIB[node.module][n.name] ) def visit_Yield(self, node): return 'yield %s' % self.visit(node.value) From f2633613191fcb544bae334c4a8ba2c5fe83eca4 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Tue, 24 Sep 2013 06:16:22 -0700 Subject: [PATCH 074/860] added random.random to mini standard library --- pythonscript/python_to_pythonjs.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index 1eb474c..c2196b3 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -57,6 +57,9 @@ def getvalue(self): MINI_STDLIB = { 'time': { 'time': 'function time() { return new Date().getTime(); }' + }, + 'random': { + 'random': 'var random = Math.random' } } class PythonToPythonJS(NodeVisitor): From 05c0bc3454bc2767256e4ada2a9badceb2bf47c3 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Wed, 25 Sep 2013 00:39:31 -0700 Subject: [PATCH 075/860] made __getattr__ correct, it first checks if instance has the attribute before calling the user defined __getattr__ --- pythonscript/python_to_pythonjs.py | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index c2196b3..21b2751 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -56,7 +56,7 @@ def getvalue(self): MINI_STDLIB = { 'time': { - 'time': 'function time() { return new Date().getTime(); }' + 'time': 'function time() { return new Date().getTime() / 1000.0; }' }, 'random': { 'random': 'var random = Math.random' @@ -102,6 +102,25 @@ def visit_ImportFrom(self, node): def visit_Yield(self, node): return 'yield %s' % self.visit(node.value) + def _gen_getattr_helper(self, class_name, func_name): + ''' + This helper is used to emulate how Python works, __getattr__ is only supposed + to be called when the attribute is not found on the instance. + ''' + a = [ + 'def __%s____getattr_helper(args, kwargs):' %class_name, + ' var(signature, arguments)', + ' signature = JSObject(kwargs=JSObject(), args=JSArray("self", "name"))', + ' arguments = get_arguments(signature, args, kwargs)', + ''' JS("var self = arguments['self']")''', + ''' JS("var name = arguments['name']")''', + ' if name in get_attribute(self, "__dict__"):', + ' return get_attribute(getattr, "__call__")( JSArray(self,name), JSObject() )', + ' else:', + ' return %s( [self, name] )' %func_name + ] + return '\n'.join(a) + def visit_ClassDef(self, node): name = node.name self._classes[ name ] = list() ## method names @@ -119,6 +138,10 @@ def visit_ClassDef(self, node): item.name = '__%s_%s' % (name, item_name) self.visit(item) # this will output the code for the function writer.write('__%s_attrs.%s = %s' % (name, item_name, item.name)) + + if item_name == '__getattr__': + writer.write( self._gen_getattr_helper(name, item.name) ) + elif isinstance(item, Assign): item_name = item.targets[0].id item.targets[0].id = '__%s_%s' % (name.id, item_name) @@ -222,7 +245,7 @@ def visit_Attribute(self, node): if name in self._instances: ## support '.' operator overloading klass = self._instances[ name ] if '__getattr__' in self._classes[ klass ]: - return '__%s___getattr__( [%s, "%s"] )' % (klass, name, node.attr) + return '__%s____getattr_helper( [%s, "%s"] )' % (klass, name, node.attr) else: return 'get_attribute(%s, "%s")' % (name, node.attr) else: @@ -422,6 +445,7 @@ def visit_While(self, node): writer.pull() + def main(script): input = parse(script) PythonToPythonJS().visit(input) From 223d4051c25c9bc92f21c985c9ba9fd7c571b80f Mon Sep 17 00:00:00 2001 From: hartsantler Date: Thu, 26 Sep 2013 01:39:28 -0700 Subject: [PATCH 076/860] @inline class decorator to speed up attribute lookups, bypassing get_attribute. made Closure Compiler compatible. --- pythonscript/python_to_pythonjs.py | 44 ++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 5 deletions(-) diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index 21b2751..113a60a 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -69,6 +69,8 @@ class PythonToPythonJS(NodeVisitor): def __init__(self): super(PythonToPythonJS, self).__init__() self._classes = dict() ## class name : [method names] + self._inline_classes = dict() ## class name : [attribute names] + self._catch_attributes = None self._names = set() self._instances = dict() ## instance name : class name @@ -124,6 +126,10 @@ def _gen_getattr_helper(self, class_name, func_name): def visit_ClassDef(self, node): name = node.name self._classes[ name ] = list() ## method names + self._catch_attributes = None + for dec in node.decorator_list: + if isinstance(dec, Name) and dec.id == 'inline': + self._catch_attributes = set() writer.write('var(%s, __%s_attrs, __%s_parents)' % (name, name, name)) writer.write('__%s_attrs = JSObject()' % name) @@ -137,7 +143,8 @@ def visit_ClassDef(self, node): item_name = item.name item.name = '__%s_%s' % (name, item_name) self.visit(item) # this will output the code for the function - writer.write('__%s_attrs.%s = %s' % (name, item_name, item.name)) + #writer.write('__%s_attrs.%s = %s' % (name, item_name, item.name)) ## not ClosureCompiler compatible + writer.write('__%s_attrs["%s"] = %s' % (name, item_name, item.name)) if item_name == '__getattr__': writer.write( self._gen_getattr_helper(name, item.name) ) @@ -146,7 +153,12 @@ def visit_ClassDef(self, node): item_name = item.targets[0].id item.targets[0].id = '__%s_%s' % (name.id, item_name) self.visit(item) # this will output the code for the assign - writer.write('%s_attrs.%s = %s' % (name, item_name, item.targets[0].id)) + #writer.write('%s_attrs.%s = %s' % (name, item_name, item.targets[0].id)) ## not ClosureCompiler compatible + writer.write('%s_attrs["%s"] = %s' % (name, item_name, item.targets[0].id)) + + if self._catch_attributes: self._inline_classes[ name ] = self._catch_attributes + self._catch_attributes = None + writer.write('%s = create_class("%s", __%s_parents, __%s_attrs)' % (name, name, name, name)) def visit_If(self, node): @@ -245,9 +257,27 @@ def visit_Attribute(self, node): if name in self._instances: ## support '.' operator overloading klass = self._instances[ name ] if '__getattr__' in self._classes[ klass ]: - return '__%s____getattr_helper( [%s, "%s"] )' % (klass, name, node.attr) + if klass in self._inline_classes: ## static attribute + if node.attr in self._inline_classes[klass]: + #return '''JS('%s.__dict__["%s"]')''' %(name, node.attr) ## this is not ClosureCompiler compatible + return '''JS('%s["__dict__"]["%s"]')''' %(name, node.attr) + elif node.attr in self._classes[ klass ]: ## method + return '''JS('__%s_attrs["%s"]')''' %(klass, node.attr) + else: + return '''JS('__%s___getattr__( [%s, "%s"] )')''' %(klass, name, node.attr) + + else: ## dynamic python style + return '__%s____getattr_helper( [%s, "%s"] )' % (klass, name, node.attr) else: - return 'get_attribute(%s, "%s")' % (name, node.attr) + if klass in self._inline_classes: ## static attribute + if node.attr in self._inline_classes[klass]: + return '''JS('%s["__dict__"]["%s"]')''' %(name, node.attr) + elif node.attr in self._classes[ klass ]: ## method + return '''JS('__%s_attrs["%s"]')''' %(klass, node.attr) + else: + return '''JS('__%s___getattr__( [%s, "%s"] )')''' %(klass, name, node.attr) + else: + return 'get_attribute(%s, "%s")' % (name, node.attr) else: return 'get_attribute(%s, "%s")' % (name, node.attr) @@ -282,8 +312,12 @@ def visit_Assign(self, node): code = code % (self.visit(target.value), self.visit(target.slice.value), self.visit(node.value)) writer.write(code) elif isinstance(target, Attribute): + name = self.visit(target.value) + if name == 'self' and isinstance(self._catch_attributes, set): + self._catch_attributes.add( target.attr ) + code = 'set_attribute(%s, "%s", %s)' % ( - self.visit(target.value), + name, target.attr, self.visit(node.value) ) From 351edab6db44f91b848bc54f98876c62d9aa9ebe Mon Sep 17 00:00:00 2001 From: hartsantler Date: Thu, 26 Sep 2013 04:25:17 -0700 Subject: [PATCH 077/860] optimized functions with no arguments --- pythonscript/python_to_pythonjs.py | 99 +++++++++++++++--------------- 1 file changed, 50 insertions(+), 49 deletions(-) diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index 113a60a..f6282a9 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -397,55 +397,56 @@ def visit_FunctionDef(self, node): writer.write('def %s(args, kwargs):' % node.name) writer.push() - # new pythonjs' python function arguments handling - # create the structure representing the functions arguments - # first create the defaultkwargs JSObject - writer.write('var(signature, arguments)') - L = len(node.args.defaults) - kwargsdefault = map(lambda x: keyword(self.visit(x[0]), x[1]), zip(node.args.args[-L:], node.args.defaults)) - kwargsdefault = Call( - Name('JSObject', None), - [], - kwargsdefault, - None, - None - ) - args = Call( - Name('JSArray', None), - map(lambda x: Str(x.id), node.args.args), - [], - None, - None - ) - keywords = list([ - keyword(Name('kwargs', None), kwargsdefault), - keyword(Name('args', None), args), - ]) - if node.args.vararg: - keywords.append(keyword(Name('vararg', None), Str(node.args.vararg))) - if node.args.kwarg: - keywords.append(keyword(Name('varkwarg', None), Str(node.args.kwarg))) - - prebody = list() - - # create a JS Object to store the value of each parameter - signature = ', '.join(map(lambda x: '%s=%s' % (self.visit(x.arg), self.visit(x.value)), keywords)) - writer.write('signature = JSObject(%s)' % signature) - writer.write('arguments = get_arguments(signature, args, kwargs)') - # # then for each argument assign its value - for arg in node.args.args: - writer.write("""JS("var %s = arguments['%s']")""" % (arg.id, arg.id)) - if node.args.vararg: - writer.write("""JS("var %s = arguments['%s']")""" % (node.args.vararg, node.args.vararg)) - # turn it into a list - expr = '%s = get_attribute(list, "__call__")(create_array(%s), {});' - expr = expr % (node.args.vararg, node.args.vararg) - writer.write(expr) - if node.args.kwarg: - writer.write("""JS('var %s = arguments["%s"]')""" % (node.args.kwarg, node.args.kwarg)) - expr = '%s = get_attribute(dict, "__call__")(create_array(%s), {});' - expr = expr % (node.args.kwarg, node.args.kwarg) - writer.write(expr) + if len(node.args.defaults) or len(node.args.args) or node.args.vararg or node.args.kwarg: + # new pythonjs' python function arguments handling + # create the structure representing the functions arguments + # first create the defaultkwargs JSObject + writer.write('var(signature, arguments)') + L = len(node.args.defaults) + kwargsdefault = map(lambda x: keyword(self.visit(x[0]), x[1]), zip(node.args.args[-L:], node.args.defaults)) + kwargsdefault = Call( + Name('JSObject', None), + [], + kwargsdefault, + None, + None + ) + args = Call( + Name('JSArray', None), + map(lambda x: Str(x.id), node.args.args), + [], + None, + None + ) + keywords = list([ + keyword(Name('kwargs', None), kwargsdefault), + keyword(Name('args', None), args), + ]) + if node.args.vararg: + keywords.append(keyword(Name('vararg', None), Str(node.args.vararg))) + if node.args.kwarg: + keywords.append(keyword(Name('varkwarg', None), Str(node.args.kwarg))) + + prebody = list() ## NOT USED? + + # create a JS Object to store the value of each parameter + signature = ', '.join(map(lambda x: '%s=%s' % (self.visit(x.arg), self.visit(x.value)), keywords)) + writer.write('signature = JSObject(%s)' % signature) + writer.write('arguments = get_arguments(signature, args, kwargs)') + # # then for each argument assign its value + for arg in node.args.args: + writer.write("""JS("var %s = arguments['%s']")""" % (arg.id, arg.id)) + if node.args.vararg: + writer.write("""JS("var %s = arguments['%s']")""" % (node.args.vararg, node.args.vararg)) + # turn it into a list + expr = '%s = get_attribute(list, "__call__")(create_array(%s), {});' + expr = expr % (node.args.vararg, node.args.vararg) + writer.write(expr) + if node.args.kwarg: + writer.write("""JS('var %s = arguments["%s"]')""" % (node.args.kwarg, node.args.kwarg)) + expr = '%s = get_attribute(dict, "__call__")(create_array(%s), {});' + expr = expr % (node.args.kwarg, node.args.kwarg) + writer.write(expr) map(self.visit, node.body) writer.pull() From fed3156d5901b28c08d843d210696a80571be7d9 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Thu, 26 Sep 2013 20:42:11 -0700 Subject: [PATCH 078/860] optimized calls with no args --- pythonscript/python_to_pythonjs.py | 38 +++++++++++++++++------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index f6282a9..05c5eaf 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -372,26 +372,32 @@ def visit_Call(self, node): args = ', '.join(args) return '%s(%s)' % (node.func.id, args) else: - args = ', '.join(map(self.visit, node.args)) - kwargs = ', '.join(map(lambda x: '%s=%s' % (x.arg, self.visit(x.value)), node.keywords)) - args_name = '__args_%s' % self.identifier - kwargs_name = '__kwargs_%s' % self.identifier - writer.append('var(%s, %s)' % (args_name, kwargs_name)) - self.identifier += 1 - writer.append('%s = JSArray(%s)' % (args_name, args)) - if node.starargs: - writer.append('%s.push.apply(%s, %s)' % (args_name, args_name, self.visit(node.starargs))) - writer.append('%s = JSObject(%s)' % (kwargs_name, kwargs)) - if node.kwargs: - kwargs = self.visit(node.kwargs) - code = "JS('for (var name in %s) { %s[name] = %s[name]; }')" % (kwargs, kwargs_name, kwargs) - writer.append(code) + + call_has_args = len(node.args) or len(node.keywords) or node.starargs or node.kwargs + + if call_has_args: + args = ', '.join(map(self.visit, node.args)) + kwargs = ', '.join(map(lambda x: '%s=%s' % (x.arg, self.visit(x.value)), node.keywords)) + args_name = '__args_%s' % self.identifier + kwargs_name = '__kwargs_%s' % self.identifier + writer.append('var(%s, %s)' % (args_name, kwargs_name)) + self.identifier += 1 + writer.append('%s = JSArray(%s)' % (args_name, args)) + if node.starargs: + writer.append('%s.push.apply(%s, %s)' % (args_name, args_name, self.visit(node.starargs))) + writer.append('%s = JSObject(%s)' % (kwargs_name, kwargs)) + if node.kwargs: + kwargs = self.visit(node.kwargs) + code = "JS('for (var name in %s) { %s[name] = %s[name]; }')" % (kwargs, kwargs_name, kwargs) + writer.append(code) name = self.visit(node.func) - if name in self._classes: + if call_has_args: return 'get_attribute(%s, "__call__")(%s, %s)' % (name, args_name, kwargs_name) + elif name in self._classes: + return 'get_attribute(%s, "__call__")( JSArray(), JSObject() )' %name else: - return 'get_attribute(%s, "__call__")(%s, %s)' % (name, args_name, kwargs_name) + return '%s()' %name def visit_FunctionDef(self, node): writer.write('def %s(args, kwargs):' % node.name) From c67658d59caf83b1eabcf98ce7fb36214e85df53 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Sat, 28 Sep 2013 16:35:26 -0700 Subject: [PATCH 079/860] starting wrapper for THREE.js note: this module is licensed BSD, not LGPL! --- bindings/three.py | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 bindings/three.py diff --git a/bindings/three.py b/bindings/three.py new file mode 100644 index 0000000..23ea79f --- /dev/null +++ b/bindings/three.py @@ -0,0 +1,42 @@ +# THREE.js wrapper for PythonScript +# by Brett Hartshorn - copyright 2013 +# License: "New" BSD + +class _Scene: + def __init__(self): + self._scene = JS('new THREE.Scene()') + +class _CSS3DRenderer: + def __init__(self): + self._renderer = JS('new THREE.CSS3DRenderer()') + + def setSize(self, width, height): + renderer = self._renderer + JS('renderer.setSize( width, height )') + + def getDomElement(self): + renderer = self._renderer + return JS('renderer.domElement') + + +class _ImageUtils: + def loadTexture( url ): + return JS('THREE.ImageUtils.loadTexture(url)') + + def loadTextureCube( urls ): + ## TODO THREE.CubeRefractionMapping() + JS('var _mapping = new THREE.CubeReflectionMapping()') + return JS('THREE.ImageUtils.loadTextureCube(urls, _mapping)') + +class _Three: + def __init__(self): + self.ImageUtils = _ImageUtils() + + def Scene(self): + return _Scene() + + def CSS3DRenderer(self): + return _CSS3DRenderer() + + +Three = _Three() \ No newline at end of file From 9aba94db7b33cddb5e7bd0640e22f00af48a5cb8 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Sun, 29 Sep 2013 07:09:31 -0700 Subject: [PATCH 080/860] wrapping more Three.js classes --- bindings/three.py | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/bindings/three.py b/bindings/three.py index 23ea79f..d654ba9 100644 --- a/bindings/three.py +++ b/bindings/three.py @@ -2,22 +2,45 @@ # by Brett Hartshorn - copyright 2013 # License: "New" BSD +class _ObjectBase: + def add(self, child): + ob = self._object + JS('ob.add(child)') + +class _PerspectiveCamera( _ObjectBase ): + + class _Scene: def __init__(self): self._scene = JS('new THREE.Scene()') -class _CSS3DRenderer: - def __init__(self): - self._renderer = JS('new THREE.CSS3DRenderer()') + def add(self, child): + scene = self._scene + JS('scene.add(child)') + +class _Renderer: def setSize(self, width, height): renderer = self._renderer JS('renderer.setSize( width, height )') + def setClearColor(self, red=1.0, green=1.0, blue=1.0, alpha=1.0): + renderer = self._renderer + JS('renderer.setClearColor( {r:red, g:green, b:blue}, alpha)') + + +class _CSS3DRenderer( _Renderer ): + def __init__(self): + self._renderer = JS('new THREE.CSS3DRenderer()') + def getDomElement(self): renderer = self._renderer return JS('renderer.domElement') +class _WebGLRenderer( _Renderer ): + def __init__(self): + self._renderer = JS('new THREE.WebGLRenderer()') + class _ImageUtils: def loadTexture( url ): @@ -38,5 +61,9 @@ def Scene(self): def CSS3DRenderer(self): return _CSS3DRenderer() + def WebGLRenderer(self): + return _WebGLRenderer() + + Three = _Three() \ No newline at end of file From 83bfb40a62e7c4b77e284794a470849cfbf3ba54 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Sun, 29 Sep 2013 11:12:03 -0700 Subject: [PATCH 081/860] THREE.js: added wrappers for Orthographic and Perspective camera types. --- bindings/three.py | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/bindings/three.py b/bindings/three.py index d654ba9..5ebec32 100644 --- a/bindings/three.py +++ b/bindings/three.py @@ -7,7 +7,35 @@ def add(self, child): ob = self._object JS('ob.add(child)') -class _PerspectiveCamera( _ObjectBase ): +class _Camera( _ObjectBase ): + + def updateProjectionMatrix(self): + ob = self._object + JS('ob.updateProjectionMatrix()') + +class _OrthographicCamera( _Camera ): + def __init__(self, left, right, top, bottom, near, far): + self._object = JS('new THREE.OrthographicCamera(left, right, top, bottom, near, far)') + +class _PerspectiveCamera( _Camera ): + def __init__(self, fov, aspect, near, far): + self._object = JS('new THREE.PerspectiveCamera(fov, aspect, near, far)') + + def setLens(self, focalLength, frameSize): + '''Uses Focal Length (in mm) to estimate and set FOV + * 35mm (fullframe) camera is used if frame size is not specified; + * Formula based on http://www.bobatkins.com/photography/technical/field_of_view.html + ''' + ob = self._object + JS('ob.setLens(focalLength, frameSize)') + + def setViewOffset(self, fullWidth, fullHeight, x, y, width, height): + ''' + Sets an offset in a larger frustum. This is useful for multi-window or + multi-monitor/multi-machine setups. + ''' + ob = self._object + JS('ob.setViewOffset(fullWidth, fullHeight, x, y, width, height)') class _Scene: @@ -64,6 +92,10 @@ def CSS3DRenderer(self): def WebGLRenderer(self): return _WebGLRenderer() + def PerspectiveCamera(self, fov, aspect, near, far): + return _PerspectiveCamera(fov, aspect, near, far) + def OrthographicCamera(left, right, top, bottom, near, far): + return _OrthographicCamera(left, right, top, bottom, near, far) Three = _Three() \ No newline at end of file From a8ee64dd1894275afa2bec90dac1480821f20f33 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Tue, 1 Oct 2013 23:21:56 -0700 Subject: [PATCH 082/860] added Tornado test server that automatically converts python scripts into javascript. --- bindings/three.py | 7 +- tests/helloworld.html | 15 ++++ tests/server.py | 171 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 192 insertions(+), 1 deletion(-) create mode 100644 tests/helloworld.html create mode 100755 tests/server.py diff --git a/bindings/three.py b/bindings/three.py index 5ebec32..9a34f7e 100644 --- a/bindings/three.py +++ b/bindings/three.py @@ -1,6 +1,11 @@ # THREE.js wrapper for PythonScript # by Brett Hartshorn - copyright 2013 -# License: "New" BSD +# License: PSFLv2 - http://www.python.org/psf/license/ + + +class _Vector3: + def __init__(self, jsobject=None): + self._vec = jsobject class _ObjectBase: def add(self, child): diff --git a/tests/helloworld.html b/tests/helloworld.html new file mode 100644 index 0000000..0661590 --- /dev/null +++ b/tests/helloworld.html @@ -0,0 +1,15 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/tests/server.py b/tests/server.py new file mode 100755 index 0000000..b81a5cb --- /dev/null +++ b/tests/server.py @@ -0,0 +1,171 @@ +#!/usr/bin/python3 +# Test Server for PythonScript +# by Brett Hartshorn - copyright 2013 +# License: PSFLv2 - http://www.python.org/psf/license/ +# Requires: Python3 and Tornado + +try: + import tornado +except ImportError: + print('ERROR: Tornado is not installed') + print('download Tornado from - http://www.tornadoweb.org/en/stable/') + raise SystemExit + +import tornado.ioloop +import tornado.web +import os, subprocess + +PATHS = dict( + webroot = os.path.dirname(os.path.abspath(__file__)), + pythonscript = os.path.abspath('../pythonscript'), + bindings = os.path.abspath('../bindings'), + closure = os.path.expanduser( '~/closure-compiler/compiler.jar'), + runtime = os.path.abspath('../pythonscript.js'), +) + + +def python_to_pythonjs( src ): + p = subprocess.Popen( + ['python2', os.path.join( PATHS['pythonscript'], 'python_to_pythonjs.py')], + stdin = subprocess.PIPE, + stdout = subprocess.PIPE + ) + stdout, stderr = p.communicate( src.encode('utf-8') ) + return stdout.decode('utf-8') + +def pythonjs_to_javascript( src, closure_compiler=False ): + p = subprocess.Popen( + ['python2', os.path.join( PATHS['pythonscript'],'pythonjs.py')], + stdin = subprocess.PIPE, + stdout = subprocess.PIPE + ) + stdout, stderr = p.communicate( src.encode('utf-8') ) + a = stdout.decode('utf-8') + + if closure_compiler and os.path.isfile( PATHS['closure'] ): + x = '/tmp/input.js'; y = '/tmp/output.js' + f = open(x, 'wb'); f.write( a.encode('utf-8') ); f.close() + subprocess.call( ['java', '-jar', PATHS['closure'], '--compilation_level', 'ADVANCED_OPTIMIZATIONS', '--js', x, '--js_output_file', y] ) + f = open(y, 'rb'); a = f.read().decode('utf-8'); f.close() + + return a + +def python_to_javascript( src, closure_compiler=False ): + a = python_to_pythonjs( src ) + return pythonjs_to_javascript( a, closure_compiler=closure_compiler ) + + + +######################################################### +def get_main_page(): + root = PATHS['webroot'] + r = ['index'] + r.append( '
    ' ) + for name in os.listdir( root ): + if name == os.path.split(__file__)[-1]: continue + path = os.path.join( root, name ) + if os.path.isfile( path ): + r.append( '
  • %s
  • ' %(name,name) ) + r.append('
') + r.append('') + return ''.join(r) + + +def convert_python_html_document( data ): + ''' + rewrites html document, converts python scripts into javascript. + example: + + ''' + doc = list() + script = None + use_closure = False + for line in data.splitlines(): + if line.strip().startswith('') + script = list() + + elif line.strip() == '': + if script: + src = '\n'.join( script ) + js = python_to_javascript( src, closure_compiler=use_closure ) + doc.append( js ) + doc.append( line ) + script = None + + elif isinstance( script, list ): + script.append( line ) + + else: + doc.append( line ) + + return '\n'.join( doc ) + +class MainHandler( tornado.web.RequestHandler ): + def get(self, path=None): + print('path', path) + if not path: + self.write( get_main_page() ) + elif path == 'pythonscript.js': + data = open( PATHS['runtime'], 'rb').read() + self.set_header("Content-Type", "text/javascript; charset=utf-8") + self.set_header("Content-Length", len(data)) + self.write(data) + elif path.startswith('bindings/'): + name = path.split('/')[-1] + local_path = os.path.join( PATHS['bindings'], name ) + + if os.path.isfile( local_path ): + data = open(local_path, 'rb').read() + else: + raise tornado.web.HTTPError(404) + + if path.endswith('.py'): + data = python_to_javascript( data.decode('utf-8'), closure_compiler=False ) + + self.set_header("Content-Type", "text/javascript; charset=utf-8") + self.set_header("Content-Length", len(data)) + self.write( data ) + + else: + local_path = os.path.join( PATHS['webroot'], path ) + if os.path.isfile( local_path ): + data = open(local_path, 'rb').read() + if path.endswith( '.html' ): + data = convert_python_html_document( data.decode('utf-8') ) + self.set_header("Content-Type", "text/html; charset=utf-8") + elif path.endswith('.py'): + data = python_to_javascript( data.decode('utf-8'), closure_compiler=True ) + self.set_header("Content-Type", "text/html; charset=utf-8") + + self.set_header("Content-Length", len(data)) + self.write( data ) + + else: + self.write('Hello World') + + +Handlers = [ + (r'/(.*)', MainHandler) +] + + +if __name__ == '__main__': + assert os.path.isfile( PATHS['runtime'] ) + assert os.path.isdir( PATHS['pythonscript'] ) + assert os.path.isdir( PATHS['bindings'] ) + + app = tornado.web.Application( + Handlers, + #cookie_secret = 'some random text', + #login_url = '/login', + #xsrf_cookies = False, + ) + + + app.listen( 8080 ) + tornado.ioloop.IOLoop.instance().start() \ No newline at end of file From f841952eb3920b9d3bd6bec907604f954a992c9f Mon Sep 17 00:00:00 2001 From: hartsantler Date: Wed, 2 Oct 2013 03:19:43 -0700 Subject: [PATCH 083/860] fixed Google Closure compiler, export functions to window global namespace. --- pythonscript/pythonjs.py | 1 + tests/server.py | 9 +++++++-- tests/test_closure.html | 22 ++++++++++++++++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 tests/test_closure.html diff --git a/pythonscript/pythonjs.py b/pythonscript/pythonjs.py index 514ebc5..13c23ee 100755 --- a/pythonscript/pythonjs.py +++ b/pythonscript/pythonjs.py @@ -78,6 +78,7 @@ def visit_FunctionDef(self, node): body.append(self.visit(child)) buffer += '\n'.join(body) buffer += '\n}\n' + buffer += 'window["%s"] = %s \n' % (node.name, node.name) ## export to global namespace so Closure will not remove them return buffer def visit_Subscript(self, node): diff --git a/tests/server.py b/tests/server.py index b81a5cb..4063ab6 100755 --- a/tests/server.py +++ b/tests/server.py @@ -43,9 +43,14 @@ def pythonjs_to_javascript( src, closure_compiler=False ): a = stdout.decode('utf-8') if closure_compiler and os.path.isfile( PATHS['closure'] ): - x = '/tmp/input.js'; y = '/tmp/output.js' + x = '/tmp/input.js'; y = '/tmp/output.js'; f = open(x, 'wb'); f.write( a.encode('utf-8') ); f.close() - subprocess.call( ['java', '-jar', PATHS['closure'], '--compilation_level', 'ADVANCED_OPTIMIZATIONS', '--js', x, '--js_output_file', y] ) + subprocess.call([ + 'java', '-jar', PATHS['closure'], + '--compilation_level', 'ADVANCED_OPTIMIZATIONS', + '--js', x, '--js_output_file', y, + #'--create_name_map_files', + ]) f = open(y, 'rb'); a = f.read().decode('utf-8'); f.close() return a diff --git a/tests/test_closure.html b/tests/test_closure.html new file mode 100644 index 0000000..4f8e0a6 --- /dev/null +++ b/tests/test_closure.html @@ -0,0 +1,22 @@ + + + + + + + + + + + \ No newline at end of file From 6d7af795607bac11d8dfb503297fee03629762ca Mon Sep 17 00:00:00 2001 From: hartsantler Date: Wed, 2 Oct 2013 19:04:50 -0700 Subject: [PATCH 084/860] ignore doc strings in function definitions --- pythonscript/python_to_pythonjs.py | 16 ++++++++++++++-- tests/server.py | 28 ++++++++++++++++++++++++++-- tests/test_threejs.html | 24 ++++++++++++++++++++++++ 3 files changed, 64 insertions(+), 4 deletions(-) create mode 100644 tests/test_threejs.html diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index 05c5eaf..83db14e 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -1,5 +1,6 @@ #!/usr/bin/env python import sys +from types import GeneratorType from ast import Str from ast import Call @@ -433,7 +434,7 @@ def visit_FunctionDef(self, node): if node.args.kwarg: keywords.append(keyword(Name('varkwarg', None), Str(node.args.kwarg))) - prebody = list() ## NOT USED? + #prebody = list() ## NOT USED? # create a JS Object to store the value of each parameter signature = ', '.join(map(lambda x: '%s=%s' % (self.visit(x.arg), self.visit(x.value)), keywords)) @@ -454,7 +455,18 @@ def visit_FunctionDef(self, node): expr = expr % (node.args.kwarg, node.args.kwarg) writer.write(expr) - map(self.visit, node.body) + #map(self.visit, node.body) + for child in node.body: + # simple test to drop triple quote comments + if hasattr(child, 'value'): + if isinstance(child.value, Str): + continue + if isinstance(child, GeneratorType): + for sub in child: + self.visit(sub) + else: + self.visit(child) + writer.pull() # apply decorators diff --git a/tests/server.py b/tests/server.py index 4063ab6..9a335ec 100755 --- a/tests/server.py +++ b/tests/server.py @@ -24,6 +24,7 @@ ) + def python_to_pythonjs( src ): p = subprocess.Popen( ['python2', os.path.join( PATHS['pythonscript'], 'python_to_pythonjs.py')], @@ -49,6 +50,7 @@ def pythonjs_to_javascript( src, closure_compiler=False ): 'java', '-jar', PATHS['closure'], '--compilation_level', 'ADVANCED_OPTIMIZATIONS', '--js', x, '--js_output_file', y, + '--formatting', 'PRETTY_PRINT', #'--create_name_map_files', ]) f = open(y, 'rb'); a = f.read().decode('utf-8'); f.close() @@ -56,7 +58,7 @@ def pythonjs_to_javascript( src, closure_compiler=False ): return a def python_to_javascript( src, closure_compiler=False ): - a = python_to_pythonjs( src ) + a = python_to_pythonjs( src ); print(a) return pythonjs_to_javascript( a, closure_compiler=closure_compiler ) @@ -154,8 +156,30 @@ def get(self, path=None): self.write('Hello World') +LIBS = dict( + three = {'three.min.js' : os.path.expanduser( '~/three.js/build/three.min.js')}, + tween = {'tween' : os.path.expanduser( '~/tween.js/build/tween.min.js')}, +) + +class LibsHandler( tornado.web.RequestHandler ): + def get(self, path=None): + print('path', path) + module, name = path.split('/') + assert module in LIBS + assert name in LIBS[ module ] + if os.path.isfile( LIBS[module][name] ): + data = open( LIBS[module][name], 'rb').read() + else: + raise tornado.web.HTTPError(404) + + self.set_header("Content-Type", "text/javascript; charset=utf-8") + self.set_header("Content-Length", len(data)) + self.write( data ) + + Handlers = [ - (r'/(.*)', MainHandler) + (r'/libs/(.*)', LibsHandler), + (r'/(.*)', MainHandler), ## order is important, this comes last. ] diff --git a/tests/test_threejs.html b/tests/test_threejs.html new file mode 100644 index 0000000..963936e --- /dev/null +++ b/tests/test_threejs.html @@ -0,0 +1,24 @@ + + + + + + + + + + + + + \ No newline at end of file From bdbd0fb0d01d104ab2637828834462a22a4b5629 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Wed, 2 Oct 2013 21:21:44 -0700 Subject: [PATCH 085/860] added support for getter/setter @property decorator --- pythonscript/python_to_pythonjs.py | 81 ++++++++++++++++++++++++++---- tests/first-class_function.html | 30 +++++++++++ tests/property_decorator.html | 49 ++++++++++++++++++ 3 files changed, 149 insertions(+), 11 deletions(-) create mode 100644 tests/first-class_function.html create mode 100644 tests/property_decorator.html diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index 83db14e..8b059f9 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -74,6 +74,8 @@ def __init__(self): self._catch_attributes = None self._names = set() self._instances = dict() ## instance name : class name + self._decorator_properties = dict() + self._decorator_class_props = dict() def visit_Assert(self, node): ## hijacking "assert isinstance(a,A)" as a type system ## @@ -128,6 +130,8 @@ def visit_ClassDef(self, node): name = node.name self._classes[ name ] = list() ## method names self._catch_attributes = None + self._decorator_properties = dict() ## property names : {'get':func, 'set':func} + for dec in node.decorator_list: if isinstance(dec, Name) and dec.id == 'inline': self._catch_attributes = set() @@ -142,10 +146,15 @@ def visit_ClassDef(self, node): if isinstance(item, FunctionDef): self._classes[ name ].append( item.name ) item_name = item.name + item.original_name = item.name item.name = '__%s_%s' % (name, item_name) + self.visit(item) # this will output the code for the function - #writer.write('__%s_attrs.%s = %s' % (name, item_name, item.name)) ## not ClosureCompiler compatible - writer.write('__%s_attrs["%s"] = %s' % (name, item_name, item.name)) + + if item_name in self._decorator_properties: + pass + else: + writer.write('__%s_attrs["%s"] = %s' % (name, item_name, item.name)) if item_name == '__getattr__': writer.write( self._gen_getattr_helper(name, item.name) ) @@ -154,11 +163,16 @@ def visit_ClassDef(self, node): item_name = item.targets[0].id item.targets[0].id = '__%s_%s' % (name.id, item_name) self.visit(item) # this will output the code for the assign - #writer.write('%s_attrs.%s = %s' % (name, item_name, item.targets[0].id)) ## not ClosureCompiler compatible writer.write('%s_attrs["%s"] = %s' % (name, item_name, item.targets[0].id)) - if self._catch_attributes: self._inline_classes[ name ] = self._catch_attributes + if self._catch_attributes: + self._inline_classes[ name ] = self._catch_attributes + if self._decorator_properties: + self._decorator_class_props[ name ] = self._decorator_properties + writer.write('#@props: %s'%self._decorator_properties) + self._catch_attributes = None + self._decorator_properties = None writer.write('%s = create_class("%s", __%s_parents, __%s_attrs)' % (name, name, name, name)) @@ -264,6 +278,9 @@ def visit_Attribute(self, node): return '''JS('%s["__dict__"]["%s"]')''' %(name, node.attr) elif node.attr in self._classes[ klass ]: ## method return '''JS('__%s_attrs["%s"]')''' %(klass, node.attr) + elif klass in self._decorator_class_props and node.attr in self._decorator_class_props[klass]: + getter = self._decorator_class_props[klass][node.attr]['get'] + return '''JS('%s( [%s] )')''' %(getter, name) else: return '''JS('__%s___getattr__( [%s, "%s"] )')''' %(klass, name, node.attr) @@ -275,8 +292,16 @@ def visit_Attribute(self, node): return '''JS('%s["__dict__"]["%s"]')''' %(name, node.attr) elif node.attr in self._classes[ klass ]: ## method return '''JS('__%s_attrs["%s"]')''' %(klass, node.attr) + elif klass in self._decorator_class_props and node.attr in self._decorator_class_props[klass]: + getter = self._decorator_class_props[klass][node.attr]['get'] + return '''JS('%s( [%s] )')''' %(getter, name) else: return '''JS('__%s___getattr__( [%s, "%s"] )')''' %(klass, name, node.attr) + + elif klass in self._decorator_class_props and node.attr in self._decorator_class_props[klass]: + getter = self._decorator_class_props[klass][node.attr]['get'] + return '''JS('%s( [%s] )')''' %(getter, name) + else: return 'get_attribute(%s, "%s")' % (name, node.attr) else: @@ -317,12 +342,23 @@ def visit_Assign(self, node): if name == 'self' and isinstance(self._catch_attributes, set): self._catch_attributes.add( target.attr ) - code = 'set_attribute(%s, "%s", %s)' % ( - name, - target.attr, - self.visit(node.value) - ) - writer.write(code) + fallback = True + if name in self._instances: ## support '.' operator overloading + klass = self._instances[ name ] + if klass in self._decorator_class_props and target.attr in self._decorator_class_props[klass]: + setter = self._decorator_class_props[klass][target.attr].get( 'set', None ) + if setter: + writer.write( '''JS('%s( [%s, %s] )')''' %(setter, name, self.visit(node.value)) ) + fallback = False + + + if fallback: + code = 'set_attribute(%s, "%s", %s)' % ( + name, + target.attr, + self.visit(node.value) + ) + writer.write(code) elif isinstance(target, Name): if isinstance(node.value, Call) and hasattr(node.value.func, 'id') and node.value.func.id in self._classes: @@ -401,6 +437,29 @@ def visit_Call(self, node): return '%s()' %name def visit_FunctionDef(self, node): + property_decorator = None + decorators = [] + for decorator in reversed(node.decorator_list): + if isinstance(decorator, Name) and decorator.id == 'property': + property_decorator = decorator + n = node.name + '__getprop__' + self._decorator_properties[ node.original_name ] = dict( get=n ) + node.name = n + + elif isinstance(decorator, Attribute) and isinstance(decorator.value, Name) and decorator.value.id in self._decorator_properties: + if decorator.attr == 'setter': + n = node.name + '__setprop__' + self._decorator_properties[ decorator.value.id ]['set'] = n + node.name = n + elif decorator.attr == 'deleter': + raise NotImplementedError + else: + raise RuntimeError + + else: + decorators.append( decorator ) + + writer.write('def %s(args, kwargs):' % node.name) writer.push() @@ -470,7 +529,7 @@ def visit_FunctionDef(self, node): writer.pull() # apply decorators - for decorator in reversed(node.decorator_list): + for decorator in decorators: writer.write('%s = %s(create_array(%s))' % (node.name, self.visit(decorator), node.name)) def visit_For(self, node): diff --git a/tests/first-class_function.html b/tests/first-class_function.html new file mode 100644 index 0000000..974c847 --- /dev/null +++ b/tests/first-class_function.html @@ -0,0 +1,30 @@ + + + + + + + + + +
+http://en.wikipedia.org/wiki/First-class_function + + \ No newline at end of file diff --git a/tests/property_decorator.html b/tests/property_decorator.html new file mode 100644 index 0000000..494d6ae --- /dev/null +++ b/tests/property_decorator.html @@ -0,0 +1,49 @@ + + + + + + + + + + + \ No newline at end of file From 7076eacd959db4bed1afce6b0ffd6cb98baef21b Mon Sep 17 00:00:00 2001 From: hartsantler Date: Thu, 3 Oct 2013 03:04:13 -0700 Subject: [PATCH 086/860] added test for Three.js, and hackish way to import star from an external module. --- bindings/three.py | 42 ++++++++++++++++++++--- pythonscript/python_to_pythonjs.py | 53 +++++++++++++++++++++++++----- tests/server.py | 22 +++++++++---- tests/test_threejs.html | 14 ++++---- 4 files changed, 103 insertions(+), 28 deletions(-) diff --git a/bindings/three.py b/bindings/three.py index 9a34f7e..549f0d4 100644 --- a/bindings/three.py +++ b/bindings/three.py @@ -2,10 +2,41 @@ # by Brett Hartshorn - copyright 2013 # License: PSFLv2 - http://www.python.org/psf/license/ +class Vector3: + def __init__(self, x=0, y=0, z=0 ): + self._vec = JS('new THREE.Vector3(x,y,z)') + + def set(self, x,y,z): + vec = self._vec + JS('vec.set(x,y,z)') + + @property + def x(self): + vec = self._vec + return JS('vec.x') + @x.setter + def x(self, value): + vec = self._vec + JS('vec.x=value') + + @property + def y(self): + vec = self._vec + return JS('vec.y') + @y.setter + def y(self, value): + vec = self._vec + JS('vec.y=value') + + @property + def z(self): + vec = self._vec + return JS('vec.z') + @x.setter + def z(self, value): + vec = self._vec + JS('vec.z=value') -class _Vector3: - def __init__(self, jsobject=None): - self._vec = jsobject class _ObjectBase: def add(self, child): @@ -27,10 +58,10 @@ def __init__(self, fov, aspect, near, far): self._object = JS('new THREE.PerspectiveCamera(fov, aspect, near, far)') def setLens(self, focalLength, frameSize): - '''Uses Focal Length (in mm) to estimate and set FOV + """Uses Focal Length (in mm) to estimate and set FOV * 35mm (fullframe) camera is used if frame size is not specified; * Formula based on http://www.bobatkins.com/photography/technical/field_of_view.html - ''' + """ ob = self._object JS('ob.setLens(focalLength, frameSize)') @@ -87,6 +118,7 @@ def loadTextureCube( urls ): class _Three: def __init__(self): self.ImageUtils = _ImageUtils() + self.Vector3 = Vector3 def Scene(self): return _Scene() diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index 8b059f9..786d25e 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -import sys +import os, sys, pickle from types import GeneratorType from ast import Str @@ -67,7 +67,7 @@ class PythonToPythonJS(NodeVisitor): identifier = 0 - def __init__(self): + def __init__(self, module=None, module_path=None): super(PythonToPythonJS, self).__init__() self._classes = dict() ## class name : [method names] self._inline_classes = dict() ## class name : [attribute names] @@ -77,6 +77,32 @@ def __init__(self): self._decorator_properties = dict() self._decorator_class_props = dict() + self._module = module + self._module_path = module_path + assert os.path.isdir( module_path ) + + def save_module(self): + if self._module and self._module_path: + a = dict( + classes = self._classes, + inline_classes = self._inline_classes, + decorator_class_props = self._decorator_class_props, + ) + pickle.dump( a, open(os.path.join(self._module_path, self._module+'.module'), 'wb') ) + + def visit_ImportFrom(self, node): + if node.module in MINI_STDLIB: + for n in node.names: + if n.name in MINI_STDLIB[ node.module ]: + writer.write( 'JS("%s")' %MINI_STDLIB[node.module][n.name] ) + + elif self._module_path and node.module+'.module' in os.listdir(self._module_path): + f = open( os.path.join(self._module_path, node.module+'.module'), 'rb' ) + a = pickle.load( f ); f.close() + self._classes.update( a['classes'] ) + self._inline_classes.update( a['inline_classes'] ) + self._decorator_class_props.update( a['decorator_class_props'] ) + def visit_Assert(self, node): ## hijacking "assert isinstance(a,A)" as a type system ## if isinstance( node.test, Call ) and node.test.func.id == 'isinstance': @@ -98,12 +124,6 @@ def visit_AugAssign(self, node): a = '%s %s= %s' %(self.visit(node.target), self.visit(node.op), self.visit(node.value)) writer.write(a) - def visit_ImportFrom(self, node): - if node.module in MINI_STDLIB: - for n in node.names: - if n.name in MINI_STDLIB[ node.module ]: - writer.write( 'JS("%s")' %MINI_STDLIB[node.module][n.name] ) - def visit_Yield(self, node): return 'yield %s' % self.visit(node.value) @@ -565,7 +585,22 @@ def main(script): def command(): - print( main(sys.stdin.read()) ) + module = module_path = None + + data = sys.stdin.read() + if data.startswith('#!'): + header = data[ 2 : data.index('\n') ] + data = data[ data.index('\n')+1 : ] + if ';' in header: + module_path, module = header.split(';') + else: + module_path = header + + compiler = PythonToPythonJS( module=module, module_path=module_path ) + compiler.visit( parse(data) ) + compiler.save_module() + output = writer.getvalue() + print( output ) ## pipe to stdout if __name__ == '__main__': diff --git a/tests/server.py b/tests/server.py index 9a335ec..ddf711c 100755 --- a/tests/server.py +++ b/tests/server.py @@ -25,13 +25,20 @@ -def python_to_pythonjs( src ): +def python_to_pythonjs( src, module=None ): + cmdheader = '#!/tmp' ## module_path + if module: + assert '.' not in module + cmdheader += ';' + module + cmdheader += '\n' + print('cmd-header', cmdheader) + p = subprocess.Popen( ['python2', os.path.join( PATHS['pythonscript'], 'python_to_pythonjs.py')], stdin = subprocess.PIPE, stdout = subprocess.PIPE ) - stdout, stderr = p.communicate( src.encode('utf-8') ) + stdout, stderr = p.communicate( (cmdheader + src).encode('utf-8') ) return stdout.decode('utf-8') def pythonjs_to_javascript( src, closure_compiler=False ): @@ -57,8 +64,9 @@ def pythonjs_to_javascript( src, closure_compiler=False ): return a -def python_to_javascript( src, closure_compiler=False ): - a = python_to_pythonjs( src ); print(a) +def python_to_javascript( src, module=None, closure_compiler=False, debug=False ): + a = python_to_pythonjs( src, module=module ) + if debug: print( a ) return pythonjs_to_javascript( a, closure_compiler=closure_compiler ) @@ -99,7 +107,7 @@ def convert_python_html_document( data ): elif line.strip() == '': if script: src = '\n'.join( script ) - js = python_to_javascript( src, closure_compiler=use_closure ) + js = python_to_javascript( src, closure_compiler=use_closure, debug=True ) doc.append( js ) doc.append( line ) script = None @@ -132,7 +140,9 @@ def get(self, path=None): raise tornado.web.HTTPError(404) if path.endswith('.py'): - data = python_to_javascript( data.decode('utf-8'), closure_compiler=False ) + print('converting python binding to javascript', name) + module = name.split('.')[0] + data = python_to_javascript( data.decode('utf-8'), closure_compiler=False, module=module ) self.set_header("Content-Type", "text/javascript; charset=utf-8") self.set_header("Content-Length", len(data)) diff --git a/tests/test_threejs.html b/tests/test_threejs.html index 963936e..1664ebd 100644 --- a/tests/test_threejs.html +++ b/tests/test_threejs.html @@ -1,19 +1,17 @@ + - From 1e724f116bca25c36174c49ac36ac109c33e83d4 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Thu, 3 Oct 2013 04:38:50 -0700 Subject: [PATCH 087/860] fixed dynamic bindings and module caching --- tests/server.py | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/tests/server.py b/tests/server.py index ddf711c..f7591de 100755 --- a/tests/server.py +++ b/tests/server.py @@ -21,17 +21,17 @@ bindings = os.path.abspath('../bindings'), closure = os.path.expanduser( '~/closure-compiler/compiler.jar'), runtime = os.path.abspath('../pythonscript.js'), + module_cache = '/tmp', ) def python_to_pythonjs( src, module=None ): - cmdheader = '#!/tmp' ## module_path + cmdheader = '#!%s' %PATHS['module_cache'] if module: assert '.' not in module cmdheader += ';' + module cmdheader += '\n' - print('cmd-header', cmdheader) p = subprocess.Popen( ['python2', os.path.join( PATHS['pythonscript'], 'python_to_pythonjs.py')], @@ -93,16 +93,33 @@ def convert_python_html_document( data ): + + Note: + we need to parse and compile any python binding scripts that appear in the head, + because later scripts may use classes from the bindings, and we need have the + AST introspected data available here to properly inline and for operator overloading. ''' doc = list() script = None use_closure = False for line in data.splitlines(): - if line.strip().startswith('') - script = list() + if line.strip().startswith('') + script = list() + else: + doc.append( line ) elif line.strip() == '': if script: From 88f4ec1a7f3dc671d5ea3a20589324ed8e2ba698 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Thu, 3 Oct 2013 14:28:31 -0700 Subject: [PATCH 088/860] updated the THREE.Vector3 test, fixed methods that use properties on self or other instances of self. --- bindings/three.py | 34 ++++++++++++++++++++++++++---- pythonscript/python_to_pythonjs.py | 6 +++--- tests/server.py | 4 +++- tests/threejs_vector3.html | 25 ++++++++++++++++++++++ 4 files changed, 61 insertions(+), 8 deletions(-) create mode 100644 tests/threejs_vector3.html diff --git a/bindings/three.py b/bindings/three.py index 549f0d4..295e719 100644 --- a/bindings/three.py +++ b/bindings/three.py @@ -6,10 +6,6 @@ class Vector3: def __init__(self, x=0, y=0, z=0 ): self._vec = JS('new THREE.Vector3(x,y,z)') - def set(self, x,y,z): - vec = self._vec - JS('vec.set(x,y,z)') - @property def x(self): vec = self._vec @@ -37,6 +33,36 @@ def z(self, value): vec = self._vec JS('vec.z=value') + def setComponent(self, index, value): + vec = self._vec + JS('vec.setComponent(index,value)') + def getComponent(self, index): + vec = self._vec + return JS('vec.getComponent(index)') + + def set(self, x,y,z): + vec = self._vec + JS('vec.set(x,y,z)') + def setX(self, x): + vec = self._vec + JS('vec.setX(x)') + def setY(self, y): + vec = self._vec + JS('vec.setY(y)') + def setZ(self, z): + vec = self._vec + JS('vec.setZ(z)') + + def copy(self, other): + assert isinstance(other, Vector3) + self.set( other.x, other.y, other.z ) + return self + + def add(self, other): + assert isinstance(other, Vector3) + #self.x += other.x ## TODO fix inplace property assignment + self.set( self.x+other.x, self.y+other.y, self.z+other.z ) + return self class _ObjectBase: def add(self, child): diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index 786d25e..b0b25ee 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -151,6 +151,8 @@ def visit_ClassDef(self, node): self._classes[ name ] = list() ## method names self._catch_attributes = None self._decorator_properties = dict() ## property names : {'get':func, 'set':func} + self._decorator_class_props[ name ] = self._decorator_properties + self._instances[ 'self' ] = name for dec in node.decorator_list: if isinstance(dec, Name) and dec.id == 'inline': @@ -187,12 +189,10 @@ def visit_ClassDef(self, node): if self._catch_attributes: self._inline_classes[ name ] = self._catch_attributes - if self._decorator_properties: - self._decorator_class_props[ name ] = self._decorator_properties - writer.write('#@props: %s'%self._decorator_properties) self._catch_attributes = None self._decorator_properties = None + self._instances.pop('self') writer.write('%s = create_class("%s", __%s_parents, __%s_attrs)' % (name, name, name, name)) diff --git a/tests/server.py b/tests/server.py index f7591de..23d123c 100755 --- a/tests/server.py +++ b/tests/server.py @@ -111,7 +111,9 @@ def convert_python_html_document( data ): name = b.split('/')[-1] path = os.path.join( PATHS['bindings'], name ) src = open(path, 'rb').read().decode('utf-8') - python_to_pythonjs( src, module=name.split('.')[0] ) + pyjs = python_to_pythonjs( src, module=name.split('.')[0] ) + print(pyjs) + print('_'*80) elif 'type="text/python"' in line: if 'closure="true"' in line.lower(): use_closure = True diff --git a/tests/threejs_vector3.html b/tests/threejs_vector3.html new file mode 100644 index 0000000..5d051c5 --- /dev/null +++ b/tests/threejs_vector3.html @@ -0,0 +1,25 @@ + + + + + + + + + + + + + \ No newline at end of file From b772e3bc1cebca00a7273fe17f46e2d4216d7491 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Thu, 3 Oct 2013 19:55:40 -0700 Subject: [PATCH 089/860] fixed typo and added warning about using the same decorator.setter more than once in a class. --- bindings/three.py | 2 +- pythonscript/python_to_pythonjs.py | 12 +++++++++--- tests/threejs_vector3.html | 12 ++++++++++++ 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/bindings/three.py b/bindings/three.py index 295e719..013e40d 100644 --- a/bindings/three.py +++ b/bindings/three.py @@ -28,7 +28,7 @@ def y(self, value): def z(self): vec = self._vec return JS('vec.z') - @x.setter + @z.setter def z(self, value): vec = self._vec JS('vec.z=value') diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index b0b25ee..4a4d76b 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -190,6 +190,9 @@ def visit_ClassDef(self, node): if self._catch_attributes: self._inline_classes[ name ] = self._catch_attributes + writer.write('#decorators#') + writer.write('#%s' %self._decorator_properties) + writer.write('#--------------------------------') self._catch_attributes = None self._decorator_properties = None self._instances.pop('self') @@ -368,7 +371,8 @@ def visit_Assign(self, node): if klass in self._decorator_class_props and target.attr in self._decorator_class_props[klass]: setter = self._decorator_class_props[klass][target.attr].get( 'set', None ) if setter: - writer.write( '''JS('%s( [%s, %s] )')''' %(setter, name, self.visit(node.value)) ) + #writer.write( '''JS('%s( [%s, %s] )')''' %(setter, name, self.visit(node.value)) ) ## can not nest have nested JS() calls + writer.write( '%s( [%s, %s] )' %(setter, name, self.visit(node.value)) ) fallback = False @@ -379,10 +383,10 @@ def visit_Assign(self, node): self.visit(node.value) ) writer.write(code) + elif isinstance(target, Name): if isinstance(node.value, Call) and hasattr(node.value.func, 'id') and node.value.func.id in self._classes: - writer.write('## creating class: %s ' %node.value.func.id) self._instances[ target.id ] = node.value.func.id ## keep track of instances elif target.id in self._instances: self._instances.pop( target.id ) @@ -463,11 +467,13 @@ def visit_FunctionDef(self, node): if isinstance(decorator, Name) and decorator.id == 'property': property_decorator = decorator n = node.name + '__getprop__' - self._decorator_properties[ node.original_name ] = dict( get=n ) + self._decorator_properties[ node.original_name ] = dict( get=n, set=None ) node.name = n elif isinstance(decorator, Attribute) and isinstance(decorator.value, Name) and decorator.value.id in self._decorator_properties: if decorator.attr == 'setter': + if self._decorator_properties[ decorator.value.id ]['set']: + raise SyntaxError('user error - the same decorator.setter is used more than once!') n = node.name + '__setprop__' self._decorator_properties[ decorator.value.id ]['set'] = n node.name = n diff --git a/tests/threejs_vector3.html b/tests/threejs_vector3.html index 5d051c5..8137808 100644 --- a/tests/threejs_vector3.html +++ b/tests/threejs_vector3.html @@ -16,6 +16,18 @@ print( v1.y ) print( v1.z ) + v1.x = v2.x + v1.y = v2.y + v1.z = v2.z + print( v1.x ) + print( v1.y ) + print( v1.z ) + + v1.copy( Vector3(9,9,9) ) + print( v1.x ) + print( v1.y ) + print( v1.z ) + From 71d5664467b7c3c8130a7e1bcf727217ea30d88d Mon Sep 17 00:00:00 2001 From: hartsantler Date: Thu, 3 Oct 2013 20:52:19 -0700 Subject: [PATCH 090/860] added new style to declare the type of a variable using the special function: var(x=SomeType) --- bindings/three.py | 10 ++++++++++ pythonscript/python_to_pythonjs.py | 12 +++++++----- tests/threejs_vector3.html | 8 ++++++++ 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/bindings/three.py b/bindings/three.py index 013e40d..1382fbe 100644 --- a/bindings/three.py +++ b/bindings/three.py @@ -64,6 +64,16 @@ def add(self, other): self.set( self.x+other.x, self.y+other.y, self.z+other.z ) return self + def addScalar(self, s): + self.set( self.x+s, self.y+s, self.z+s ) + return self + + def addVectors(self, a,b): + var( a=Vector3, b=Vector3 ) + self.set( a.x+b.x, a.y+b.y, a.z+b.z ) + return self + + class _ObjectBase: def add(self, child): ob = self._object diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index 4a4d76b..07354ab 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -190,9 +190,6 @@ def visit_ClassDef(self, node): if self._catch_attributes: self._inline_classes[ name ] = self._catch_attributes - writer.write('#decorators#') - writer.write('#%s' %self._decorator_properties) - writer.write('#--------------------------------') self._catch_attributes = None self._decorator_properties = None self._instances.pop('self') @@ -428,8 +425,13 @@ def visit_Expr(self, node): def visit_Call(self, node): if hasattr(node.func, 'id') and node.func.id in ('JS', 'toString', 'JSObject', 'JSArray', 'var'): args = list( map(self.visit, node.args) ) ## map in py3 returns an iterator not a list - kwargs = map(lambda x: '%s=%s' % (x.arg, self.visit(x.value)), node.keywords) - args.extend(kwargs) + if node.func.id == 'var': + for k in node.keywords: + self._instances[ k.arg ] = k.value.id + args.append( k.arg ) + else: + kwargs = map(lambda x: '%s=%s' % (x.arg, self.visit(x.value)), node.keywords) + args.extend(kwargs) args = ', '.join(args) return '%s(%s)' % (node.func.id, args) else: diff --git a/tests/threejs_vector3.html b/tests/threejs_vector3.html index 8137808..5af5ab5 100644 --- a/tests/threejs_vector3.html +++ b/tests/threejs_vector3.html @@ -28,6 +28,14 @@ print( v1.y ) print( v1.z ) + v3 = Vector3(400,400,400) + v4 = Vector3() + v4.addScalar( 20 ) + v1.addVectors( v3, v4 ) + print( v1.x ) + print( v1.y ) + print( v1.z ) + From 223b0bb76a76bfc66527259325ea90dc65be4e36 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Fri, 4 Oct 2013 03:01:24 -0700 Subject: [PATCH 091/860] added support for "*" multiply operator --- bindings/three.py | 42 ++++++++++++++++++++++++++++++ pythonscript/python_to_pythonjs.py | 3 +++ pythonscript/pythonjs.py | 3 +++ tests/threejs_vector3.html | 6 +++++ 4 files changed, 54 insertions(+) diff --git a/bindings/three.py b/bindings/three.py index 1382fbe..393a1c5 100644 --- a/bindings/three.py +++ b/bindings/three.py @@ -64,6 +64,8 @@ def add(self, other): self.set( self.x+other.x, self.y+other.y, self.z+other.z ) return self + #def __iadd__(self, other): + def addScalar(self, s): self.set( self.x+s, self.y+s, self.z+s ) return self @@ -73,6 +75,46 @@ def addVectors(self, a,b): self.set( a.x+b.x, a.y+b.y, a.z+b.z ) return self + def sub(self, other): + assert isinstance(other, Vector3) + self.set( self.x-other.x, self.y-other.y, self.z-other.z ) + return self + + def subVectors(self, a,b): + var( a=Vector3, b=Vector3 ) + self.set( a.x-b.x, a.y-b.y, a.z-b.z ) + return self + + def multiply(self, other): + assert isinstance(other, Vector3) + self.set( self.x*other.x, self.y*other.y, self.z*other.z ) + return self + + def multiplyScalar(self, s): + self.set( self.x*s, self.y*s, self.z*s ) + return self + + def multiplyVectors(self, a,b): + var( a=Vector3, b=Vector3 ) + self.set( a.x*b.x, a.y*b.y, a.z*b.z ) + return self + + def applyMatrix3(self, m): + vec = self._vec + JS('vec.applyMatrix3(m)') + return self + + def applyMatrix4(self, m): + vec = self._vec + JS('vec.applyMatrix4(m)') + return self + + def applyProjection(self, m): + vec = self._vec + JS('vec.applyProjection(m)') + return self + + class _ObjectBase: def add(self, child): diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index 07354ab..fd4ce7a 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -257,6 +257,9 @@ def visit_NotEq(self, node): def visit_Is(self, node): return 'is' + def visit_Mult(self, node): + return '*' + def visit_Add(self, node): return '+' diff --git a/pythonscript/pythonjs.py b/pythonscript/pythonjs.py index 13c23ee..e379e69 100755 --- a/pythonscript/pythonjs.py +++ b/pythonscript/pythonjs.py @@ -158,6 +158,9 @@ def visit_BinOp(self, node): right = self.visit(node.right) return '%s %s %s' % (left, op, right) + def visit_Mult(self, node): + return '*' + def visit_Add(self, node): return '+' diff --git a/tests/threejs_vector3.html b/tests/threejs_vector3.html index 5af5ab5..d8849da 100644 --- a/tests/threejs_vector3.html +++ b/tests/threejs_vector3.html @@ -36,6 +36,12 @@ print( v1.y ) print( v1.z ) + v1.multiply( v4 ) + print( v1.x ) + print( v1.y ) + print( v1.z ) + + From 2dfaac705fea92e7ba7737c2c3e88b72127bfe2f Mon Sep 17 00:00:00 2001 From: hartsantler Date: Fri, 4 Oct 2013 17:20:16 -0700 Subject: [PATCH 092/860] testing support for "*" __mul__ operator overloading also changed visit_Return to try to detect the return type of a function, operator overloading needs this. --- bindings/three.py | 4 +++ pythonscript/python_to_pythonjs.py | 46 +++++++++++++++++++++++++----- tests/threejs_vector3.html | 4 +++ 3 files changed, 47 insertions(+), 7 deletions(-) diff --git a/bindings/three.py b/bindings/three.py index 393a1c5..3cbbd9f 100644 --- a/bindings/three.py +++ b/bindings/three.py @@ -90,6 +90,10 @@ def multiply(self, other): self.set( self.x*other.x, self.y*other.y, self.z*other.z ) return self + def __mul__(self, other): + assert isinstance(other, Vector3) + return Vector3( self.x*other.x, self.y*other.y, self.z*other.z ) + def multiplyScalar(self, s): self.set( self.x*s, self.y*s, self.z*s ) return self diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index fd4ce7a..12f5d90 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -11,6 +11,7 @@ from ast import Subscript from ast import Attribute from ast import FunctionDef +from ast import BinOp from ast import parse from ast import NodeVisitor @@ -76,7 +77,8 @@ def __init__(self, module=None, module_path=None): self._instances = dict() ## instance name : class name self._decorator_properties = dict() self._decorator_class_props = dict() - + self._function_return_types = dict() + self._return_type = None self._module = module self._module_path = module_path assert os.path.isdir( module_path ) @@ -87,6 +89,7 @@ def save_module(self): classes = self._classes, inline_classes = self._inline_classes, decorator_class_props = self._decorator_class_props, + function_return_types = self._function_return_types, ) pickle.dump( a, open(os.path.join(self._module_path, self._module+'.module'), 'wb') ) @@ -102,6 +105,7 @@ def visit_ImportFrom(self, node): self._classes.update( a['classes'] ) self._inline_classes.update( a['inline_classes'] ) self._decorator_class_props.update( a['decorator_class_props'] ) + self._function_return_types.update( a['function_return_types'] ) def visit_Assert(self, node): ## hijacking "assert isinstance(a,A)" as a type system ## @@ -239,13 +243,27 @@ def visit_Num(self, node): def visit_Return(self, node): if node.value: - return writer.write('return %s' % self.visit(node.value)) - return writer.write('return undefined') + if isinstance(node.value, Call) and isinstance(node.value.func, Name) and node.value.func.id in self._classes: + self._return_type = node.value.func.id + elif isinstance(node.value, Name) and node.value.id == 'self' and 'self' in self._instances: + self._return_type = self._instances['self'] + + writer.write('return %s' % self.visit(node.value)) + + else: + raise RuntimeError def visit_BinOp(self, node): + node.operator_overloading = 'undefined' left = self.visit(node.left) op = self.visit(node.op) right = self.visit(node.right) + if isinstance(node.left, Name) and node.left.id in self._instances: + klass = self._instances[ node.left.id ] + if op == '*' and '__mul__' in self._classes[klass]: + node.operator_overloading = '__%s___mul__' %klass + assert node.operator_overloading + return '''JS('__%s___mul__( [%s, %s] )')''' %(klass, left, right) return '%s %s %s' % (left, op, right) def visit_Eq(self, node): @@ -385,18 +403,25 @@ def visit_Assign(self, node): writer.write(code) elif isinstance(target, Name): + node_value = self.visit( node.value ) ## node.value may have extra attributes after being visited if isinstance(node.value, Call) and hasattr(node.value.func, 'id') and node.value.func.id in self._classes: self._instances[ target.id ] = node.value.func.id ## keep track of instances + elif isinstance(node.value, Call) and isinstance(node.value.func, Name) and node.value.func.id in self._function_return_types: + self._instances[ target.id ] = self._function_return_types[ node.value.func.id ] elif target.id in self._instances: - self._instances.pop( target.id ) + self._instances.pop( target.id ) ## TODO is this correct? - if isinstance(node.value, Name): + if isinstance(node.value, Name): ## if this is a simple copy: "a = b" and "b" is known to be of some class name = self.visit(node.value) if name in self._instances: self._instances[ target.id ] = self._instances[ name ] writer.write('%s = %s' % (target.id, name)) - else: - writer.write('%s = %s' % (target.id, self.visit(node.value))) + elif isinstance(node.value, BinOp) and hasattr(node.value, 'operator_overloading') and node.value.operator_overloading in self._function_return_types: + self._instances[ target.id ] = self._function_return_types[ node.value.operator_overloading ] + writer.write('%s = %s' % (target.id, node_value)) + + else: ## blind assignment + writer.write('%s = %s' % (target.id, node_value)) else: # it's a Tuple id = self.identifier @@ -545,6 +570,7 @@ def visit_FunctionDef(self, node): expr = expr % (node.args.kwarg, node.args.kwarg) writer.write(expr) + self._return_type = None #map(self.visit, node.body) for child in node.body: # simple test to drop triple quote comments @@ -557,6 +583,12 @@ def visit_FunctionDef(self, node): else: self.visit(child) + if self._return_type: + #if hasattr(node, 'original_name'): + # self._function_return_types[ node.original_name ] = self._return_type + #else: + self._function_return_types[ node.name ] = self._return_type + writer.pull() # apply decorators diff --git a/tests/threejs_vector3.html b/tests/threejs_vector3.html index d8849da..3578756 100644 --- a/tests/threejs_vector3.html +++ b/tests/threejs_vector3.html @@ -41,6 +41,10 @@ print( v1.y ) print( v1.z ) + v = v1 * v4 + print( v.x ) + print( v.y ) + print( v.z ) From 19872d3d294c80ee442cb94825dc809e8d7b15a9 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Sat, 5 Oct 2013 02:13:40 -0700 Subject: [PATCH 093/860] more operator overloading support, and inplace overloading operators: +=, -=, *= --- bindings/three.py | 11 ++++- pythonscript/python_to_pythonjs.py | 76 +++++++++++++++++++++++++----- tests/threejs_vector3.html | 10 ++++ 3 files changed, 85 insertions(+), 12 deletions(-) diff --git a/bindings/three.py b/bindings/three.py index 3cbbd9f..d2144b3 100644 --- a/bindings/three.py +++ b/bindings/three.py @@ -64,7 +64,9 @@ def add(self, other): self.set( self.x+other.x, self.y+other.y, self.z+other.z ) return self - #def __iadd__(self, other): + def __add__(self, other): + assert isinstance(other, Vector3) + return Vector3( self.x+other.x, self.y+other.y, self.z+other.z ) def addScalar(self, s): self.set( self.x+s, self.y+s, self.z+s ) @@ -80,6 +82,10 @@ def sub(self, other): self.set( self.x-other.x, self.y-other.y, self.z-other.z ) return self + def __sub__(self, other): + assert isinstance(other, Vector3) + return Vector3( self.x-other.x, self.y-other.y, self.z-other.z ) + def subVectors(self, a,b): var( a=Vector3, b=Vector3 ) self.set( a.x-b.x, a.y-b.y, a.z-b.z ) @@ -94,6 +100,9 @@ def __mul__(self, other): assert isinstance(other, Vector3) return Vector3( self.x*other.x, self.y*other.y, self.z*other.z ) + def __imul__(self, s): + self.multiplyScalar(s) + def multiplyScalar(self, s): self.set( self.x*s, self.y*s, self.z*s ) return self diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index 12f5d90..1d063b3 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -64,6 +64,33 @@ def getvalue(self): 'random': 'var random = Math.random' } } + +class Typedef(object): + # http://docs.python.org/2/reference/datamodel.html#emulating-numeric-types + _opmap = dict( + __add__ = '+', + __iadd__ = '+=', + __sub__ = '-', + __isub__ = '-=', + __mul__ = '*', + __imul__ = '*=', + ) + + def __init__(self, **kwargs): + for name in kwargs.keys(): + setattr( self, name, kwargs[name] ) + + self.operators = dict() + for name in self.methods: + if name in self._opmap: + op = self._opmap[ name ] + self.operators[ op ] = self.get_pythonjs_function_name( name ) + + def get_pythonjs_function_name(self, name): + assert name in self.methods + return '__%s_%s' %(self.name, name) ## class name + + class PythonToPythonJS(NodeVisitor): identifier = 0 @@ -73,7 +100,7 @@ def __init__(self, module=None, module_path=None): self._classes = dict() ## class name : [method names] self._inline_classes = dict() ## class name : [attribute names] self._catch_attributes = None - self._names = set() + self._names = set() ## not used? self._instances = dict() ## instance name : class name self._decorator_properties = dict() self._decorator_class_props = dict() @@ -81,7 +108,18 @@ def __init__(self, module=None, module_path=None): self._return_type = None self._module = module self._module_path = module_path - assert os.path.isdir( module_path ) + + def get_typedef(self, node): + assert isinstance(node, Name) + if node.id in self._instances: + klass = self._instances[ node.id ] + typedef = Typedef( + name = klass, + methods = self._classes[ klass ], + properties = self._decorator_class_props[ klass ], + #compiler = self, + ) + return typedef def save_module(self): if self._module and self._module_path: @@ -125,8 +163,18 @@ def visit_In(self, node): return ' in ' def visit_AugAssign(self, node): - a = '%s %s= %s' %(self.visit(node.target), self.visit(node.op), self.visit(node.value)) - writer.write(a) + target = self.visit( node.target ) + op = '%s=' %self.visit( node.op ) + + typedef = self.get_typedef( node.target ) + if typedef and op in typedef.operators: + func = typedef.operators[ op ] + a = '%s( [%s, %s] )' %(func, target, self.visit(node.value)) + writer.write( a ) + else: + ## TODO extra checks to make sure the operator type is valid in this context + a = '%s %s= %s' %(target, op, self.visit(node.value)) + writer.write(a) def visit_Yield(self, node): return 'yield %s' % self.visit(node.value) @@ -254,16 +302,22 @@ def visit_Return(self, node): raise RuntimeError def visit_BinOp(self, node): - node.operator_overloading = 'undefined' left = self.visit(node.left) op = self.visit(node.op) right = self.visit(node.right) - if isinstance(node.left, Name) and node.left.id in self._instances: - klass = self._instances[ node.left.id ] - if op == '*' and '__mul__' in self._classes[klass]: - node.operator_overloading = '__%s___mul__' %klass - assert node.operator_overloading - return '''JS('__%s___mul__( [%s, %s] )')''' %(klass, left, right) + #if isinstance(node.left, Name) and node.left.id in self._instances: + # klass = self._instances[ node.left.id ] + # if op == '*' and '__mul__' in self._classes[klass]: + # node.operator_overloading = '__%s___mul__' %klass + # assert node.operator_overloading + # return '''JS('__%s___mul__( [%s, %s] )')''' %(klass, left, right) + if isinstance(node.left, Name): + typedef = self.get_typedef( node.left ) + if typedef and op in typedef.operators: + func = typedef.operators[ op ] + node.operator_overloading = func + return '''JS('%s( [%s, %s] )')''' %(func, left, right) + return '%s %s %s' % (left, op, right) def visit_Eq(self, node): diff --git a/tests/threejs_vector3.html b/tests/threejs_vector3.html index 3578756..0efe6df 100644 --- a/tests/threejs_vector3.html +++ b/tests/threejs_vector3.html @@ -46,6 +46,16 @@ print( v.y ) print( v.z ) + w = v1 + v4 + print( w.x ) + print( w.y ) + print( w.z ) + + w *= 10.0 + print( w.x ) + print( w.y ) + print( w.z ) + From efa7fed21084fc335ce43d9b5e4f2927662a6e8e Mon Sep 17 00:00:00 2001 From: hartsantler Date: Sat, 5 Oct 2013 04:13:22 -0700 Subject: [PATCH 094/860] made THREE.js Vector3 bindings operator overloading smarter, now a vector or scalar can both be used. --- bindings/three.py | 33 ++++++++++--- tests/threejs_vector3.html | 15 ------ .../threejs_vector3_operator_overloading.html | 48 +++++++++++++++++++ 3 files changed, 75 insertions(+), 21 deletions(-) create mode 100644 tests/threejs_vector3_operator_overloading.html diff --git a/bindings/three.py b/bindings/three.py index d2144b3..e3f517b 100644 --- a/bindings/three.py +++ b/bindings/three.py @@ -65,8 +65,17 @@ def add(self, other): return self def __add__(self, other): - assert isinstance(other, Vector3) - return Vector3( self.x+other.x, self.y+other.y, self.z+other.z ) + if JS("{}.toString.call(other) === '[object Object]'"): + assert isinstance(other, Vector3) + return Vector3( self.x+other.x, self.y+other.y, self.z+other.z ) + else: + return Vector3( self.x+other, self.y+other, self.z+other ) + + def __iadd__(self, other): + if JS("{}.toString.call(other) === '[object Object]'"): + self.add( other ) + else: + self.addScalar( other ) def addScalar(self, s): self.set( self.x+s, self.y+s, self.z+s ) @@ -83,8 +92,17 @@ def sub(self, other): return self def __sub__(self, other): - assert isinstance(other, Vector3) - return Vector3( self.x-other.x, self.y-other.y, self.z-other.z ) + if JS("{}.toString.call(other) === '[object Object]'"): + assert isinstance(other, Vector3) + return Vector3( self.x-other.x, self.y-other.y, self.z-other.z ) + else: + return Vector3( self.x-other, self.y-other, self.z-other ) + + def __isub__(self, other): + if JS("{}.toString.call(other) === '[object Object]'"): + self.sub( other ) + else: + self.set( self.x-other, self.y-other, self.z-other ) def subVectors(self, a,b): var( a=Vector3, b=Vector3 ) @@ -100,8 +118,11 @@ def __mul__(self, other): assert isinstance(other, Vector3) return Vector3( self.x*other.x, self.y*other.y, self.z*other.z ) - def __imul__(self, s): - self.multiplyScalar(s) + def __imul__(self, other): + if JS("{}.toString.call(other) === '[object Object]'"): + self.multiply( other ) + else: + self.multiplyScalar( other ) def multiplyScalar(self, s): self.set( self.x*s, self.y*s, self.z*s ) diff --git a/tests/threejs_vector3.html b/tests/threejs_vector3.html index 0efe6df..8675937 100644 --- a/tests/threejs_vector3.html +++ b/tests/threejs_vector3.html @@ -41,21 +41,6 @@ print( v1.y ) print( v1.z ) - v = v1 * v4 - print( v.x ) - print( v.y ) - print( v.z ) - - w = v1 + v4 - print( w.x ) - print( w.y ) - print( w.z ) - - w *= 10.0 - print( w.x ) - print( w.y ) - print( w.z ) - diff --git a/tests/threejs_vector3_operator_overloading.html b/tests/threejs_vector3_operator_overloading.html new file mode 100644 index 0000000..da8003c --- /dev/null +++ b/tests/threejs_vector3_operator_overloading.html @@ -0,0 +1,48 @@ + + + + + + + + + + + + + \ No newline at end of file From 476c913cfad341e1a848a292ac51657751cf6c33 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Sat, 5 Oct 2013 07:46:43 -0700 Subject: [PATCH 095/860] more operator overloading and tests --- bindings/three.py | 140 +++++++++++++++++- pythonscript/python_to_pythonjs.py | 33 ++++- pythonscript/pythonjs.py | 6 + .../threejs_vector3_operator_overloading.html | 5 + 4 files changed, 180 insertions(+), 4 deletions(-) diff --git a/bindings/three.py b/bindings/three.py index e3f517b..0e47109 100644 --- a/bindings/three.py +++ b/bindings/three.py @@ -115,8 +115,11 @@ def multiply(self, other): return self def __mul__(self, other): - assert isinstance(other, Vector3) - return Vector3( self.x*other.x, self.y*other.y, self.z*other.z ) + if JS("{}.toString.call(other) === '[object Object]'"): + assert isinstance(other, Vector3) + return Vector3( self.x*other.x, self.y*other.y, self.z*other.z ) + else: + return Vector3( self.x*other, self.y*other, self.z*other ) def __imul__(self, other): if JS("{}.toString.call(other) === '[object Object]'"): @@ -148,6 +151,139 @@ def applyProjection(self, m): JS('vec.applyProjection(m)') return self + def applyQuaternion(self, q): + vec = self._vec + JS('vec.applyQuaternion(q)') + return self + + def transformDirection(self, m): + vec = self._vec + JS('vec.transformDirection(m)') + return self + + def divide(self, other): + assert isinstance(other, Vector3) + self.set( self.x/other.x, self.y/other.y, self.z/other.z ) + return self + + def divideScalar(self, s): + vec = self._vec + JS('vec.divideScalar(s)') ## takes care of divide by zero + return self + + def __div__(self, other): + if JS("{}.toString.call(other) === '[object Object]'"): + assert isinstance(other, Vector3) + return Vector3( self.x/other.x, self.y/other.y, self.z/other.z ) + else: + return Vector3( self.x/other, self.y/other, self.z/other ) + + def __idiv__(self, other): + if JS("{}.toString.call(other) === '[object Object]'"): + self.divide( other ) + else: + self.divideScalar( other ) + + def min(self, s): + vec = self._vec + JS('vec.min(s)') + return self + def max(self, s): + vec = self._vec + JS('vec.max(s)') + return self + def clamp(self, s): + vec = self._vec + JS('vec.clamp(s)') + return self + def negate(self): + vec = self._vec + JS('vec.negate()') + return self + + def dot(self, v): + vec = self._vec + return JS('vec.dot(v)') + def lengthSq(self): + vec = self._vec + return JS('vec.lengthSq()') + def length(self): + vec = self._vec + return JS('vec.length()') + def lengthManhattan(self): + vec = self._vec + return JS('vec.lengthManhattan()') + + def normalize(self): + vec = self._vec + JS('vec.normalize()') + return self + + def setLength(self, l): + vec = self._vec + JS('vec.setLength(l)') + return self + + def lerp(self, v, alpha): + vec = self._vec + JS('vec.lerp(v, alpha)') + return self + + def cross(self, v): ## cross product + vec = self._vec + JS('vec.cross(v)') + return self + + def crossVectors(self, a,b): + vec = self._vec + JS('vec.crossVectors(a,b)') + return self + + def __ixor__(self, other): ## ^= + self.cross(other) + + def angleTo(self, v): + vec = self._vec + return JS('vec.angleTo(v)') + + def distanceTo(self, v): + vec = self._vec + return JS('vec.distanceTo(v)') + + def distanceToSquared(self, v): + vec = self._vec + return JS('vec.distanceToSquared(v)') + + def getPositionFromMatrix(self, m): + vec = self._vec + JS('vec.getPositionFromMatrix(m)') + return self + + def getScaleFromMatrix(self, m): + vec = self._vec + JS('vec.getScaleFromMatrix(m)') + return self + + def getColumnFromMatrix(self, i, m): + vec = self._vec + JS('vec.getColumnFromMatrix(i,m)') + return self + + def equals(self, v): + vec = self._vec + return JS('vec.equals(v)') + + def fromArray(self, a): + vec = self._vec + JS('vec.fromArray(a)') + return self + + def toArray(self): + vec = self._vec + return JS('vec.toArray()') + + def clone(self): + return Vector3( self.x, self.y, self.z ) class _ObjectBase: diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index 1d063b3..f1f933f 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -74,6 +74,20 @@ class Typedef(object): __isub__ = '-=', __mul__ = '*', __imul__ = '*=', + __div__ = '/', + __idiv__ = '/=', + __mod__ = '%', + __imod__ = '%=', + __lshift__ = '<<', + __ilshift__ = '<<=', + __rshift__ = '>>', + __irshift__ = '>>=', + __and__ = '&', + __iand__ = '&=', + __xor__ = '^', + __ixor__ = '^=', + __or__ = '|', + __ior__ = '|=', ) def __init__(self, **kwargs): @@ -173,7 +187,7 @@ def visit_AugAssign(self, node): writer.write( a ) else: ## TODO extra checks to make sure the operator type is valid in this context - a = '%s %s= %s' %(target, op, self.visit(node.value)) + a = '%s %s %s' %(target, op, self.visit(node.value)) writer.write(a) def visit_Yield(self, node): @@ -338,6 +352,21 @@ def visit_Add(self, node): def visit_Sub(self, node): return '-' + def visit_Div(self, node): + return '/' + def visit_Mod(self, node): + return '%' + def visit_LShift(self, node): + return '<<' + def visit_RShift(self, node): + return '>>' + def visit_BitXor(self, node): + return '^' + def visit_BitOr(self, node): + return '|' + def visit_BitAnd(self, node): + return '&' + def visit_Lt(self, node): return '<' @@ -542,7 +571,7 @@ def visit_Call(self, node): elif name in self._classes: return 'get_attribute(%s, "__call__")( JSArray(), JSObject() )' %name else: - return '%s()' %name + return '%s( JSArray(), JSObject() )' %name def visit_FunctionDef(self, node): property_decorator = None diff --git a/pythonscript/pythonjs.py b/pythonscript/pythonjs.py index e379e69..945a0f4 100755 --- a/pythonscript/pythonjs.py +++ b/pythonscript/pythonjs.py @@ -167,6 +167,12 @@ def visit_Add(self, node): def visit_Sub(self, node): return '-' + def visit_Div(self, node): + return '/' + + def visit_Mod(self, node): + return '%' + def visit_Lt(self, node): return '<' diff --git a/tests/threejs_vector3_operator_overloading.html b/tests/threejs_vector3_operator_overloading.html index da8003c..6befd38 100644 --- a/tests/threejs_vector3_operator_overloading.html +++ b/tests/threejs_vector3_operator_overloading.html @@ -39,6 +39,11 @@ b *= v2 show_vec(b) + c = b.clone() + assert isinstance(c, Vector3) + c ^= v1 ## cross product + show_vec(c) + From 0c3fb719420ba06430202f0c95fac4b2ad6352dd Mon Sep 17 00:00:00 2001 From: hartsantler Date: Sat, 5 Oct 2013 19:51:25 -0700 Subject: [PATCH 096/860] fixed setting the instance type on assignment when calling a method and the method returns a known type. --- pythonscript/python_to_pythonjs.py | 27 +++++++++++-------- .../threejs_vector3_operator_overloading.html | 4 ++- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index f1f933f..f8397da 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -475,7 +475,8 @@ def visit_Assign(self, node): #writer.write( '''JS('%s( [%s, %s] )')''' %(setter, name, self.visit(node.value)) ) ## can not nest have nested JS() calls writer.write( '%s( [%s, %s] )' %(setter, name, self.visit(node.value)) ) fallback = False - + else: + writer.write('#!!!! class is known: %s' %klass) if fallback: code = 'set_attribute(%s, "%s", %s)' % ( @@ -492,19 +493,23 @@ def visit_Assign(self, node): self._instances[ target.id ] = node.value.func.id ## keep track of instances elif isinstance(node.value, Call) and isinstance(node.value.func, Name) and node.value.func.id in self._function_return_types: self._instances[ target.id ] = self._function_return_types[ node.value.func.id ] - elif target.id in self._instances: - self._instances.pop( target.id ) ## TODO is this correct? - - if isinstance(node.value, Name): ## if this is a simple copy: "a = b" and "b" is known to be of some class - name = self.visit(node.value) - if name in self._instances: self._instances[ target.id ] = self._instances[ name ] - writer.write('%s = %s' % (target.id, name)) + elif isinstance(node.value, Call) and isinstance(node.value.func, Attribute) and node.value.func.value.id in self._instances: + typedef = self.get_typedef( node.value.func.value ) + method = node.value.func.attr + if method in typedef.methods: + func = typedef.get_pythonjs_function_name( method ) + if func in self._function_return_types: + self._instances[ target.id ] = self._function_return_types[ func ] + + elif isinstance(node.value, Name) and node_value in self._instances: ## if this is a simple copy: "a = b" and "b" is known to be of some class + self._instances[ target.id ] = self._instances[ node_value ] elif isinstance(node.value, BinOp) and hasattr(node.value, 'operator_overloading') and node.value.operator_overloading in self._function_return_types: self._instances[ target.id ] = self._function_return_types[ node.value.operator_overloading ] - writer.write('%s = %s' % (target.id, node_value)) - else: ## blind assignment - writer.write('%s = %s' % (target.id, node_value)) + elif target.id in self._instances: + self._instances.pop( target.id ) + + writer.write('%s = %s' % (target.id, node_value)) else: # it's a Tuple id = self.identifier diff --git a/tests/threejs_vector3_operator_overloading.html b/tests/threejs_vector3_operator_overloading.html index 6befd38..2b79303 100644 --- a/tests/threejs_vector3_operator_overloading.html +++ b/tests/threejs_vector3_operator_overloading.html @@ -40,7 +40,9 @@ show_vec(b) c = b.clone() - assert isinstance(c, Vector3) + c.normalize() + print( c.x ) + v1.normalize() c ^= v1 ## cross product show_vec(c) From af8c1e5b44125ffa5f0e02b932e227d5c57a74af Mon Sep 17 00:00:00 2001 From: hartsantler Date: Sat, 5 Oct 2013 23:46:49 -0700 Subject: [PATCH 097/860] added simple THREE.js hello world test, and updated the THREE.js bindings. --- bindings/three.py | 49 +++++++++++++++-------------------- tests/threejs_helloworld.html | 39 ++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 28 deletions(-) create mode 100644 tests/threejs_helloworld.html diff --git a/bindings/three.py b/bindings/three.py index 0e47109..78953eb 100644 --- a/bindings/three.py +++ b/bindings/three.py @@ -297,11 +297,11 @@ def updateProjectionMatrix(self): ob = self._object JS('ob.updateProjectionMatrix()') -class _OrthographicCamera( _Camera ): +class OrthographicCamera( _Camera ): def __init__(self, left, right, top, bottom, near, far): self._object = JS('new THREE.OrthographicCamera(left, right, top, bottom, near, far)') -class _PerspectiveCamera( _Camera ): +class PerspectiveCamera( _Camera ): def __init__(self, fov, aspect, near, far): self._object = JS('new THREE.PerspectiveCamera(fov, aspect, near, far)') @@ -322,7 +322,7 @@ def setViewOffset(self, fullWidth, fullHeight, x, y, width, height): JS('ob.setViewOffset(fullWidth, fullHeight, x, y, width, height)') -class _Scene: +class Scene: def __init__(self): self._scene = JS('new THREE.Scene()') @@ -330,6 +330,10 @@ def add(self, child): scene = self._scene JS('scene.add(child)') + def updateMatrixWorld(self): + scene = self._scene + JS('scene.updateMatrixWorld()') + class _Renderer: def setSize(self, width, height): @@ -340,19 +344,27 @@ def setClearColor(self, red=1.0, green=1.0, blue=1.0, alpha=1.0): renderer = self._renderer JS('renderer.setClearColor( {r:red, g:green, b:blue}, alpha)') + def getDomElement(self): + renderer = self._renderer + return JS('renderer.domElement') -class _CSS3DRenderer( _Renderer ): + def render(self, scn, cam): + renderer = self._renderer + return JS('renderer.render(scn, cam)') + +class CSS3DRenderer( _Renderer ): def __init__(self): self._renderer = JS('new THREE.CSS3DRenderer()') - def getDomElement(self): - renderer = self._renderer - return JS('renderer.domElement') -class _WebGLRenderer( _Renderer ): +class WebGLRenderer( _Renderer ): def __init__(self): self._renderer = JS('new THREE.WebGLRenderer()') + def getContext(self): + renderer = self._renderer + return JS('renderer.getContext()') + class _ImageUtils: def loadTexture( url ): @@ -363,24 +375,5 @@ def loadTextureCube( urls ): JS('var _mapping = new THREE.CubeReflectionMapping()') return JS('THREE.ImageUtils.loadTextureCube(urls, _mapping)') -class _Three: - def __init__(self): - self.ImageUtils = _ImageUtils() - self.Vector3 = Vector3 - - def Scene(self): - return _Scene() - - def CSS3DRenderer(self): - return _CSS3DRenderer() - - def WebGLRenderer(self): - return _WebGLRenderer() - - def PerspectiveCamera(self, fov, aspect, near, far): - return _PerspectiveCamera(fov, aspect, near, far) - - def OrthographicCamera(left, right, top, bottom, near, far): - return _OrthographicCamera(left, right, top, bottom, near, far) +ImageUtils = _ImageUtils() -Three = _Three() \ No newline at end of file diff --git a/tests/threejs_helloworld.html b/tests/threejs_helloworld.html new file mode 100644 index 0000000..e16654a --- /dev/null +++ b/tests/threejs_helloworld.html @@ -0,0 +1,39 @@ + + + + + + + + + + + + \ No newline at end of file From 3262d084dbf24925ec4c80a37f1eabe537b02f49 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Sun, 6 Oct 2013 20:35:02 -0700 Subject: [PATCH 098/860] refactoring getter/setter @property so that nested lookups can work, ie: camera.position.x=1 --- pythonscript/python_to_pythonjs.py | 93 +++++++++++++++++++++++------- 1 file changed, 71 insertions(+), 22 deletions(-) diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index f8397da..95281a7 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -123,15 +123,17 @@ def __init__(self, module=None, module_path=None): self._module = module self._module_path = module_path - def get_typedef(self, node): - assert isinstance(node, Name) - if node.id in self._instances: - klass = self._instances[ node.id ] + def get_typedef(self, instance=None, class_name=None): + assert instance or class_name + if isinstance(instance, Name) and instance.id in self._instances: + class_name = self._instances[ instance.id ] + + if class_name: + assert class_name in self._classes typedef = Typedef( - name = klass, - methods = self._classes[ klass ], - properties = self._decorator_class_props[ klass ], - #compiler = self, + name = class_name, + methods = self._classes[ class_name ], + properties = self._decorator_class_props[ class_name ], ) return typedef @@ -255,7 +257,7 @@ def visit_ClassDef(self, node): if self._catch_attributes: self._inline_classes[ name ] = self._catch_attributes - + writer.write('#$---: %s' %self._function_return_types) self._catch_attributes = None self._decorator_properties = None self._instances.pop('self') @@ -392,6 +394,23 @@ def visit_UnaryOp(self, node): return self.visit(node.op) + self.visit(node.operand) def visit_Attribute(self, node): + if isinstance(node.value, Name): + name = self.visit( node.value ) + typedef = self.get_typedef( node.value ) + if typedef: + if node.attr in typedef.properties: + getter = typedef.properties[ node.attr ]['get'] + if getter in self._function_return_types: + node.returns_type = self._function_return_types[getter] + return '%s( [%s] )' %(getter, name) + else: + return 'get_attribute(%s, "%s")' % (name, node.attr) + else: + return 'get_attribute(%s, "%s")' % (name, node.attr) + else: + return 'get_attribute(%s, "%s")' % (self.visit(node.value), node.attr) + + def visit_Attribute_OLD(self, node): name = self.visit(node.value) if name in self._instances: ## support '.' operator overloading klass = self._instances[ name ] @@ -462,25 +481,50 @@ def visit_Assign(self, node): code = code % (self.visit(target.value), self.visit(target.slice.value), self.visit(node.value)) writer.write(code) elif isinstance(target, Attribute): - name = self.visit(target.value) - if name == 'self' and isinstance(self._catch_attributes, set): - self._catch_attributes.add( target.attr ) + #name = self.visit(target.value) + #if name == 'self' and isinstance(self._catch_attributes, set): + # self._catch_attributes.add( target.attr ) fallback = True - if name in self._instances: ## support '.' operator overloading - klass = self._instances[ name ] - if klass in self._decorator_class_props and target.attr in self._decorator_class_props[klass]: - setter = self._decorator_class_props[klass][target.attr].get( 'set', None ) + #if name in self._instances: ## support '.' operator overloading + # klass = self._instances[ name ] + # if klass in self._decorator_class_props and target.attr in self._decorator_class_props[klass]: + # setter = self._decorator_class_props[klass][target.attr].get( 'set', None ) + # if setter: + # #writer.write( '''JS('%s( [%s, %s] )')''' %(setter, name, self.visit(node.value)) ) ## can not nest have nested JS() calls + # writer.write( '%s( [%s, %s] )' %(setter, name, self.visit(node.value)) ) + # fallback = False + # else: + # writer.write('#!!!! class is known: %s' %klass) + #else: + # writer.write('##fallback--unknown-type: %s - %s' %(target.value, name)) + + target_value = self.visit(target.value) ## target.value may have "returns_type" after being visited + if isinstance(target.value, Name): + if target.value.id == 'self' and isinstance(self._catch_attributes, set): + self._catch_attributes.add( target.attr ) + + typedef = self.get_typedef( instance=target.value ) + if typedef and target.attr in typedef.properties: + setter = typedef.properties[ target.attr ].get('set',None) if setter: - #writer.write( '''JS('%s( [%s, %s] )')''' %(setter, name, self.visit(node.value)) ) ## can not nest have nested JS() calls - writer.write( '%s( [%s, %s] )' %(setter, name, self.visit(node.value)) ) + writer.write( '%s( [%s, %s] )' %(setter, target_value, self.visit(node.value)) ) + fallback = False + + elif hasattr(target.value, 'returns_type'): + writer.write('#### HEY: %s' %target.value.returns_type) + typedef = self.get_typedef( class_name=target.value.returns_type ) + if typedef and target.attr in typedef.properties: + setter = typedef.properties[ target.attr ].get('set',None) + if setter: + writer.write( '%s( [%s, %s] )' %(setter, target_value, self.visit(node.value)) ) fallback = False - else: - writer.write('#!!!! class is known: %s' %klass) + if fallback: + writer.write('#FALLBACK') code = 'set_attribute(%s, "%s", %s)' % ( - name, + target_value, target.attr, self.visit(node.value) ) @@ -500,12 +544,17 @@ def visit_Assign(self, node): func = typedef.get_pythonjs_function_name( method ) if func in self._function_return_types: self._instances[ target.id ] = self._function_return_types[ func ] + else: + writer.write('## %s - unknown return type for: %s'(typedef.name, func)) + else: + writer.write('## %s - not a method: %s' %(typedef.name, method)) elif isinstance(node.value, Name) and node_value in self._instances: ## if this is a simple copy: "a = b" and "b" is known to be of some class self._instances[ target.id ] = self._instances[ node_value ] elif isinstance(node.value, BinOp) and hasattr(node.value, 'operator_overloading') and node.value.operator_overloading in self._function_return_types: self._instances[ target.id ] = self._function_return_types[ node.value.operator_overloading ] - + elif hasattr(node.value, 'returns_type'): + self._instances[ target.id ] = node.value.returns_type elif target.id in self._instances: self._instances.pop( target.id ) From 430edc5b79d892272cc8609e9817696f52254d20 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Sun, 6 Oct 2013 22:27:22 -0700 Subject: [PATCH 099/860] fixed and refactored nested attribute lookups that were overloaded using @property --- bindings/three.py | 70 +++++++++++++++++-- pythonscript/python_to_pythonjs.py | 69 +++++++----------- tests/threejs_helloworld.html | 31 ++++---- ...js_nested_attribute_lookup_decorators.html | 27 +++++++ 4 files changed, 136 insertions(+), 61 deletions(-) create mode 100644 tests/threejs_nested_attribute_lookup_decorators.html diff --git a/bindings/three.py b/bindings/three.py index 78953eb..999e0a0 100644 --- a/bindings/three.py +++ b/bindings/three.py @@ -2,9 +2,40 @@ # by Brett Hartshorn - copyright 2013 # License: PSFLv2 - http://www.python.org/psf/license/ +class Color: + def __init__(self, red=1.0, green=1.0, blue=1.0, object=None ): + if object: + self._color = object + else: + self._color = JS('new THREE.Vector3()') + self.setRGB(red=red, green=green, blue=blue) + + def setRGB(self, red=1.0, green=1.0, blue=1.0): + color = self._color + JS('color.setRGB(red, green, blue)') + + @property + def r(self): + color = self._color + return JS('color.r') + @property + def g(self): + color = self._color + return JS('color.g') + @property + def b(self): + color = self._color + return JS('color.b') + + def clone(self): + return Color( red=self.r, green=self.g, blue=self.b ) + class Vector3: - def __init__(self, x=0, y=0, z=0 ): - self._vec = JS('new THREE.Vector3(x,y,z)') + def __init__(self, x=0, y=0, z=0, object=None ): + if object: + self._vec = object + else: + self._vec = JS('new THREE.Vector3(x,y,z)') @property def x(self): @@ -321,6 +352,15 @@ def setViewOffset(self, fullWidth, fullHeight, x, y, width, height): ob = self._object JS('ob.setViewOffset(fullWidth, fullHeight, x, y, width, height)') + @property + def position(self): + vec = self._object.position + return Vector3( object=vec ) + + def get_position(self): + vec = self._object.position + return Vector3( object=vec ) + class Scene: def __init__(self): @@ -328,7 +368,8 @@ def __init__(self): def add(self, child): scene = self._scene - JS('scene.add(child)') + c = child._object + JS('scene.add(c)') def updateMatrixWorld(self): scene = self._scene @@ -350,7 +391,14 @@ def getDomElement(self): def render(self, scn, cam): renderer = self._renderer - return JS('renderer.render(scn, cam)') + s = scn._scene; c = cam._object + return JS('renderer.render(s, c)') + + +class CanvasRenderer( _Renderer ): + def __init__(self): + self._renderer = JS('new THREE.CanvasRenderer()') + class CSS3DRenderer( _Renderer ): def __init__(self): @@ -377,3 +425,17 @@ def loadTextureCube( urls ): ImageUtils = _ImageUtils() +class MeshBasicMaterial: + def __init__(self): + self._object = JS('new THREE.MeshBasicMaterial( {color:0xff0000, wireframe:true} )') + +class CubeGeometry: + def __init__(self, width, height, length): + self._object = JS('new THREE.CubeGeometry(width, height, length)') + + +class Mesh: + def __init__(self, geometry, material): + g = geometry._object + m = material._object + self._object = JS('new THREE.Mesh(g,m)') \ No newline at end of file diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index 95281a7..c816a99 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -257,7 +257,7 @@ def visit_ClassDef(self, node): if self._catch_attributes: self._inline_classes[ name ] = self._catch_attributes - writer.write('#$---: %s' %self._function_return_types) + self._catch_attributes = None self._decorator_properties = None self._instances.pop('self') @@ -394,21 +394,24 @@ def visit_UnaryOp(self, node): return self.visit(node.op) + self.visit(node.operand) def visit_Attribute(self, node): + node_value = self.visit(node.value) + typedef = None if isinstance(node.value, Name): - name = self.visit( node.value ) - typedef = self.get_typedef( node.value ) - if typedef: - if node.attr in typedef.properties: - getter = typedef.properties[ node.attr ]['get'] - if getter in self._function_return_types: - node.returns_type = self._function_return_types[getter] - return '%s( [%s] )' %(getter, name) - else: - return 'get_attribute(%s, "%s")' % (name, node.attr) + typedef = self.get_typedef( instance=node.value ) + elif hasattr(node.value, 'returns_type'): + typedef = self.get_typedef( class_name=node.value.returns_type ) + + if typedef: + if node.attr in typedef.properties: + getter = typedef.properties[ node.attr ]['get'] + if getter in self._function_return_types: + node.returns_type = self._function_return_types[getter] + return '%s( [%s] )' %(getter, node_value) else: - return 'get_attribute(%s, "%s")' % (name, node.attr) + return 'get_attribute(%s, "%s")' % (node_value, node.attr) else: - return 'get_attribute(%s, "%s")' % (self.visit(node.value), node.attr) + return 'get_attribute(%s, "%s")' % (node_value, node.attr) + def visit_Attribute_OLD(self, node): name = self.visit(node.value) @@ -480,49 +483,25 @@ def visit_Assign(self, node): code = "get_attribute(get_attribute('%s', '__setitem__'), '__call__')([%s, %s], JSObject())" code = code % (self.visit(target.value), self.visit(target.slice.value), self.visit(node.value)) writer.write(code) - elif isinstance(target, Attribute): - #name = self.visit(target.value) - #if name == 'self' and isinstance(self._catch_attributes, set): - # self._catch_attributes.add( target.attr ) - - fallback = True - #if name in self._instances: ## support '.' operator overloading - # klass = self._instances[ name ] - # if klass in self._decorator_class_props and target.attr in self._decorator_class_props[klass]: - # setter = self._decorator_class_props[klass][target.attr].get( 'set', None ) - # if setter: - # #writer.write( '''JS('%s( [%s, %s] )')''' %(setter, name, self.visit(node.value)) ) ## can not nest have nested JS() calls - # writer.write( '%s( [%s, %s] )' %(setter, name, self.visit(node.value)) ) - # fallback = False - # else: - # writer.write('#!!!! class is known: %s' %klass) - #else: - # writer.write('##fallback--unknown-type: %s - %s' %(target.value, name)) + elif isinstance(target, Attribute): target_value = self.visit(target.value) ## target.value may have "returns_type" after being visited + typedef = None if isinstance(target.value, Name): if target.value.id == 'self' and isinstance(self._catch_attributes, set): self._catch_attributes.add( target.attr ) - typedef = self.get_typedef( instance=target.value ) - if typedef and target.attr in typedef.properties: - setter = typedef.properties[ target.attr ].get('set',None) - if setter: - writer.write( '%s( [%s, %s] )' %(setter, target_value, self.visit(node.value)) ) - fallback = False - elif hasattr(target.value, 'returns_type'): - writer.write('#### HEY: %s' %target.value.returns_type) typedef = self.get_typedef( class_name=target.value.returns_type ) - if typedef and target.attr in typedef.properties: - setter = typedef.properties[ target.attr ].get('set',None) - if setter: - writer.write( '%s( [%s, %s] )' %(setter, target_value, self.visit(node.value)) ) - fallback = False + fallback = True + if typedef and target.attr in typedef.properties: + setter = typedef.properties[ target.attr ].get('set',None) + if setter: + writer.write( '%s( [%s, %s] )' %(setter, target_value, self.visit(node.value)) ) + fallback = False if fallback: - writer.write('#FALLBACK') code = 'set_attribute(%s, "%s", %s)' % ( target_value, target.attr, diff --git a/tests/threejs_helloworld.html b/tests/threejs_helloworld.html index e16654a..d08364a 100644 --- a/tests/threejs_helloworld.html +++ b/tests/threejs_helloworld.html @@ -6,32 +6,39 @@ - diff --git a/tests/threejs_nested_attribute_lookup_decorators.html b/tests/threejs_nested_attribute_lookup_decorators.html new file mode 100644 index 0000000..930043d --- /dev/null +++ b/tests/threejs_nested_attribute_lookup_decorators.html @@ -0,0 +1,27 @@ + + + + + + + + + + + + \ No newline at end of file From c7921bf4890a032b9cb484819d8c53244629a113 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Mon, 7 Oct 2013 02:39:43 -0700 Subject: [PATCH 100/860] made python_to_pythonjs.py compatible with runtime again, changed server.py so that regenerates the runtime each time it starts. --- pythonscript/python_to_pythonjs.py | 2 +- tests/server.py | 27 ++++++++++++++++++++++++--- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index c816a99..ea82699 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -516,7 +516,7 @@ def visit_Assign(self, node): self._instances[ target.id ] = node.value.func.id ## keep track of instances elif isinstance(node.value, Call) and isinstance(node.value.func, Name) and node.value.func.id in self._function_return_types: self._instances[ target.id ] = self._function_return_types[ node.value.func.id ] - elif isinstance(node.value, Call) and isinstance(node.value.func, Attribute) and node.value.func.value.id in self._instances: + elif isinstance(node.value, Call) and isinstance(node.value.func, Attribute) and isinstance(node.value.func.value, Name) and node.value.func.value.id in self._instances: typedef = self.get_typedef( node.value.func.value ) method = node.value.func.attr if method in typedef.methods: diff --git a/tests/server.py b/tests/server.py index 23d123c..a7b5729 100755 --- a/tests/server.py +++ b/tests/server.py @@ -13,7 +13,7 @@ import tornado.ioloop import tornado.web -import os, subprocess +import os, subprocess, datetime PATHS = dict( webroot = os.path.dirname(os.path.abspath(__file__)), @@ -22,9 +22,13 @@ closure = os.path.expanduser( '~/closure-compiler/compiler.jar'), runtime = os.path.abspath('../pythonscript.js'), module_cache = '/tmp', -) + runtime_pythonjs = os.path.abspath('../runtime/pythonpythonjs.py'), ## handwritten pythonjs + runtime_builtins = os.path.abspath('../runtime/builtins.py'), + +) +REGENERATE_RUNTIME = True ## to be safer, the runtime should be rebuilt each run def python_to_pythonjs( src, module=None ): cmdheader = '#!%s' %PATHS['module_cache'] @@ -139,13 +143,30 @@ def convert_python_html_document( data ): return '\n'.join( doc ) + +def regenerate_runtime(): + print('regenerating pythonscript runtime...') + global REGENERATE_RUNTIME + REGENERATE_RUNTIME = False + a = '// PythonScript Runtime - regenerated on: %s' %datetime.datetime.now().ctime() + b = pythonjs_to_javascript( open(PATHS['runtime_pythonjs'],'rb').read().decode('utf-8') ) + c = python_to_javascript( open(PATHS['runtime_builtins'],'rb').read().decode('utf-8') ) + src = '\n'.join( [a,b.strip(),c.strip()] ) + file = open( PATHS['runtime'], 'wb') + file.write( src.encode('utf-8') ) + file.close() + return src + class MainHandler( tornado.web.RequestHandler ): def get(self, path=None): print('path', path) if not path: self.write( get_main_page() ) elif path == 'pythonscript.js': - data = open( PATHS['runtime'], 'rb').read() + if REGENERATE_RUNTIME: + data = regenerate_runtime() + else: + data = open( PATHS['runtime'], 'rb').read() self.set_header("Content-Type", "text/javascript; charset=utf-8") self.set_header("Content-Length", len(data)) self.write(data) From 50f72d2c97a9fdcac768bea9d69df6ade644aa8b Mon Sep 17 00:00:00 2001 From: hartsantler Date: Mon, 7 Oct 2013 03:34:39 -0700 Subject: [PATCH 101/860] fixed new lines, string variables in functions, regenerated runtime. --- bindings/three.py | 18 +- pythonscript.js | 218 ++++++++++++++---------- pythonscript/python_to_pythonjs.py | 24 +-- pythonscript/pythonjs.py | 11 +- runtime/pythonpythonjs.py | 10 +- tests/helloworld.html | 13 +- tests/test_calling_args_and_kwargs.html | 30 ++++ tests/threejs_helloworld.html | 8 +- 8 files changed, 217 insertions(+), 115 deletions(-) create mode 100644 tests/test_calling_args_and_kwargs.html diff --git a/bindings/three.py b/bindings/three.py index 999e0a0..869deea 100644 --- a/bindings/three.py +++ b/bindings/three.py @@ -7,7 +7,7 @@ def __init__(self, red=1.0, green=1.0, blue=1.0, object=None ): if object: self._color = object else: - self._color = JS('new THREE.Vector3()') + self._color = JS('new THREE.Color()') self.setRGB(red=red, green=green, blue=blue) def setRGB(self, red=1.0, green=1.0, blue=1.0): @@ -383,7 +383,9 @@ def setSize(self, width, height): def setClearColor(self, red=1.0, green=1.0, blue=1.0, alpha=1.0): renderer = self._renderer - JS('renderer.setClearColor( {r:red, g:green, b:blue}, alpha)') + clr = Color( red=red, green=green, blue=blue ) + c = clr._color + JS('renderer.setClearColor( c, alpha)') def getDomElement(self): renderer = self._renderer @@ -438,4 +440,14 @@ class Mesh: def __init__(self, geometry, material): g = geometry._object m = material._object - self._object = JS('new THREE.Mesh(g,m)') \ No newline at end of file + self._object = JS('new THREE.Mesh(g,m)') + + @property + def position(self): + vec = self._object.position + return Vector3( object=vec ) + + @property + def rotation(self): + vec = self._object.rotation + return Vector3( object=vec ) \ No newline at end of file diff --git a/pythonscript.js b/pythonscript.js index 73a6271..807d45c 100644 --- a/pythonscript.js +++ b/pythonscript.js @@ -1,9 +1,6 @@ - - - - - +// PythonScript Runtime - regenerated on: Mon Oct 7 03:32:19 2013 var jsrange = function(num) { +"Emulates Python's range function"; var i, r; i = 0; r = []; @@ -13,8 +10,10 @@ i = i + 1; } return r; } +window["jsrange"] = jsrange var create_array = function() { +"Used to fix a bug/feature of Javascript where new Array(number)\n created a array with number of undefined elements which is not\n what we want"; var array; array = []; var iter = jsrange(arguments.length); @@ -27,16 +26,21 @@ i = backup; return array; } +window["create_array"] = create_array var adapt_arguments = function(handler) { +"Useful to transform Javascript arguments to Python arguments"; var func = function() { handler(Array.prototype.slice.call(arguments)); } +window["func"] = func return func; } +window["adapt_arguments"] = adapt_arguments var create_class = function(class_name, parents, attrs) { +"Create a PythonScript class"; if(attrs.__metaclass__) { var metaclass; metaclass = attrs.__metaclass__; @@ -50,6 +54,7 @@ klass.bases = parents; klass.__name__ = class_name; klass.__dict__ = attrs; var __call__ = function() { +"Create a PythonScript object"; var object; object = Object(); object.__class__ = klass; @@ -62,12 +67,15 @@ init.apply(undefined, arguments); return object; } +window["__call__"] = __call__ klass.__call__ = __call__; return klass; } +window["create_class"] = create_class var get_attribute = function(object, attribute) { +"Retrieve an attribute, method or property\n\n method are actually functions which are converted to methods by\n prepending their arguments with the current object. Properties are\n not functions!"; if(attribute == "__call__") { if({}.toString.call(object) === '[object Function]') { return object; @@ -172,6 +180,7 @@ args = [object]; return attr.apply(undefined, args); } +window["method"] = method return method; } @@ -201,6 +210,7 @@ args = [object]; return attr.apply(undefined, args); } +window["method"] = method return method; } @@ -215,8 +225,10 @@ i = backup; return undefined; } +window["get_attribute"] = get_attribute var set_attribute = function(object, attribute, value) { +"Set an attribute on an object by updating its __dict__ property"; var __dict__, __class__; __class__ = object.__class__; if(__class__) { @@ -263,8 +275,10 @@ object[attribute] = value; } } +window["set_attribute"] = set_attribute var get_arguments = function(signature, args, kwargs) { +"Based on ``signature`` and ``args``, ``kwargs`` parameters retrieve\n the actual parameters.\n\n This will set default keyword arguments and retrieve positional arguments\n in kwargs if their called as such"; if(args === undefined) { args = []; } @@ -282,10 +296,7 @@ argslength = 0; } j = 0; -var iter = jsrange(argslength); -for (var i=0; i < iter.length; i++) { -var backup = i; -i = iter[i]; +while(j < argslength) { arg = signature.args[j]; if(kwargs) { kwarg = kwargs[arg]; @@ -293,19 +304,28 @@ if(kwarg) { out[arg] = kwarg; } else { +if(arg in signature.kwargs) { +out[arg] = signature.kwargs[arg]; +} +else { out[arg] = args[j]; -j = j + 1; +} + } +} +else { +if(arg in signature.kwargs) { +out[arg] = signature.kwargs[arg]; } else { out[arg] = args[j]; -j = j + 1; } -i = backup; } +j += 1 +} args = args.slice(j); if(signature.vararg) { out[signature.vararg] = args; @@ -317,6 +337,7 @@ out[signature.varkwarg] = kwargs; return out; } +window["get_arguments"] = get_arguments var type = function(args, kwargs) { var class_name, parents, attrs; @@ -325,6 +346,7 @@ parents = args[1]; attrs = args[2]; return create_class(class_name, parents, attrs); } +window["type"] = type var getattr = function(args, kwargs) { var object, attribute; @@ -332,6 +354,7 @@ object = args[0]; attribute = args[1]; return get_attribute(object, attribute); } +window["getattr"] = getattr var setattr = function(args, kwargs) { var object, attribute, value; @@ -340,6 +363,7 @@ attribute = args[1]; value = args[2]; return set_attribute(object, attribute, value); } +window["setattr"] = setattr var issubclass = function(args, kwargs) { var C, B, base; @@ -363,6 +387,7 @@ index = backup; return false; } +window["issubclass"] = issubclass var isinstance = function(args, kwargs) { var object_class, object, klass; @@ -375,6 +400,7 @@ return false; return issubclass(create_array(object_class, klass)); } +window["isinstance"] = isinstance var json_to_pythonscript = function(json) { var jstype, item, output; @@ -414,27 +440,26 @@ key = backup; return output; } - +window["json_to_pythonscript"] = json_to_pythonscript var range = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("num")}; arguments = get_arguments(signature, args, kwargs); var num = arguments['num']; +"Emulates Python's range function"; var i, r; i = 0; +r = list(create_array(), Object()); +while(i < num) { var __args_0, __kwargs_0; -__args_0 = create_array(); +__args_0 = create_array(i); __kwargs_0 = Object(); -r = get_attribute(list, "__call__")(__args_0, __kwargs_0); -while(i < num) { -var __args_1, __kwargs_1; -__args_1 = create_array(i); -__kwargs_1 = Object(); -get_attribute(get_attribute(r, "append"), "__call__")(__args_1, __kwargs_1); +get_attribute(get_attribute(r, "append"), "__call__")(__args_0, __kwargs_0); i = i + 1; } return r; } +window["range"] = range var StopIteration, __StopIteration_attrs, __StopIteration_parents; __StopIteration_attrs = Object(); @@ -445,22 +470,18 @@ var signature, arguments; signature = {"kwargs": Object(), "args": create_array("obj")}; arguments = get_arguments(signature, args, kwargs); var obj = arguments['obj']; -var __args_2, __kwargs_2; -__args_2 = create_array(); -__kwargs_2 = Object(); -return get_attribute(get_attribute(obj, "__len__"), "__call__")(__args_2, __kwargs_2); +return get_attribute(obj, "__len__")(create_array(), Object()); } +window["len"] = len var next = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("obj")}; arguments = get_arguments(signature, args, kwargs); var obj = arguments['obj']; -var __args_3, __kwargs_3; -__args_3 = create_array(); -__kwargs_3 = Object(); -return get_attribute(get_attribute(obj, "next"), "__call__")(__args_3, __kwargs_3); +return get_attribute(obj, "next")(create_array(), Object()); } +window["next"] = next var map = function(args, kwargs) { var signature, arguments; @@ -468,16 +489,14 @@ signature = {"kwargs": Object(), "args": create_array("func", "objs")}; arguments = get_arguments(signature, args, kwargs); var func = arguments['func']; var objs = arguments['objs']; -var __args_4, __kwargs_4; -__args_4 = create_array(); -__kwargs_4 = Object(); -out = get_attribute(list, "__call__")(__args_4, __kwargs_4); -var __args_5, __kwargs_5; -__args_5 = create_array(func, get_attribute(objs, "js_object")); -__kwargs_5 = Object(); -set_attribute(out, "js_object", get_attribute(map, "__call__")(__args_5, __kwargs_5)); +out = list(create_array(), Object()); +var __args_1, __kwargs_1; +__args_1 = create_array(func, get_attribute(objs, "js_object")); +__kwargs_1 = Object(); +set_attribute(out, "js_object", get_attribute(map, "__call__")(__args_1, __kwargs_1)); return out; } +window["map"] = map var Iterator, __Iterator_attrs, __Iterator_parents; __Iterator_attrs = Object(); @@ -492,31 +511,33 @@ var index = arguments['index']; set_attribute(self, "obj", obj); set_attribute(self, "index", index); } +window["__Iterator___init__"] = __Iterator___init__ -__Iterator_attrs.__init__ = __Iterator___init__; +__Iterator_attrs["__init__"] = __Iterator___init__; var __Iterator_next = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; index = get_attribute(self, "index"); -var __args_6, __kwargs_6; -__args_6 = create_array(get_attribute(self, "obj")); -__kwargs_6 = Object(); -length = get_attribute(len, "__call__")(__args_6, __kwargs_6); +var __args_2, __kwargs_2; +__args_2 = create_array(get_attribute(self, "obj")); +__kwargs_2 = Object(); +length = get_attribute(len, "__call__")(__args_2, __kwargs_2); if(index == length) { throw StopIteration; } -var __args_7, __kwargs_7; -__args_7 = create_array(get_attribute(self, "index")); -__kwargs_7 = Object(); -item = get_attribute(get_attribute(get_attribute(self, "obj"), "get"), "__call__")(__args_7, __kwargs_7); +var __args_3, __kwargs_3; +__args_3 = create_array(get_attribute(self, "index")); +__kwargs_3 = Object(); +item = get_attribute(get_attribute(get_attribute(self, "obj"), "get"), "__call__")(__args_3, __kwargs_3); set_attribute(self, "index", get_attribute(self, "index") + 1); return item; } +window["__Iterator_next"] = __Iterator_next -__Iterator_attrs.next = __Iterator_next; +__Iterator_attrs["next"] = __Iterator_next; Iterator = create_class("Iterator", __Iterator_parents, __Iterator_attrs); var list, __list_attrs, __list_parents; __list_attrs = Object(); @@ -535,8 +556,9 @@ set_attribute(self, "js_object", create_array()); } } +window["__list___init__"] = __list___init__ -__list_attrs.__init__ = __list___init__; +__list_attrs["__init__"] = __list___init__; var __list_append = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "obj")}; @@ -547,8 +569,9 @@ var __array; __array = get_attribute(self, "js_object"); __array.push(obj); } +window["__list_append"] = __list_append -__list_attrs.append = __list_append; +__list_attrs["append"] = __list_append; var __list_extend = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "other")}; @@ -560,10 +583,10 @@ __iterator__ = get_attribute(get_attribute(other, "__iter__"), "__call__")(creat try { obj = get_attribute(__iterator__, "next")(create_array(), Object()); while(true) { -var __args_8, __kwargs_8; -__args_8 = create_array(obj); -__kwargs_8 = Object(); -get_attribute(get_attribute(self, "append"), "__call__")(__args_8, __kwargs_8); +var __args_4, __kwargs_4; +__args_4 = create_array(obj); +__kwargs_4 = Object(); +get_attribute(get_attribute(self, "append"), "__call__")(__args_4, __kwargs_4); obj = get_attribute(__iterator__, "next")(create_array(), Object()); } } @@ -575,8 +598,9 @@ if (__exception__ == StopIteration || isinstance([__exception__, StopIteration]) } } +window["__list_extend"] = __list_extend -__list_attrs.extend = __list_extend; +__list_attrs["extend"] = __list_extend; var __list_insert = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "index", "obj")}; @@ -588,8 +612,9 @@ var __array; __array = get_attribute(self, "js_object"); __array.splice(index, 0, obj); } +window["__list_insert"] = __list_insert -__list_attrs.insert = __list_insert; +__list_attrs["insert"] = __list_insert; var __list_remove = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "obj")}; @@ -597,15 +622,16 @@ arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var obj = arguments['obj']; var __array; -var __args_9, __kwargs_9; -__args_9 = create_array(obj); -__kwargs_9 = Object(); -index = get_attribute(get_attribute(self, "index"), "__call__")(__args_9, __kwargs_9); +var __args_5, __kwargs_5; +__args_5 = create_array(obj); +__kwargs_5 = Object(); +index = get_attribute(get_attribute(self, "index"), "__call__")(__args_5, __kwargs_5); __array = get_attribute(self, "js_object"); __array.splice(index, 1); } +window["__list_remove"] = __list_remove -__list_attrs.remove = __list_remove; +__list_attrs["remove"] = __list_remove; var __list_pop = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self")}; @@ -615,8 +641,9 @@ var __array; __array = get_attribute(self, "js_object"); return __array.pop(); } +window["__list_pop"] = __list_pop -__list_attrs.pop = __list_pop; +__list_attrs["pop"] = __list_pop; var __list_index = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "obj")}; @@ -627,8 +654,9 @@ var __array; __array = get_attribute(self, "js_object"); return __array.indexOf(obj); } +window["__list_index"] = __list_index -__list_attrs.index = __list_index; +__list_attrs["index"] = __list_index; var __list_count = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "obj")}; @@ -657,8 +685,9 @@ if (__exception__ == StopIteration || isinstance([__exception__, StopIteration]) return i; } +window["__list_count"] = __list_count -__list_attrs.count = __list_count; +__list_attrs["count"] = __list_count; var __list_reverse = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self")}; @@ -668,8 +697,9 @@ var __array; __array = get_attribute(self, "js_object"); set_attribute(self, "js_object", __array.reverse()); } +window["__list_reverse"] = __list_reverse -__list_attrs.reverse = __list_reverse; +__list_attrs["reverse"] = __list_reverse; var __list_shift = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self")}; @@ -679,8 +709,9 @@ var __array; __array = get_attribute(self, "js_object"); return __array.shift(); } +window["__list_shift"] = __list_shift -__list_attrs.shift = __list_shift; +__list_attrs["shift"] = __list_shift; var __list_slice = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "start", "end")}; @@ -692,20 +723,22 @@ var __array; __array = get_attribute(self, "js_object"); return __array.slice(start, end); } +window["__list_slice"] = __list_slice -__list_attrs.slice = __list_slice; +__list_attrs["slice"] = __list_slice; var __list___iter__ = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; -var __args_10, __kwargs_10; -__args_10 = create_array(self, 0); -__kwargs_10 = Object(); -return get_attribute(Iterator, "__call__")(__args_10, __kwargs_10); +var __args_6, __kwargs_6; +__args_6 = create_array(self, 0); +__kwargs_6 = Object(); +return get_attribute(Iterator, "__call__")(__args_6, __kwargs_6); } +window["__list___iter__"] = __list___iter__ -__list_attrs.__iter__ = __list___iter__; +__list_attrs["__iter__"] = __list___iter__; var __list_get = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "index")}; @@ -716,8 +749,9 @@ var __array; __array = get_attribute(self, "js_object"); return __array[index]; } +window["__list_get"] = __list_get -__list_attrs.get = __list_get; +__list_attrs["get"] = __list_get; var __list_set = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "index", "value")}; @@ -729,8 +763,9 @@ var __array; __array = get_attribute(self, "js_object"); __array[index] = value; } +window["__list_set"] = __list_set -__list_attrs.set = __list_set; +__list_attrs["set"] = __list_set; var __list___len__ = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self")}; @@ -740,8 +775,9 @@ var __array; __array = get_attribute(self, "js_object"); return __array.length; } +window["__list___len__"] = __list___len__ -__list_attrs.__len__ = __list___len__; +__list_attrs["__len__"] = __list___len__; list = create_class("list", __list_parents, __list_attrs); var dict, __dict_attrs, __dict_parents; __dict_attrs = Object(); @@ -760,8 +796,9 @@ set_attribute(self, "js_object", Object()); } } +window["__dict___init__"] = __dict___init__ -__dict_attrs.__init__ = __dict___init__; +__dict_attrs["__init__"] = __dict___init__; var __dict_get = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "key", "d")}; @@ -777,8 +814,9 @@ return __dict[key]; return d; } +window["__dict_get"] = __dict_get -__dict_attrs.get = __dict_get; +__dict_attrs["get"] = __dict_get; var __dict_set = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "key", "value")}; @@ -790,8 +828,9 @@ var __dict; __dict = get_attribute(self, "js_object"); __dict[key] = value; } +window["__dict_set"] = __dict_set -__dict_attrs.set = __dict_set; +__dict_attrs["set"] = __dict_set; var __dict___len__ = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self")}; @@ -801,8 +840,9 @@ var __dict; __dict = get_attribute(self, "js_object"); return Object.keys(__dict).length; } +window["__dict___len__"] = __dict___len__ -__dict_attrs.__len__ = __dict___len__; +__dict_attrs["__len__"] = __dict___len__; var __dict_keys = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self")}; @@ -811,15 +851,13 @@ var self = arguments['self']; var __dict, out; __dict = get_attribute(self, "js_object"); __keys = Object.keys(__dict); -var __args_11, __kwargs_11; -__args_11 = create_array(); -__kwargs_11 = Object(); -out = get_attribute(list, "__call__")(__args_11, __kwargs_11); +out = get_attribute(list, "__call__")(create_array(), Object()); set_attribute(out, "js_object", __keys); return out; } +window["__dict_keys"] = __dict_keys -__dict_attrs.keys = __dict_keys; +__dict_attrs["keys"] = __dict_keys; dict = create_class("dict", __dict_parents, __dict_attrs); var str, __str_attrs, __str_parents; __str_attrs = Object(); @@ -832,18 +870,20 @@ var self = arguments['self']; var jsstring = arguments['jsstring']; set_attribute(self, "jsstring", jsstring); } +window["__str___init__"] = __str___init__ -__str_attrs.__init__ = __str___init__; +__str_attrs["__init__"] = __str___init__; var __str___iter__ = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; -var __args_12, __kwargs_12; -__args_12 = create_array(get_attribute(self, "jsstring"), 0); -__kwargs_12 = Object(); -return get_attribute(Iterator, "__call__")(__args_12, __kwargs_12); +var __args_7, __kwargs_7; +__args_7 = create_array(get_attribute(self, "jsstring"), 0); +__kwargs_7 = Object(); +return get_attribute(Iterator, "__call__")(__args_7, __kwargs_7); } +window["__str___iter__"] = __str___iter__ -__str_attrs.__iter__ = __str___iter__; -str = create_class("str", __str_parents, __str_attrs); +__str_attrs["__iter__"] = __str___iter__; +str = create_class("str", __str_parents, __str_attrs); \ No newline at end of file diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index ea82699..49c069c 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -561,7 +561,7 @@ def visit_Print(self, node): writer.write('print %s' % ', '.join(map(self.visit, node.values))) def visit_Str(self, node): - return '"%s"' % node.s + return '"""%s"""' % node.s def visit_Expr(self, node): writer.write(self.visit(node.value)) @@ -687,17 +687,17 @@ def visit_FunctionDef(self, node): writer.write(expr) self._return_type = None - #map(self.visit, node.body) - for child in node.body: - # simple test to drop triple quote comments - if hasattr(child, 'value'): - if isinstance(child.value, Str): - continue - if isinstance(child, GeneratorType): - for sub in child: - self.visit(sub) - else: - self.visit(child) + map(self.visit, node.body) + #for child in node.body: + # # simple test to drop triple quote comments + # if hasattr(child, 'value'): + # if isinstance(child.value, Str): + # continue + # if isinstance(child, GeneratorType): + # for sub in child: + # self.visit(sub) + # else: + # self.visit(child) if self._return_type: #if hasattr(node, 'original_name'): diff --git a/pythonscript/pythonjs.py b/pythonscript/pythonjs.py index 945a0f4..51e1fe6 100755 --- a/pythonscript/pythonjs.py +++ b/pythonscript/pythonjs.py @@ -68,9 +68,12 @@ def visit_FunctionDef(self, node): body = list() for child in node.body: # simple test to drop triple quote comments - if hasattr(child, 'value'): - if isinstance(child.value, Str): - continue + #if hasattr(child, 'value'): + # if isinstance(child.value, Str): + # continue + if isinstance(child, Str): + continue + if isinstance(child, GeneratorType): for sub in child: body.append(self.visit(sub)) @@ -150,7 +153,7 @@ def visit_While(self, node): return 'while(%s) {\n%s\n}' % (self.visit(node.test), body) def visit_Str(self, node): - return '"%s"' % node.s + return '"%s"' % node.s.replace('\n', '\\n') def visit_BinOp(self, node): left = self.visit(node.left) diff --git a/runtime/pythonpythonjs.py b/runtime/pythonpythonjs.py index e93b010..5c647bf 100644 --- a/runtime/pythonpythonjs.py +++ b/runtime/pythonpythonjs.py @@ -197,19 +197,23 @@ def get_arguments(signature, args, kwargs): argslength = signature.args.length else: argslength = 0 + j = 0 - for i in jsrange(argslength): + while j < argslength: arg = JS('signature.args[j]') if kwargs: kwarg = kwargs[arg] if kwarg: out[arg] = kwarg + elif arg in signature.kwargs: + out[arg] = signature.kwargs[arg] else: out[arg] = args[j] - j = j + 1 + elif arg in signature.kwargs: + out[arg] = signature.kwargs[arg] else: out[arg] = args[j] - j = j + 1 + j += 1 args = args.slice(j) if signature.vararg: out[signature.vararg] = args diff --git a/tests/helloworld.html b/tests/helloworld.html index 0661590..8a94b12 100644 --- a/tests/helloworld.html +++ b/tests/helloworld.html @@ -3,8 +3,19 @@ diff --git a/tests/test_calling_args_and_kwargs.html b/tests/test_calling_args_and_kwargs.html new file mode 100644 index 0000000..1848088 --- /dev/null +++ b/tests/test_calling_args_and_kwargs.html @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/tests/threejs_helloworld.html b/tests/threejs_helloworld.html index d08364a..b20615a 100644 --- a/tests/threejs_helloworld.html +++ b/tests/threejs_helloworld.html @@ -23,7 +23,7 @@ #ren = WebGLRenderer() ren = CanvasRenderer() ren.setSize( width, height ) -#ren.setClearColor( red=1.0, green=0.0, blue=0.5 ) +ren.setClearColor( red=0.1, green=0.8, blue=0.5 ) element = ren.getDomElement() #JS('con.appendChild( element )') @@ -36,9 +36,11 @@ def animate(): JS('requestAnimationFrame( animate )') - scn.updateMatrixWorld() + #scn.updateMatrixWorld() + + mesh.rotation.x = mesh.rotation.x + 0.01 + mesh.rotation.y = mesh.rotation.y + 0.02 ren.render( scn, cam ) - #print('rendering') From 54f3256f4dee2e71b7dac60a1f6b5d5dc8dffbfc Mon Sep 17 00:00:00 2001 From: hartsantler Date: Mon, 7 Oct 2013 06:35:36 -0700 Subject: [PATCH 102/860] fixed calling a function that expects kwargs, but the caller passes plain args, do not use kwarg defaults. added server.py --regenerate-runtime updated runtime --- bindings/three.py | 5 +++++ pythonscript.js | 18 +++++++++++++++--- runtime/pythonpythonjs.py | 10 ++++++++-- tests/server.py | 4 ++-- tests/test_calling_args_and_kwargs.html | 8 ++++++++ tests/test_threejs.html | 2 +- 6 files changed, 39 insertions(+), 8 deletions(-) diff --git a/bindings/three.py b/bindings/three.py index 869deea..ab79eb5 100644 --- a/bindings/three.py +++ b/bindings/three.py @@ -450,4 +450,9 @@ def position(self): @property def rotation(self): vec = self._object.rotation + return Vector3( object=vec ) + + @property + def scale(self): + vec = self._object.scale return Vector3( object=vec ) \ No newline at end of file diff --git a/pythonscript.js b/pythonscript.js index 807d45c..a03f0f0 100644 --- a/pythonscript.js +++ b/pythonscript.js @@ -1,4 +1,4 @@ -// PythonScript Runtime - regenerated on: Mon Oct 7 03:32:19 2013 +// PythonScript Runtime - regenerated on: Mon Oct 7 06:29:29 2013 var jsrange = function(num) { "Emulates Python's range function"; var i, r; @@ -304,22 +304,34 @@ if(kwarg) { out[arg] = kwarg; } else { +if(j < args.length) { +out[arg] = args[j]; +} +else { if(arg in signature.kwargs) { out[arg] = signature.kwargs[arg]; } else { -out[arg] = args[j]; +throw TypeError; +} + } } +} +else { +if(j < args.length) { +out[arg] = args[j]; } else { if(arg in signature.kwargs) { out[arg] = signature.kwargs[arg]; } else { -out[arg] = args[j]; +throw TypeError; +} + } } diff --git a/runtime/pythonpythonjs.py b/runtime/pythonpythonjs.py index 5c647bf..0efd584 100644 --- a/runtime/pythonpythonjs.py +++ b/runtime/pythonpythonjs.py @@ -205,14 +205,20 @@ def get_arguments(signature, args, kwargs): kwarg = kwargs[arg] if kwarg: out[arg] = kwarg + elif j < args.length: + out[arg] = args[j] elif arg in signature.kwargs: out[arg] = signature.kwargs[arg] else: - out[arg] = args[j] + #out[arg] = args[j] + raise TypeError + elif j < args.length: + out[arg] = args[j] elif arg in signature.kwargs: out[arg] = signature.kwargs[arg] else: - out[arg] = args[j] + #out[arg] = args[j] + raise TypeError j += 1 args = args.slice(j) if signature.vararg: diff --git a/tests/server.py b/tests/server.py index a7b5729..8f1b2f4 100755 --- a/tests/server.py +++ b/tests/server.py @@ -13,7 +13,7 @@ import tornado.ioloop import tornado.web -import os, subprocess, datetime +import os, sys, subprocess, datetime PATHS = dict( webroot = os.path.dirname(os.path.abspath(__file__)), @@ -28,7 +28,7 @@ ) -REGENERATE_RUNTIME = True ## to be safer, the runtime should be rebuilt each run +REGENERATE_RUNTIME = '--regenerate-runtime' in sys.argv def python_to_pythonjs( src, module=None ): cmdheader = '#!%s' %PATHS['module_cache'] diff --git a/tests/test_calling_args_and_kwargs.html b/tests/test_calling_args_and_kwargs.html index 1848088..f431c62 100644 --- a/tests/test_calling_args_and_kwargs.html +++ b/tests/test_calling_args_and_kwargs.html @@ -12,6 +12,9 @@ print('testing mixed args and kwargs') print a,b, x,y,z +def test_simple(x,y): + print x,y + def test(): print('hello world') test_kwargs() @@ -21,6 +24,11 @@ mixed_args_kwargs(9,9) mixed_args_kwargs(9,9, z=420) + test_kwargs(3, 2, 1) + + test_simple(1,2) + test_simple(1) ## calling with too few args throw a TypeError + diff --git a/tests/test_threejs.html b/tests/test_threejs.html index 1664ebd..ce8b5ac 100644 --- a/tests/test_threejs.html +++ b/tests/test_threejs.html @@ -8,7 +8,7 @@ from three import * def test(): - v = Vector3(1, 2, 3) + v = Vector3(1, 2, z=3) print( v.x ) print( v.y ) print( v.z ) From 5efddb318f0d9a9e111d940ca641a2f037bfe611 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Mon, 7 Oct 2013 11:23:40 -0700 Subject: [PATCH 103/860] fixed class level attributes, fixed __getattr__, added test__getattr__.html --- pythonscript/python_to_pythonjs.py | 56 ++++++++++++++++++++---------- tests/test__getattr__.html | 47 +++++++++++++++++++++++++ 2 files changed, 85 insertions(+), 18 deletions(-) create mode 100644 tests/test__getattr__.html diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index 49c069c..f59bd28 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -112,7 +112,8 @@ class PythonToPythonJS(NodeVisitor): def __init__(self, module=None, module_path=None): super(PythonToPythonJS, self).__init__() self._classes = dict() ## class name : [method names] - self._inline_classes = dict() ## class name : [attribute names] + self._instance_attributes = dict() ## class name : [attribute names] + self._class_attributes = dict() self._catch_attributes = None self._names = set() ## not used? self._instances = dict() ## instance name : class name @@ -134,6 +135,8 @@ def get_typedef(self, instance=None, class_name=None): name = class_name, methods = self._classes[ class_name ], properties = self._decorator_class_props[ class_name ], + attributes = self._instance_attributes[ class_name ], + class_attributes = self._class_attributes[ class_name ], ) return typedef @@ -141,7 +144,8 @@ def save_module(self): if self._module and self._module_path: a = dict( classes = self._classes, - inline_classes = self._inline_classes, + instance_attributes = self._instance_attributes, + class_attributes = self._class_attributes, decorator_class_props = self._decorator_class_props, function_return_types = self._function_return_types, ) @@ -157,13 +161,14 @@ def visit_ImportFrom(self, node): f = open( os.path.join(self._module_path, node.module+'.module'), 'rb' ) a = pickle.load( f ); f.close() self._classes.update( a['classes'] ) - self._inline_classes.update( a['inline_classes'] ) + self._class_attributes.update( a['class_attributes'] ) + self._instance_attributes.update( a['instance_attributes'] ) self._decorator_class_props.update( a['decorator_class_props'] ) self._function_return_types.update( a['function_return_types'] ) def visit_Assert(self, node): ## hijacking "assert isinstance(a,A)" as a type system ## - if isinstance( node.test, Call ) and node.test.func.id == 'isinstance': + if isinstance( node.test, Call ) and isinstance(node.test.func, Name) and node.test.func.id == 'isinstance': a,b = node.test.args if b.id in self._classes: self._instances[ a.id ] = b.id @@ -217,14 +222,19 @@ def _gen_getattr_helper(self, class_name, func_name): def visit_ClassDef(self, node): name = node.name self._classes[ name ] = list() ## method names + self._class_attributes[ name ] = set() self._catch_attributes = None self._decorator_properties = dict() ## property names : {'get':func, 'set':func} self._decorator_class_props[ name ] = self._decorator_properties self._instances[ 'self' ] = name - for dec in node.decorator_list: - if isinstance(dec, Name) and dec.id == 'inline': - self._catch_attributes = set() + #for dec in node.decorator_list: + # if isinstance(dec, Name) and dec.id == 'inline': + # self._catch_attributes = set() + ## always catch attributes ## + self._catch_attributes = set() + self._instance_attributes[ name ] = self._catch_attributes + writer.write('var(%s, __%s_attrs, __%s_parents)' % (name, name, name)) writer.write('__%s_attrs = JSObject()' % name) @@ -246,17 +256,20 @@ def visit_ClassDef(self, node): else: writer.write('__%s_attrs["%s"] = %s' % (name, item_name, item.name)) - if item_name == '__getattr__': - writer.write( self._gen_getattr_helper(name, item.name) ) + #if item_name == '__getattr__': + # writer.write( self._gen_getattr_helper(name, item.name) ) - elif isinstance(item, Assign): + elif isinstance(item, Assign) and isinstance(item.targets[0], Name): item_name = item.targets[0].id - item.targets[0].id = '__%s_%s' % (name.id, item_name) + item.targets[0].id = '__%s_%s' % (name, item_name) self.visit(item) # this will output the code for the assign - writer.write('%s_attrs["%s"] = %s' % (name, item_name, item.targets[0].id)) + writer.write('__%s_attrs["%s"] = %s' % (name, item_name, item.targets[0].id)) + self._class_attributes[ name ].add( item_name ) ## should this come before self.visit(item) ?? + else: + raise NotImplementedError - if self._catch_attributes: - self._inline_classes[ name ] = self._catch_attributes + #if self._catch_attributes: + # self._instance_attributes[ name ] = self._catch_attributes self._catch_attributes = None self._decorator_properties = None @@ -407,6 +420,13 @@ def visit_Attribute(self, node): if getter in self._function_return_types: node.returns_type = self._function_return_types[getter] return '%s( [%s] )' %(getter, node_value) + elif node.attr in typedef.class_attributes: + return "%s['__class__']['__dict__']['%s']" %(node_value, node.attr) + elif node.attr in typedef.attributes: + return "%s['__dict__']['%s']" %(node_value, node.attr) + elif '__getattr__' in typedef.methods: + func = typedef.get_pythonjs_function_name( '__getattr__' ) + return '%s([%s, "%s"])' %(func, node_value, node.attr) else: return 'get_attribute(%s, "%s")' % (node_value, node.attr) else: @@ -418,8 +438,8 @@ def visit_Attribute_OLD(self, node): if name in self._instances: ## support '.' operator overloading klass = self._instances[ name ] if '__getattr__' in self._classes[ klass ]: - if klass in self._inline_classes: ## static attribute - if node.attr in self._inline_classes[klass]: + if klass in self._instance_attributes: ## static attribute + if node.attr in self._instance_attributes[klass]: #return '''JS('%s.__dict__["%s"]')''' %(name, node.attr) ## this is not ClosureCompiler compatible return '''JS('%s["__dict__"]["%s"]')''' %(name, node.attr) elif node.attr in self._classes[ klass ]: ## method @@ -433,8 +453,8 @@ def visit_Attribute_OLD(self, node): else: ## dynamic python style return '__%s____getattr_helper( [%s, "%s"] )' % (klass, name, node.attr) else: - if klass in self._inline_classes: ## static attribute - if node.attr in self._inline_classes[klass]: + if klass in self._instance_attributes: ## static attribute + if node.attr in self._instance_attributes[klass]: return '''JS('%s["__dict__"]["%s"]')''' %(name, node.attr) elif node.attr in self._classes[ klass ]: ## method return '''JS('__%s_attrs["%s"]')''' %(klass, node.attr) diff --git a/tests/test__getattr__.html b/tests/test__getattr__.html new file mode 100644 index 0000000..270edeb --- /dev/null +++ b/tests/test__getattr__.html @@ -0,0 +1,47 @@ + + + + + + + + + + + \ No newline at end of file From fee3baf5e9923248b98383a45f0e4e1f964555da Mon Sep 17 00:00:00 2001 From: hartsantler Date: Mon, 7 Oct 2013 19:11:35 -0700 Subject: [PATCH 104/860] made __getattr__ work with parent and grandparent classes, fixed class attribute lookup on grandparents, made closure compatible again. --- pythonscript/python_to_pythonjs.py | 79 ++++++++++++++++++++----- tests/test_parent-class__getattr__.html | 62 +++++++++++++++++++ 2 files changed, 127 insertions(+), 14 deletions(-) create mode 100644 tests/test_parent-class__getattr__.html diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index f59bd28..b5e1a36 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -104,6 +104,26 @@ def get_pythonjs_function_name(self, name): assert name in self.methods return '__%s_%s' %(self.name, name) ## class name + def check_for_parent_with(self, method=None, property=None, operator=None, class_attribute=None): + for parent_name in self.parents: + typedef = self.compiler.get_typedef( class_name=parent_name ) + if method and method in typedef.methods: + return typedef + elif property and property in typedef.properties: + return typedef + elif operator and typedef.operators: + return typedef + elif class_attribute in typedef.class_attributes: + return typedef + elif typedef.parents: + res = typedef.check_for_parent_with( + method=method, + property=property, + operator=operator, + class_attribute=class_attribute + ) + if res: + return res class PythonToPythonJS(NodeVisitor): @@ -112,6 +132,7 @@ class PythonToPythonJS(NodeVisitor): def __init__(self, module=None, module_path=None): super(PythonToPythonJS, self).__init__() self._classes = dict() ## class name : [method names] + self._class_parents = dict() ## class name : parents self._instance_attributes = dict() ## class name : [attribute names] self._class_attributes = dict() self._catch_attributes = None @@ -124,6 +145,8 @@ def __init__(self, module=None, module_path=None): self._module = module self._module_path = module_path + self._typedefs = dict() ## class name : typedef (not pickled) + def get_typedef(self, instance=None, class_name=None): assert instance or class_name if isinstance(instance, Name) and instance.id in self._instances: @@ -131,14 +154,18 @@ def get_typedef(self, instance=None, class_name=None): if class_name: assert class_name in self._classes - typedef = Typedef( - name = class_name, - methods = self._classes[ class_name ], - properties = self._decorator_class_props[ class_name ], - attributes = self._instance_attributes[ class_name ], - class_attributes = self._class_attributes[ class_name ], - ) - return typedef + + if class_name not in self._typedefs: + self._typedefs[ class_name ] = Typedef( + name = class_name, + methods = self._classes[ class_name ], + properties = self._decorator_class_props[ class_name ], + attributes = self._instance_attributes[ class_name ], + class_attributes = self._class_attributes[ class_name ], + parents = self._class_parents[ class_name ], + compiler = self, + ) + return self._typedefs[ class_name ] def save_module(self): if self._module and self._module_path: @@ -148,6 +175,7 @@ def save_module(self): class_attributes = self._class_attributes, decorator_class_props = self._decorator_class_props, function_return_types = self._function_return_types, + class_parents = self._class_parents, ) pickle.dump( a, open(os.path.join(self._module_path, self._module+'.module'), 'wb') ) @@ -165,6 +193,7 @@ def visit_ImportFrom(self, node): self._instance_attributes.update( a['instance_attributes'] ) self._decorator_class_props.update( a['decorator_class_props'] ) self._function_return_types.update( a['function_return_types'] ) + self._class_parents.update( a['class_parents'] ) def visit_Assert(self, node): ## hijacking "assert isinstance(a,A)" as a type system ## @@ -200,7 +229,7 @@ def visit_AugAssign(self, node): def visit_Yield(self, node): return 'yield %s' % self.visit(node.value) - def _gen_getattr_helper(self, class_name, func_name): + def _gen_getattr_helper(self, class_name, func_name): ## DEPRECATED ''' This helper is used to emulate how Python works, __getattr__ is only supposed to be called when the attribute is not found on the instance. @@ -222,6 +251,7 @@ def _gen_getattr_helper(self, class_name, func_name): def visit_ClassDef(self, node): name = node.name self._classes[ name ] = list() ## method names + self._class_parents[ name ] = set() self._class_attributes[ name ] = set() self._catch_attributes = None self._decorator_properties = dict() ## property names : {'get':func, 'set':func} @@ -237,11 +267,16 @@ def visit_ClassDef(self, node): writer.write('var(%s, __%s_attrs, __%s_parents)' % (name, name, name)) - writer.write('__%s_attrs = JSObject()' % name) - writer.write('__%s_parents = JSArray()' % name) + writer.write('window["__%s_attrs"] = JSObject()' % name) + writer.write('window["__%s_parents"] = JSArray()' % name) for base in node.bases: code = '__%s_parents.push(%s)' % (name, self.visit(base)) writer.write(code) + if isinstance(base, Name): + self._class_parents[ name ] = base.id + else: + raise NotImplementedError + for item in node.body: if isinstance(item, FunctionDef): self._classes[ name ].append( item.name ) @@ -254,7 +289,7 @@ def visit_ClassDef(self, node): if item_name in self._decorator_properties: pass else: - writer.write('__%s_attrs["%s"] = %s' % (name, item_name, item.name)) + writer.write('window["__%s_attrs"]["%s"] = %s' % (name, item_name, item.name)) #if item_name == '__getattr__': # writer.write( self._gen_getattr_helper(name, item.name) ) @@ -263,7 +298,7 @@ def visit_ClassDef(self, node): item_name = item.targets[0].id item.targets[0].id = '__%s_%s' % (name, item_name) self.visit(item) # this will output the code for the assign - writer.write('__%s_attrs["%s"] = %s' % (name, item_name, item.targets[0].id)) + writer.write('window["__%s_attrs"]["%s"] = %s' % (name, item_name, item.targets[0].id)) self._class_attributes[ name ].add( item_name ) ## should this come before self.visit(item) ?? else: raise NotImplementedError @@ -275,7 +310,7 @@ def visit_ClassDef(self, node): self._decorator_properties = None self._instances.pop('self') - writer.write('%s = create_class("%s", __%s_parents, __%s_attrs)' % (name, name, name, name)) + writer.write('%s = create_class("%s", window["__%s_parents"], window["__%s_attrs"])' % (name, name, name, name)) def visit_If(self, node): writer.write('if %s:' % self.visit(node.test)) @@ -427,6 +462,22 @@ def visit_Attribute(self, node): elif '__getattr__' in typedef.methods: func = typedef.get_pythonjs_function_name( '__getattr__' ) return '%s([%s, "%s"])' %(func, node_value, node.attr) + + elif typedef.check_for_parent_with( property=node.attr ): + parent = typedef.check_for_parent_with( property=node.attr ) + getter = parent.properties[ node.attr ]['get'] + if getter in self._function_return_types: + node.returns_type = self._function_return_types[getter] + return '%s( [%s] )' %(getter, node_value) + elif typedef.check_for_parent_with( class_attribute=node.attr ): + #return 'get_attribute(%s, "%s")' % (node_value, node.attr) ## get_attribute is broken with grandparent class attributes + parent = typedef.check_for_parent_with( class_attribute=node.attr ) + return "window['__%s_attrs']['%s']" %(parent.name, node.attr) + elif typedef.check_for_parent_with( method='__getattr__' ): + parent = typedef.check_for_parent_with( method='__getattr__' ) + func = parent.get_pythonjs_function_name( '__getattr__' ) + return '%s([%s, "%s"])' %(func, node_value, node.attr) + else: return 'get_attribute(%s, "%s")' % (node_value, node.attr) else: diff --git a/tests/test_parent-class__getattr__.html b/tests/test_parent-class__getattr__.html new file mode 100644 index 0000000..0e3d419 --- /dev/null +++ b/tests/test_parent-class__getattr__.html @@ -0,0 +1,62 @@ + + + + + + + + + + + \ No newline at end of file From 9096e40fd5edbc7526710084974642a0e69b4600 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Mon, 7 Oct 2013 19:32:39 -0700 Subject: [PATCH 105/860] cleaned up deprecated code in python_to_pythonjs.py --- pythonscript/python_to_pythonjs.py | 83 +----------------------------- 1 file changed, 2 insertions(+), 81 deletions(-) diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index b5e1a36..22ae6d8 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -229,24 +229,6 @@ def visit_AugAssign(self, node): def visit_Yield(self, node): return 'yield %s' % self.visit(node.value) - def _gen_getattr_helper(self, class_name, func_name): ## DEPRECATED - ''' - This helper is used to emulate how Python works, __getattr__ is only supposed - to be called when the attribute is not found on the instance. - ''' - a = [ - 'def __%s____getattr_helper(args, kwargs):' %class_name, - ' var(signature, arguments)', - ' signature = JSObject(kwargs=JSObject(), args=JSArray("self", "name"))', - ' arguments = get_arguments(signature, args, kwargs)', - ''' JS("var self = arguments['self']")''', - ''' JS("var name = arguments['name']")''', - ' if name in get_attribute(self, "__dict__"):', - ' return get_attribute(getattr, "__call__")( JSArray(self,name), JSObject() )', - ' else:', - ' return %s( [self, name] )' %func_name - ] - return '\n'.join(a) def visit_ClassDef(self, node): name = node.name @@ -258,8 +240,8 @@ def visit_ClassDef(self, node): self._decorator_class_props[ name ] = self._decorator_properties self._instances[ 'self' ] = name - #for dec in node.decorator_list: - # if isinstance(dec, Name) and dec.id == 'inline': + #for dec in node.decorator_list: ## TODO class decorators + # if isinstance(dec, Name) and dec.id == 'inline': ## @inline class decorator is DEPRECATED # self._catch_attributes = set() ## always catch attributes ## self._catch_attributes = set() @@ -291,9 +273,6 @@ def visit_ClassDef(self, node): else: writer.write('window["__%s_attrs"]["%s"] = %s' % (name, item_name, item.name)) - #if item_name == '__getattr__': - # writer.write( self._gen_getattr_helper(name, item.name) ) - elif isinstance(item, Assign) and isinstance(item.targets[0], Name): item_name = item.targets[0].id item.targets[0].id = '__%s_%s' % (name, item_name) @@ -303,9 +282,6 @@ def visit_ClassDef(self, node): else: raise NotImplementedError - #if self._catch_attributes: - # self._instance_attributes[ name ] = self._catch_attributes - self._catch_attributes = None self._decorator_properties = None self._instances.pop('self') @@ -484,46 +460,6 @@ def visit_Attribute(self, node): return 'get_attribute(%s, "%s")' % (node_value, node.attr) - def visit_Attribute_OLD(self, node): - name = self.visit(node.value) - if name in self._instances: ## support '.' operator overloading - klass = self._instances[ name ] - if '__getattr__' in self._classes[ klass ]: - if klass in self._instance_attributes: ## static attribute - if node.attr in self._instance_attributes[klass]: - #return '''JS('%s.__dict__["%s"]')''' %(name, node.attr) ## this is not ClosureCompiler compatible - return '''JS('%s["__dict__"]["%s"]')''' %(name, node.attr) - elif node.attr in self._classes[ klass ]: ## method - return '''JS('__%s_attrs["%s"]')''' %(klass, node.attr) - elif klass in self._decorator_class_props and node.attr in self._decorator_class_props[klass]: - getter = self._decorator_class_props[klass][node.attr]['get'] - return '''JS('%s( [%s] )')''' %(getter, name) - else: - return '''JS('__%s___getattr__( [%s, "%s"] )')''' %(klass, name, node.attr) - - else: ## dynamic python style - return '__%s____getattr_helper( [%s, "%s"] )' % (klass, name, node.attr) - else: - if klass in self._instance_attributes: ## static attribute - if node.attr in self._instance_attributes[klass]: - return '''JS('%s["__dict__"]["%s"]')''' %(name, node.attr) - elif node.attr in self._classes[ klass ]: ## method - return '''JS('__%s_attrs["%s"]')''' %(klass, node.attr) - elif klass in self._decorator_class_props and node.attr in self._decorator_class_props[klass]: - getter = self._decorator_class_props[klass][node.attr]['get'] - return '''JS('%s( [%s] )')''' %(getter, name) - else: - return '''JS('__%s___getattr__( [%s, "%s"] )')''' %(klass, name, node.attr) - - elif klass in self._decorator_class_props and node.attr in self._decorator_class_props[klass]: - getter = self._decorator_class_props[klass][node.attr]['get'] - return '''JS('%s( [%s] )')''' %(getter, name) - - else: - return 'get_attribute(%s, "%s")' % (name, node.attr) - else: - return 'get_attribute(%s, "%s")' % (name, node.attr) - def visit_Index(self, node): return self.visit(node.value) @@ -736,8 +672,6 @@ def visit_FunctionDef(self, node): if node.args.kwarg: keywords.append(keyword(Name('varkwarg', None), Str(node.args.kwarg))) - #prebody = list() ## NOT USED? - # create a JS Object to store the value of each parameter signature = ', '.join(map(lambda x: '%s=%s' % (self.visit(x.arg), self.visit(x.value)), keywords)) writer.write('signature = JSObject(%s)' % signature) @@ -759,21 +693,8 @@ def visit_FunctionDef(self, node): self._return_type = None map(self.visit, node.body) - #for child in node.body: - # # simple test to drop triple quote comments - # if hasattr(child, 'value'): - # if isinstance(child.value, Str): - # continue - # if isinstance(child, GeneratorType): - # for sub in child: - # self.visit(sub) - # else: - # self.visit(child) if self._return_type: - #if hasattr(node, 'original_name'): - # self._function_return_types[ node.original_name ] = self._return_type - #else: self._function_return_types[ node.name ] = self._return_type writer.pull() From 27d3bc14fc2fe234df54ea6a0b5048d1ccceac1c Mon Sep 17 00:00:00 2001 From: hartsantler Date: Mon, 7 Oct 2013 21:40:02 -0700 Subject: [PATCH 106/860] added __setattr__ operator overloading, and tests to make sure its compatible with instance vs class-level attributes. --- pythonscript/python_to_pythonjs.py | 44 +++++++++++-- tests/test__setattr__.html | 80 +++++++++++++++++++++++ tests/test_parent-class__setattr__.html | 84 +++++++++++++++++++++++++ 3 files changed, 202 insertions(+), 6 deletions(-) create mode 100644 tests/test__setattr__.html create mode 100644 tests/test_parent-class__setattr__.html diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index 22ae6d8..18fc470 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -501,14 +501,46 @@ def visit_Assign(self, node): elif hasattr(target.value, 'returns_type'): typedef = self.get_typedef( class_name=target.value.returns_type ) - fallback = True - if typedef and target.attr in typedef.properties: - setter = typedef.properties[ target.attr ].get('set',None) - if setter: + + if typedef and target.attr in typedef.properties and 'set' in typedef.properties[ target.attr ]: + setter = typedef.properties[ target.attr ]['set'] + writer.write( '%s( [%s, %s] )' %(setter, target_value, self.visit(node.value)) ) + elif typedef and target.attr in typedef.class_attributes: + writer.write( '''%s['__class__']['__dict__']['%s'] = %s''' %(target_value, target.attr, self.visit(node.value))) + elif typedef and target.attr in typedef.attributes: + writer.write( '''%s['__dict__']['%s'] = %s''' %(target_value, target.attr, self.visit(node.value))) + + elif typedef and typedef.parents: + parent_prop = typedef.check_for_parent_with( property=target.attr ) + parent_classattr = typedef.check_for_parent_with( class_attribute=target.attr ) + parent_setattr = typedef.check_for_parent_with( method='__setattr__' ) + if parent_prop and 'set' in parent_prop.properties[target.attr]: + setter = parent_prop.properties[target.attr]['set'] writer.write( '%s( [%s, %s] )' %(setter, target_value, self.visit(node.value)) ) - fallback = False + elif parent_classattr: + writer.write( "window['__%s_attrs']['%s'] = %s" %(parent_classattr.name, target.attr, self.visit(node.value)) ) + elif parent_setattr: + func = parent_setattr.get_pythonjs_function_name( '__setattr__' ) + writer.write( '%s([%s, "%s", %s])' %(func, target_value, target.attr, self.visit(node.value)) ) + + elif '__setattr__' in typedef.methods: + func = typedef.get_pythonjs_function_name( '__setattr__' ) + writer.write( '%s([%s, "%s", %s])' %(func, target_value, target.attr, self.visit(node.value)) ) + + else: + code = 'set_attribute(%s, "%s", %s)' % ( + target_value, + target.attr, + self.visit(node.value) + ) + writer.write(code) + + elif typedef and '__setattr__' in typedef.methods: + func = typedef.get_pythonjs_function_name( '__setattr__' ) + writer.write( '%s([%s, "%s", %s])' %(func, target_value, target.attr, self.visit(node.value)) ) - if fallback: + + else: code = 'set_attribute(%s, "%s", %s)' % ( target_value, target.attr, diff --git a/tests/test__setattr__.html b/tests/test__setattr__.html new file mode 100644 index 0000000..0f95362 --- /dev/null +++ b/tests/test__setattr__.html @@ -0,0 +1,80 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/tests/test_parent-class__setattr__.html b/tests/test_parent-class__setattr__.html new file mode 100644 index 0000000..039cf45 --- /dev/null +++ b/tests/test_parent-class__setattr__.html @@ -0,0 +1,84 @@ + + + + + + + + + + + \ No newline at end of file From 00ed942c1f1dbdcfb490d68d4c3cdaebc57c261d Mon Sep 17 00:00:00 2001 From: hartsantler Date: Tue, 8 Oct 2013 02:24:00 -0700 Subject: [PATCH 107/860] added DOM binding directly to get_attribute in pythonpythonjs.py, added test_dom.html, regenerated runtime --- pythonscript.js | 174 +++++++++++++++++------------ pythonscript/python_to_pythonjs.py | 3 + runtime/pythonpythonjs.py | 26 ++++- tests/test_dom.html | 29 +++++ 4 files changed, 159 insertions(+), 73 deletions(-) create mode 100644 tests/test_dom.html diff --git a/pythonscript.js b/pythonscript.js index a03f0f0..e009df1 100644 --- a/pythonscript.js +++ b/pythonscript.js @@ -1,4 +1,4 @@ -// PythonScript Runtime - regenerated on: Mon Oct 7 06:29:29 2013 +// PythonScript Runtime - regenerated on: Tue Oct 8 02:22:49 2013 var jsrange = function(num) { "Emulates Python's range function"; var i, r; @@ -75,7 +75,7 @@ return klass; window["create_class"] = create_class var get_attribute = function(object, attribute) { -"Retrieve an attribute, method or property\n\n method are actually functions which are converted to methods by\n prepending their arguments with the current object. Properties are\n not functions!"; +"Retrieve an attribute, method or property\n\n method are actually functions which are converted to methods by\n prepending their arguments with the current object. Properties are\n not functions!\n\n DOM support:\n http://stackoverflow.com/questions/14202699/document-createelement-not-working\n https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof\n "; if(attribute == "__call__") { if({}.toString.call(object) === '[object Function]') { return object; @@ -85,6 +85,38 @@ return object; var attr; attr = object[attribute]; +if(object instanceof HTMLDocument) { +if(typeof(attr) === 'function') { +var wrapper = function(args, kwargs) { +return attr.apply(object, args); +} +window["wrapper"] = wrapper + +return wrapper; +} +else { +return attr; +} + +} +else { +if(object instanceof HTMLElement) { +if(typeof(attr) === 'function') { +var wrapper = function(args, kwargs) { +return attr.apply(object, args); +} +window["wrapper"] = wrapper + +return wrapper; +} +else { +return attr; +} + +} + +} + if(attr) { return attr; } @@ -474,9 +506,9 @@ return r; window["range"] = range var StopIteration, __StopIteration_attrs, __StopIteration_parents; -__StopIteration_attrs = Object(); -__StopIteration_parents = create_array(); -StopIteration = create_class("StopIteration", __StopIteration_parents, __StopIteration_attrs); +window["__StopIteration_attrs"] = Object(); +window["__StopIteration_parents"] = create_array(); +StopIteration = create_class("StopIteration", window["__StopIteration_parents"], window["__StopIteration_attrs"]); var len = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("obj")}; @@ -511,8 +543,8 @@ return out; window["map"] = map var Iterator, __Iterator_attrs, __Iterator_parents; -__Iterator_attrs = Object(); -__Iterator_parents = create_array(); +window["__Iterator_attrs"] = Object(); +window["__Iterator_parents"] = create_array(); var __Iterator___init__ = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "obj", "index")}; @@ -520,20 +552,20 @@ arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var obj = arguments['obj']; var index = arguments['index']; -set_attribute(self, "obj", obj); -set_attribute(self, "index", index); +self["__dict__"]["obj"] = obj; +self["__dict__"]["index"] = index; } window["__Iterator___init__"] = __Iterator___init__ -__Iterator_attrs["__init__"] = __Iterator___init__; +window["__Iterator_attrs"]["__init__"] = __Iterator___init__; var __Iterator_next = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; -index = get_attribute(self, "index"); +index = self["__dict__"]["index"]; var __args_2, __kwargs_2; -__args_2 = create_array(get_attribute(self, "obj")); +__args_2 = create_array(self["__dict__"]["obj"]); __kwargs_2 = Object(); length = get_attribute(len, "__call__")(__args_2, __kwargs_2); if(index == length) { @@ -541,19 +573,19 @@ throw StopIteration; } var __args_3, __kwargs_3; -__args_3 = create_array(get_attribute(self, "index")); +__args_3 = create_array(self["__dict__"]["index"]); __kwargs_3 = Object(); -item = get_attribute(get_attribute(get_attribute(self, "obj"), "get"), "__call__")(__args_3, __kwargs_3); -set_attribute(self, "index", get_attribute(self, "index") + 1); +item = get_attribute(get_attribute(self["__dict__"]["obj"], "get"), "__call__")(__args_3, __kwargs_3); +self["__dict__"]["index"] = self["__dict__"]["index"] + 1; return item; } window["__Iterator_next"] = __Iterator_next -__Iterator_attrs["next"] = __Iterator_next; -Iterator = create_class("Iterator", __Iterator_parents, __Iterator_attrs); +window["__Iterator_attrs"]["next"] = __Iterator_next; +Iterator = create_class("Iterator", window["__Iterator_parents"], window["__Iterator_attrs"]); var list, __list_attrs, __list_parents; -__list_attrs = Object(); -__list_parents = create_array(); +window["__list_attrs"] = Object(); +window["__list_parents"] = create_array(); var __list___init__ = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {"js_object": undefined}, "args": create_array("self", "js_object")}; @@ -561,16 +593,16 @@ arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var js_object = arguments['js_object']; if(js_object) { -set_attribute(self, "js_object", js_object); +self["__dict__"]["js_object"] = js_object; } else { -set_attribute(self, "js_object", create_array()); +self["__dict__"]["js_object"] = create_array(); } } window["__list___init__"] = __list___init__ -__list_attrs["__init__"] = __list___init__; +window["__list_attrs"]["__init__"] = __list___init__; var __list_append = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "obj")}; @@ -578,12 +610,12 @@ arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var obj = arguments['obj']; var __array; -__array = get_attribute(self, "js_object"); +__array = self["__dict__"]["js_object"]; __array.push(obj); } window["__list_append"] = __list_append -__list_attrs["append"] = __list_append; +window["__list_attrs"]["append"] = __list_append; var __list_extend = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "other")}; @@ -612,7 +644,7 @@ if (__exception__ == StopIteration || isinstance([__exception__, StopIteration]) } window["__list_extend"] = __list_extend -__list_attrs["extend"] = __list_extend; +window["__list_attrs"]["extend"] = __list_extend; var __list_insert = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "index", "obj")}; @@ -621,12 +653,12 @@ var self = arguments['self']; var index = arguments['index']; var obj = arguments['obj']; var __array; -__array = get_attribute(self, "js_object"); +__array = self["__dict__"]["js_object"]; __array.splice(index, 0, obj); } window["__list_insert"] = __list_insert -__list_attrs["insert"] = __list_insert; +window["__list_attrs"]["insert"] = __list_insert; var __list_remove = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "obj")}; @@ -638,24 +670,24 @@ var __args_5, __kwargs_5; __args_5 = create_array(obj); __kwargs_5 = Object(); index = get_attribute(get_attribute(self, "index"), "__call__")(__args_5, __kwargs_5); -__array = get_attribute(self, "js_object"); +__array = self["__dict__"]["js_object"]; __array.splice(index, 1); } window["__list_remove"] = __list_remove -__list_attrs["remove"] = __list_remove; +window["__list_attrs"]["remove"] = __list_remove; var __list_pop = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var __array; -__array = get_attribute(self, "js_object"); +__array = self["__dict__"]["js_object"]; return __array.pop(); } window["__list_pop"] = __list_pop -__list_attrs["pop"] = __list_pop; +window["__list_attrs"]["pop"] = __list_pop; var __list_index = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "obj")}; @@ -663,12 +695,12 @@ arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var obj = arguments['obj']; var __array; -__array = get_attribute(self, "js_object"); +__array = self["__dict__"]["js_object"]; return __array.indexOf(obj); } window["__list_index"] = __list_index -__list_attrs["index"] = __list_index; +window["__list_attrs"]["index"] = __list_index; var __list_count = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "obj")}; @@ -699,31 +731,31 @@ return i; } window["__list_count"] = __list_count -__list_attrs["count"] = __list_count; +window["__list_attrs"]["count"] = __list_count; var __list_reverse = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var __array; -__array = get_attribute(self, "js_object"); -set_attribute(self, "js_object", __array.reverse()); +__array = self["__dict__"]["js_object"]; +self["__dict__"]["js_object"] = __array.reverse(); } window["__list_reverse"] = __list_reverse -__list_attrs["reverse"] = __list_reverse; +window["__list_attrs"]["reverse"] = __list_reverse; var __list_shift = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var __array; -__array = get_attribute(self, "js_object"); +__array = self["__dict__"]["js_object"]; return __array.shift(); } window["__list_shift"] = __list_shift -__list_attrs["shift"] = __list_shift; +window["__list_attrs"]["shift"] = __list_shift; var __list_slice = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "start", "end")}; @@ -732,12 +764,12 @@ var self = arguments['self']; var start = arguments['start']; var end = arguments['end']; var __array; -__array = get_attribute(self, "js_object"); +__array = self["__dict__"]["js_object"]; return __array.slice(start, end); } window["__list_slice"] = __list_slice -__list_attrs["slice"] = __list_slice; +window["__list_attrs"]["slice"] = __list_slice; var __list___iter__ = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self")}; @@ -750,7 +782,7 @@ return get_attribute(Iterator, "__call__")(__args_6, __kwargs_6); } window["__list___iter__"] = __list___iter__ -__list_attrs["__iter__"] = __list___iter__; +window["__list_attrs"]["__iter__"] = __list___iter__; var __list_get = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "index")}; @@ -758,12 +790,12 @@ arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var index = arguments['index']; var __array; -__array = get_attribute(self, "js_object"); +__array = self["__dict__"]["js_object"]; return __array[index]; } window["__list_get"] = __list_get -__list_attrs["get"] = __list_get; +window["__list_attrs"]["get"] = __list_get; var __list_set = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "index", "value")}; @@ -772,28 +804,28 @@ var self = arguments['self']; var index = arguments['index']; var value = arguments['value']; var __array; -__array = get_attribute(self, "js_object"); +__array = self["__dict__"]["js_object"]; __array[index] = value; } window["__list_set"] = __list_set -__list_attrs["set"] = __list_set; +window["__list_attrs"]["set"] = __list_set; var __list___len__ = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var __array; -__array = get_attribute(self, "js_object"); +__array = self["__dict__"]["js_object"]; return __array.length; } window["__list___len__"] = __list___len__ -__list_attrs["__len__"] = __list___len__; -list = create_class("list", __list_parents, __list_attrs); +window["__list_attrs"]["__len__"] = __list___len__; +list = create_class("list", window["__list_parents"], window["__list_attrs"]); var dict, __dict_attrs, __dict_parents; -__dict_attrs = Object(); -__dict_parents = create_array(); +window["__dict_attrs"] = Object(); +window["__dict_parents"] = create_array(); var __dict___init__ = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {"js_object": undefined}, "args": create_array("self", "js_object")}; @@ -801,16 +833,16 @@ arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var js_object = arguments['js_object']; if(js_object) { -set_attribute(self, "js_object", js_object); +self["__dict__"]["js_object"] = js_object; } else { -set_attribute(self, "js_object", Object()); +self["__dict__"]["js_object"] = Object(); } } window["__dict___init__"] = __dict___init__ -__dict_attrs["__init__"] = __dict___init__; +window["__dict_attrs"]["__init__"] = __dict___init__; var __dict_get = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "key", "d")}; @@ -819,7 +851,7 @@ var self = arguments['self']; var key = arguments['key']; var d = arguments['d']; var __dict; -__dict = get_attribute(self, "js_object"); +__dict = self["__dict__"]["js_object"]; if(__dict[key]) { return __dict[key]; } @@ -828,7 +860,7 @@ return d; } window["__dict_get"] = __dict_get -__dict_attrs["get"] = __dict_get; +window["__dict_attrs"]["get"] = __dict_get; var __dict_set = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "key", "value")}; @@ -837,65 +869,65 @@ var self = arguments['self']; var key = arguments['key']; var value = arguments['value']; var __dict; -__dict = get_attribute(self, "js_object"); +__dict = self["__dict__"]["js_object"]; __dict[key] = value; } window["__dict_set"] = __dict_set -__dict_attrs["set"] = __dict_set; +window["__dict_attrs"]["set"] = __dict_set; var __dict___len__ = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var __dict; -__dict = get_attribute(self, "js_object"); +__dict = self["__dict__"]["js_object"]; return Object.keys(__dict).length; } window["__dict___len__"] = __dict___len__ -__dict_attrs["__len__"] = __dict___len__; +window["__dict_attrs"]["__len__"] = __dict___len__; var __dict_keys = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var __dict, out; -__dict = get_attribute(self, "js_object"); +__dict = self["__dict__"]["js_object"]; __keys = Object.keys(__dict); out = get_attribute(list, "__call__")(create_array(), Object()); -set_attribute(out, "js_object", __keys); +out["__dict__"]["js_object"] = __keys; return out; } window["__dict_keys"] = __dict_keys -__dict_attrs["keys"] = __dict_keys; -dict = create_class("dict", __dict_parents, __dict_attrs); +window["__dict_attrs"]["keys"] = __dict_keys; +dict = create_class("dict", window["__dict_parents"], window["__dict_attrs"]); var str, __str_attrs, __str_parents; -__str_attrs = Object(); -__str_parents = create_array(); +window["__str_attrs"] = Object(); +window["__str_parents"] = create_array(); var __str___init__ = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "jsstring")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var jsstring = arguments['jsstring']; -set_attribute(self, "jsstring", jsstring); +self["__dict__"]["jsstring"] = jsstring; } window["__str___init__"] = __str___init__ -__str_attrs["__init__"] = __str___init__; +window["__str_attrs"]["__init__"] = __str___init__; var __str___iter__ = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var __args_7, __kwargs_7; -__args_7 = create_array(get_attribute(self, "jsstring"), 0); +__args_7 = create_array(self["__dict__"]["jsstring"], 0); __kwargs_7 = Object(); return get_attribute(Iterator, "__call__")(__args_7, __kwargs_7); } window["__str___iter__"] = __str___iter__ -__str_attrs["__iter__"] = __str___iter__; -str = create_class("str", __str_parents, __str_attrs); \ No newline at end of file +window["__str_attrs"]["__iter__"] = __str___iter__; +str = create_class("str", window["__str_parents"], window["__str_attrs"]); \ No newline at end of file diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index 18fc470..685bcb5 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -12,6 +12,7 @@ from ast import Attribute from ast import FunctionDef from ast import BinOp +from ast import Pass from ast import parse from ast import NodeVisitor @@ -279,6 +280,8 @@ def visit_ClassDef(self, node): self.visit(item) # this will output the code for the assign writer.write('window["__%s_attrs"]["%s"] = %s' % (name, item_name, item.targets[0].id)) self._class_attributes[ name ].add( item_name ) ## should this come before self.visit(item) ?? + elif isinstance(item, Pass): + pass else: raise NotImplementedError diff --git a/runtime/pythonpythonjs.py b/runtime/pythonpythonjs.py index 0efd584..be5372d 100644 --- a/runtime/pythonpythonjs.py +++ b/runtime/pythonpythonjs.py @@ -67,13 +67,35 @@ def get_attribute(object, attribute): method are actually functions which are converted to methods by prepending their arguments with the current object. Properties are - not functions!""" + not functions! + + DOM support: + http://stackoverflow.com/questions/14202699/document-createelement-not-working + https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof + """ if attribute == '__call__': if JS("{}.toString.call(object) === '[object Function]'"): return object + var(attr) attr = object[attribute] - if attr: + + if JS("object instanceof HTMLDocument"): + if JS("typeof(attr) === 'function'"): + def wrapper(args,kwargs): + return attr.apply(object, args) + return wrapper + else: + return attr + elif JS("object instanceof HTMLElement"): + if JS("typeof(attr) === 'function'"): + def wrapper(args,kwargs): + return attr.apply(object, args) + return wrapper + else: + return attr + + if attr: ## what about cases where attr is zero? return attr var(__class__, __dict__, __get__, bases) # Check object.__class__.__dict__ for data descriptors named attr diff --git a/tests/test_dom.html b/tests/test_dom.html new file mode 100644 index 0000000..3cd2c31 --- /dev/null +++ b/tests/test_dom.html @@ -0,0 +1,29 @@ + + + + + + + + + + + \ No newline at end of file From 8d9fbf1d322b4624c17b5aefd504e7427e3d6942 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Tue, 8 Oct 2013 04:45:10 -0700 Subject: [PATCH 108/860] fixed adding parent class name to set used by Typedef --- pythonscript/python_to_pythonjs.py | 30 +++++++++++++++++++++++++++--- tests/threejs_helloworld.html | 8 ++++---- 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index 685bcb5..a6a4d62 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -24,6 +24,16 @@ from cStringIO import StringIO as StringIO +try: + _log_file = open('/tmp/python_to_pythonjs.log', 'wb') +except: + _log_file = None +def log(txt): + if _log_file: + _log_file.write( txt+'\n' ) + _log_file.flush() + + class Writer(object): def __init__(self): @@ -106,6 +116,9 @@ def get_pythonjs_function_name(self, name): return '__%s_%s' %(self.name, name) ## class name def check_for_parent_with(self, method=None, property=None, operator=None, class_attribute=None): + log('check_for_parent_with: %s'%locals()) + log('self.parents: %s'%self.parents) + for parent_name in self.parents: typedef = self.compiler.get_typedef( class_name=parent_name ) if method and method in typedef.methods: @@ -154,7 +167,11 @@ def get_typedef(self, instance=None, class_name=None): class_name = self._instances[ instance.id ] if class_name: - assert class_name in self._classes + #assert class_name in self._classes + if class_name not in self._classes: + log('ERROR: class name not in self._classes: %s'%class_name) + log('self._classes: %s'%self._classes) + raise RuntimeError('class name: %s - not found in self._classes - node:%s '%(class_name, instance)) if class_name not in self._typedefs: self._typedefs[ class_name ] = Typedef( @@ -233,6 +250,7 @@ def visit_Yield(self, node): def visit_ClassDef(self, node): name = node.name + log('ClassDef: %s'%name) self._classes[ name ] = list() ## method names self._class_parents[ name ] = set() self._class_attributes[ name ] = set() @@ -256,12 +274,13 @@ def visit_ClassDef(self, node): code = '__%s_parents.push(%s)' % (name, self.visit(base)) writer.write(code) if isinstance(base, Name): - self._class_parents[ name ] = base.id + self._class_parents[ name ].add( base.id ) else: raise NotImplementedError for item in node.body: if isinstance(item, FunctionDef): + log(' method: %s'%item.name) self._classes[ name ].append( item.name ) item_name = item.name item.original_name = item.name @@ -540,6 +559,7 @@ def visit_Assign(self, node): elif typedef and '__setattr__' in typedef.methods: func = typedef.get_pythonjs_function_name( '__setattr__' ) + log('__setattr__ in instance typedef.methods - func:%s target_value:%s target_attr:%s' %(func, target_value, target_attr)) writer.write( '%s([%s, "%s", %s])' %(func, target_value, target.attr, self.visit(node.value)) ) @@ -652,6 +672,8 @@ def visit_FunctionDef(self, node): property_decorator = None decorators = [] for decorator in reversed(node.decorator_list): + log('@decorator: %s' %decorator) + if isinstance(decorator, Name) and decorator.id == 'property': property_decorator = decorator n = node.name + '__getprop__' @@ -673,7 +695,7 @@ def visit_FunctionDef(self, node): else: decorators.append( decorator ) - + log('function: %s'%node.name) writer.write('def %s(args, kwargs):' % node.name) writer.push() @@ -725,6 +747,8 @@ def visit_FunctionDef(self, node): expr = '%s = get_attribute(dict, "__call__")(create_array(%s), {});' expr = expr % (node.args.kwarg, node.args.kwarg) writer.write(expr) + else: + log('(function has no arguments)') self._return_type = None map(self.visit, node.body) diff --git a/tests/threejs_helloworld.html b/tests/threejs_helloworld.html index b20615a..757e0ab 100644 --- a/tests/threejs_helloworld.html +++ b/tests/threejs_helloworld.html @@ -9,8 +9,8 @@ + + +The server knows that the above script needs to be dynamically compiled to JavaScript because the script is located in the "bindings" directory and the file name ends with ".py" + +Embedded Python:: + + + + + +The server knows that above is an embedded Python script because the in the script tag the type attribute is set to "text/python". The server will compile and replace the Python code with JavaScript, change the type attribute to be "text/javascript", and serve the page to the client. + +The syntax "from three import *" tells the compiler to load static type information about the previously compiled binding "three.py" into the compilers namespace, this is required because three.py uses operator overloading to wrap the THREE.js API. PythonScript programs are explicitly and implicitly statically typed to allow for operator overloading and optimizations. + diff --git a/pythonscript.js b/pythonscript.js index e009df1..780751c 100644 --- a/pythonscript.js +++ b/pythonscript.js @@ -1,4 +1,4 @@ -// PythonScript Runtime - regenerated on: Tue Oct 8 02:22:49 2013 +// PythonScript Runtime - regenerated on: Tue Oct 8 17:34:29 2013 var jsrange = function(num) { "Emulates Python's range function"; var i, r; @@ -75,10 +75,30 @@ return klass; window["create_class"] = create_class var get_attribute = function(object, attribute) { -"Retrieve an attribute, method or property\n\n method are actually functions which are converted to methods by\n prepending their arguments with the current object. Properties are\n not functions!\n\n DOM support:\n http://stackoverflow.com/questions/14202699/document-createelement-not-working\n https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof\n "; +"Retrieve an attribute, method, property, or wrapper function.\n\n method are actually functions which are converted to methods by\n prepending their arguments with the current object. Properties are\n not functions!\n\n DOM support:\n http://stackoverflow.com/questions/14202699/document-createelement-not-working\n https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof\n\n Direct JavaScript Calls:\n if an external javascript function is found, and it was not a wrapper that was generated here,\n check the function for a 'cached_wrapper' attribute, if none is found then generate a new\n wrapper, cache it on the function, and return the wrapper.\n "; if(attribute == "__call__") { if({}.toString.call(object) === '[object Function]') { +if(object.is_wrapper !== undefined) { return object; +} +else { +var cached = object.cached_wrapper; +if(cached) { +return cached; +} +else { +var wrapper = function(args, kwargs) { +return object.apply(undefined, args); +} +window["wrapper"] = wrapper + +wrapper.is_wrapper = true; +object.cached_wrapper = wrapper; +return wrapper; +} + +} + } } @@ -92,6 +112,7 @@ return attr.apply(object, args); } window["wrapper"] = wrapper +wrapper.is_wrapper = true; return wrapper; } else { @@ -107,6 +128,7 @@ return attr.apply(object, args); } window["wrapper"] = wrapper +wrapper.is_wrapper = true; return wrapper; } else { @@ -214,12 +236,15 @@ return attr.apply(undefined, args); } window["method"] = method +method.is_wrapper = true; return method; } - +else { return attr; } +} + bases = __class__.bases; var iter = jsrange(bases.length); for (var i=0; i < iter.length; i++) { @@ -244,12 +269,15 @@ return attr.apply(undefined, args); } window["method"] = method +method.is_wrapper = true; return method; } - +else { return attr; } +} + i = backup; } @@ -327,6 +355,10 @@ else { argslength = 0; } +if(args.length > signature.args.length) { +throw TypeError("function called with wrong number of arguments"); +} + j = 0; while(j < argslength) { arg = signature.args[j]; @@ -344,7 +376,7 @@ if(arg in signature.kwargs) { out[arg] = signature.kwargs[arg]; } else { -throw TypeError; +throw TypeError("function called with wrong number of arguments"); } } @@ -361,7 +393,7 @@ if(arg in signature.kwargs) { out[arg] = signature.kwargs[arg]; } else { -throw TypeError; +throw TypeError("function called with wrong number of arguments"); } } diff --git a/runtime/pythonpythonjs.py b/runtime/pythonpythonjs.py index be5372d..e48365b 100644 --- a/runtime/pythonpythonjs.py +++ b/runtime/pythonpythonjs.py @@ -63,7 +63,7 @@ def __call__(): def get_attribute(object, attribute): - """Retrieve an attribute, method or property + """Retrieve an attribute, method, property, or wrapper function. method are actually functions which are converted to methods by prepending their arguments with the current object. Properties are @@ -72,32 +72,52 @@ def get_attribute(object, attribute): DOM support: http://stackoverflow.com/questions/14202699/document-createelement-not-working https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof + + Direct JavaScript Calls: + if an external javascript function is found, and it was not a wrapper that was generated here, + check the function for a 'cached_wrapper' attribute, if none is found then generate a new + wrapper, cache it on the function, and return the wrapper. """ if attribute == '__call__': if JS("{}.toString.call(object) === '[object Function]'"): - return object + if JS("object.is_wrapper !== undefined"): + return object + else: + JS("var cached = object.cached_wrapper") + if cached: + return cached + else: + #print 'generating new wrapper' + def wrapper(args,kwargs): return object.apply(None, args) + wrapper.is_wrapper = True + object.cached_wrapper = wrapper + return wrapper var(attr) attr = object[attribute] if JS("object instanceof HTMLDocument"): + #print 'DYNAMIC wrapping HTMLDocument' if JS("typeof(attr) === 'function'"): - def wrapper(args,kwargs): - return attr.apply(object, args) + def wrapper(args,kwargs): return attr.apply(object, args) + wrapper.is_wrapper = True return wrapper else: return attr elif JS("object instanceof HTMLElement"): + #print 'DYNAMIC wrapping HTMLElement' if JS("typeof(attr) === 'function'"): - def wrapper(args,kwargs): - return attr.apply(object, args) + def wrapper(args,kwargs): return attr.apply(object, args) + wrapper.is_wrapper = True return wrapper else: return attr if attr: ## what about cases where attr is zero? return attr + var(__class__, __dict__, __get__, bases) + # Check object.__class__.__dict__ for data descriptors named attr __class__ = object.__class__ if __class__: @@ -128,6 +148,7 @@ def wrapper(args,kwargs): if __get__: return __get__([None, __class__]) return attr + if bases: for i in jsrange(bases.length): var(base, attr) @@ -137,6 +158,7 @@ def wrapper(args,kwargs): __get__ = get_attribute(attr, '__get__') if __get__: return __get__([object, __class__]) + if __class__: var(__dict__) __dict__ = __class__.__dict__ @@ -151,8 +173,11 @@ def method(): else: args = [object] return attr.apply(None, args) + method.is_wrapper = True return method - return attr + else: + return attr + bases = __class__.bases for i in jsrange(bases.length): var(base, attr) @@ -168,9 +193,10 @@ def method(): else: args = [object] return attr.apply(None, args) + method.is_wrapper = True return method - - return attr + else: + return attr return None # XXX: raise AttributeError instead @@ -220,6 +246,9 @@ def get_arguments(signature, args, kwargs): else: argslength = 0 + if args.length > signature.args.length: + raise TypeError('function called with wrong number of arguments') + j = 0 while j < argslength: arg = JS('signature.args[j]') @@ -232,16 +261,15 @@ def get_arguments(signature, args, kwargs): elif arg in signature.kwargs: out[arg] = signature.kwargs[arg] else: - #out[arg] = args[j] - raise TypeError + raise TypeError('function called with wrong number of arguments') elif j < args.length: out[arg] = args[j] elif arg in signature.kwargs: out[arg] = signature.kwargs[arg] else: - #out[arg] = args[j] - raise TypeError + raise TypeError('function called with wrong number of arguments') j += 1 + args = args.slice(j) if signature.vararg: out[signature.vararg] = args From 9ba79e1109b482fd88317e87229c31cebaad0d34 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Tue, 8 Oct 2013 21:48:12 -0700 Subject: [PATCH 110/860] made global variable scope an option: python_to_pythonjs.py --global-variable-scope the new default is not to have variable scope, this is normal python style. --- bindings/three.py | 15 +++++--- pythonscript/python_to_pythonjs.py | 21 +++++++++++ tests/server.py | 53 ++++++++++++++++------------ tests/test_multiple_inheritance.html | 32 +++++++++++++++++ tests/threejs_helloworld.html | 49 +++++++++++++------------ 5 files changed, 118 insertions(+), 52 deletions(-) create mode 100644 tests/test_multiple_inheritance.html diff --git a/bindings/three.py b/bindings/three.py index ab79eb5..786f1ba 100644 --- a/bindings/three.py +++ b/bindings/three.py @@ -387,7 +387,8 @@ def setClearColor(self, red=1.0, green=1.0, blue=1.0, alpha=1.0): c = clr._color JS('renderer.setClearColor( c, alpha)') - def getDomElement(self): + @property + def domElement(self): renderer = self._renderer return JS('renderer.domElement') @@ -427,9 +428,15 @@ def loadTextureCube( urls ): ImageUtils = _ImageUtils() -class MeshBasicMaterial: - def __init__(self): - self._object = JS('new THREE.MeshBasicMaterial( {color:0xff0000, wireframe:true} )') +class _Material: + pass + +class MeshBasicMaterial( _Material ): + def __init__(self, color=None, wireframe=False): + if not color: color = Color() + elif isinstance(color, dict): + color = Color(red=color['red'], green=color['green'], blue=color['blue']) + self._object = JS('new THREE.MeshBasicMaterial( {color:color, wireframe:wireframe} )') class CubeGeometry: def __init__(self, width, height, length): diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index a6a4d62..c80dd27 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -13,6 +13,7 @@ from ast import FunctionDef from ast import BinOp from ast import Pass +from ast import Global from ast import parse from ast import NodeVisitor @@ -34,6 +35,11 @@ def log(txt): _log_file.flush() +GLOBAL_VARIABLE_SCOPE = False ## Python style +if '--global-variable-scope' in sys.argv: ## JavaScript style + GLOBAL_VARIABLE_SCOPE = True + log('not using python style variable scope') + class Writer(object): def __init__(self): @@ -699,6 +705,21 @@ def visit_FunctionDef(self, node): writer.write('def %s(args, kwargs):' % node.name) writer.push() + ## the user will almost always want to use Python-style variable scope, + ## this is kept here as an option to be sure we are compatible with the + ## old-style code in runtime/pythonpythonjs.py and runtime/builtins.py + if not GLOBAL_VARIABLE_SCOPE: + local_vars = set() + global_vars = set() + for n in node.body: + if isinstance(n, Assign) and isinstance(n.targets[0], Name): ## assignment to local + local_vars.add( n.targets[0].id ) + elif isinstance(n, Global): + global_vars.update( n.names ) + if local_vars: + a = ','.join( local_vars-global_vars ) + writer.write('var(%s)' %a) + if len(node.args.defaults) or len(node.args.args) or node.args.vararg or node.args.kwarg: # new pythonjs' python function arguments handling # create the structure representing the functions arguments diff --git a/tests/server.py b/tests/server.py index 8f1b2f4..365646f 100755 --- a/tests/server.py +++ b/tests/server.py @@ -28,17 +28,19 @@ ) -REGENERATE_RUNTIME = '--regenerate-runtime' in sys.argv -def python_to_pythonjs( src, module=None ): + +def python_to_pythonjs( src, module=None, global_variable_scope=False ): cmdheader = '#!%s' %PATHS['module_cache'] if module: assert '.' not in module cmdheader += ';' + module cmdheader += '\n' + cmd = ['python2', os.path.join( PATHS['pythonscript'], 'python_to_pythonjs.py')] + if global_variable_scope: cmd.append('--global-variable-scope') p = subprocess.Popen( - ['python2', os.path.join( PATHS['pythonscript'], 'python_to_pythonjs.py')], + cmd, stdin = subprocess.PIPE, stdout = subprocess.PIPE ) @@ -68,8 +70,8 @@ def pythonjs_to_javascript( src, closure_compiler=False ): return a -def python_to_javascript( src, module=None, closure_compiler=False, debug=False ): - a = python_to_pythonjs( src, module=module ) +def python_to_javascript( src, module=None, closure_compiler=False, debug=False, global_variable_scope=False ): + a = python_to_pythonjs( src, module=module, global_variable_scope=global_variable_scope ) if debug: print( a ) return pythonjs_to_javascript( a, closure_compiler=closure_compiler ) @@ -146,11 +148,15 @@ def convert_python_html_document( data ): def regenerate_runtime(): print('regenerating pythonscript runtime...') - global REGENERATE_RUNTIME - REGENERATE_RUNTIME = False a = '// PythonScript Runtime - regenerated on: %s' %datetime.datetime.now().ctime() - b = pythonjs_to_javascript( open(PATHS['runtime_pythonjs'],'rb').read().decode('utf-8') ) - c = python_to_javascript( open(PATHS['runtime_builtins'],'rb').read().decode('utf-8') ) + b = pythonjs_to_javascript( + open(PATHS['runtime_pythonjs'],'rb').read().decode('utf-8'), + global_variable_scope = True ## because we are not sure if the old code is compatible with the new style + ) + c = python_to_javascript( + open(PATHS['runtime_builtins'],'rb').read().decode('utf-8'), + global_variable_scope = True + ) src = '\n'.join( [a,b.strip(),c.strip()] ) file = open( PATHS['runtime'], 'wb') file.write( src.encode('utf-8') ) @@ -163,10 +169,7 @@ def get(self, path=None): if not path: self.write( get_main_page() ) elif path == 'pythonscript.js': - if REGENERATE_RUNTIME: - data = regenerate_runtime() - else: - data = open( PATHS['runtime'], 'rb').read() + data = open( PATHS['runtime'], 'rb').read() self.set_header("Content-Type", "text/javascript; charset=utf-8") self.set_header("Content-Length", len(data)) self.write(data) @@ -238,13 +241,17 @@ def get(self, path=None): assert os.path.isdir( PATHS['pythonscript'] ) assert os.path.isdir( PATHS['bindings'] ) - app = tornado.web.Application( - Handlers, - #cookie_secret = 'some random text', - #login_url = '/login', - #xsrf_cookies = False, - ) - - - app.listen( 8080 ) - tornado.ioloop.IOLoop.instance().start() \ No newline at end of file + if '--regenerate-runtime' in sys.argv: + data = regenerate_runtime() + print(data) + + else: + print('running server on localhost:8080') + app = tornado.web.Application( + Handlers, + #cookie_secret = 'some random text', + #login_url = '/login', + #xsrf_cookies = False, + ) + app.listen( 8080 ) + tornado.ioloop.IOLoop.instance().start() \ No newline at end of file diff --git a/tests/test_multiple_inheritance.html b/tests/test_multiple_inheritance.html new file mode 100644 index 0000000..ba69c63 --- /dev/null +++ b/tests/test_multiple_inheritance.html @@ -0,0 +1,32 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/tests/threejs_helloworld.html b/tests/threejs_helloworld.html index 757e0ab..c27e12a 100644 --- a/tests/threejs_helloworld.html +++ b/tests/threejs_helloworld.html @@ -3,46 +3,45 @@ - - - + + + + \ No newline at end of file From 1e43d3ab4b8c924f37e9c616a51ca3c494914586 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Wed, 9 Oct 2013 02:49:12 -0700 Subject: [PATCH 111/860] fixed get_attribute when getting "__call__" on an internal pythonscript function. --- pythonscript.js | 87 +++++++++++++++++++++++++++++- pythonscript/python_to_pythonjs.py | 15 +++++- runtime/builtins.py | 8 +++ runtime/pythonpythonjs.py | 7 ++- tests/server.py | 3 +- tests/test_dict.html | 30 +++++++++++ 6 files changed, 144 insertions(+), 6 deletions(-) create mode 100644 tests/test_dict.html diff --git a/pythonscript.js b/pythonscript.js index 780751c..aaf66d5 100644 --- a/pythonscript.js +++ b/pythonscript.js @@ -1,4 +1,4 @@ -// PythonScript Runtime - regenerated on: Tue Oct 8 17:34:29 2013 +// PythonScript Runtime - regenerated on: Wed Oct 9 02:45:12 2013 var jsrange = function(num) { "Emulates Python's range function"; var i, r; @@ -78,6 +78,10 @@ var get_attribute = function(object, attribute) { "Retrieve an attribute, method, property, or wrapper function.\n\n method are actually functions which are converted to methods by\n prepending their arguments with the current object. Properties are\n not functions!\n\n DOM support:\n http://stackoverflow.com/questions/14202699/document-createelement-not-working\n https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof\n\n Direct JavaScript Calls:\n if an external javascript function is found, and it was not a wrapper that was generated here,\n check the function for a 'cached_wrapper' attribute, if none is found then generate a new\n wrapper, cache it on the function, and return the wrapper.\n "; if(attribute == "__call__") { if({}.toString.call(object) === '[object Function]') { +if(object.pythonscript_function === true) { +return object; +} +else { if(object.is_wrapper !== undefined) { return object; } @@ -103,6 +107,8 @@ return wrapper; } +} + var attr; attr = object[attribute]; if(object instanceof HTMLDocument) { @@ -356,6 +362,7 @@ argslength = 0; } if(args.length > signature.args.length) { +console.log("ERROR args:", args, "kwargs:", kwargs, "sig:", signature); throw TypeError("function called with wrong number of arguments"); } @@ -376,6 +383,7 @@ if(arg in signature.kwargs) { out[arg] = signature.kwargs[arg]; } else { +console.log("ERROR args:", args, "kwargs:", kwargs, "sig:", signature, j); throw TypeError("function called with wrong number of arguments"); } @@ -393,6 +401,7 @@ if(arg in signature.kwargs) { out[arg] = signature.kwargs[arg]; } else { +console.log("ERROR args:", args, "kwargs:", kwargs, "sig:", signature, j); throw TypeError("function called with wrong number of arguments"); } @@ -518,6 +527,7 @@ return output; } window["json_to_pythonscript"] = json_to_pythonscript var range = function(args, kwargs) { +var i, r; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("num")}; arguments = get_arguments(signature, args, kwargs); @@ -537,6 +547,7 @@ return r; } window["range"] = range +range.pythonscript_function = true; var StopIteration, __StopIteration_attrs, __StopIteration_parents; window["__StopIteration_attrs"] = Object(); window["__StopIteration_parents"] = create_array(); @@ -550,6 +561,7 @@ return get_attribute(obj, "__len__")(create_array(), Object()); } window["len"] = len +len.pythonscript_function = true; var next = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("obj")}; @@ -559,7 +571,9 @@ return get_attribute(obj, "next")(create_array(), Object()); } window["next"] = next +next.pythonscript_function = true; var map = function(args, kwargs) { +var out; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("func", "objs")}; arguments = get_arguments(signature, args, kwargs); @@ -574,6 +588,7 @@ return out; } window["map"] = map +map.pythonscript_function = true; var Iterator, __Iterator_attrs, __Iterator_parents; window["__Iterator_attrs"] = Object(); window["__Iterator_parents"] = create_array(); @@ -589,8 +604,10 @@ self["__dict__"]["index"] = index; } window["__Iterator___init__"] = __Iterator___init__ +__Iterator___init__.pythonscript_function = true; window["__Iterator_attrs"]["__init__"] = __Iterator___init__; var __Iterator_next = function(args, kwargs) { +var index, length, item; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); @@ -613,6 +630,7 @@ return item; } window["__Iterator_next"] = __Iterator_next +__Iterator_next.pythonscript_function = true; window["__Iterator_attrs"]["next"] = __Iterator_next; Iterator = create_class("Iterator", window["__Iterator_parents"], window["__Iterator_attrs"]); var list, __list_attrs, __list_parents; @@ -634,8 +652,10 @@ self["__dict__"]["js_object"] = create_array(); } window["__list___init__"] = __list___init__ +__list___init__.pythonscript_function = true; window["__list_attrs"]["__init__"] = __list___init__; var __list_append = function(args, kwargs) { +var __array; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "obj")}; arguments = get_arguments(signature, args, kwargs); @@ -647,6 +667,7 @@ __array.push(obj); } window["__list_append"] = __list_append +__list_append.pythonscript_function = true; window["__list_attrs"]["append"] = __list_append; var __list_extend = function(args, kwargs) { var signature, arguments; @@ -676,8 +697,10 @@ if (__exception__ == StopIteration || isinstance([__exception__, StopIteration]) } window["__list_extend"] = __list_extend +__list_extend.pythonscript_function = true; window["__list_attrs"]["extend"] = __list_extend; var __list_insert = function(args, kwargs) { +var __array; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "index", "obj")}; arguments = get_arguments(signature, args, kwargs); @@ -690,8 +713,10 @@ __array.splice(index, 0, obj); } window["__list_insert"] = __list_insert +__list_insert.pythonscript_function = true; window["__list_attrs"]["insert"] = __list_insert; var __list_remove = function(args, kwargs) { +var index, __array; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "obj")}; arguments = get_arguments(signature, args, kwargs); @@ -707,8 +732,10 @@ __array.splice(index, 1); } window["__list_remove"] = __list_remove +__list_remove.pythonscript_function = true; window["__list_attrs"]["remove"] = __list_remove; var __list_pop = function(args, kwargs) { +var __array; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); @@ -719,8 +746,10 @@ return __array.pop(); } window["__list_pop"] = __list_pop +__list_pop.pythonscript_function = true; window["__list_attrs"]["pop"] = __list_pop; var __list_index = function(args, kwargs) { +var __array; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "obj")}; arguments = get_arguments(signature, args, kwargs); @@ -732,8 +761,10 @@ return __array.indexOf(obj); } window["__list_index"] = __list_index +__list_index.pythonscript_function = true; window["__list_attrs"]["index"] = __list_index; var __list_count = function(args, kwargs) { +var i; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "obj")}; arguments = get_arguments(signature, args, kwargs); @@ -763,8 +794,10 @@ return i; } window["__list_count"] = __list_count +__list_count.pythonscript_function = true; window["__list_attrs"]["count"] = __list_count; var __list_reverse = function(args, kwargs) { +var __array; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); @@ -775,8 +808,10 @@ self["__dict__"]["js_object"] = __array.reverse(); } window["__list_reverse"] = __list_reverse +__list_reverse.pythonscript_function = true; window["__list_attrs"]["reverse"] = __list_reverse; var __list_shift = function(args, kwargs) { +var __array; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); @@ -787,8 +822,10 @@ return __array.shift(); } window["__list_shift"] = __list_shift +__list_shift.pythonscript_function = true; window["__list_attrs"]["shift"] = __list_shift; var __list_slice = function(args, kwargs) { +var __array; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "start", "end")}; arguments = get_arguments(signature, args, kwargs); @@ -801,6 +838,7 @@ return __array.slice(start, end); } window["__list_slice"] = __list_slice +__list_slice.pythonscript_function = true; window["__list_attrs"]["slice"] = __list_slice; var __list___iter__ = function(args, kwargs) { var signature, arguments; @@ -814,8 +852,10 @@ return get_attribute(Iterator, "__call__")(__args_6, __kwargs_6); } window["__list___iter__"] = __list___iter__ +__list___iter__.pythonscript_function = true; window["__list_attrs"]["__iter__"] = __list___iter__; var __list_get = function(args, kwargs) { +var __array; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "index")}; arguments = get_arguments(signature, args, kwargs); @@ -827,8 +867,10 @@ return __array[index]; } window["__list_get"] = __list_get +__list_get.pythonscript_function = true; window["__list_attrs"]["get"] = __list_get; var __list_set = function(args, kwargs) { +var __array; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "index", "value")}; arguments = get_arguments(signature, args, kwargs); @@ -841,8 +883,10 @@ __array[index] = value; } window["__list_set"] = __list_set +__list_set.pythonscript_function = true; window["__list_attrs"]["set"] = __list_set; var __list___len__ = function(args, kwargs) { +var __array; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); @@ -853,6 +897,7 @@ return __array.length; } window["__list___len__"] = __list___len__ +__list___len__.pythonscript_function = true; window["__list_attrs"]["__len__"] = __list___len__; list = create_class("list", window["__list_parents"], window["__list_attrs"]); var dict, __dict_attrs, __dict_parents; @@ -874,8 +919,10 @@ self["__dict__"]["js_object"] = Object(); } window["__dict___init__"] = __dict___init__ +__dict___init__.pythonscript_function = true; window["__dict_attrs"]["__init__"] = __dict___init__; var __dict_get = function(args, kwargs) { +var __dict; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "key", "d")}; arguments = get_arguments(signature, args, kwargs); @@ -892,8 +939,10 @@ return d; } window["__dict_get"] = __dict_get +__dict_get.pythonscript_function = true; window["__dict_attrs"]["get"] = __dict_get; var __dict_set = function(args, kwargs) { +var __dict; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "key", "value")}; arguments = get_arguments(signature, args, kwargs); @@ -906,8 +955,10 @@ __dict[key] = value; } window["__dict_set"] = __dict_set +__dict_set.pythonscript_function = true; window["__dict_attrs"]["set"] = __dict_set; var __dict___len__ = function(args, kwargs) { +var __dict; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); @@ -918,8 +969,10 @@ return Object.keys(__dict).length; } window["__dict___len__"] = __dict___len__ +__dict___len__.pythonscript_function = true; window["__dict_attrs"]["__len__"] = __dict___len__; var __dict_keys = function(args, kwargs) { +var __dict, __keys, out; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); @@ -933,7 +986,37 @@ return out; } window["__dict_keys"] = __dict_keys +__dict_keys.pythonscript_function = true; window["__dict_attrs"]["keys"] = __dict_keys; +var __dict___getitem__ = function(args, kwargs) { +var __dict; +var signature, arguments; +signature = {"kwargs": Object(), "args": create_array("self", "key")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var key = arguments['key']; +__dict = self["__dict__"]["js_object"]; +return __dict[key]; +} +window["__dict___getitem__"] = __dict___getitem__ + +__dict___getitem__.pythonscript_function = true; +window["__dict_attrs"]["__getitem__"] = __dict___getitem__; +var __dict___setitem__ = function(args, kwargs) { +var __dict; +var signature, arguments; +signature = {"kwargs": Object(), "args": create_array("self", "key", "value")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var key = arguments['key']; +var value = arguments['value']; +__dict = self["__dict__"]["js_object"]; +__dict[key] = value; +} +window["__dict___setitem__"] = __dict___setitem__ + +__dict___setitem__.pythonscript_function = true; +window["__dict_attrs"]["__setitem__"] = __dict___setitem__; dict = create_class("dict", window["__dict_parents"], window["__dict_attrs"]); var str, __str_attrs, __str_parents; window["__str_attrs"] = Object(); @@ -948,6 +1031,7 @@ self["__dict__"]["jsstring"] = jsstring; } window["__str___init__"] = __str___init__ +__str___init__.pythonscript_function = true; window["__str_attrs"]["__init__"] = __str___init__; var __str___iter__ = function(args, kwargs) { var signature, arguments; @@ -961,5 +1045,6 @@ return get_attribute(Iterator, "__call__")(__args_7, __kwargs_7); } window["__str___iter__"] = __str___iter__ +__str___iter__.pythonscript_function = true; window["__str_attrs"]["__iter__"] = __str___iter__; str = create_class("str", window["__str_parents"], window["__str_attrs"]); \ No newline at end of file diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index c80dd27..21ac4ad 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -166,6 +166,10 @@ def __init__(self, module=None, module_path=None): self._module_path = module_path self._typedefs = dict() ## class name : typedef (not pickled) + self.setup_builtins() + + def setup_builtins(self): + self._classes['dict'] = set(['__getitem__', '__setitem__']) def get_typedef(self, instance=None, class_name=None): assert instance or class_name @@ -226,6 +230,13 @@ def visit_Assert(self, node): if b.id in self._classes: self._instances[ a.id ] = b.id + def visit_Dict(self, node): + node.returns_type = 'dict' + keys = [x.s for x in node.keys] + values = map(self.visit, node.values) + a = [ '%s=%s'%x for x in zip(keys, values) ] + return 'get_attribute(dict, "__call__")([], JSObject(%s))' % ', '.join(a) + def visit_Tuple(self, node): ## TODO how to deal with tuples return '(%s)' % ', '.join(map(self.visit, node.elts)) @@ -716,7 +727,7 @@ def visit_FunctionDef(self, node): local_vars.add( n.targets[0].id ) elif isinstance(n, Global): global_vars.update( n.names ) - if local_vars: + if local_vars-global_vars: a = ','.join( local_vars-global_vars ) writer.write('var(%s)' %a) @@ -778,7 +789,7 @@ def visit_FunctionDef(self, node): self._function_return_types[ node.name ] = self._return_type writer.pull() - + writer.write('%s.pythonscript_function=True'%node.name) # apply decorators for decorator in decorators: writer.write('%s = %s(create_array(%s))' % (node.name, self.visit(decorator), node.name)) diff --git a/runtime/builtins.py b/runtime/builtins.py index 3bbd29f..2db2602 100644 --- a/runtime/builtins.py +++ b/runtime/builtins.py @@ -161,6 +161,14 @@ def keys(self): out.js_object = __keys return out + def __getitem__(self, key): + __dict = self.js_object + return JS('__dict[key]') + + def __setitem__(self, key, value): + __dict = self.js_object + JS('__dict[key] = value') + class str: diff --git a/runtime/pythonpythonjs.py b/runtime/pythonpythonjs.py index e48365b..ab208f7 100644 --- a/runtime/pythonpythonjs.py +++ b/runtime/pythonpythonjs.py @@ -80,7 +80,9 @@ def get_attribute(object, attribute): """ if attribute == '__call__': if JS("{}.toString.call(object) === '[object Function]'"): - if JS("object.is_wrapper !== undefined"): + if JS("object.pythonscript_function === true"): + return object + elif JS("object.is_wrapper !== undefined"): return object else: JS("var cached = object.cached_wrapper") @@ -247,6 +249,7 @@ def get_arguments(signature, args, kwargs): argslength = 0 if args.length > signature.args.length: + print 'ERROR args:', args, 'kwargs:', kwargs, 'sig:', signature raise TypeError('function called with wrong number of arguments') j = 0 @@ -261,12 +264,14 @@ def get_arguments(signature, args, kwargs): elif arg in signature.kwargs: out[arg] = signature.kwargs[arg] else: + print 'ERROR args:', args, 'kwargs:', kwargs, 'sig:', signature, j raise TypeError('function called with wrong number of arguments') elif j < args.length: out[arg] = args[j] elif arg in signature.kwargs: out[arg] = signature.kwargs[arg] else: + print 'ERROR args:', args, 'kwargs:', kwargs, 'sig:', signature, j raise TypeError('function called with wrong number of arguments') j += 1 diff --git a/tests/server.py b/tests/server.py index 365646f..93777db 100755 --- a/tests/server.py +++ b/tests/server.py @@ -151,11 +151,10 @@ def regenerate_runtime(): a = '// PythonScript Runtime - regenerated on: %s' %datetime.datetime.now().ctime() b = pythonjs_to_javascript( open(PATHS['runtime_pythonjs'],'rb').read().decode('utf-8'), - global_variable_scope = True ## because we are not sure if the old code is compatible with the new style ) c = python_to_javascript( open(PATHS['runtime_builtins'],'rb').read().decode('utf-8'), - global_variable_scope = True + global_variable_scope = False ## this should be safe ) src = '\n'.join( [a,b.strip(),c.strip()] ) file = open( PATHS['runtime'], 'wb') diff --git a/tests/test_dict.html b/tests/test_dict.html new file mode 100644 index 0000000..f2860de --- /dev/null +++ b/tests/test_dict.html @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file From 814a8c19a397ad66ddd0c36e2e63ae737de6c85a Mon Sep 17 00:00:00 2001 From: hartsantler Date: Wed, 9 Oct 2013 03:09:43 -0700 Subject: [PATCH 112/860] fixed __setitem__ --- pythonscript/python_to_pythonjs.py | 2 +- tests/test_dict.html | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index 21ac4ad..8913050 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -526,7 +526,7 @@ def visit_Assign(self, node): # XXX: support only one target for subscripts target = node.targets[0] if isinstance(target, Subscript): - code = "get_attribute(get_attribute('%s', '__setitem__'), '__call__')([%s, %s], JSObject())" + code = "get_attribute(get_attribute(%s, '__setitem__'), '__call__')([%s, %s], JSObject())" code = code % (self.visit(target.value), self.visit(target.slice.value), self.visit(node.value)) writer.write(code) diff --git a/tests/test_dict.html b/tests/test_dict.html index f2860de..e07910c 100644 --- a/tests/test_dict.html +++ b/tests/test_dict.html @@ -10,16 +10,21 @@ print( d['a'] ) print( d['b'] ) print( len(d) ) - #d['a'] = 'hello' - #d['b'] = 'world' - #print( d['a'] ) - #print( d['b'] ) - #print( len(d) ) + print( d ) + + d['a'] = 'hello' + d['b'] = 'world' + print( d['a'] ) + print( d['b'] ) + print( len(d) ) l = {'x':3, 'y':4} print( l['x'] ) print( l['y'] ) + l['x'] = 'XXX' + print( l['x'] ) + print( len(l) ) From 1bdaf9e17866f6fbe46d83a0d73c5d7c92f81d7a Mon Sep 17 00:00:00 2001 From: hartsantler Date: Wed, 9 Oct 2013 06:21:01 -0700 Subject: [PATCH 113/860] fixed initialize dict with keys:values both init styles work: literal {'x':1} and functional dict(x=1) --- pythonscript.js | 2 +- pythonscript/python_to_pythonjs.py | 8 ++++++-- tests/test_dict.html | 9 +++++---- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/pythonscript.js b/pythonscript.js index aaf66d5..df32485 100644 --- a/pythonscript.js +++ b/pythonscript.js @@ -1,4 +1,4 @@ -// PythonScript Runtime - regenerated on: Wed Oct 9 02:45:12 2013 +// PythonScript Runtime - regenerated on: Wed Oct 9 06:17:34 2013 var jsrange = function(num) { "Emulates Python's range function"; var i, r; diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index 8913050..1d532d3 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -235,7 +235,8 @@ def visit_Dict(self, node): keys = [x.s for x in node.keys] values = map(self.visit, node.values) a = [ '%s=%s'%x for x in zip(keys, values) ] - return 'get_attribute(dict, "__call__")([], JSObject(%s))' % ', '.join(a) + b = 'js_object=JSObject(%s)' %', '.join(a) + return 'get_attribute(dict, "__call__")([], JSObject(%s))' % b def visit_Tuple(self, node): ## TODO how to deal with tuples @@ -679,7 +680,10 @@ def visit_Call(self, node): name = self.visit(node.func) if call_has_args: - return 'get_attribute(%s, "__call__")(%s, %s)' % (name, args_name, kwargs_name) + if name == 'dict': + return 'get_attribute(%s, "__call__")(%s, JSObject(js_object=%s))' % (name, args_name, kwargs_name) + else: + return 'get_attribute(%s, "__call__")(%s, %s)' % (name, args_name, kwargs_name) elif name in self._classes: return 'get_attribute(%s, "__call__")( JSArray(), JSObject() )' %name else: diff --git a/tests/test_dict.html b/tests/test_dict.html index e07910c..0d24674 100644 --- a/tests/test_dict.html +++ b/tests/test_dict.html @@ -6,20 +6,21 @@ def test(): global d, l - d = dict(a=1, b=2) + + d = dict(a=1, b=2) ## functional style print( d['a'] ) print( d['b'] ) print( len(d) ) - print( d ) d['a'] = 'hello' d['b'] = 'world' + d['c'] = 'foobar' print( d['a'] ) print( d['b'] ) + print( d['c'] ) print( len(d) ) - - l = {'x':3, 'y':4} + l = {'x':3, 'y':4} ## literal style print( l['x'] ) print( l['y'] ) l['x'] = 'XXX' From 56f260248bd3d25c55071b42be97d602dcbdd582 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Wed, 9 Oct 2013 08:08:09 -0700 Subject: [PATCH 114/860] fixed init empty list(), added tuple type and test, regenerated runtime. --- pythonscript.js | 224 ++++++++++++++++++++++++----- pythonscript/python_to_pythonjs.py | 35 +++-- runtime/builtins.py | 43 +++++- tests/server.py | 9 +- tests/test_dict.html | 7 + tests/test_list.html | 45 ++++++ tests/test_tuple.html | 41 ++++++ 7 files changed, 356 insertions(+), 48 deletions(-) create mode 100644 tests/test_list.html create mode 100644 tests/test_tuple.html diff --git a/pythonscript.js b/pythonscript.js index df32485..249e3ce 100644 --- a/pythonscript.js +++ b/pythonscript.js @@ -1,4 +1,4 @@ -// PythonScript Runtime - regenerated on: Wed Oct 9 06:17:34 2013 +// PythonScript Runtime - regenerated on: Wed Oct 9 08:04:44 2013 var jsrange = function(num) { "Emulates Python's range function"; var i, r; @@ -535,13 +535,13 @@ var num = arguments['num']; "Emulates Python's range function"; var i, r; i = 0; -r = list(create_array(), Object()); +r = get_attribute(list, "__call__")(create_array(), Object()); while(i < num) { var __args_0, __kwargs_0; __args_0 = create_array(i); __kwargs_0 = Object(); get_attribute(get_attribute(r, "append"), "__call__")(__args_0, __kwargs_0); -i = i + 1; +i += 1 } return r; } @@ -579,7 +579,7 @@ signature = {"kwargs": Object(), "args": create_array("func", "objs")}; arguments = get_arguments(signature, args, kwargs); var func = arguments['func']; var objs = arguments['objs']; -out = list(create_array(), Object()); +out = get_attribute(list, "__call__")(create_array(), Object()); var __args_1, __kwargs_1; __args_1 = create_array(func, get_attribute(objs, "js_object")); __kwargs_1 = Object(); @@ -633,6 +633,131 @@ window["__Iterator_next"] = __Iterator_next __Iterator_next.pythonscript_function = true; window["__Iterator_attrs"]["next"] = __Iterator_next; Iterator = create_class("Iterator", window["__Iterator_parents"], window["__Iterator_attrs"]); +var tuple, __tuple_attrs, __tuple_parents; +window["__tuple_attrs"] = Object(); +window["__tuple_parents"] = create_array(); +var __tuple___init__ = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": {"js_object": undefined}, "args": create_array("self", "js_object")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var js_object = arguments['js_object']; +if(js_object) { +self["__dict__"]["js_object"] = js_object; +} +else { +self["__dict__"]["js_object"] = create_array(); +} + +} +window["__tuple___init__"] = __tuple___init__ + +__tuple___init__.pythonscript_function = true; +window["__tuple_attrs"]["__init__"] = __tuple___init__; +var __tuple___getitem__ = function(args, kwargs) { +var __array; +var signature, arguments; +signature = {"kwargs": Object(), "args": create_array("self", "index")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var index = arguments['index']; +__array = self["__dict__"]["js_object"]; +return __array[index]; +} +window["__tuple___getitem__"] = __tuple___getitem__ + +__tuple___getitem__.pythonscript_function = true; +window["__tuple_attrs"]["__getitem__"] = __tuple___getitem__; +var __tuple___iter__ = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": Object(), "args": create_array("self")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var __args_4, __kwargs_4; +__args_4 = create_array(self, 0); +__kwargs_4 = Object(); +return get_attribute(Iterator, "__call__")(__args_4, __kwargs_4); +} +window["__tuple___iter__"] = __tuple___iter__ + +__tuple___iter__.pythonscript_function = true; +window["__tuple_attrs"]["__iter__"] = __tuple___iter__; +var __tuple___len__ = function(args, kwargs) { +var __array; +var signature, arguments; +signature = {"kwargs": Object(), "args": create_array("self")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var __array; +__array = self["__dict__"]["js_object"]; +return __array.length; +} +window["__tuple___len__"] = __tuple___len__ + +__tuple___len__.pythonscript_function = true; +window["__tuple_attrs"]["__len__"] = __tuple___len__; +var __tuple_index = function(args, kwargs) { +var __array; +var signature, arguments; +signature = {"kwargs": Object(), "args": create_array("self", "obj")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var obj = arguments['obj']; +__array = self["__dict__"]["js_object"]; +return __array.indexOf(obj); +} +window["__tuple_index"] = __tuple_index + +__tuple_index.pythonscript_function = true; +window["__tuple_attrs"]["index"] = __tuple_index; +var __tuple_count = function(args, kwargs) { +var i; +var signature, arguments; +signature = {"kwargs": Object(), "args": create_array("self", "obj")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var obj = arguments['obj']; +i = 0; +var __iterator__, other; +__iterator__ = get_attribute(get_attribute(self, "__iter__"), "__call__")(create_array(), Object()); +try { +other = get_attribute(__iterator__, "next")(create_array(), Object()); +while(true) { +if(other == obj) { +i = i + 1; +} + +other = get_attribute(__iterator__, "next")(create_array(), Object()); +} +} +catch(__exception__) { +if (__exception__ == StopIteration || isinstance([__exception__, StopIteration])) { + +} + +} + +return i; +} +window["__tuple_count"] = __tuple_count + +__tuple_count.pythonscript_function = true; +window["__tuple_attrs"]["count"] = __tuple_count; +var __tuple_get = function(args, kwargs) { +var __array; +var signature, arguments; +signature = {"kwargs": Object(), "args": create_array("self", "index")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var index = arguments['index']; +__array = self["__dict__"]["js_object"]; +return __array[index]; +} +window["__tuple_get"] = __tuple_get + +__tuple_get.pythonscript_function = true; +window["__tuple_attrs"]["get"] = __tuple_get; +tuple = create_class("tuple", window["__tuple_parents"], window["__tuple_attrs"]); var list, __list_attrs, __list_parents; window["__list_attrs"] = Object(); window["__list_parents"] = create_array(); @@ -643,10 +768,10 @@ arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var js_object = arguments['js_object']; if(js_object) { -self["__dict__"]["js_object"] = js_object; +set_attribute(self, "js_object", js_object); } else { -self["__dict__"]["js_object"] = create_array(); +set_attribute(self, "js_object", create_array()); } } @@ -654,6 +779,35 @@ window["__list___init__"] = __list___init__ __list___init__.pythonscript_function = true; window["__list_attrs"]["__init__"] = __list___init__; +var __list___getitem__ = function(args, kwargs) { +var __array; +var signature, arguments; +signature = {"kwargs": Object(), "args": create_array("self", "index")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var index = arguments['index']; +__array = get_attribute(self, "js_object"); +return __array[index]; +} +window["__list___getitem__"] = __list___getitem__ + +__list___getitem__.pythonscript_function = true; +window["__list_attrs"]["__getitem__"] = __list___getitem__; +var __list___setitem__ = function(args, kwargs) { +var __array; +var signature, arguments; +signature = {"kwargs": Object(), "args": create_array("self", "index", "value")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var index = arguments['index']; +var value = arguments['value']; +__array = get_attribute(self, "js_object"); +__array[index] = value; +} +window["__list___setitem__"] = __list___setitem__ + +__list___setitem__.pythonscript_function = true; +window["__list_attrs"]["__setitem__"] = __list___setitem__; var __list_append = function(args, kwargs) { var __array; var signature, arguments; @@ -662,7 +816,7 @@ arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var obj = arguments['obj']; var __array; -__array = self["__dict__"]["js_object"]; +__array = get_attribute(self, "js_object"); __array.push(obj); } window["__list_append"] = __list_append @@ -680,10 +834,10 @@ __iterator__ = get_attribute(get_attribute(other, "__iter__"), "__call__")(creat try { obj = get_attribute(__iterator__, "next")(create_array(), Object()); while(true) { -var __args_4, __kwargs_4; -__args_4 = create_array(obj); -__kwargs_4 = Object(); -get_attribute(get_attribute(self, "append"), "__call__")(__args_4, __kwargs_4); +var __args_5, __kwargs_5; +__args_5 = create_array(obj); +__kwargs_5 = Object(); +get_attribute(get_attribute(self, "append"), "__call__")(__args_5, __kwargs_5); obj = get_attribute(__iterator__, "next")(create_array(), Object()); } } @@ -708,7 +862,7 @@ var self = arguments['self']; var index = arguments['index']; var obj = arguments['obj']; var __array; -__array = self["__dict__"]["js_object"]; +__array = get_attribute(self, "js_object"); __array.splice(index, 0, obj); } window["__list_insert"] = __list_insert @@ -723,11 +877,11 @@ arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var obj = arguments['obj']; var __array; -var __args_5, __kwargs_5; -__args_5 = create_array(obj); -__kwargs_5 = Object(); -index = get_attribute(get_attribute(self, "index"), "__call__")(__args_5, __kwargs_5); -__array = self["__dict__"]["js_object"]; +var __args_6, __kwargs_6; +__args_6 = create_array(obj); +__kwargs_6 = Object(); +index = get_attribute(get_attribute(self, "index"), "__call__")(__args_6, __kwargs_6); +__array = get_attribute(self, "js_object"); __array.splice(index, 1); } window["__list_remove"] = __list_remove @@ -741,7 +895,7 @@ signature = {"kwargs": Object(), "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var __array; -__array = self["__dict__"]["js_object"]; +__array = get_attribute(self, "js_object"); return __array.pop(); } window["__list_pop"] = __list_pop @@ -756,7 +910,7 @@ arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var obj = arguments['obj']; var __array; -__array = self["__dict__"]["js_object"]; +__array = get_attribute(self, "js_object"); return __array.indexOf(obj); } window["__list_index"] = __list_index @@ -803,8 +957,8 @@ signature = {"kwargs": Object(), "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var __array; -__array = self["__dict__"]["js_object"]; -self["__dict__"]["js_object"] = __array.reverse(); +__array = get_attribute(self, "js_object"); +set_attribute(self, "js_object", __array.reverse()); } window["__list_reverse"] = __list_reverse @@ -817,7 +971,7 @@ signature = {"kwargs": Object(), "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var __array; -__array = self["__dict__"]["js_object"]; +__array = get_attribute(self, "js_object"); return __array.shift(); } window["__list_shift"] = __list_shift @@ -833,7 +987,7 @@ var self = arguments['self']; var start = arguments['start']; var end = arguments['end']; var __array; -__array = self["__dict__"]["js_object"]; +__array = get_attribute(self, "js_object"); return __array.slice(start, end); } window["__list_slice"] = __list_slice @@ -845,10 +999,10 @@ var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; -var __args_6, __kwargs_6; -__args_6 = create_array(self, 0); -__kwargs_6 = Object(); -return get_attribute(Iterator, "__call__")(__args_6, __kwargs_6); +var __args_7, __kwargs_7; +__args_7 = create_array(self, 0); +__kwargs_7 = Object(); +return get_attribute(Iterator, "__call__")(__args_7, __kwargs_7); } window["__list___iter__"] = __list___iter__ @@ -862,7 +1016,7 @@ arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var index = arguments['index']; var __array; -__array = self["__dict__"]["js_object"]; +__array = get_attribute(self, "js_object"); return __array[index]; } window["__list_get"] = __list_get @@ -878,7 +1032,7 @@ var self = arguments['self']; var index = arguments['index']; var value = arguments['value']; var __array; -__array = self["__dict__"]["js_object"]; +__array = get_attribute(self, "js_object"); __array[index] = value; } window["__list_set"] = __list_set @@ -892,7 +1046,7 @@ signature = {"kwargs": Object(), "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var __array; -__array = self["__dict__"]["js_object"]; +__array = get_attribute(self, "js_object"); return __array.length; } window["__list___len__"] = __list___len__ @@ -981,7 +1135,7 @@ var __dict, out; __dict = self["__dict__"]["js_object"]; __keys = Object.keys(__dict); out = get_attribute(list, "__call__")(create_array(), Object()); -out["__dict__"]["js_object"] = __keys; +set_attribute(out, "js_object", __keys); return out; } window["__dict_keys"] = __dict_keys @@ -1038,10 +1192,10 @@ var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; -var __args_7, __kwargs_7; -__args_7 = create_array(self["__dict__"]["jsstring"], 0); -__kwargs_7 = Object(); -return get_attribute(Iterator, "__call__")(__args_7, __kwargs_7); +var __args_8, __kwargs_8; +__args_8 = create_array(self["__dict__"]["jsstring"], 0); +__kwargs_8 = Object(); +return get_attribute(Iterator, "__call__")(__args_8, __kwargs_8); } window["__str___iter__"] = __str___iter__ diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index 1d532d3..108c767 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -170,6 +170,9 @@ def __init__(self, module=None, module_path=None): def setup_builtins(self): self._classes['dict'] = set(['__getitem__', '__setitem__']) + self._classes['list'] = set(['__getitem__', '__setitem__']) + self._classes['tuple'] = set(['__getitem__', '__setitem__']) + self._builtins = set(['dict', 'list', 'tuple']) def get_typedef(self, instance=None, class_name=None): assert instance or class_name @@ -187,10 +190,15 @@ def get_typedef(self, instance=None, class_name=None): self._typedefs[ class_name ] = Typedef( name = class_name, methods = self._classes[ class_name ], - properties = self._decorator_class_props[ class_name ], - attributes = self._instance_attributes[ class_name ], - class_attributes = self._class_attributes[ class_name ], - parents = self._class_parents[ class_name ], + #properties = self._decorator_class_props[ class_name ], + #attributes = self._instance_attributes[ class_name ], + #class_attributes = self._class_attributes[ class_name ], + #parents = self._class_parents[ class_name ], + properties = self._decorator_class_props.get( class_name, set()), + attributes = self._instance_attributes.get( class_name, set()), + class_attributes = self._class_attributes.get( class_name, set()), + parents = self._class_parents.get( class_name, set()), + compiler = self, ) return self._typedefs[ class_name ] @@ -235,15 +243,16 @@ def visit_Dict(self, node): keys = [x.s for x in node.keys] values = map(self.visit, node.values) a = [ '%s=%s'%x for x in zip(keys, values) ] - b = 'js_object=JSObject(%s)' %', '.join(a) - return 'get_attribute(dict, "__call__")([], JSObject(%s))' % b + b = 'JSObject(%s)' %', '.join(a) + return 'get_attribute(dict, "__call__")([], JSObject(js_object=%s))' %b def visit_Tuple(self, node): - ## TODO how to deal with tuples - return '(%s)' % ', '.join(map(self.visit, node.elts)) + a = '[%s]' % ', '.join(map(self.visit, node.elts)) + return 'get_attribute(tuple, "__call__")([], JSObject(js_object=%s))' %a def visit_List(self, node): - return 'get_attribute(list, "__call__")(create_array([%s]), Object())' % ', '.join(map(self.visit, node.elts)) + a = '[%s]' % ', '.join(map(self.visit, node.elts)) + return 'get_attribute(list, "__call__")([], JSObject(js_object=%s))' %a def visit_In(self, node): return ' in ' @@ -682,11 +691,15 @@ def visit_Call(self, node): if call_has_args: if name == 'dict': return 'get_attribute(%s, "__call__")(%s, JSObject(js_object=%s))' % (name, args_name, kwargs_name) + elif name in ('list', 'tuple'): + return 'get_attribute(%s, "__call__")([], JSObject(js_object=%s))' % (name, args_name) else: return 'get_attribute(%s, "__call__")(%s, %s)' % (name, args_name, kwargs_name) - elif name in self._classes: + + elif name in self._classes or name in self._builtins: return 'get_attribute(%s, "__call__")( JSArray(), JSObject() )' %name - else: + + else: ## this could be a dangerous optimization ## return '%s( JSArray(), JSObject() )' %name def visit_FunctionDef(self, node): diff --git a/runtime/builtins.py b/runtime/builtins.py index 2db2602..9e4d44a 100644 --- a/runtime/builtins.py +++ b/runtime/builtins.py @@ -11,7 +11,7 @@ def range(num): r = list() while i < num: r.append(i) - i = i + 1 + i += 1 return r @@ -48,6 +48,39 @@ def next(self): self.index = self.index + 1 return item +class tuple: + def __init__(self, js_object=None): + if js_object: + self.js_object = js_object + else: + self.js_object = JSArray() + + def __getitem__(self, index): + __array = self.js_object + return JS('__array[index]') + + def __iter__(self): + return Iterator(self, 0) + + def __len__(self): + var(__array) + __array = self.js_object + return JS('__array.length') + + def index(self, obj): + __array = self.js_object + return JS('__array.indexOf(obj)') + + def count(self, obj): + i = 0 + for other in self: + if other == obj: + i = i + 1 + return i + + def get(self, index): ## used by Iterator + __array = self.js_object + return JS('__array[index]') class list: @@ -57,6 +90,14 @@ def __init__(self, js_object=None): else: self.js_object = JSArray() + def __getitem__(self, index): + __array = self.js_object + return JS('__array[index]') + + def __setitem__(self, index, value): + __array = self.js_object + JS('__array[index] = value') + def append(self, obj): var(__array) __array = self.js_object diff --git a/tests/server.py b/tests/server.py index 93777db..08a5e96 100755 --- a/tests/server.py +++ b/tests/server.py @@ -70,9 +70,15 @@ def pythonjs_to_javascript( src, closure_compiler=False ): return a -def python_to_javascript( src, module=None, closure_compiler=False, debug=False, global_variable_scope=False ): +def python_to_javascript( src, module=None, closure_compiler=False, debug=False, dump=False, global_variable_scope=False ): a = python_to_pythonjs( src, module=module, global_variable_scope=global_variable_scope ) if debug: print( a ) + if dump: + if isinstance(dump, str): + open(dump, 'wb').write( a.encode('utf-8') ) + else: + open('/tmp/pythonjs.dump', 'wb').write( a.encode('utf-8') ) + return pythonjs_to_javascript( a, closure_compiler=closure_compiler ) @@ -154,6 +160,7 @@ def regenerate_runtime(): ) c = python_to_javascript( open(PATHS['runtime_builtins'],'rb').read().decode('utf-8'), + dump='/tmp/runtime-builtins.dump.py', global_variable_scope = False ## this should be safe ) src = '\n'.join( [a,b.strip(),c.strip()] ) diff --git a/tests/test_dict.html b/tests/test_dict.html index 0d24674..640ad4e 100644 --- a/tests/test_dict.html +++ b/tests/test_dict.html @@ -27,6 +27,13 @@ print( l['x'] ) print( len(l) ) + print('--testing empty init--') + e1 = {} + e1['A'] = 1 + e2 = dict() + e2['B'] = 2 + print e1, e2 + diff --git a/tests/test_list.html b/tests/test_list.html new file mode 100644 index 0000000..e3956c0 --- /dev/null +++ b/tests/test_list.html @@ -0,0 +1,45 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/tests/test_tuple.html b/tests/test_tuple.html new file mode 100644 index 0000000..b3328bb --- /dev/null +++ b/tests/test_tuple.html @@ -0,0 +1,41 @@ + + + + + + + + + + + \ No newline at end of file From f3aa88ffeeb42b6bd8639a222005b45e733160ad Mon Sep 17 00:00:00 2001 From: hartsantler Date: Wed, 9 Oct 2013 19:07:11 -0700 Subject: [PATCH 115/860] any type can now be used dictionary keys, including lists and dicts. --- pythonscript.js | 25 +++++++++++++++++- runtime/builtins.py | 21 +++++++++++++--- tests/test_dict.html | 60 +++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 101 insertions(+), 5 deletions(-) diff --git a/pythonscript.js b/pythonscript.js index 249e3ce..70f032c 100644 --- a/pythonscript.js +++ b/pythonscript.js @@ -1,4 +1,4 @@ -// PythonScript Runtime - regenerated on: Wed Oct 9 08:04:44 2013 +// PythonScript Runtime - regenerated on: Wed Oct 9 19:04:53 2013 var jsrange = function(num) { "Emulates Python's range function"; var i, r; @@ -1057,6 +1057,8 @@ list = create_class("list", window["__list_parents"], window["__list_attrs"]); var dict, __dict_attrs, __dict_parents; window["__dict_attrs"] = Object(); window["__dict_parents"] = create_array(); +__dict_UID = 0; +window["__dict_attrs"]["UID"] = __dict_UID; var __dict___init__ = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {"js_object": undefined}, "args": create_array("self", "js_object")}; @@ -1150,7 +1152,14 @@ arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var key = arguments['key']; __dict = self["__dict__"]["js_object"]; +if(typeof(key) === 'object') { +var uid = key.uid; +return __dict["@"+uid]; +} +else { return __dict[key]; +} + } window["__dict___getitem__"] = __dict___getitem__ @@ -1165,7 +1174,21 @@ var self = arguments['self']; var key = arguments['key']; var value = arguments['value']; __dict = self["__dict__"]["js_object"]; +if(typeof(key) === 'object') { +console.log("setitem-object->", key); +if(key.uid === undefined) { +uid = self["__class__"]["__dict__"]["UID"]; +key.uid = uid; +self["__class__"]["__dict__"]["UID"] += 1 +} + +var uid = key.uid; +__dict["@"+uid] = value; +} +else { __dict[key] = value; +} + } window["__dict___setitem__"] = __dict___setitem__ diff --git a/runtime/builtins.py b/runtime/builtins.py index 9e4d44a..9c0f2e1 100644 --- a/runtime/builtins.py +++ b/runtime/builtins.py @@ -170,8 +170,10 @@ def __len__(self): class dict: - + # http://stackoverflow.com/questions/10892322/javascript-hashtable-use-object-key + UID = 0 def __init__(self, js_object=None): + #self.js_object = JS('Object.create(null)') if js_object: self.js_object = js_object else: @@ -204,11 +206,24 @@ def keys(self): def __getitem__(self, key): __dict = self.js_object - return JS('__dict[key]') + if JS("typeof(key) === 'object'"): + JS('var uid = key.uid') + return JS('__dict["@"+uid]') ## "@" is needed so that integers can also be used as keys + else: + return JS('__dict[key]') def __setitem__(self, key, value): __dict = self.js_object - JS('__dict[key] = value') + if JS("typeof(key) === 'object'"): + print 'setitem-object->', key + if JS("key.uid === undefined"): + uid = self.UID + JS("key.uid = uid") + self.UID += 1 + JS('var uid = key.uid') + JS('__dict["@"+uid] = value') + else: + JS('__dict[key] = value') class str: diff --git a/tests/test_dict.html b/tests/test_dict.html index 640ad4e..7dcfa3b 100644 --- a/tests/test_dict.html +++ b/tests/test_dict.html @@ -4,8 +4,15 @@ From b5fe7f078c9a64bfad2f64db01f4e796b3b9b6fa Mon Sep 17 00:00:00 2001 From: hartsantler Date: Wed, 9 Oct 2013 19:23:47 -0700 Subject: [PATCH 116/860] optimized the rare case of using functions as dict keys. --- pythonscript.js | 23 +++++++++++++++++++++-- runtime/builtins.py | 13 ++++++++++++- tests/test_dict.html | 12 ++++++++++++ 3 files changed, 45 insertions(+), 3 deletions(-) diff --git a/pythonscript.js b/pythonscript.js index 70f032c..c1df6ea 100644 --- a/pythonscript.js +++ b/pythonscript.js @@ -1,4 +1,4 @@ -// PythonScript Runtime - regenerated on: Wed Oct 9 19:04:53 2013 +// PythonScript Runtime - regenerated on: Wed Oct 9 19:22:57 2013 var jsrange = function(num) { "Emulates Python's range function"; var i, r; @@ -1157,9 +1157,16 @@ var uid = key.uid; return __dict["@"+uid]; } else { +if(typeof(key) === 'function') { +var uid = key.uid; +return __dict["@"+uid]; +} +else { return __dict[key]; } +} + } window["__dict___getitem__"] = __dict___getitem__ @@ -1175,7 +1182,17 @@ var key = arguments['key']; var value = arguments['value']; __dict = self["__dict__"]["js_object"]; if(typeof(key) === 'object') { -console.log("setitem-object->", key); +if(key.uid === undefined) { +uid = self["__class__"]["__dict__"]["UID"]; +key.uid = uid; +self["__class__"]["__dict__"]["UID"] += 1 +} + +var uid = key.uid; +__dict["@"+uid] = value; +} +else { +if(typeof(key) === 'function') { if(key.uid === undefined) { uid = self["__class__"]["__dict__"]["UID"]; key.uid = uid; @@ -1189,6 +1206,8 @@ else { __dict[key] = value; } +} + } window["__dict___setitem__"] = __dict___setitem__ diff --git a/runtime/builtins.py b/runtime/builtins.py index 9c0f2e1..bd9623b 100644 --- a/runtime/builtins.py +++ b/runtime/builtins.py @@ -171,6 +171,8 @@ def __len__(self): class dict: # http://stackoverflow.com/questions/10892322/javascript-hashtable-use-object-key + # using a function as a key is allowed, but would waste memory because it gets converted to a string + # http://stackoverflow.com/questions/10858632/are-functions-valid-keys-for-javascript-object-properties UID = 0 def __init__(self, js_object=None): #self.js_object = JS('Object.create(null)') @@ -209,13 +211,22 @@ def __getitem__(self, key): if JS("typeof(key) === 'object'"): JS('var uid = key.uid') return JS('__dict["@"+uid]') ## "@" is needed so that integers can also be used as keys + elif JS("typeof(key) === 'function'"): + JS('var uid = key.uid') + return JS('__dict["@"+uid]') ## "@" is needed so that integers can also be used as keys else: return JS('__dict[key]') def __setitem__(self, key, value): __dict = self.js_object if JS("typeof(key) === 'object'"): - print 'setitem-object->', key + if JS("key.uid === undefined"): + uid = self.UID + JS("key.uid = uid") + self.UID += 1 + JS('var uid = key.uid') + JS('__dict["@"+uid] = value') + elif JS("typeof(key) === 'function'"): if JS("key.uid === undefined"): uid = self.UID JS("key.uid = uid") diff --git a/tests/test_dict.html b/tests/test_dict.html index 7dcfa3b..edefd5f 100644 --- a/tests/test_dict.html +++ b/tests/test_dict.html @@ -12,7 +12,14 @@ def bar(self): print('BAR') +def func1(): + print('func1') + +def func2(): + print('func2') + def test(): + global d, l, e1, e2 d = dict(a=1, b=2) ## functional style print( d['a'] ) @@ -92,6 +99,11 @@ e1[ 1.333 ] = 'myfloat' print e1[ 1.333 ] + e2[ func1 ] = 'my func1' + e2[ func2 ] = 'my func2' + print e2[func1] + print e2[func2] + From d59559ede7ba846c31fb294f80234cbd3fd7f25a Mon Sep 17 00:00:00 2001 From: hartsantler Date: Wed, 9 Oct 2013 21:00:00 -0700 Subject: [PATCH 117/860] allow any object type to be used to contruct a dict litteral, and other improvements to dict class. --- pythonscript.js | 139 +++++++++++++++++++++++------ pythonscript/python_to_pythonjs.py | 15 +++- runtime/builtins.py | 75 ++++++++++++---- tests/test_dict.html | 2 +- tests/test_dict_advanced.html | 51 +++++++++++ 5 files changed, 230 insertions(+), 52 deletions(-) create mode 100644 tests/test_dict_advanced.html diff --git a/pythonscript.js b/pythonscript.js index c1df6ea..906d4d3 100644 --- a/pythonscript.js +++ b/pythonscript.js @@ -1,4 +1,4 @@ -// PythonScript Runtime - regenerated on: Wed Oct 9 19:22:57 2013 +// PythonScript Runtime - regenerated on: Wed Oct 9 20:55:21 2013 var jsrange = function(num) { "Emulates Python's range function"; var i, r; @@ -1066,7 +1066,23 @@ arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var js_object = arguments['js_object']; if(js_object) { +if(js_object instanceof Array) { +self["__dict__"]["js_object"] = Object.create(null); +i = 0; +while(i < get_attribute(js_object, "length")) { +var key = js_object[i]["key"]; +var value = js_object[i]["value"]; +var __args_8, __kwargs_8; +__args_8 = create_array(key, value); +__kwargs_8 = Object(); +get_attribute(get_attribute(self, "set"), "__call__")(__args_8, __kwargs_8); +i += 1 +} +} +else { self["__dict__"]["js_object"] = js_object; +} + } else { self["__dict__"]["js_object"] = Object(); @@ -1080,18 +1096,37 @@ window["__dict_attrs"]["__init__"] = __dict___init__; var __dict_get = function(args, kwargs) { var __dict; var signature, arguments; -signature = {"kwargs": Object(), "args": create_array("self", "key", "d")}; +signature = {"kwargs": {"_default": undefined}, "args": create_array("self", "key", "_default")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var key = arguments['key']; -var d = arguments['d']; -var __dict; +var _default = arguments['_default']; __dict = self["__dict__"]["js_object"]; -if(__dict[key]) { +if(typeof(key) === 'object') { +var uid = "@"+key.uid; +if(uid in __dict) { +return __dict[uid]; +} + +} +else { +if(typeof(key) === 'function') { +var uid = "@"+key.uid; +if(uid in __dict) { +return __dict[uid]; +} + +} +else { +if(key in __dict) { return __dict[key]; } -return d; +} + +} + +return _default; } window["__dict_get"] = __dict_get @@ -1105,9 +1140,34 @@ arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var key = arguments['key']; var value = arguments['value']; -var __dict; __dict = self["__dict__"]["js_object"]; +if(typeof(key) === 'object') { +if(key.uid === undefined) { +uid = self["__class__"]["__dict__"]["UID"]; +key.uid = uid; +self["__class__"]["__dict__"]["UID"] += 1 +} + +var uid = key.uid; +__dict["@"+uid] = value; +} +else { +if(typeof(key) === 'function') { +if(key.uid === undefined) { +uid = self["__class__"]["__dict__"]["UID"]; +key.uid = uid; +self["__class__"]["__dict__"]["UID"] += 1 +} + +var uid = key.uid; +__dict["@"+uid] = value; +} +else { __dict[key] = value; +} + +} + } window["__dict_set"] = __dict_set @@ -1119,7 +1179,6 @@ var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; -var __dict; __dict = self["__dict__"]["js_object"]; return Object.keys(__dict).length; } @@ -1127,23 +1186,6 @@ window["__dict___len__"] = __dict___len__ __dict___len__.pythonscript_function = true; window["__dict_attrs"]["__len__"] = __dict___len__; -var __dict_keys = function(args, kwargs) { -var __dict, __keys, out; -var signature, arguments; -signature = {"kwargs": Object(), "args": create_array("self")}; -arguments = get_arguments(signature, args, kwargs); -var self = arguments['self']; -var __dict, out; -__dict = self["__dict__"]["js_object"]; -__keys = Object.keys(__dict); -out = get_attribute(list, "__call__")(create_array(), Object()); -set_attribute(out, "js_object", __keys); -return out; -} -window["__dict_keys"] = __dict_keys - -__dict_keys.pythonscript_function = true; -window["__dict_attrs"]["keys"] = __dict_keys; var __dict___getitem__ = function(args, kwargs) { var __dict; var signature, arguments; @@ -1213,6 +1255,45 @@ window["__dict___setitem__"] = __dict___setitem__ __dict___setitem__.pythonscript_function = true; window["__dict_attrs"]["__setitem__"] = __dict___setitem__; +var __dict_keys = function(args, kwargs) { +var __dict, __keys, out; +var signature, arguments; +signature = {"kwargs": Object(), "args": create_array("self")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +__dict = self["__dict__"]["js_object"]; +__keys = Object.keys(__dict); +out = get_attribute(list, "__call__")(create_array(), Object()); +set_attribute(out, "js_object", __keys); +return out; +} +window["__dict_keys"] = __dict_keys + +__dict_keys.pythonscript_function = true; +window["__dict_attrs"]["keys"] = __dict_keys; +var __dict_values = function(args, kwargs) { +var __dict, __keys, i, out; +var signature, arguments; +signature = {"kwargs": Object(), "args": create_array("self")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +__dict = self["__dict__"]["js_object"]; +__keys = Object.keys(__dict); +out = get_attribute(list, "__call__")(create_array(), Object()); +i = 0; +while(i < get_attribute(__keys, "length")) { +var __args_9, __kwargs_9; +__args_9 = create_array(__dict[ __keys[i] ]); +__kwargs_9 = Object(); +get_attribute(get_attribute(out, "append"), "__call__")(__args_9, __kwargs_9); +i += 1 +} +return out; +} +window["__dict_values"] = __dict_values + +__dict_values.pythonscript_function = true; +window["__dict_attrs"]["values"] = __dict_values; dict = create_class("dict", window["__dict_parents"], window["__dict_attrs"]); var str, __str_attrs, __str_parents; window["__str_attrs"] = Object(); @@ -1234,10 +1315,10 @@ var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; -var __args_8, __kwargs_8; -__args_8 = create_array(self["__dict__"]["jsstring"], 0); -__kwargs_8 = Object(); -return get_attribute(Iterator, "__call__")(__args_8, __kwargs_8); +var __args_10, __kwargs_10; +__args_10 = create_array(self["__dict__"]["jsstring"], 0); +__kwargs_10 = Object(); +return get_attribute(Iterator, "__call__")(__args_10, __kwargs_10); } window["__str___iter__"] = __str___iter__ diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index 108c767..ab08d6c 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -240,10 +240,17 @@ def visit_Assert(self, node): def visit_Dict(self, node): node.returns_type = 'dict' - keys = [x.s for x in node.keys] - values = map(self.visit, node.values) - a = [ '%s=%s'%x for x in zip(keys, values) ] - b = 'JSObject(%s)' %', '.join(a) + #keys = [x.s for x in node.keys] + #values = map(self.visit, node.values) + #a = [ '%s=%s'%x for x in zip(keys, values) ] + #b = 'JSObject(%s)' %', '.join(a) + #return 'get_attribute(dict, "__call__")([], JSObject(js_object=%s))' %b + a = [] + for i in range( len(node.keys) ): + k = self.visit( node.keys[ i ] ) + v = self.visit( node.values[i] ) + a.append( 'JSObject(key=%s, value=%s)'%(k,v) ) + b = '[%s]' %', '.join(a) return 'get_attribute(dict, "__call__")([], JSObject(js_object=%s))' %b def visit_Tuple(self, node): diff --git a/runtime/builtins.py b/runtime/builtins.py index bd9623b..9cce77f 100644 --- a/runtime/builtins.py +++ b/runtime/builtins.py @@ -175,37 +175,59 @@ class dict: # http://stackoverflow.com/questions/10858632/are-functions-valid-keys-for-javascript-object-properties UID = 0 def __init__(self, js_object=None): - #self.js_object = JS('Object.create(null)') if js_object: - self.js_object = js_object + if JS("js_object instanceof Array"): + self.js_object = JS('Object.create(null)') + i = 0 + while i < js_object.length: + JS('var key = js_object[i]["key"]') + JS('var value = js_object[i]["value"]') + self.set(key, value) + i += 1 + else: + self.js_object = js_object else: self.js_object = JSObject() - def get(self, key, d): - var(__dict) + def get(self, key, _default=None): __dict = self.js_object - if JS('__dict[key]'): - return JS('__dict[key]') - return d + if JS("typeof(key) === 'object'"): + JS('var uid = "@"+key.uid') ## gotcha - what if "@undefined" was in __dict ? + if JS('uid in __dict'): + return JS('__dict[uid]') + elif JS("typeof(key) === 'function'"): + JS('var uid = "@"+key.uid') + if JS('uid in __dict'): + return JS('__dict[uid]') + else: + if JS('key in __dict'): + return JS('__dict[key]') + + return _default def set(self, key, value): - var(__dict) __dict = self.js_object - JS('__dict[key] = value') + if JS("typeof(key) === 'object'"): + if JS("key.uid === undefined"): + uid = self.UID + JS("key.uid = uid") + self.UID += 1 + JS('var uid = key.uid') + JS('__dict["@"+uid] = value') + elif JS("typeof(key) === 'function'"): + if JS("key.uid === undefined"): + uid = self.UID + JS("key.uid = uid") + self.UID += 1 + JS('var uid = key.uid') + JS('__dict["@"+uid] = value') + else: + JS('__dict[key] = value') def __len__(self): - var(__dict) __dict = self.js_object return JS('Object.keys(__dict).length') - def keys(self): - var(__dict, out) - __dict = self.js_object - __keys = JS('Object.keys(__dict)') - out = list() - out.js_object = __keys - return out - def __getitem__(self, key): __dict = self.js_object if JS("typeof(key) === 'object'"): @@ -236,6 +258,23 @@ def __setitem__(self, key, value): else: JS('__dict[key] = value') + def keys(self): + __dict = self.js_object + __keys = JS('Object.keys(__dict)') + out = list() + out.js_object = __keys + return out + + def values(self): + __dict = self.js_object + __keys = JS('Object.keys(__dict)') + out = list() + i = 0 + while i < __keys.length: + out.append( JS('__dict[ __keys[i] ]') ) + i += 1 + return out + class str: diff --git a/tests/test_dict.html b/tests/test_dict.html index edefd5f..8fe4c93 100644 --- a/tests/test_dict.html +++ b/tests/test_dict.html @@ -71,7 +71,7 @@ e2[ e1 ] = "in python you can't use a dict as a key!" ## in PythonScript we allow this print 'int-key:0', e2[0] - print 'int-key:1', e2[0] + print 'int-key:1', e2[1] print 'dict-key:e1', e2[ e1 ] e2[ 'mykey' ] = 'simple string key' diff --git a/tests/test_dict_advanced.html b/tests/test_dict_advanced.html new file mode 100644 index 0000000..3501ab4 --- /dev/null +++ b/tests/test_dict_advanced.html @@ -0,0 +1,51 @@ + + + + + + + + + + + \ No newline at end of file From 7316b4d06ef9603597ca4adea9d1585c5d0fb73e Mon Sep 17 00:00:00 2001 From: hartsantler Date: Thu, 10 Oct 2013 00:34:03 -0700 Subject: [PATCH 118/860] finished tuple implementation --- pythonscript.js | 18 ++++++++++++++---- pythonscript/python_to_pythonjs.py | 11 +++++++++-- runtime/builtins.py | 13 +++++++++---- tests/test_tuple.html | 2 +- 4 files changed, 33 insertions(+), 11 deletions(-) diff --git a/pythonscript.js b/pythonscript.js index 906d4d3..887373b 100644 --- a/pythonscript.js +++ b/pythonscript.js @@ -1,4 +1,4 @@ -// PythonScript Runtime - regenerated on: Wed Oct 9 20:55:21 2013 +// PythonScript Runtime - regenerated on: Thu Oct 10 00:32:54 2013 var jsrange = function(num) { "Emulates Python's range function"; var i, r; @@ -642,11 +642,21 @@ signature = {"kwargs": {"js_object": undefined}, "args": create_array("self", "j arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var js_object = arguments['js_object']; -if(js_object) { -self["__dict__"]["js_object"] = js_object; +self["__dict__"]["js_object"] = create_array(); +if(js_object instanceof Array) { +arr = self["__dict__"]["js_object"]; +i = 0; +length = js_object.length; +while(i < length) { +arr.push( js_object[i] ); +i += 1 +} } else { -self["__dict__"]["js_object"] = create_array(); +if(js_object) { +throw TypeError; +} + } } diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index ab08d6c..6dd3c5c 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -677,24 +677,31 @@ def visit_Call(self, node): else: call_has_args = len(node.args) or len(node.keywords) or node.starargs or node.kwargs + name = self.visit(node.func) if call_has_args: args = ', '.join(map(self.visit, node.args)) kwargs = ', '.join(map(lambda x: '%s=%s' % (x.arg, self.visit(x.value)), node.keywords)) args_name = '__args_%s' % self.identifier kwargs_name = '__kwargs_%s' % self.identifier + writer.append('var(%s, %s)' % (args_name, kwargs_name)) self.identifier += 1 - writer.append('%s = JSArray(%s)' % (args_name, args)) + + if name in ('list', 'tuple'): + writer.write( '%s = JS("%s.__dict__.js_object")' % (args_name, args)) + else: + writer.append('%s = JSArray(%s)' % (args_name, args)) + if node.starargs: writer.append('%s.push.apply(%s, %s)' % (args_name, args_name, self.visit(node.starargs))) writer.append('%s = JSObject(%s)' % (kwargs_name, kwargs)) + if node.kwargs: kwargs = self.visit(node.kwargs) code = "JS('for (var name in %s) { %s[name] = %s[name]; }')" % (kwargs, kwargs_name, kwargs) writer.append(code) - name = self.visit(node.func) if call_has_args: if name == 'dict': return 'get_attribute(%s, "__call__")(%s, JSObject(js_object=%s))' % (name, args_name, kwargs_name) diff --git a/runtime/builtins.py b/runtime/builtins.py index 9cce77f..33435ae 100644 --- a/runtime/builtins.py +++ b/runtime/builtins.py @@ -50,10 +50,15 @@ def next(self): class tuple: def __init__(self, js_object=None): - if js_object: - self.js_object = js_object - else: - self.js_object = JSArray() + self.js_object = JSArray() + if JS('js_object instanceof Array'): + arr = self.js_object + i = 0; length = JS('js_object.length') + while i < length: + JS('arr.push( js_object[i] )') + i += 1 + elif js_object: + raise TypeError def __getitem__(self, index): __array = self.js_object diff --git a/tests/test_tuple.html b/tests/test_tuple.html index b3328bb..e731a8f 100644 --- a/tests/test_tuple.html +++ b/tests/test_tuple.html @@ -16,7 +16,7 @@ j += 1 def test(): - global a, b + global a, b, c, d print('--testing literal style--') a = (1,2,3) ## literal style show( a ) From 115cdceee988015ccc12e5c8183cba4c745e0087 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Thu, 10 Oct 2013 04:32:39 -0700 Subject: [PATCH 119/860] added array class that wraps ArrayBuffer and DataView, added test_array.html --- runtime/builtins.py | 103 ++++++++++++++++++++++++++++++++++++++++++ tests/test_array.html | 28 ++++++++++++ 2 files changed, 131 insertions(+) create mode 100644 tests/test_array.html diff --git a/runtime/builtins.py b/runtime/builtins.py index 33435ae..2712db6 100644 --- a/runtime/builtins.py +++ b/runtime/builtins.py @@ -48,6 +48,8 @@ def next(self): self.index = self.index + 1 return item + + class tuple: def __init__(self, js_object=None): self.js_object = JSArray() @@ -288,3 +290,104 @@ def __init__(self, jsstring): def __iter__(self): return Iterator(self.jsstring, 0) + + +class array: + ## note that class-level dicts can only be used after the dict class has been defined above + typecodes = { + 'c': 1, # char + 'b': 1, # signed char + 'B': 1, # unsigned char + 'u': 2, # unicode + 'h': 2, # signed short + 'H': 2, # unsigned short + 'i': 4, # signed int + 'I': 4, # unsigned int + 'l': 4, # signed long + 'L': 4, # unsigned long + 'f': 4, # float + 'd': 8, # double + } + typecode_names = { + 'c': 'Int8', + 'b': 'Int8', + 'B': 'Uint8', + 'u': 'Uint16', + 'h': 'Int16', + 'H': 'Uint16', + 'i': 'Int32', + 'I': 'Uint32', + #'l': 'TODO', + #'L': 'TODO', + 'f': 'Float32', + 'd': 'Float64' + } + def __init__(self, typecode, initializer=None, little_endian=False): + self.typecode = typecode + self.little_endian = little_endian + size = 0 + if initializer: + length = len(initializer) + print 'array.initalizer length', length + print 'array.typecode', typecode + print 'array.type size', self.typecodes[ typecode ] + size = length * self.typecodes[ typecode ] + else: size = 0 + self.size = size + print 'array.init bytes', size + buff = JS('new ArrayBuffer(size)') + self.dataview = JS('new DataView(buff)') + self.buffer = buff + self.fromlist( initializer ) + + def fromlist(self, lst): + print 'array.fromlist->', lst + length = len(lst) + step = self.typecodes[ self.typecode ] + size = length * step + + dataview = self.dataview + func_name = 'set'+self.typecode_names[ self.typecode ] + print 'func name->', func_name + func = JS('dataview[func_name].bind(dataview)') + print 'func->', func + if size <= self.size: + i = 0; offset = 0 + while i < length: + item = lst[i] + print ' item->', item + print ' index', i + print ' offset', offset + #JS('func.apply(dataview, [offset, item])') + #JS('func.call(dataview, offset, item)') + JS('func(offset,item)') + offset += step + i += 1 + else: + raise TypeError + + def __getitem__(self, index): + step = self.typecodes[ self.typecode ] + offset = step * index + + dataview = self.dataview + func_name = 'get'+self.typecode_names[ self.typecode ] + func = JS('dataview[func_name].bind(dataview)') + + if offset < self.size: + return JS('func(offset)') + else: + raise IndexError + + def __setitem__(self, index, value): + step = self.typecodes[ self.typecode ] + offset = step * index + + dataview = self.dataview + func_name = 'set'+self.typecode_names[ self.typecode ] + func = JS('dataview[func_name].bind(dataview)') + + if offset < self.size: + JS('func(offset, value)') + else: + raise IndexError diff --git a/tests/test_array.html b/tests/test_array.html new file mode 100644 index 0000000..521b8ed --- /dev/null +++ b/tests/test_array.html @@ -0,0 +1,28 @@ + + + + + + + + + + + \ No newline at end of file From d6235d51523aef12e9d3ac84fa94195f648cd6c8 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Thu, 10 Oct 2013 06:39:11 -0700 Subject: [PATCH 120/860] improved array implementation --- pythonscript.js | 244 +++++++++++++++++++++++++++++++++++++++++- runtime/builtins.py | 101 ++++++++++------- tests/test_array.html | 17 +++ 3 files changed, 322 insertions(+), 40 deletions(-) diff --git a/pythonscript.js b/pythonscript.js index 887373b..5b1ab31 100644 --- a/pythonscript.js +++ b/pythonscript.js @@ -1,4 +1,4 @@ -// PythonScript Runtime - regenerated on: Thu Oct 10 00:32:54 2013 +// PythonScript Runtime - regenerated on: Thu Oct 10 06:35:59 2013 var jsrange = function(num) { "Emulates Python's range function"; var i, r; @@ -1334,4 +1334,244 @@ window["__str___iter__"] = __str___iter__ __str___iter__.pythonscript_function = true; window["__str_attrs"]["__iter__"] = __str___iter__; -str = create_class("str", window["__str_parents"], window["__str_attrs"]); \ No newline at end of file +str = create_class("str", window["__str_parents"], window["__str_attrs"]); +var array, __array_attrs, __array_parents; +window["__array_attrs"] = Object(); +window["__array_parents"] = create_array(); +__array_typecodes = get_attribute(dict, "__call__")([], {"js_object": [{"key": "c", "value": 1}, {"key": "b", "value": 1}, {"key": "B", "value": 1}, {"key": "u", "value": 2}, {"key": "h", "value": 2}, {"key": "H", "value": 2}, {"key": "i", "value": 4}, {"key": "I", "value": 4}, {"key": "l", "value": 4}, {"key": "L", "value": 4}, {"key": "f", "value": 4}, {"key": "d", "value": 8}]}); +window["__array_attrs"]["typecodes"] = __array_typecodes; +__array_typecode_names = get_attribute(dict, "__call__")([], {"js_object": [{"key": "c", "value": "Int8"}, {"key": "b", "value": "Int8"}, {"key": "B", "value": "Uint8"}, {"key": "u", "value": "Uint16"}, {"key": "h", "value": "Int16"}, {"key": "H", "value": "Uint16"}, {"key": "i", "value": "Int32"}, {"key": "I", "value": "Uint32"}, {"key": "f", "value": "Float32"}, {"key": "d", "value": "Float64"}]}); +window["__array_attrs"]["typecode_names"] = __array_typecode_names; +var __array___init__ = function(args, kwargs) { +var size, buff; +var signature, arguments; +signature = {"kwargs": {"initializer": undefined, "little_endian": false}, "args": create_array("self", "typecode", "initializer", "little_endian")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var typecode = arguments['typecode']; +var initializer = arguments['initializer']; +var little_endian = arguments['little_endian']; +self["__dict__"]["typecode"] = typecode; +self["__dict__"]["itemsize"] = get_attribute(self["__class__"]["__dict__"]["typecodes"], "__getitem__")([typecode], Object()); +self["__dict__"]["little_endian"] = little_endian; +if(initializer) { +var __args_11, __kwargs_11; +__args_11 = create_array(initializer); +__kwargs_11 = Object(); +self["__dict__"]["length"] = get_attribute(len, "__call__")(__args_11, __kwargs_11); +self["__dict__"]["bytes"] = self["__dict__"]["length"] * self["__dict__"]["itemsize"]; +} +else { +self["__dict__"]["length"] = 0; +self["__dict__"]["bytes"] = 0; +} + +size = self["__dict__"]["bytes"]; +buff = new ArrayBuffer(size); +self["__dict__"]["dataview"] = new DataView(buff); +self["__dict__"]["buffer"] = buff; +var __args_12, __kwargs_12; +__args_12 = create_array(initializer); +__kwargs_12 = Object(); +get_attribute(get_attribute(self, "fromlist"), "__call__")(__args_12, __kwargs_12); +} +window["__array___init__"] = __array___init__ + +__array___init__.pythonscript_function = true; +window["__array_attrs"]["__init__"] = __array___init__; +var __array___len__ = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": Object(), "args": create_array("self")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +return self["__dict__"]["length"]; +} +window["__array___len__"] = __array___len__ + +__array___len__.pythonscript_function = true; +window["__array_attrs"]["__len__"] = __array___len__; +var __array___getitem__ = function(args, kwargs) { +var func_name, step, dataview, func, offset; +var signature, arguments; +signature = {"kwargs": Object(), "args": create_array("self", "index")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var index = arguments['index']; +step = self["__dict__"]["itemsize"]; +offset = step * index; +dataview = self["__dict__"]["dataview"]; +func_name = "get" + get_attribute(self["__class__"]["__dict__"]["typecode_names"], "__getitem__")([self["__dict__"]["typecode"]], Object()); +func = dataview[func_name].bind(dataview); +if(offset < self["__dict__"]["bytes"]) { +return func(offset); +} +else { +throw IndexError; +} + +} +window["__array___getitem__"] = __array___getitem__ + +__array___getitem__.pythonscript_function = true; +window["__array_attrs"]["__getitem__"] = __array___getitem__; +var __array___setitem__ = function(args, kwargs) { +var func_name, step, dataview, func, offset; +var signature, arguments; +signature = {"kwargs": Object(), "args": create_array("self", "index", "value")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var index = arguments['index']; +var value = arguments['value']; +step = self["__dict__"]["itemsize"]; +if(index < 0) { +index = self["__dict__"]["length"] + index - 1; +} + +offset = step * index; +dataview = self["__dict__"]["dataview"]; +func_name = "set" + get_attribute(self["__class__"]["__dict__"]["typecode_names"], "__getitem__")([self["__dict__"]["typecode"]], Object()); +func = dataview[func_name].bind(dataview); +if(offset < self["__dict__"]["bytes"]) { +func(offset, value); +} +else { +throw IndexError; +} + +} +window["__array___setitem__"] = __array___setitem__ + +__array___setitem__.pythonscript_function = true; +window["__array_attrs"]["__setitem__"] = __array___setitem__; +var __array___iter__ = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": Object(), "args": create_array("self")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var __args_13, __kwargs_13; +__args_13 = create_array(self, 0); +__kwargs_13 = Object(); +return get_attribute(Iterator, "__call__")(__args_13, __kwargs_13); +} +window["__array___iter__"] = __array___iter__ + +__array___iter__.pythonscript_function = true; +window["__array_attrs"]["__iter__"] = __array___iter__; +var __array_get = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": Object(), "args": create_array("self", "index")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var index = arguments['index']; +return __array___getitem__([self, index]); +} +window["__array_get"] = __array_get + +__array_get.pythonscript_function = true; +window["__array_attrs"]["get"] = __array_get; +var __array_fromlist = function(args, kwargs) { +var func_name, dataview, length, step, func, size; +var signature, arguments; +signature = {"kwargs": Object(), "args": create_array("self", "lst")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var lst = arguments['lst']; +var __args_14, __kwargs_14; +__args_14 = create_array(lst); +__kwargs_14 = Object(); +length = get_attribute(len, "__call__")(__args_14, __kwargs_14); +step = self["__dict__"]["itemsize"]; +size = length * step; +dataview = self["__dict__"]["dataview"]; +func_name = "set" + get_attribute(self["__class__"]["__dict__"]["typecode_names"], "__getitem__")([self["__dict__"]["typecode"]], Object()); +func = dataview[func_name].bind(dataview); +if(size <= self["__dict__"]["bytes"]) { +i = 0; +offset = 0; +while(i < length) { +item = get_attribute(lst, "__getitem__")([i], Object()); +func(offset,item); +offset += step +i += 1 +} +} +else { +throw TypeError; +} + +} +window["__array_fromlist"] = __array_fromlist + +__array_fromlist.pythonscript_function = true; +window["__array_attrs"]["fromlist"] = __array_fromlist; +var __array_resize = function(args, kwargs) { +var source, new_buff, target, new_size, buff; +var signature, arguments; +signature = {"kwargs": Object(), "args": create_array("self", "length")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var length = arguments['length']; +buff = self["__dict__"]["buffer"]; +source = new Uint8Array(buff); +new_size = length * self["__dict__"]["itemsize"]; +new_buff = new ArrayBuffer(new_size); +target = new Uint8Array(new_buff); +target.set(source); +self["__dict__"]["length"] = length; +self["__dict__"]["bytes"] = new_size; +self["__dict__"]["buffer"] = new_buff; +self["__dict__"]["dataview"] = new DataView(new_buff); +} +window["__array_resize"] = __array_resize + +__array_resize.pythonscript_function = true; +window["__array_attrs"]["resize"] = __array_resize; +var __array_append = function(args, kwargs) { +var length; +var signature, arguments; +signature = {"kwargs": Object(), "args": create_array("self", "value")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var value = arguments['value']; +length = self["__dict__"]["length"]; +var __args_15, __kwargs_15; +__args_15 = create_array(self["__dict__"]["length"] + 1); +__kwargs_15 = Object(); +get_attribute(get_attribute(self, "resize"), "__call__")(__args_15, __kwargs_15); +get_attribute(get_attribute(self, "__setitem__"), "__call__")([length, value], Object()); +} +window["__array_append"] = __array_append + +__array_append.pythonscript_function = true; +window["__array_attrs"]["append"] = __array_append; +var __array_extend = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": Object(), "args": create_array("self", "lst")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var lst = arguments['lst']; +var __iterator__, value; +__iterator__ = get_attribute(get_attribute(lst, "__iter__"), "__call__")(create_array(), Object()); +try { +value = get_attribute(__iterator__, "next")(create_array(), Object()); +while(true) { +var __args_16, __kwargs_16; +__args_16 = create_array(value); +__kwargs_16 = Object(); +get_attribute(get_attribute(self, "append"), "__call__")(__args_16, __kwargs_16); +value = get_attribute(__iterator__, "next")(create_array(), Object()); +} +} +catch(__exception__) { +if (__exception__ == StopIteration || isinstance([__exception__, StopIteration])) { + +} + +} + +} +window["__array_extend"] = __array_extend + +__array_extend.pythonscript_function = true; +window["__array_attrs"]["extend"] = __array_extend; +array = create_class("array", window["__array_parents"], window["__array_attrs"]); \ No newline at end of file diff --git a/runtime/builtins.py b/runtime/builtins.py index 2712db6..f73475f 100644 --- a/runtime/builtins.py +++ b/runtime/builtins.py @@ -324,70 +324,95 @@ class array: } def __init__(self, typecode, initializer=None, little_endian=False): self.typecode = typecode + self.itemsize = self.typecodes[ typecode ] self.little_endian = little_endian - size = 0 + if initializer: - length = len(initializer) - print 'array.initalizer length', length - print 'array.typecode', typecode - print 'array.type size', self.typecodes[ typecode ] - size = length * self.typecodes[ typecode ] - else: size = 0 - self.size = size - print 'array.init bytes', size + self.length = len(initializer) + self.bytes = self.length * self.itemsize + else: + self.length = 0 + self.bytes = 0 + + size = self.bytes buff = JS('new ArrayBuffer(size)') self.dataview = JS('new DataView(buff)') self.buffer = buff self.fromlist( initializer ) - def fromlist(self, lst): - print 'array.fromlist->', lst - length = len(lst) - step = self.typecodes[ self.typecode ] - size = length * step - - dataview = self.dataview - func_name = 'set'+self.typecode_names[ self.typecode ] - print 'func name->', func_name - func = JS('dataview[func_name].bind(dataview)') - print 'func->', func - if size <= self.size: - i = 0; offset = 0 - while i < length: - item = lst[i] - print ' item->', item - print ' index', i - print ' offset', offset - #JS('func.apply(dataview, [offset, item])') - #JS('func.call(dataview, offset, item)') - JS('func(offset,item)') - offset += step - i += 1 - else: - raise TypeError + def __len__(self): + return self.length def __getitem__(self, index): - step = self.typecodes[ self.typecode ] + step = self.itemsize offset = step * index dataview = self.dataview func_name = 'get'+self.typecode_names[ self.typecode ] func = JS('dataview[func_name].bind(dataview)') - if offset < self.size: + if offset < self.bytes: return JS('func(offset)') else: raise IndexError def __setitem__(self, index, value): - step = self.typecodes[ self.typecode ] + step = self.itemsize + if index < 0: index = self.length + index -1 offset = step * index dataview = self.dataview func_name = 'set'+self.typecode_names[ self.typecode ] func = JS('dataview[func_name].bind(dataview)') - if offset < self.size: + if offset < self.bytes: JS('func(offset, value)') else: raise IndexError + + def __iter__(self): + return Iterator(self, 0) + + def get(self, index): + return self[ index ] + + def fromlist(self, lst): + length = len(lst) + step = self.itemsize + size = length * step + + dataview = self.dataview + func_name = 'set'+self.typecode_names[ self.typecode ] + func = JS('dataview[func_name].bind(dataview)') + if size <= self.bytes: + i = 0; offset = 0 + while i < length: + item = lst[i] + JS('func(offset,item)') + offset += step + i += 1 + else: + raise TypeError + + def resize(self, length): + buff = self.buffer + source = JS('new Uint8Array(buff)') + + new_size = length * self.itemsize + new_buff = JS('new ArrayBuffer(new_size)') + target = JS('new Uint8Array(new_buff)') + JS('target.set(source)') + + self.length = length + self.bytes = new_size + self.buffer = new_buff + self.dataview = JS('new DataView(new_buff)') + + def append(self, value): + length = self.length + self.resize( self.length + 1 ) + self[ length ] = value + + def extend(self, lst): ## TODO optimize + for value in lst: + self.append( value ) \ No newline at end of file diff --git a/tests/test_array.html b/tests/test_array.html index 521b8ed..e38fa05 100644 --- a/tests/test_array.html +++ b/tests/test_array.html @@ -19,6 +19,23 @@ a[0] = 1000 print a[0] + print( '--resizing--' ) + a.resize( 8 ) + a[4] = 5 + a[5] = 6 + a[6] = 7 + a[7] = 8 + for value in a: + print value + print( '--testing append--' ) + a.append( 99 ) + #print a[-1] ## TODO fix negative indices + + print( '--testing extend--' ) + a.extend( [100, 101, 102] ) + for value in a: + print value + From 03daebe3b931859ce5f05e381ca1b9465b68965b Mon Sep 17 00:00:00 2001 From: hartsantler Date: Thu, 10 Oct 2013 18:12:44 -0700 Subject: [PATCH 121/860] added float16 and float8 automatically quantized float types to array added builtins: ord, chr, min, max, abs "./server.py --recompile-runtime" will now raise RuntimeError if code was not generated. added more array tests --- pythonscript.js | 281 ++++++++++++++++++++++++++--- pythonscript/python_to_pythonjs.py | 2 +- runtime/builtins.py | 92 +++++++++- tests/server.py | 5 + tests/test_array.html | 23 ++- tests/test_array_advanced.html | 30 +++ 6 files changed, 399 insertions(+), 34 deletions(-) create mode 100644 tests/test_array_advanced.html diff --git a/pythonscript.js b/pythonscript.js index 5b1ab31..3de1647 100644 --- a/pythonscript.js +++ b/pythonscript.js @@ -1,4 +1,4 @@ -// PythonScript Runtime - regenerated on: Thu Oct 10 06:35:59 2013 +// PythonScript Runtime - regenerated on: Thu Oct 10 18:03:46 2013 var jsrange = function(num) { "Emulates Python's range function"; var i, r; @@ -589,6 +589,110 @@ return out; window["map"] = map map.pythonscript_function = true; +var min = function(args, kwargs) { +var a; +var signature, arguments; +signature = {"kwargs": Object(), "args": create_array("lst")}; +arguments = get_arguments(signature, args, kwargs); +var lst = arguments['lst']; +a = undefined; +var __iterator__, value; +__iterator__ = get_attribute(get_attribute(lst, "__iter__"), "__call__")(create_array(), Object()); +try { +value = get_attribute(__iterator__, "next")(create_array(), Object()); +while(true) { +if(a === undefined) { +a = value; +} +else { +if(value < a) { +a = value; +} + +} + +value = get_attribute(__iterator__, "next")(create_array(), Object()); +} +} +catch(__exception__) { +if (__exception__ == StopIteration || isinstance([__exception__, StopIteration])) { + +} + +} + +return a; +} +window["min"] = min + +min.pythonscript_function = true; +var max = function(args, kwargs) { +var a; +var signature, arguments; +signature = {"kwargs": Object(), "args": create_array("lst")}; +arguments = get_arguments(signature, args, kwargs); +var lst = arguments['lst']; +a = undefined; +var __iterator__, value; +__iterator__ = get_attribute(get_attribute(lst, "__iter__"), "__call__")(create_array(), Object()); +try { +value = get_attribute(__iterator__, "next")(create_array(), Object()); +while(true) { +if(a === undefined) { +a = value; +} +else { +if(value > a) { +a = value; +} + +} + +value = get_attribute(__iterator__, "next")(create_array(), Object()); +} +} +catch(__exception__) { +if (__exception__ == StopIteration || isinstance([__exception__, StopIteration])) { + +} + +} + +return a; +} +window["max"] = max + +max.pythonscript_function = true; +var abs = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": Object(), "args": create_array("num")}; +arguments = get_arguments(signature, args, kwargs); +var num = arguments['num']; +return Math.abs(num); +} +window["abs"] = abs + +abs.pythonscript_function = true; +var ord = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": Object(), "args": create_array("char")}; +arguments = get_arguments(signature, args, kwargs); +var char = arguments['char']; +return char.charCodeAt(0); +} +window["ord"] = ord + +ord.pythonscript_function = true; +var chr = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": Object(), "args": create_array("num")}; +arguments = get_arguments(signature, args, kwargs); +var num = arguments['num']; +return String.fromCharCode(num); +} +window["chr"] = chr + +chr.pythonscript_function = true; var Iterator, __Iterator_attrs, __Iterator_parents; window["__Iterator_attrs"] = Object(); window["__Iterator_parents"] = create_array(); @@ -1338,9 +1442,9 @@ str = create_class("str", window["__str_parents"], window["__str_attrs"]); var array, __array_attrs, __array_parents; window["__array_attrs"] = Object(); window["__array_parents"] = create_array(); -__array_typecodes = get_attribute(dict, "__call__")([], {"js_object": [{"key": "c", "value": 1}, {"key": "b", "value": 1}, {"key": "B", "value": 1}, {"key": "u", "value": 2}, {"key": "h", "value": 2}, {"key": "H", "value": 2}, {"key": "i", "value": 4}, {"key": "I", "value": 4}, {"key": "l", "value": 4}, {"key": "L", "value": 4}, {"key": "f", "value": 4}, {"key": "d", "value": 8}]}); +__array_typecodes = get_attribute(dict, "__call__")([], {"js_object": [{"key": "c", "value": 1}, {"key": "b", "value": 1}, {"key": "B", "value": 1}, {"key": "u", "value": 2}, {"key": "h", "value": 2}, {"key": "H", "value": 2}, {"key": "i", "value": 4}, {"key": "I", "value": 4}, {"key": "l", "value": 4}, {"key": "L", "value": 4}, {"key": "f", "value": 4}, {"key": "d", "value": 8}, {"key": "float32", "value": 4}, {"key": "float16", "value": 2}, {"key": "float8", "value": 1}]}); window["__array_attrs"]["typecodes"] = __array_typecodes; -__array_typecode_names = get_attribute(dict, "__call__")([], {"js_object": [{"key": "c", "value": "Int8"}, {"key": "b", "value": "Int8"}, {"key": "B", "value": "Uint8"}, {"key": "u", "value": "Uint16"}, {"key": "h", "value": "Int16"}, {"key": "H", "value": "Uint16"}, {"key": "i", "value": "Int32"}, {"key": "I", "value": "Uint32"}, {"key": "f", "value": "Float32"}, {"key": "d", "value": "Float64"}]}); +__array_typecode_names = get_attribute(dict, "__call__")([], {"js_object": [{"key": "c", "value": "Int8"}, {"key": "b", "value": "Int8"}, {"key": "B", "value": "Uint8"}, {"key": "u", "value": "Uint16"}, {"key": "h", "value": "Int16"}, {"key": "H", "value": "Uint16"}, {"key": "i", "value": "Int32"}, {"key": "I", "value": "Uint32"}, {"key": "f", "value": "Float32"}, {"key": "d", "value": "Float64"}, {"key": "float32", "value": "Float32"}, {"key": "float16", "value": "Int16"}, {"key": "float8", "value": "Int8"}]}); window["__array_attrs"]["typecode_names"] = __array_typecode_names; var __array___init__ = function(args, kwargs) { var size, buff; @@ -1360,6 +1464,44 @@ __args_11 = create_array(initializer); __kwargs_11 = Object(); self["__dict__"]["length"] = get_attribute(len, "__call__")(__args_11, __kwargs_11); self["__dict__"]["bytes"] = self["__dict__"]["length"] * self["__dict__"]["itemsize"]; +if(self["__dict__"]["typecode"] == "float8") { +var __args_12, __kwargs_12; +__args_12 = create_array(initializer); +__kwargs_12 = Object(); +var __args_13, __kwargs_13; +__args_13 = create_array(get_attribute(min, "__call__")(__args_12, __kwargs_12)); +__kwargs_13 = Object(); +var __args_14, __kwargs_14; +__args_14 = create_array(initializer); +__kwargs_14 = Object(); +var __args_15, __kwargs_15; +__args_15 = create_array(get_attribute(list, "__call__")([], {"js_object": [get_attribute(abs, "__call__")(__args_13, __kwargs_13), get_attribute(max, "__call__")(__args_14, __kwargs_14)]})); +__kwargs_15 = Object(); +self["__dict__"]["_scale"] = get_attribute(max, "__call__")(__args_15, __kwargs_15); +self["__dict__"]["_norm_get"] = self["__dict__"]["_scale"] / 127; +self["__dict__"]["_norm_set"] = 1.0 / self["__dict__"]["_norm_get"]; +} +else { +if(self["__dict__"]["typecode"] == "float16") { +var __args_16, __kwargs_16; +__args_16 = create_array(initializer); +__kwargs_16 = Object(); +var __args_17, __kwargs_17; +__args_17 = create_array(get_attribute(min, "__call__")(__args_16, __kwargs_16)); +__kwargs_17 = Object(); +var __args_18, __kwargs_18; +__args_18 = create_array(initializer); +__kwargs_18 = Object(); +var __args_19, __kwargs_19; +__args_19 = create_array(get_attribute(list, "__call__")([], {"js_object": [get_attribute(abs, "__call__")(__args_17, __kwargs_17), get_attribute(max, "__call__")(__args_18, __kwargs_18)]})); +__kwargs_19 = Object(); +self["__dict__"]["_scale"] = get_attribute(max, "__call__")(__args_19, __kwargs_19); +self["__dict__"]["_norm_get"] = self["__dict__"]["_scale"] / 32767; +self["__dict__"]["_norm_set"] = 1.0 / self["__dict__"]["_norm_get"]; +} + +} + } else { self["__dict__"]["length"] = 0; @@ -1370,10 +1512,10 @@ size = self["__dict__"]["bytes"]; buff = new ArrayBuffer(size); self["__dict__"]["dataview"] = new DataView(buff); self["__dict__"]["buffer"] = buff; -var __args_12, __kwargs_12; -__args_12 = create_array(initializer); -__kwargs_12 = Object(); -get_attribute(get_attribute(self, "fromlist"), "__call__")(__args_12, __kwargs_12); +var __args_20, __kwargs_20; +__args_20 = create_array(initializer); +__kwargs_20 = Object(); +get_attribute(get_attribute(self, "fromlist"), "__call__")(__args_20, __kwargs_20); } window["__array___init__"] = __array___init__ @@ -1403,7 +1545,18 @@ dataview = self["__dict__"]["dataview"]; func_name = "get" + get_attribute(self["__class__"]["__dict__"]["typecode_names"], "__getitem__")([self["__dict__"]["typecode"]], Object()); func = dataview[func_name].bind(dataview); if(offset < self["__dict__"]["bytes"]) { -return func(offset); +value = func(offset); +if(self["__dict__"]["typecode"] == "float8") { +value = value * self["__dict__"]["_norm_get"]; +} +else { +if(self["__dict__"]["typecode"] == "float16") { +value = value * self["__dict__"]["_norm_get"]; +} + +} + +return value; } else { throw IndexError; @@ -1432,6 +1585,16 @@ dataview = self["__dict__"]["dataview"]; func_name = "set" + get_attribute(self["__class__"]["__dict__"]["typecode_names"], "__getitem__")([self["__dict__"]["typecode"]], Object()); func = dataview[func_name].bind(dataview); if(offset < self["__dict__"]["bytes"]) { +if(self["__dict__"]["typecode"] == "float8") { +value = value * self["__dict__"]["_norm_set"]; +} +else { +if(self["__dict__"]["typecode"] == "float16") { +value = value * self["__dict__"]["_norm_set"]; +} + +} + func(offset, value); } else { @@ -1448,10 +1611,10 @@ var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; -var __args_13, __kwargs_13; -__args_13 = create_array(self, 0); -__kwargs_13 = Object(); -return get_attribute(Iterator, "__call__")(__args_13, __kwargs_13); +var __args_21, __kwargs_21; +__args_21 = create_array(self, 0); +__kwargs_21 = Object(); +return get_attribute(Iterator, "__call__")(__args_21, __kwargs_21); } window["__array___iter__"] = __array___iter__ @@ -1470,26 +1633,37 @@ window["__array_get"] = __array_get __array_get.pythonscript_function = true; window["__array_attrs"]["get"] = __array_get; var __array_fromlist = function(args, kwargs) { -var func_name, dataview, length, step, func, size; +var typecode, func_name, dataview, length, step, func, size; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "lst")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var lst = arguments['lst']; -var __args_14, __kwargs_14; -__args_14 = create_array(lst); -__kwargs_14 = Object(); -length = get_attribute(len, "__call__")(__args_14, __kwargs_14); +var __args_22, __kwargs_22; +__args_22 = create_array(lst); +__kwargs_22 = Object(); +length = get_attribute(len, "__call__")(__args_22, __kwargs_22); step = self["__dict__"]["itemsize"]; +typecode = self["__dict__"]["typecode"]; size = length * step; dataview = self["__dict__"]["dataview"]; -func_name = "set" + get_attribute(self["__class__"]["__dict__"]["typecode_names"], "__getitem__")([self["__dict__"]["typecode"]], Object()); +func_name = "set" + get_attribute(self["__class__"]["__dict__"]["typecode_names"], "__getitem__")([typecode], Object()); func = dataview[func_name].bind(dataview); if(size <= self["__dict__"]["bytes"]) { i = 0; offset = 0; while(i < length) { item = get_attribute(lst, "__getitem__")([i], Object()); +if(typecode == "float8") { +item *= self["__dict__"]["_norm_set"] +} +else { +if(typecode == "float16") { +item *= self["__dict__"]["_norm_set"] +} + +} + func(offset,item); offset += step i += 1 @@ -1534,10 +1708,10 @@ arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var value = arguments['value']; length = self["__dict__"]["length"]; -var __args_15, __kwargs_15; -__args_15 = create_array(self["__dict__"]["length"] + 1); -__kwargs_15 = Object(); -get_attribute(get_attribute(self, "resize"), "__call__")(__args_15, __kwargs_15); +var __args_23, __kwargs_23; +__args_23 = create_array(self["__dict__"]["length"] + 1); +__kwargs_23 = Object(); +get_attribute(get_attribute(self, "resize"), "__call__")(__args_23, __kwargs_23); get_attribute(get_attribute(self, "__setitem__"), "__call__")([length, value], Object()); } window["__array_append"] = __array_append @@ -1555,10 +1729,10 @@ __iterator__ = get_attribute(get_attribute(lst, "__iter__"), "__call__")(create_ try { value = get_attribute(__iterator__, "next")(create_array(), Object()); while(true) { -var __args_16, __kwargs_16; -__args_16 = create_array(value); -__kwargs_16 = Object(); -get_attribute(get_attribute(self, "append"), "__call__")(__args_16, __kwargs_16); +var __args_24, __kwargs_24; +__args_24 = create_array(value); +__kwargs_24 = Object(); +get_attribute(get_attribute(self, "append"), "__call__")(__args_24, __kwargs_24); value = get_attribute(__iterator__, "next")(create_array(), Object()); } } @@ -1574,4 +1748,59 @@ window["__array_extend"] = __array_extend __array_extend.pythonscript_function = true; window["__array_attrs"]["extend"] = __array_extend; +var __array_to_array = function(args, kwargs) { +var i, arr; +var signature, arguments; +signature = {"kwargs": Object(), "args": create_array("self")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +arr = create_array(); +i = 0; +while(i < self["__dict__"]["length"]) { +item = __array___getitem__([self, i]); +arr.push( item ); +i += 1 +} +return arr; +} +window["__array_to_array"] = __array_to_array + +__array_to_array.pythonscript_function = true; +window["__array_attrs"]["to_array"] = __array_to_array; +var __array_to_list = function(args, kwargs) { +var lst; +var signature, arguments; +signature = {"kwargs": Object(), "args": create_array("self")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +lst = get_attribute(list, "__call__")(create_array(), Object()); +set_attribute(lst, "js_object", get_attribute(self, "to_array")(create_array(), Object())); +return lst; +} +window["__array_to_list"] = __array_to_list + +__array_to_list.pythonscript_function = true; +window["__array_attrs"]["to_list"] = __array_to_list; +var __array_to_ascii = function(args, kwargs) { +var i, length, arr, string; +var signature, arguments; +signature = {"kwargs": Object(), "args": create_array("self")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +string = ""; +arr = get_attribute(self, "to_array")(create_array(), Object()); +i = 0; +length = get_attribute(arr, "length"); +while(i < length) { +var num = arr[i]; +var char = String.fromCharCode(num); +string += char +i += 1 +} +return string; +} +window["__array_to_ascii"] = __array_to_ascii + +__array_to_ascii.pythonscript_function = true; +window["__array_attrs"]["to_ascii"] = __array_to_ascii; array = create_class("array", window["__array_parents"], window["__array_attrs"]); \ No newline at end of file diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index 6dd3c5c..0eeb6f0 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -620,7 +620,7 @@ def visit_Assign(self, node): if func in self._function_return_types: self._instances[ target.id ] = self._function_return_types[ func ] else: - writer.write('## %s - unknown return type for: %s'(typedef.name, func)) + writer.write('## %s - unknown return type for: %s' % (typedef.name, func)) else: writer.write('## %s - not a method: %s' %(typedef.name, method)) diff --git a/runtime/builtins.py b/runtime/builtins.py index f73475f..038cbaf 100644 --- a/runtime/builtins.py +++ b/runtime/builtins.py @@ -32,6 +32,28 @@ def map(func, objs): out.js_object = map(func, objs.js_object) return out +def min( lst ): + a = None + for value in lst: + if a is None: a = value + elif value < a: a = value + return a + +def max( lst ): + a = None + for value in lst: + if a is None: a = value + elif value > a: a = value + return a + +def abs( num ): + return JS('Math.abs(num)') + +def ord( char ): + return JS('char.charCodeAt(0)') + +def chr( num ): + return JS('String.fromCharCode(num)') class Iterator: @@ -307,6 +329,9 @@ class array: 'L': 4, # unsigned long 'f': 4, # float 'd': 8, # double + 'float32':4, + 'float16':2, + 'float8' :1, } typecode_names = { 'c': 'Int8', @@ -320,7 +345,11 @@ class array: #'l': 'TODO', #'L': 'TODO', 'f': 'Float32', - 'd': 'Float64' + 'd': 'Float64', + + 'float32': 'Float32', + 'float16': 'Int16', + 'float8' : 'Int8' } def __init__(self, typecode, initializer=None, little_endian=False): self.typecode = typecode @@ -330,6 +359,16 @@ def __init__(self, typecode, initializer=None, little_endian=False): if initializer: self.length = len(initializer) self.bytes = self.length * self.itemsize + + if self.typecode == 'float8': + self._scale = max( [abs(min(initializer)), max(initializer)] ) + self._norm_get = self._scale / 127 ## half 8bits-1 + self._norm_set = 1.0 / self._norm_get + elif self.typecode == 'float16': + self._scale = max( [abs(min(initializer)), max(initializer)] ) + self._norm_get = self._scale / 32767 ## half 16bits-1 + self._norm_set = 1.0 / self._norm_get + else: self.length = 0 self.bytes = 0 @@ -352,13 +391,18 @@ def __getitem__(self, index): func = JS('dataview[func_name].bind(dataview)') if offset < self.bytes: - return JS('func(offset)') + value = JS('func(offset)') + if self.typecode == 'float8': + value = value * self._norm_get + elif self.typecode == 'float16': + value = value * self._norm_get + return value else: raise IndexError def __setitem__(self, index, value): step = self.itemsize - if index < 0: index = self.length + index -1 + if index < 0: index = self.length + index -1 ## TODO fixme offset = step * index dataview = self.dataview @@ -366,6 +410,11 @@ def __setitem__(self, index, value): func = JS('dataview[func_name].bind(dataview)') if offset < self.bytes: + if self.typecode == 'float8': + value = value * self._norm_set + elif self.typecode == 'float16': + value = value * self._norm_set + JS('func(offset, value)') else: raise IndexError @@ -379,15 +428,20 @@ def get(self, index): def fromlist(self, lst): length = len(lst) step = self.itemsize + typecode = self.typecode size = length * step - dataview = self.dataview - func_name = 'set'+self.typecode_names[ self.typecode ] + func_name = 'set'+self.typecode_names[ typecode ] func = JS('dataview[func_name].bind(dataview)') if size <= self.bytes: i = 0; offset = 0 while i < length: item = lst[i] + if typecode == 'float8': + item *= self._norm_set + elif typecode == 'float16': + item *= self._norm_set + JS('func(offset,item)') offset += step i += 1 @@ -415,4 +469,30 @@ def append(self, value): def extend(self, lst): ## TODO optimize for value in lst: - self.append( value ) \ No newline at end of file + self.append( value ) + + def to_array(self): + arr = JSArray() + i = 0 + while i < self.length: + item = self[i] + JS('arr.push( item )') + i += 1 + return arr + + def to_list(self): + #return list( js_object=self.to_array() ) ## TODO fixme + lst = list() + lst.js_object = self.to_array() + return lst + + def to_ascii(self): + string = '' + arr = self.to_array() + i = 0; length = arr.length + while i < length: + JS('var num = arr[i]') + JS('var char = String.fromCharCode(num)') + string += char + i += 1 + return string diff --git a/tests/server.py b/tests/server.py index 08a5e96..9280809 100755 --- a/tests/server.py +++ b/tests/server.py @@ -158,11 +158,16 @@ def regenerate_runtime(): b = pythonjs_to_javascript( open(PATHS['runtime_pythonjs'],'rb').read().decode('utf-8'), ) + if not b.strip(): + raise RuntimeError c = python_to_javascript( open(PATHS['runtime_builtins'],'rb').read().decode('utf-8'), dump='/tmp/runtime-builtins.dump.py', global_variable_scope = False ## this should be safe ) + if not c.strip(): + raise RuntimeError + src = '\n'.join( [a,b.strip(),c.strip()] ) file = open( PATHS['runtime'], 'wb') file.write( src.encode('utf-8') ) diff --git a/tests/test_array.html b/tests/test_array.html index e38fa05..50d365d 100644 --- a/tests/test_array.html +++ b/tests/test_array.html @@ -6,7 +6,7 @@ def test(): - global a + global a, b a = array('i', [1,2,3,4] ) print(a.typecode) print(a.buffer) @@ -36,6 +36,27 @@ for value in a: print value + print( '--testing float8--' ) + b = array('float8', [3.14, 100.1, 5.5]) + for value in b: + print value + + print( '--testing float8--' ) + c = array('float8', [0.12345, 0.5554, 0.99998]) + for value in c: + print value + + print( '--testing float8--' ) + d = array('float8', [0.12345, 0.5554, 0.99998, 500.88283, -1001.88716]) + for value in d: + print value + + print( '--testing float16--' ) + e = array('float16', [0.12345, 0.5554, 0.99998, 500.88283, -1001.88716]) + for value in e: + print value + + diff --git a/tests/test_array_advanced.html b/tests/test_array_advanced.html new file mode 100644 index 0000000..f008414 --- /dev/null +++ b/tests/test_array_advanced.html @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file From 7746e0cb85653ac6873ed5c915924d8001fc83ec Mon Sep 17 00:00:00 2001 From: hartsantler Date: Sat, 12 Oct 2013 04:14:06 -0700 Subject: [PATCH 122/860] tested JSArray and JSObject, improved direct calling of JavaScript functions and functions attached to JavaScript instances. --- pythonscript.js | 67 ++++++++++++++++++++++++++++++++++++++- runtime/pythonpythonjs.py | 38 +++++++++++++++++++--- tests/test_JSArray.html | 44 +++++++++++++++++++++++++ tests/test_array.html | 14 ++++---- tests/test_json.html | 31 ++++++++++++++++++ tests/test_min_max.html | 24 ++++++++++++++ 6 files changed, 207 insertions(+), 11 deletions(-) create mode 100644 tests/test_JSArray.html create mode 100644 tests/test_json.html create mode 100644 tests/test_min_max.html diff --git a/pythonscript.js b/pythonscript.js index 3de1647..3c9beb7 100644 --- a/pythonscript.js +++ b/pythonscript.js @@ -1,4 +1,4 @@ -// PythonScript Runtime - regenerated on: Thu Oct 10 18:03:46 2013 +// PythonScript Runtime - regenerated on: Sat Oct 12 04:11:21 2013 var jsrange = function(num) { "Emulates Python's range function"; var i, r; @@ -69,6 +69,7 @@ return object; } window["__call__"] = __call__ +__call__.pythonscript_function = true; klass.__call__ = __call__; return klass; } @@ -146,9 +147,21 @@ return attr; } if(attr) { +if(typeof(attr) === 'function' && attr.pythonscript_function === undefined && attr.is_wrapper === undefined) { +var wrapper = function(args, kwargs) { +return attr.apply(object, args); +} +window["wrapper"] = wrapper + +wrapper.is_wrapper = true; +return wrapper; +} +else { return attr; } +} + var __class__, __dict__, __get__, bases; __class__ = object.__class__; if(__class__) { @@ -289,6 +302,55 @@ i = backup; } +if(object instanceof Array) { +if(attribute == "__getitem__") { +var wrapper = function(args, kwargs) { +return object[args[0]]; +} +window["wrapper"] = wrapper + +wrapper.is_wrapper = true; +return wrapper; +} +else { +if(attribute == "__setitem__") { +var wrapper = function(args, kwargs) { +object[args[0]] = args[1]; +} +window["wrapper"] = wrapper + +wrapper.is_wrapper = true; +return wrapper; +} + +} + +} +else { +if(attribute == "__getitem__") { +var wrapper = function(args, kwargs) { +return object[args[0]]; +} +window["wrapper"] = wrapper + +wrapper.is_wrapper = true; +return wrapper; +} +else { +if(attribute == "__setitem__") { +var wrapper = function(args, kwargs) { +object[args[0]] = args[1]; +} +window["wrapper"] = wrapper + +wrapper.is_wrapper = true; +return wrapper; +} + +} + +} + return undefined; } window["get_attribute"] = get_attribute @@ -343,6 +405,7 @@ object[attribute] = value; } window["set_attribute"] = set_attribute +set_attribute.pythonscript_function = true; var get_arguments = function(signature, args, kwargs) { "Based on ``signature`` and ``args``, ``kwargs`` parameters retrieve\n the actual parameters.\n\n This will set default keyword arguments and retrieve positional arguments\n in kwargs if their called as such"; if(args === undefined) { @@ -424,6 +487,7 @@ return out; } window["get_arguments"] = get_arguments +get_arguments.pythonscript_function = true; var type = function(args, kwargs) { var class_name, parents, attrs; class_name = args[0]; @@ -433,6 +497,7 @@ return create_class(class_name, parents, attrs); } window["type"] = type +type.pythonscript_function = true; var getattr = function(args, kwargs) { var object, attribute; object = args[0]; diff --git a/runtime/pythonpythonjs.py b/runtime/pythonpythonjs.py index ab208f7..acb0684 100644 --- a/runtime/pythonpythonjs.py +++ b/runtime/pythonpythonjs.py @@ -58,6 +58,7 @@ def __call__(): if init: init.apply(None, arguments) return object + __call__.pythonscript_function = True klass.__call__ = __call__ return klass @@ -89,7 +90,6 @@ def get_attribute(object, attribute): if cached: return cached else: - #print 'generating new wrapper' def wrapper(args,kwargs): return object.apply(None, args) wrapper.is_wrapper = True object.cached_wrapper = wrapper @@ -116,7 +116,16 @@ def wrapper(args,kwargs): return attr.apply(object, args) return attr if attr: ## what about cases where attr is zero? - return attr + if JS("typeof(attr) === 'function' && attr.pythonscript_function === undefined && attr.is_wrapper === undefined"): + ## to avoid problems with other generated wrapper funcs not marked with: + ## F.pythonscript_function or F.is_wrapper, we could check if object has these props: + ## bases, __name__, __dict__, __call__ + #print 'wrapping something external', object, attribute + def wrapper(args,kwargs): return attr.apply(object, args) + wrapper.is_wrapper = True + return wrapper + else: + return attr var(__class__, __dict__, __get__, bases) @@ -199,6 +208,26 @@ def method(): return method else: return attr + + if JS('object instanceof Array'): + if attribute == '__getitem__': + def wrapper(args,kwargs): return object[ args[0] ] + wrapper.is_wrapper = True + return wrapper + elif attribute == '__setitem__': + def wrapper(args,kwargs): object[ args[0] ] = args[1] + wrapper.is_wrapper = True + return wrapper + + elif attribute == '__getitem__': ## this should be a JSObject - or anything else - is this always safe? + def wrapper(args,kwargs): return object[ args[0] ] + wrapper.is_wrapper = True + return wrapper + elif attribute == '__setitem__': + def wrapper(args,kwargs): object[ args[0] ] = args[1] + wrapper.is_wrapper = True + return wrapper + return None # XXX: raise AttributeError instead @@ -230,6 +259,7 @@ def set_attribute(object, attribute, value): __dict__[attribute] = value else: object[attribute] = value +set_attribute.pythonscript_function = True def get_arguments(signature, args, kwargs): @@ -281,7 +311,7 @@ def get_arguments(signature, args, kwargs): if signature.varkwarg: out[signature.varkwarg] = kwargs return out - +get_arguments.pythonscript_function = True def type(args, kwargs): var(class_name, parents, attrs) @@ -289,7 +319,7 @@ def type(args, kwargs): parents = args[1] attrs = args[2] return create_class(class_name, parents, attrs) - +type.pythonscript_function = True def getattr(args, kwargs): var(object, attribute) diff --git a/tests/test_JSArray.html b/tests/test_JSArray.html new file mode 100644 index 0000000..f030322 --- /dev/null +++ b/tests/test_JSArray.html @@ -0,0 +1,44 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/tests/test_array.html b/tests/test_array.html index 50d365d..f0e94db 100644 --- a/tests/test_array.html +++ b/tests/test_array.html @@ -47,14 +47,16 @@ print value print( '--testing float8--' ) - d = array('float8', [0.12345, 0.5554, 0.99998, 500.88283, -1001.88716]) - for value in d: - print value + d = array('float8', [-10.0, 3.141592653589793, 10.0]) + print 'error:', d[1] - 3.141592653589793 + + d = array('float8', [-50.0, 3.141592653589793, 50.0]) + print 'error:', d[1] - 3.141592653589793 + print d[1] print( '--testing float16--' ) - e = array('float16', [0.12345, 0.5554, 0.99998, 500.88283, -1001.88716]) - for value in e: - print value + e = array('float16', [-10.0, 3.141592653589793, 10.0]) + print 'error:', e[1] - 3.141592653589793 diff --git a/tests/test_json.html b/tests/test_json.html new file mode 100644 index 0000000..377351f --- /dev/null +++ b/tests/test_json.html @@ -0,0 +1,31 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/tests/test_min_max.html b/tests/test_min_max.html new file mode 100644 index 0000000..33ece8f --- /dev/null +++ b/tests/test_min_max.html @@ -0,0 +1,24 @@ + + + + + + + + + + + \ No newline at end of file From 0d225a2844effd3543b9122ccf6644d83e1250f4 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Sat, 12 Oct 2013 18:02:20 -0700 Subject: [PATCH 123/860] updated README, three.js bindings and test, and tested setInterval. --- README.rst | 59 +++++++++++++++++++++++++++++++---- bindings/three.py | 5 +-- tests/test_setInterval.html | 22 +++++++++++++ tests/threejs_helloworld.html | 2 +- 4 files changed, 79 insertions(+), 9 deletions(-) create mode 100644 tests/test_setInterval.html diff --git a/README.rst b/README.rst index 9051b34..d249700 100644 --- a/README.rst +++ b/README.rst @@ -32,9 +32,10 @@ Demos See also ======== -- `Type Inference ` -- `The Missing Python AST Docs ` +- `Type Inference `_ +- `The Missing Python AST Docs `_ +--------------- Getting Started - Experimental Development Branch --------------- @@ -65,7 +66,7 @@ Test Server (server.py) The test server dynamically compiles PythonScript into JavaScript, this greatly speeds up the testing and development process. Any html file you place in the PythonScript/tests directory will become available as a new web-page. When this web-page is requested the server will parse the html and check all the @@ -73,16 +74,62 @@ External Bindings:: The server knows that the above script needs to be dynamically compiled to JavaScript because the script is located in the "bindings" directory and the file name ends with ".py" -Embedded Python:: +Embedded Python Scripts:: -The server knows that above is an embedded Python script because the in the script tag the type attribute is set to "text/python". The server will compile and replace the Python code with JavaScript, change the type attribute to be "text/javascript", and serve the page to the client. +The server knows that above is an embedded Python script because the script tag has its type attribute set to "text/python". The server will compile and replace the Python code with JavaScript, change the type attribute to be "text/javascript", and serve the page to the client. The syntax "from three import *" tells the compiler to load static type information about the previously compiled binding "three.py" into the compilers namespace, this is required because three.py uses operator overloading to wrap the THREE.js API. PythonScript programs are explicitly and implicitly statically typed to allow for operator overloading and optimizations. +--------------- + +Directly Calling JavaScript Functions +--------------- + +HTML DOM Example:: + + + + + + + + + + + + + +Numbers and strings can be passed directly to JavaScript functions. Simple callbacks that do not take any arguments can also be passed as an argument to a JavaScript function, like window.setInterval. PythonScript allows you to call any JavaScript function directly by wrapping it at runtime. Attributes of JavaScript objects are also returned directly, like document.body. This allows you to use the HTML DOM API just as you would in normal JavaScript. + diff --git a/bindings/three.py b/bindings/three.py index 786f1ba..eb08329 100644 --- a/bindings/three.py +++ b/bindings/three.py @@ -434,9 +434,10 @@ class _Material: class MeshBasicMaterial( _Material ): def __init__(self, color=None, wireframe=False): if not color: color = Color() - elif isinstance(color, dict): + else: #elif isinstance(color, dict): color = Color(red=color['red'], green=color['green'], blue=color['blue']) - self._object = JS('new THREE.MeshBasicMaterial( {color:color, wireframe:wireframe} )') + clr = color._color + self._object = JS('new THREE.MeshBasicMaterial( {color:clr, wireframe:wireframe} )') class CubeGeometry: def __init__(self, width, height, length): diff --git a/tests/test_setInterval.html b/tests/test_setInterval.html new file mode 100644 index 0000000..f2c1c35 --- /dev/null +++ b/tests/test_setInterval.html @@ -0,0 +1,22 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/tests/threejs_helloworld.html b/tests/threejs_helloworld.html index c27e12a..c75edab 100644 --- a/tests/threejs_helloworld.html +++ b/tests/threejs_helloworld.html @@ -26,7 +26,7 @@ div.appendChild( ren.domElement ) geo = CubeGeometry( 10, 10, 10 ) - mat = MeshBasicMaterial() + mat = MeshBasicMaterial( color={'red':0.9, 'green':0.1, 'blue':0.5}, wireframe=False ) mesh = Mesh( geo, mat ) scn.add( mesh ) From efdc18f073e9afc4536f5fbabaf7895275839196 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Sat, 12 Oct 2013 21:18:52 -0700 Subject: [PATCH 124/860] added new "with javascript:" syntax that allows for simple insertion of python-javascript without having to use manuallyJS("...") --- pythonscript/python_to_pythonjs.py | 53 +++++++++++++++++++++++++----- tests/test_with_javascript.html | 26 +++++++++++++++ 2 files changed, 71 insertions(+), 8 deletions(-) create mode 100644 tests/test_with_javascript.html diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index 0eeb6f0..568c819 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -31,7 +31,7 @@ _log_file = None def log(txt): if _log_file: - _log_file.write( txt+'\n' ) + _log_file.write( str(txt)+'\n' ) _log_file.flush() @@ -46,6 +46,7 @@ def __init__(self): self.level = 0 self.buffers = list() self.output = StringIO() + self.with_javascript = False def push(self): self.level += 1 @@ -64,6 +65,7 @@ def write(self, code): def _write(self, code): indentation = self.level * 4 * ' ' + if self.with_javascript: code = """JS('''%s''')"""%code self.output.write('%s%s\n' % (indentation, code)) def getvalue(self): @@ -164,7 +166,7 @@ def __init__(self, module=None, module_path=None): self._return_type = None self._module = module self._module_path = module_path - + self._with_js = False self._typedefs = dict() ## class name : typedef (not pickled) self.setup_builtins() @@ -249,9 +251,16 @@ def visit_Dict(self, node): for i in range( len(node.keys) ): k = self.visit( node.keys[ i ] ) v = self.visit( node.values[i] ) - a.append( 'JSObject(key=%s, value=%s)'%(k,v) ) - b = '[%s]' %', '.join(a) - return 'get_attribute(dict, "__call__")([], JSObject(js_object=%s))' %b + if self._with_js: + a.append( '%s:%s'%(k,v) ) + else: + a.append( 'JSObject(key=%s, value=%s)'%(k,v) ) + if self._with_js: + b = ','.join( a ) + return '{ %s }' %b + else: + b = '[%s]' %', '.join(a) + return 'get_attribute(dict, "__call__")([], JSObject(js_object=%s))' %b def visit_Tuple(self, node): a = '[%s]' % ', '.join(map(self.visit, node.elts)) @@ -259,7 +268,10 @@ def visit_Tuple(self, node): def visit_List(self, node): a = '[%s]' % ', '.join(map(self.visit, node.elts)) - return 'get_attribute(list, "__call__")([], JSObject(js_object=%s))' %a + if self._with_js: + return a + else: + return 'get_attribute(list, "__call__")([], JSObject(js_object=%s))' %a def visit_In(self, node): return ' in ' @@ -475,6 +487,9 @@ def visit_UnaryOp(self, node): def visit_Attribute(self, node): node_value = self.visit(node.value) + + if self._with_js: + return '%s.%s' %(node_value, node.attr) typedef = None if isinstance(node.value, Name): typedef = self.get_typedef( instance=node.value ) @@ -521,6 +536,10 @@ def visit_Index(self, node): def visit_Subscript(self, node): name = self.visit(node.value) + + if self._with_js: + return '%s[ %s ]' %(name, self.visit(node.slice)) + if name in self._instances: ## support x[y] operator overloading klass = self._instances[ name ] if '__getitem__' in self._classes[ klass ]: @@ -543,7 +562,10 @@ def visit_Assign(self, node): # XXX: support only one target for subscripts target = node.targets[0] if isinstance(target, Subscript): - code = "get_attribute(get_attribute(%s, '__setitem__'), '__call__')([%s, %s], JSObject())" + if self._with_js: + code = '%s[ %s ] = %s' + else: + code = "get_attribute(get_attribute(%s, '__setitem__'), '__call__')([%s, %s], JSObject())" code = code % (self.visit(target.value), self.visit(target.slice.value), self.visit(node.value)) writer.write(code) @@ -657,12 +679,20 @@ def visit_Print(self, node): writer.write('print %s' % ', '.join(map(self.visit, node.values))) def visit_Str(self, node): - return '"""%s"""' % node.s + if self._with_js: + return '"%s"' %node.s + else: + return '"""%s"""' % node.s def visit_Expr(self, node): writer.write(self.visit(node.value)) def visit_Call(self, node): + if self._with_js: + args = list( map(self.visit, node.args) ) + a = ','.join(args) + return '%s( %s )' %( self.visit(node.func), a ) + if hasattr(node.func, 'id') and node.func.id in ('JS', 'toString', 'JSObject', 'JSArray', 'var'): args = list( map(self.visit, node.args) ) ## map in py3 returns an iterator not a list if node.func.id == 'var': @@ -849,6 +879,13 @@ def visit_While(self, node): map(self.visit, node.body) writer.pull() + def visit_With(self, node): + if isinstance( node.context_expr, Name ) and node.context_expr.id == 'javascript': + self._with_js = True + writer.with_javascript = True + map(self.visit, node.body) + writer.with_javascript = False + self._with_js = False def main(script): diff --git a/tests/test_with_javascript.html b/tests/test_with_javascript.html new file mode 100644 index 0000000..4e76c07 --- /dev/null +++ b/tests/test_with_javascript.html @@ -0,0 +1,26 @@ + + + + + + + + + + + From 3fc877185614ae721bb10d428467d4a9a4f308b1 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Sun, 13 Oct 2013 06:23:33 -0700 Subject: [PATCH 125/860] improved "with javascript:" now working: while, if/else, and for loops over an array. --- pythonscript/python_to_pythonjs.py | 43 ++++++++++++++++++------------ tests/test_with_javascript.html | 20 ++++++++++++-- 2 files changed, 44 insertions(+), 19 deletions(-) diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index 568c819..e65a116 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -65,7 +65,10 @@ def write(self, code): def _write(self, code): indentation = self.level * 4 * ' ' - if self.with_javascript: code = """JS('''%s''')"""%code + if self.with_javascript: + if not code.endswith(':'): ## will this rule always catch: while, and if/else blocks? + if not code.startswith('print '): + code = """JS('''%s''')"""%code self.output.write('%s%s\n' % (indentation, code)) def getvalue(self): @@ -856,22 +859,28 @@ def visit_FunctionDef(self, node): writer.write('%s = %s(create_array(%s))' % (node.name, self.visit(decorator), node.name)) def visit_For(self, node): - writer.write('var(__iterator__, %s)' % node.target.id) - writer.write('__iterator__ = get_attribute(get_attribute(%s, "__iter__"), "__call__")(JSArray(), JSObject())' % self.visit(node.iter)) - writer.write('try:') - writer.push() - writer.write('%s = get_attribute(__iterator__, "next")(JSArray(), JSObject())' % node.target.id) - writer.write('while True:') - writer.push() - map(self.visit, node.body) - writer.write('%s = get_attribute(__iterator__, "next")(JSArray(), JSObject())' % node.target.id) - writer.pull() - writer.pull() - writer.write('except StopIteration:') - writer.push() - writer.write('pass') - writer.pull() - return '' + if self._with_js: + writer.write('for %s in %s:' %(self.visit(node.target),self.visit(node.iter))) + writer.push() + map(self.visit, node.body) + writer.pull() + else: + writer.write('var(__iterator__, %s)' % node.target.id) + writer.write('__iterator__ = get_attribute(get_attribute(%s, "__iter__"), "__call__")(JSArray(), JSObject())' % self.visit(node.iter)) + writer.write('try:') + writer.push() + writer.write('%s = get_attribute(__iterator__, "next")(JSArray(), JSObject())' % node.target.id) + writer.write('while True:') + writer.push() + map(self.visit, node.body) + writer.write('%s = get_attribute(__iterator__, "next")(JSArray(), JSObject())' % node.target.id) + writer.pull() + writer.pull() + writer.write('except StopIteration:') + writer.push() + writer.write('pass') + writer.pull() + return '' def visit_While(self, node): writer.write('while %s:' % self.visit(node.test)) diff --git a/tests/test_with_javascript.html b/tests/test_with_javascript.html index 4e76c07..4e0bfcf 100644 --- a/tests/test_with_javascript.html +++ b/tests/test_with_javascript.html @@ -14,8 +14,24 @@ arr.push('hello') arr[1] = 'world' ob = { x:'foo', y:'bar'} - console.log( arr ) - console.log( ob ) + print arr + print ob + i = 0 + while i < arr.length: + print 'hi', arr[i] + i += 1 + + if arr[0] == 'hello': + print 'if test passed' + + if arr[0] == 'XXX': + print 'this will not print' + else: + print 'else test passed' + + print 'testing for value in arr...' + for value in arr: + print value From 082c50b9204ca9f1efa781b97554e4f1dcecd032 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Sun, 13 Oct 2013 12:51:43 -0700 Subject: [PATCH 126/860] inject var for locals in "with javascript" blocks --- pythonscript/python_to_pythonjs.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index e65a116..75bf699 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -14,6 +14,7 @@ from ast import BinOp from ast import Pass from ast import Global +from ast import With from ast import parse from ast import NodeVisitor @@ -791,6 +792,11 @@ def visit_FunctionDef(self, node): local_vars.add( n.targets[0].id ) elif isinstance(n, Global): global_vars.update( n.names ) + elif isinstance(n, With) and isinstance( n.context_expr, Name ) and n.context_expr.id == 'javascript': + for c in n.body: + if isinstance(c, Assign) and isinstance(c.targets[0], Name): ## assignment to local + local_vars.add( c.targets[0].id ) + if local_vars-global_vars: a = ','.join( local_vars-global_vars ) writer.write('var(%s)' %a) From b19284865b730f3062712db734765374faccdea4 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Sun, 13 Oct 2013 16:13:52 -0700 Subject: [PATCH 127/860] allow functions in "with javascript:" blocks --- pythonscript/python_to_pythonjs.py | 21 ++++++++++++++++++--- tests/test_with_javascript.html | 9 +++++++++ 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index 75bf699..bff2054 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -778,7 +778,19 @@ def visit_FunctionDef(self, node): decorators.append( decorator ) log('function: %s'%node.name) - writer.write('def %s(args, kwargs):' % node.name) + if self._with_js: + if node.args.defaults: + raise SyntaxError( 'pure javascript functions can not take keyword arguments') + elif node.args.vararg: + raise SyntaxError( 'pure javascript functions can not take variable arguments (*args)' ) + elif node.args.kwarg: + raise SyntaxError( 'pure javascript functions can not take variable keyword arguments (**kwargs)' ) + + args = [ a.id for a in node.args.args ] + writer.write( 'def %s( %s ):' % (node.name, ','.join(args)) ) + + else: + writer.write('def %s(args, kwargs):' % node.name) writer.push() ## the user will almost always want to use Python-style variable scope, @@ -801,7 +813,7 @@ def visit_FunctionDef(self, node): a = ','.join( local_vars-global_vars ) writer.write('var(%s)' %a) - if len(node.args.defaults) or len(node.args.args) or node.args.vararg or node.args.kwarg: + if not self._with_js and (len(node.args.defaults) or len(node.args.args) or node.args.vararg or node.args.kwarg): # new pythonjs' python function arguments handling # create the structure representing the functions arguments # first create the defaultkwargs JSObject @@ -859,7 +871,10 @@ def visit_FunctionDef(self, node): self._function_return_types[ node.name ] = self._return_type writer.pull() - writer.write('%s.pythonscript_function=True'%node.name) + if self._with_js: + writer.write('%s.pythonscript_function=true'%node.name) + else: + writer.write('%s.pythonscript_function=True'%node.name) # apply decorators for decorator in decorators: writer.write('%s = %s(create_array(%s))' % (node.name, self.visit(decorator), node.name)) diff --git a/tests/test_with_javascript.html b/tests/test_with_javascript.html index 4e0bfcf..e2ce2a2 100644 --- a/tests/test_with_javascript.html +++ b/tests/test_with_javascript.html @@ -33,6 +33,15 @@ for value in arr: print value + def myfunc1(): + print 'my function' + myfunc1() + + def myfunc2( arg ): + print arg + myfunc2( 'myfunc2 - hello world') + + From e24c7e90162cadfda4a77254f10ac69b5a993cc5 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Sun, 13 Oct 2013 21:05:03 -0700 Subject: [PATCH 128/860] using "with javascript:" to modify String.prototype to act like Python's str object. --- pythonscript.js | 34 +++++++++++++++++++++++++++++- pythonscript/python_to_pythonjs.py | 9 +++++++- runtime/builtins.py | 25 ++++++++++++++++++---- tests/test_string.html | 27 ++++++++++++++++++++++++ 4 files changed, 89 insertions(+), 6 deletions(-) create mode 100644 tests/test_string.html diff --git a/pythonscript.js b/pythonscript.js index 3c9beb7..c6341ad 100644 --- a/pythonscript.js +++ b/pythonscript.js @@ -1,4 +1,4 @@ -// PythonScript Runtime - regenerated on: Sat Oct 12 04:11:21 2013 +// PythonScript Runtime - regenerated on: Sun Oct 13 21:03:22 2013 var jsrange = function(num) { "Emulates Python's range function"; var i, r; @@ -591,6 +591,38 @@ key = backup; return output; } window["json_to_pythonscript"] = json_to_pythonscript +var _setup_str_prototype = function(args, kwargs) { +var func = function(a) { +if(this.substring(0, a.length) == a) { +return true; +} +else { +return false; +} + +} +window["func"] = func + +func.pythonscript_function=true; +set_attribute(String.prototype, "startswith", func); +var func = function(a) { +if(this.substring(this.length - a.length, this.length) == a) { +return true; +} +else { +return false; +} + +} +window["func"] = func + +func.pythonscript_function=true; +set_attribute(String.prototype, "endswith", func); +} +window["_setup_str_prototype"] = _setup_str_prototype + +_setup_str_prototype.pythonscript_function = true; +_setup_str_prototype(create_array(), Object()); var range = function(args, kwargs) { var i, r; var signature, arguments; diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index bff2054..ecaeae9 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -69,7 +69,8 @@ def _write(self, code): if self.with_javascript: if not code.endswith(':'): ## will this rule always catch: while, and if/else blocks? if not code.startswith('print '): - code = """JS('''%s''')"""%code + if not code.startswith('var('): + code = """JS('''%s''')"""%code self.output.write('%s%s\n' % (indentation, code)) def getvalue(self): @@ -396,6 +397,12 @@ def visit_Pass(self, node): writer.write('pass') def visit_Name(self, node): + if self._with_js: + if node.id == 'True': + return 'true' + elif node.id == 'False': + return 'false' + return node.id def visit_Num(self, node): diff --git a/runtime/builtins.py b/runtime/builtins.py index 038cbaf..9ab49e9 100644 --- a/runtime/builtins.py +++ b/runtime/builtins.py @@ -1,8 +1,25 @@ -from pythonjs import JS -from pythonjs import var -from pythonjs import JSArray -from pythonjs import JSObject +#from pythonjs import JS +#from pythonjs import var +#from pythonjs import JSArray +#from pythonjs import JSObject + +def _setup_str_prototype(): + with javascript: + def func(a): + if this.substring(0, a.length) == a: + return True + else: + return False + String.prototype.startswith = func + + def func(a): + if this.substring(this.length-a.length, this.length) == a: + return True + else: + return False + String.prototype.endswith = func +_setup_str_prototype() def range(num): """Emulates Python's range function""" diff --git a/tests/test_string.html b/tests/test_string.html new file mode 100644 index 0000000..54d4d93 --- /dev/null +++ b/tests/test_string.html @@ -0,0 +1,27 @@ + + + + + + + + + + + \ No newline at end of file From 0c40d75ab9f864c7ef026f6de81f37d20ddebecf Mon Sep 17 00:00:00 2001 From: hartsantler Date: Mon, 14 Oct 2013 00:29:54 -0700 Subject: [PATCH 129/860] abusing @decorator syntax in "with javascript:" for functions that hijack object prototypes and use the special "this" keyword. --- pythonscript.js | 22 +++------------------- pythonscript/python_to_pythonjs.py | 17 +++++++++++++++-- pythonscript/pythonjs.py | 11 ++++++++++- runtime/builtins.py | 6 ++++-- tests/test_string.html | 13 ++++++++++--- tests/threejs_helloworld.html | 2 +- 6 files changed, 43 insertions(+), 28 deletions(-) diff --git a/pythonscript.js b/pythonscript.js index c6341ad..0bdceb1 100644 --- a/pythonscript.js +++ b/pythonscript.js @@ -1,4 +1,4 @@ -// PythonScript Runtime - regenerated on: Sun Oct 13 21:03:22 2013 +// PythonScript Runtime - regenerated on: Mon Oct 14 00:26:47 2013 var jsrange = function(num) { "Emulates Python's range function"; var i, r; @@ -33,7 +33,6 @@ var adapt_arguments = function(handler) { var func = function() { handler(Array.prototype.slice.call(arguments)); } -window["func"] = func return func; } @@ -67,7 +66,6 @@ init.apply(undefined, arguments); return object; } -window["__call__"] = __call__ __call__.pythonscript_function = true; klass.__call__ = __call__; @@ -95,7 +93,6 @@ else { var wrapper = function(args, kwargs) { return object.apply(undefined, args); } -window["wrapper"] = wrapper wrapper.is_wrapper = true; object.cached_wrapper = wrapper; @@ -117,7 +114,6 @@ if(typeof(attr) === 'function') { var wrapper = function(args, kwargs) { return attr.apply(object, args); } -window["wrapper"] = wrapper wrapper.is_wrapper = true; return wrapper; @@ -133,7 +129,6 @@ if(typeof(attr) === 'function') { var wrapper = function(args, kwargs) { return attr.apply(object, args); } -window["wrapper"] = wrapper wrapper.is_wrapper = true; return wrapper; @@ -151,7 +146,6 @@ if(typeof(attr) === 'function' && attr.pythonscript_function === undefined && at var wrapper = function(args, kwargs) { return attr.apply(object, args); } -window["wrapper"] = wrapper wrapper.is_wrapper = true; return wrapper; @@ -253,7 +247,6 @@ args = [object]; return attr.apply(undefined, args); } -window["method"] = method method.is_wrapper = true; return method; @@ -286,7 +279,6 @@ args = [object]; return attr.apply(undefined, args); } -window["method"] = method method.is_wrapper = true; return method; @@ -307,7 +299,6 @@ if(attribute == "__getitem__") { var wrapper = function(args, kwargs) { return object[args[0]]; } -window["wrapper"] = wrapper wrapper.is_wrapper = true; return wrapper; @@ -317,7 +308,6 @@ if(attribute == "__setitem__") { var wrapper = function(args, kwargs) { object[args[0]] = args[1]; } -window["wrapper"] = wrapper wrapper.is_wrapper = true; return wrapper; @@ -331,7 +321,6 @@ if(attribute == "__getitem__") { var wrapper = function(args, kwargs) { return object[args[0]]; } -window["wrapper"] = wrapper wrapper.is_wrapper = true; return wrapper; @@ -341,7 +330,6 @@ if(attribute == "__setitem__") { var wrapper = function(args, kwargs) { object[args[0]] = args[1]; } -window["wrapper"] = wrapper wrapper.is_wrapper = true; return wrapper; @@ -601,10 +589,8 @@ return false; } } -window["func"] = func -func.pythonscript_function=true; -set_attribute(String.prototype, "startswith", func); +String.prototype.startswith=func; var func = function(a) { if(this.substring(this.length - a.length, this.length) == a) { return true; @@ -614,10 +600,8 @@ return false; } } -window["func"] = func -func.pythonscript_function=true; -set_attribute(String.prototype, "endswith", func); +String.prototype.endswith=func; } window["_setup_str_prototype"] = _setup_str_prototype diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index ecaeae9..907d842 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -760,10 +760,13 @@ def visit_Call(self, node): def visit_FunctionDef(self, node): property_decorator = None decorators = [] + with_js_decorators = [] for decorator in reversed(node.decorator_list): log('@decorator: %s' %decorator) + if self._with_js: ## decorators are special in with-js mode + with_js_decorators.append( self.visit( decorator ) ) - if isinstance(decorator, Name) and decorator.id == 'property': + elif isinstance(decorator, Name) and decorator.id == 'property': property_decorator = decorator n = node.name + '__getprop__' self._decorator_properties[ node.original_name ] = dict( get=n, set=None ) @@ -878,12 +881,22 @@ def visit_FunctionDef(self, node): self._function_return_types[ node.name ] = self._return_type writer.pull() - if self._with_js: + if self._with_js and with_js_decorators: + ## these with-js functions are assigned to a some objects prototype, + ## here we assume that they depend on the special "this" variable, + ## therefore this function can not be marked as f.pythonscript_function, + ## because we need get_attribute(f,'__call__') to dynamically bind "this" + for dec in with_js_decorators: + assert '.prototype.' in dec + writer.write( '%s=%s'%(dec,node.name) ) + elif self._with_js: ## this is just an optimization so we can avoid making wrappers at runtime writer.write('%s.pythonscript_function=true'%node.name) else: writer.write('%s.pythonscript_function=True'%node.name) + # apply decorators for decorator in decorators: + assert not self._with_js writer.write('%s = %s(create_array(%s))' % (node.name, self.visit(decorator), node.name)) def visit_For(self, node): diff --git a/pythonscript/pythonjs.py b/pythonscript/pythonjs.py index 51e1fe6..a3301c1 100755 --- a/pythonscript/pythonjs.py +++ b/pythonscript/pythonjs.py @@ -60,6 +60,11 @@ def visit_ExceptHandler(self, node): return out def visit_FunctionDef(self, node): + if not hasattr(self, '_function_stack'): ## track nested functions ## + self._function_stack = [] + + self._function_stack.append( node.name ) + args = self.visit(node.args) buffer = 'var %s = function(%s) {\n' % ( node.name, @@ -81,7 +86,11 @@ def visit_FunctionDef(self, node): body.append(self.visit(child)) buffer += '\n'.join(body) buffer += '\n}\n' - buffer += 'window["%s"] = %s \n' % (node.name, node.name) ## export to global namespace so Closure will not remove them + + if node.name == self._function_stack[0]: ## to be safe do not export nested functions + buffer += 'window["%s"] = %s \n' % (node.name, node.name) ## export to global namespace so Closure will not remove them + + assert node.name == self._function_stack.pop() return buffer def visit_Subscript(self, node): diff --git a/runtime/builtins.py b/runtime/builtins.py index 9ab49e9..71bc6d5 100644 --- a/runtime/builtins.py +++ b/runtime/builtins.py @@ -5,19 +5,21 @@ def _setup_str_prototype(): with javascript: + + @String.prototype.startswith def func(a): if this.substring(0, a.length) == a: return True else: return False - String.prototype.startswith = func + #String.prototype.startswith = func ## the problem with this is "this" gets lost when get_attribute(f,'__call__') is used. + @String.prototype.endswith def func(a): if this.substring(this.length-a.length, this.length) == a: return True else: return False - String.prototype.endswith = func _setup_str_prototype() diff --git a/tests/test_string.html b/tests/test_string.html index 54d4d93..ce63332 100644 --- a/tests/test_string.html +++ b/tests/test_string.html @@ -10,12 +10,19 @@ a = 'hello' b = 'world' print a+b + with javascript: if a.startswith('h'): - print 'startswith test passed' + print 'WITH - startswith test passed' + + if a.endswith('lo'): + print 'WITH - endswith test passed' + + if a.startswith('he'): + print 'startswith test passed' - if a.endswith('h'): - print 'endswith test passed' + if a.endswith('llo'): + print 'endswith test passed' diff --git a/tests/threejs_helloworld.html b/tests/threejs_helloworld.html index c75edab..2071901 100644 --- a/tests/threejs_helloworld.html +++ b/tests/threejs_helloworld.html @@ -26,7 +26,7 @@ div.appendChild( ren.domElement ) geo = CubeGeometry( 10, 10, 10 ) - mat = MeshBasicMaterial( color={'red':0.9, 'green':0.1, 'blue':0.5}, wireframe=False ) + mat = MeshBasicMaterial( color={'red':0.0, 'green':0.9, 'blue':0.1}, wireframe=False ) mesh = Mesh( geo, mat ) scn.add( mesh ) From bb86a85295ee871d0845b21a18cfe102453996e9 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Mon, 14 Oct 2013 02:02:14 -0700 Subject: [PATCH 130/860] added string.join --- pythonscript.js | 30 +++++++++++++++++++++++++++++- pythonscript/pythonjs.py | 13 ++++++++++--- runtime/builtins.py | 16 +++++++++++++++- runtime/pythonpythonjs.py | 4 +++- tests/test_string.html | 14 +++++++++++++- 5 files changed, 70 insertions(+), 7 deletions(-) diff --git a/pythonscript.js b/pythonscript.js index 0bdceb1..25db070 100644 --- a/pythonscript.js +++ b/pythonscript.js @@ -1,4 +1,4 @@ -// PythonScript Runtime - regenerated on: Mon Oct 14 00:26:47 2013 +// PythonScript Runtime - regenerated on: Mon Oct 14 02:00:23 2013 var jsrange = function(num) { "Emulates Python's range function"; var i, r; @@ -602,6 +602,34 @@ return false; } String.prototype.endswith=func; +var func = function(a) { +var i, out; +out = ""; +if(a instanceof Array) { +arr = a; +} +else { +arr = a.__dict__.js_object; +} + +i = 0; +var iter = arr; +for (var value=0; value < iter.length; value++) { +var backup = value; +value = iter[value]; +out += value; +i += 1; +if(i < arr.length) { +out += this; +} + +value = backup; +} + +return out; +} + +String.prototype.join=func; } window["_setup_str_prototype"] = _setup_str_prototype diff --git a/pythonscript/pythonjs.py b/pythonscript/pythonjs.py index a3301c1..57da0cb 100755 --- a/pythonscript/pythonjs.py +++ b/pythonscript/pythonjs.py @@ -128,7 +128,14 @@ def visit_keyword(self, node): def visit_Call(self, node): name = self.visit(node.func) - if name == 'JSObject': + if name == 'instanceof': ## this gets used by "with javascript:" blocks to test if an instance is a JavaScript type + args = map(self.visit, node.args) + if len(args) == 2: + return '%s instanceof %s' %tuple(args) + else: + raise SyntaxError( args ) + + elif name == 'JSObject': if node.keywords: kwargs = map(self.visit, node.keywords) f = lambda x: '"%s": %s' % (x[0], x[1]) @@ -136,11 +143,11 @@ def visit_Call(self, node): return '{%s}' % out else: return 'Object()' - if name == 'var': + elif name == 'var': args = map(self.visit, node.args) out = ', '.join(args) return 'var %s' % out - if name == 'JSArray': + elif name == 'JSArray': if node.args: args = map(self.visit, node.args) out = ', '.join(args) diff --git a/runtime/builtins.py b/runtime/builtins.py index 71bc6d5..c5d510a 100644 --- a/runtime/builtins.py +++ b/runtime/builtins.py @@ -12,7 +12,6 @@ def func(a): return True else: return False - #String.prototype.startswith = func ## the problem with this is "this" gets lost when get_attribute(f,'__call__') is used. @String.prototype.endswith def func(a): @@ -21,6 +20,21 @@ def func(a): else: return False + @String.prototype.join + def func(a): + out = '' + if instanceof(a, Array): + arr = a + else: + arr = a.__dict__.js_object + i = 0 + for value in arr: + out += value + i += 1 + if i < arr.length: + out += this + return out + _setup_str_prototype() def range(num): diff --git a/runtime/pythonpythonjs.py b/runtime/pythonpythonjs.py index acb0684..e17a6b4 100644 --- a/runtime/pythonpythonjs.py +++ b/runtime/pythonpythonjs.py @@ -121,7 +121,9 @@ def wrapper(args,kwargs): return attr.apply(object, args) ## F.pythonscript_function or F.is_wrapper, we could check if object has these props: ## bases, __name__, __dict__, __call__ #print 'wrapping something external', object, attribute - def wrapper(args,kwargs): return attr.apply(object, args) + + def wrapper(args,kwargs): return attr.apply(object, args) ## THIS IS CORRECT + #def wrapper(args,kwargs): return attr.call(object, args) ## this is not correct wrapper.is_wrapper = True return wrapper else: diff --git a/tests/test_string.html b/tests/test_string.html index ce63332..9825b7c 100644 --- a/tests/test_string.html +++ b/tests/test_string.html @@ -6,7 +6,7 @@ def test(): - global a, b + global a, b, c a = 'hello' b = 'world' print a+b @@ -18,6 +18,16 @@ if a.endswith('lo'): print 'WITH - endswith test passed' + + print 'WITH - testing string.join...' + d = ','.join( [1,2,3,4] ) + print( d ) + + print '--testing string.join...' + c = [1,2,3,4,5] + d = ','.join( c ) + print( d ) + if a.startswith('he'): print 'startswith test passed' @@ -25,6 +35,8 @@ print 'endswith test passed' + print 'tests complete' + From f0c46f2ffb55912068748157943d0153b23cd13f Mon Sep 17 00:00:00 2001 From: hartsantler Date: Mon, 14 Oct 2013 07:02:49 -0700 Subject: [PATCH 131/860] improved str implementation using new "with javascript:" style --- pythonscript.js | 181 +++++++++++++++++------------ pythonscript/python_to_pythonjs.py | 3 +- pythonscript/pythonjs.py | 2 +- runtime/builtins.py | 56 +++++++-- tests/test_string.html | 12 +- 5 files changed, 165 insertions(+), 89 deletions(-) diff --git a/pythonscript.js b/pythonscript.js index 25db070..4d9ef81 100644 --- a/pythonscript.js +++ b/pythonscript.js @@ -1,4 +1,4 @@ -// PythonScript Runtime - regenerated on: Mon Oct 14 02:00:23 2013 +// PythonScript Runtime - regenerated on: Mon Oct 14 07:00:04 2013 var jsrange = function(num) { "Emulates Python's range function"; var i, r; @@ -579,7 +579,34 @@ key = backup; return output; } window["json_to_pythonscript"] = json_to_pythonscript +var _create_empty_object = function(arr) { +var o; +o = Object.create( null ); +var iter = arr; +for (var i=0; i < iter.length; i++) { +var backup = i; +i = iter[i]; +o[ i ] = true; +i = backup; +} + +return o; +} +window["_create_empty_object"] = _create_empty_object + +_create_empty_object.pythonscript_function=true; +var str = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": Object(), "args": create_array("s")}; +arguments = get_arguments(signature, args, kwargs); +var s = arguments['s']; +return "" + s; +} +window["str"] = str + +str.pythonscript_function = true; var _setup_str_prototype = function(args, kwargs) { +"\n Extend JavaScript String.prototype with methods that implement the Python str API.\n The decorator @String.prototype.[name] assigns the function to the prototype,\n and ensures that the special 'this' variable will work.\n "; var func = function(a) { if(this.substring(0, a.length) == a) { return true; @@ -630,6 +657,42 @@ return out; } String.prototype.join=func; +var func = function() { +return this.toUpperCase( ); +} + +String.prototype.upper=func; +var func = function() { +return this.toLowerCase( ); +} + +String.prototype.lower=func; +var func = function(a) { +return this.indexOf( a ); +} + +String.prototype.index=func; +var func = function() { +var digits; +digits = _create_empty_object( ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] ); +var iter = this; +for (var char=0; char < iter.length; char++) { +var backup = char; +char = iter[char]; +if(char in digits) { +/*pass*/ +} +else { +return false; +} + +char = backup; +} + +return true; +} + +String.prototype.isdigit=func; } window["_setup_str_prototype"] = _setup_str_prototype @@ -725,7 +788,7 @@ value = get_attribute(__iterator__, "next")(create_array(), Object()); } catch(__exception__) { if (__exception__ == StopIteration || isinstance([__exception__, StopIteration])) { - +/*pass*/ } } @@ -762,7 +825,7 @@ value = get_attribute(__iterator__, "next")(create_array(), Object()); } catch(__exception__) { if (__exception__ == StopIteration || isinstance([__exception__, StopIteration])) { - +/*pass*/ } } @@ -955,7 +1018,7 @@ other = get_attribute(__iterator__, "next")(create_array(), Object()); } catch(__exception__) { if (__exception__ == StopIteration || isinstance([__exception__, StopIteration])) { - +/*pass*/ } } @@ -1066,7 +1129,7 @@ obj = get_attribute(__iterator__, "next")(create_array(), Object()); } catch(__exception__) { if (__exception__ == StopIteration || isinstance([__exception__, StopIteration])) { - +/*pass*/ } } @@ -1162,7 +1225,7 @@ other = get_attribute(__iterator__, "next")(create_array(), Object()); } catch(__exception__) { if (__exception__ == StopIteration || isinstance([__exception__, StopIteration])) { - +/*pass*/ } } @@ -1518,36 +1581,6 @@ window["__dict_values"] = __dict_values __dict_values.pythonscript_function = true; window["__dict_attrs"]["values"] = __dict_values; dict = create_class("dict", window["__dict_parents"], window["__dict_attrs"]); -var str, __str_attrs, __str_parents; -window["__str_attrs"] = Object(); -window["__str_parents"] = create_array(); -var __str___init__ = function(args, kwargs) { -var signature, arguments; -signature = {"kwargs": Object(), "args": create_array("self", "jsstring")}; -arguments = get_arguments(signature, args, kwargs); -var self = arguments['self']; -var jsstring = arguments['jsstring']; -self["__dict__"]["jsstring"] = jsstring; -} -window["__str___init__"] = __str___init__ - -__str___init__.pythonscript_function = true; -window["__str_attrs"]["__init__"] = __str___init__; -var __str___iter__ = function(args, kwargs) { -var signature, arguments; -signature = {"kwargs": Object(), "args": create_array("self")}; -arguments = get_arguments(signature, args, kwargs); -var self = arguments['self']; -var __args_10, __kwargs_10; -__args_10 = create_array(self["__dict__"]["jsstring"], 0); -__kwargs_10 = Object(); -return get_attribute(Iterator, "__call__")(__args_10, __kwargs_10); -} -window["__str___iter__"] = __str___iter__ - -__str___iter__.pythonscript_function = true; -window["__str_attrs"]["__iter__"] = __str___iter__; -str = create_class("str", window["__str_parents"], window["__str_attrs"]); var array, __array_attrs, __array_parents; window["__array_attrs"] = Object(); window["__array_parents"] = create_array(); @@ -1568,43 +1601,43 @@ self["__dict__"]["typecode"] = typecode; self["__dict__"]["itemsize"] = get_attribute(self["__class__"]["__dict__"]["typecodes"], "__getitem__")([typecode], Object()); self["__dict__"]["little_endian"] = little_endian; if(initializer) { +var __args_10, __kwargs_10; +__args_10 = create_array(initializer); +__kwargs_10 = Object(); +self["__dict__"]["length"] = get_attribute(len, "__call__")(__args_10, __kwargs_10); +self["__dict__"]["bytes"] = self["__dict__"]["length"] * self["__dict__"]["itemsize"]; +if(self["__dict__"]["typecode"] == "float8") { var __args_11, __kwargs_11; __args_11 = create_array(initializer); __kwargs_11 = Object(); -self["__dict__"]["length"] = get_attribute(len, "__call__")(__args_11, __kwargs_11); -self["__dict__"]["bytes"] = self["__dict__"]["length"] * self["__dict__"]["itemsize"]; -if(self["__dict__"]["typecode"] == "float8") { var __args_12, __kwargs_12; -__args_12 = create_array(initializer); +__args_12 = create_array(get_attribute(min, "__call__")(__args_11, __kwargs_11)); __kwargs_12 = Object(); var __args_13, __kwargs_13; -__args_13 = create_array(get_attribute(min, "__call__")(__args_12, __kwargs_12)); +__args_13 = create_array(initializer); __kwargs_13 = Object(); var __args_14, __kwargs_14; -__args_14 = create_array(initializer); +__args_14 = create_array(get_attribute(list, "__call__")([], {"js_object": [get_attribute(abs, "__call__")(__args_12, __kwargs_12), get_attribute(max, "__call__")(__args_13, __kwargs_13)]})); __kwargs_14 = Object(); -var __args_15, __kwargs_15; -__args_15 = create_array(get_attribute(list, "__call__")([], {"js_object": [get_attribute(abs, "__call__")(__args_13, __kwargs_13), get_attribute(max, "__call__")(__args_14, __kwargs_14)]})); -__kwargs_15 = Object(); -self["__dict__"]["_scale"] = get_attribute(max, "__call__")(__args_15, __kwargs_15); +self["__dict__"]["_scale"] = get_attribute(max, "__call__")(__args_14, __kwargs_14); self["__dict__"]["_norm_get"] = self["__dict__"]["_scale"] / 127; self["__dict__"]["_norm_set"] = 1.0 / self["__dict__"]["_norm_get"]; } else { if(self["__dict__"]["typecode"] == "float16") { +var __args_15, __kwargs_15; +__args_15 = create_array(initializer); +__kwargs_15 = Object(); var __args_16, __kwargs_16; -__args_16 = create_array(initializer); +__args_16 = create_array(get_attribute(min, "__call__")(__args_15, __kwargs_15)); __kwargs_16 = Object(); var __args_17, __kwargs_17; -__args_17 = create_array(get_attribute(min, "__call__")(__args_16, __kwargs_16)); +__args_17 = create_array(initializer); __kwargs_17 = Object(); var __args_18, __kwargs_18; -__args_18 = create_array(initializer); +__args_18 = create_array(get_attribute(list, "__call__")([], {"js_object": [get_attribute(abs, "__call__")(__args_16, __kwargs_16), get_attribute(max, "__call__")(__args_17, __kwargs_17)]})); __kwargs_18 = Object(); -var __args_19, __kwargs_19; -__args_19 = create_array(get_attribute(list, "__call__")([], {"js_object": [get_attribute(abs, "__call__")(__args_17, __kwargs_17), get_attribute(max, "__call__")(__args_18, __kwargs_18)]})); -__kwargs_19 = Object(); -self["__dict__"]["_scale"] = get_attribute(max, "__call__")(__args_19, __kwargs_19); +self["__dict__"]["_scale"] = get_attribute(max, "__call__")(__args_18, __kwargs_18); self["__dict__"]["_norm_get"] = self["__dict__"]["_scale"] / 32767; self["__dict__"]["_norm_set"] = 1.0 / self["__dict__"]["_norm_get"]; } @@ -1621,10 +1654,10 @@ size = self["__dict__"]["bytes"]; buff = new ArrayBuffer(size); self["__dict__"]["dataview"] = new DataView(buff); self["__dict__"]["buffer"] = buff; -var __args_20, __kwargs_20; -__args_20 = create_array(initializer); -__kwargs_20 = Object(); -get_attribute(get_attribute(self, "fromlist"), "__call__")(__args_20, __kwargs_20); +var __args_19, __kwargs_19; +__args_19 = create_array(initializer); +__kwargs_19 = Object(); +get_attribute(get_attribute(self, "fromlist"), "__call__")(__args_19, __kwargs_19); } window["__array___init__"] = __array___init__ @@ -1720,10 +1753,10 @@ var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; -var __args_21, __kwargs_21; -__args_21 = create_array(self, 0); -__kwargs_21 = Object(); -return get_attribute(Iterator, "__call__")(__args_21, __kwargs_21); +var __args_20, __kwargs_20; +__args_20 = create_array(self, 0); +__kwargs_20 = Object(); +return get_attribute(Iterator, "__call__")(__args_20, __kwargs_20); } window["__array___iter__"] = __array___iter__ @@ -1748,10 +1781,10 @@ signature = {"kwargs": Object(), "args": create_array("self", "lst")}; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var lst = arguments['lst']; -var __args_22, __kwargs_22; -__args_22 = create_array(lst); -__kwargs_22 = Object(); -length = get_attribute(len, "__call__")(__args_22, __kwargs_22); +var __args_21, __kwargs_21; +__args_21 = create_array(lst); +__kwargs_21 = Object(); +length = get_attribute(len, "__call__")(__args_21, __kwargs_21); step = self["__dict__"]["itemsize"]; typecode = self["__dict__"]["typecode"]; size = length * step; @@ -1817,10 +1850,10 @@ arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var value = arguments['value']; length = self["__dict__"]["length"]; -var __args_23, __kwargs_23; -__args_23 = create_array(self["__dict__"]["length"] + 1); -__kwargs_23 = Object(); -get_attribute(get_attribute(self, "resize"), "__call__")(__args_23, __kwargs_23); +var __args_22, __kwargs_22; +__args_22 = create_array(self["__dict__"]["length"] + 1); +__kwargs_22 = Object(); +get_attribute(get_attribute(self, "resize"), "__call__")(__args_22, __kwargs_22); get_attribute(get_attribute(self, "__setitem__"), "__call__")([length, value], Object()); } window["__array_append"] = __array_append @@ -1838,16 +1871,16 @@ __iterator__ = get_attribute(get_attribute(lst, "__iter__"), "__call__")(create_ try { value = get_attribute(__iterator__, "next")(create_array(), Object()); while(true) { -var __args_24, __kwargs_24; -__args_24 = create_array(value); -__kwargs_24 = Object(); -get_attribute(get_attribute(self, "append"), "__call__")(__args_24, __kwargs_24); +var __args_23, __kwargs_23; +__args_23 = create_array(value); +__kwargs_23 = Object(); +get_attribute(get_attribute(self, "append"), "__call__")(__args_23, __kwargs_23); value = get_attribute(__iterator__, "next")(create_array(), Object()); } } catch(__exception__) { if (__exception__ == StopIteration || isinstance([__exception__, StopIteration])) { - +/*pass*/ } } diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index 907d842..7551e8b 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -70,7 +70,8 @@ def _write(self, code): if not code.endswith(':'): ## will this rule always catch: while, and if/else blocks? if not code.startswith('print '): if not code.startswith('var('): - code = """JS('''%s''')"""%code + if not code == 'pass': + code = """JS('''%s''')"""%code self.output.write('%s%s\n' % (indentation, code)) def getvalue(self): diff --git a/pythonscript/pythonjs.py b/pythonscript/pythonjs.py index 57da0cb..b86e2c8 100755 --- a/pythonscript/pythonjs.py +++ b/pythonscript/pythonjs.py @@ -230,7 +230,7 @@ def visit_Return(self, node): return 'return undefined;' def visit_Pass(self, node): - return '' + return '/*pass*/' def visit_Eq(self, node): return '==' diff --git a/runtime/builtins.py b/runtime/builtins.py index c5d510a..85ab7a2 100644 --- a/runtime/builtins.py +++ b/runtime/builtins.py @@ -1,9 +1,20 @@ -#from pythonjs import JS -#from pythonjs import var -#from pythonjs import JSArray -#from pythonjs import JSObject +with javascript: + def _create_empty_object(arr): + o = Object.create(null) + for i in arr: + o[ i ] = True + return o + + +def str(s): + return ''+s def _setup_str_prototype(): + ''' + Extend JavaScript String.prototype with methods that implement the Python str API. + The decorator @String.prototype.[name] assigns the function to the prototype, + and ensures that the special 'this' variable will work. + ''' with javascript: @String.prototype.startswith @@ -35,6 +46,27 @@ def func(a): out += this return out + @String.prototype.upper + def func(): + return this.toUpperCase() + + @String.prototype.lower + def func(): + return this.toLowerCase() + + @String.prototype.index + def func(a): + return this.indexOf(a) + + @String.prototype.isdigit + def func(): + digits = _create_empty_object( ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'] ) + for char in this: + if char in digits: pass + else: return False + return True + + _setup_str_prototype() def range(num): @@ -337,14 +369,14 @@ def values(self): i += 1 return out - -class str: - - def __init__(self, jsstring): - self.jsstring = jsstring - - def __iter__(self): - return Iterator(self.jsstring, 0) +# DEPRECATED - see _setup_str_prototype +#class str: +# +# def __init__(self, jsstring): +# self.jsstring = jsstring +# +# def __iter__(self): +# return Iterator(self.jsstring, 0) class array: diff --git a/tests/test_string.html b/tests/test_string.html index 9825b7c..d587389 100644 --- a/tests/test_string.html +++ b/tests/test_string.html @@ -6,7 +6,7 @@ def test(): - global a, b, c + global a, b, c, d, e, s a = 'hello' b = 'world' print a+b @@ -34,6 +34,16 @@ if a.endswith('llo'): print 'endswith test passed' + print a.upper() + print 'LOWERED'.lower() + print a.index( 'e' ) + print a, '.isdigit->', a.isdigit() + print '100.isdigit->', '100'.isdigit() + + s = str('functional style ok') + print s + e = str( 100 ) + print e print 'tests complete' From 596bb73005566104bc01f644cfd700d829d221e6 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Mon, 14 Oct 2013 23:26:09 -0700 Subject: [PATCH 132/860] updated README, added int and float functions. --- README.rst | 38 ++++++++++++++++++++++++++++++++++++++ pythonscript.js | 34 +++++++++++++++++++++++++++++++++- runtime/builtins.py | 13 +++++++++++++ tests/test_JSObject.html | 24 ++++++++++++++++++++++++ tests/test_int.html | 22 ++++++++++++++++++++++ 5 files changed, 130 insertions(+), 1 deletion(-) create mode 100644 tests/test_JSObject.html create mode 100644 tests/test_int.html diff --git a/README.rst b/README.rst index d249700..056357b 100644 --- a/README.rst +++ b/README.rst @@ -133,3 +133,41 @@ HTML DOM Example:: Numbers and strings can be passed directly to JavaScript functions. Simple callbacks that do not take any arguments can also be passed as an argument to a JavaScript function, like window.setInterval. PythonScript allows you to call any JavaScript function directly by wrapping it at runtime. Attributes of JavaScript objects are also returned directly, like document.body. This allows you to use the HTML DOM API just as you would in normal JavaScript. +--------------- + +Inline JavaScript +--------------- + +There are times that JavaScript needs to be directly inlined into PythonScript code, this is done with the special 'JS([str])' function that takes a string literal as its only argument. The compiler will insert the string directly into the final output JavaScript. + +JS Example:: + JS("var arr = new Array()") + JS("var ob = new Object()") + JS("ob['key'] = 'value'") + if JS("Object.prototype.toString.call( arr ) === '[object Array]'"): + JS("arr.push('hello world')") + JS("arr.push( ob )") + +In the example above we create a new JavaScript Array. The if statement is still Python syntax, but its condition is allowed to be inlined JavaScript. As the compiler becomes smarter and the PythonScript low-level API develops, there will be less need to write inline JavaScript in the above style. Lets take a look at two alternative ways this can be rewritten. + +1. JSArray, JSObject, and instanceof:: + arr = JSArray() + ob = JSObject() + if instanceof(arr, Array): + arr.push('hello world') + arr.push( ob ) + +The special function JSArray will create a new JavaScript Array object, and JSObject creates a new JavaScript Object. The 'instanceof' function will be translated into using the 'instanceof' JavaScript operator. At the end, arr.push is called without wrapping it in JS(), this is allowed because from PythonScript, we can directly call JavaScript functions by dynamically wrapping it at runtime. + +This code is more clear than before, but the downside is that the calls to arr.push will be slower because it gets wrapped at runtime. To have fast and clear code we need to use the final method below, 'with javascript' + +2. with javascript:: + with javascript: + arr = [] + ob = {} + if instanceof(arr, Array): + arr.push('hello world') + arr.push( ob ) + +The "with javascript:" statement can be used to mark a block of code as being direct JavaScript. The compiler will basically wrap each line it can in JS() calls. The calls to arr.push will be fast because there is no longer any runtime wrapping. Instead of using JSArray and JSObject you just use the literal notation to create them. + diff --git a/pythonscript.js b/pythonscript.js index 4d9ef81..e942cef 100644 --- a/pythonscript.js +++ b/pythonscript.js @@ -1,4 +1,4 @@ -// PythonScript Runtime - regenerated on: Mon Oct 14 07:00:04 2013 +// PythonScript Runtime - regenerated on: Mon Oct 14 23:23:48 2013 var jsrange = function(num) { "Emulates Python's range function"; var i, r; @@ -595,6 +595,38 @@ return o; window["_create_empty_object"] = _create_empty_object _create_empty_object.pythonscript_function=true; +var int = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": Object(), "args": create_array("a")}; +arguments = get_arguments(signature, args, kwargs); +var a = arguments['a']; +if(a instanceof String) { +return window.parseInt( a ); +} +else { +return Math.round( a ); +} + +} +window["int"] = int + +int.pythonscript_function = true; +var float = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": Object(), "args": create_array("a")}; +arguments = get_arguments(signature, args, kwargs); +var a = arguments['a']; +if(a instanceof String) { +return window.parseFloat( a ); +} +else { +return a; +} + +} +window["float"] = float + +float.pythonscript_function = true; var str = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("s")}; diff --git a/runtime/builtins.py b/runtime/builtins.py index 85ab7a2..3d6aa8e 100644 --- a/runtime/builtins.py +++ b/runtime/builtins.py @@ -5,6 +5,19 @@ def _create_empty_object(arr): o[ i ] = True return o +def int(a): + with javascript: + if instanceof(a, String): + return window.parseInt(a) + else: + return Math.round(a) + +def float(a): + with javascript: + if instanceof(a, String): + return window.parseFloat(a) + else: + return a def str(s): return ''+s diff --git a/tests/test_JSObject.html b/tests/test_JSObject.html new file mode 100644 index 0000000..4fd4ca1 --- /dev/null +++ b/tests/test_JSObject.html @@ -0,0 +1,24 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/tests/test_int.html b/tests/test_int.html new file mode 100644 index 0000000..f771008 --- /dev/null +++ b/tests/test_int.html @@ -0,0 +1,22 @@ + + + + + + + + + + + \ No newline at end of file From cb46ad42c6157307bdeced27e5fa5c3136d82cb8 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Mon, 14 Oct 2013 23:41:39 -0700 Subject: [PATCH 133/860] fixing formatting in README --- README.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.rst b/README.rst index 056357b..1047278 100644 --- a/README.rst +++ b/README.rst @@ -141,6 +141,7 @@ Inline JavaScript There are times that JavaScript needs to be directly inlined into PythonScript code, this is done with the special 'JS([str])' function that takes a string literal as its only argument. The compiler will insert the string directly into the final output JavaScript. JS Example:: + JS("var arr = new Array()") JS("var ob = new Object()") JS("ob['key'] = 'value'") @@ -151,6 +152,7 @@ JS Example:: In the example above we create a new JavaScript Array. The if statement is still Python syntax, but its condition is allowed to be inlined JavaScript. As the compiler becomes smarter and the PythonScript low-level API develops, there will be less need to write inline JavaScript in the above style. Lets take a look at two alternative ways this can be rewritten. 1. JSArray, JSObject, and instanceof:: + arr = JSArray() ob = JSObject() if instanceof(arr, Array): @@ -162,6 +164,7 @@ The special function JSArray will create a new JavaScript Array object, and JSOb This code is more clear than before, but the downside is that the calls to arr.push will be slower because it gets wrapped at runtime. To have fast and clear code we need to use the final method below, 'with javascript' 2. with javascript:: + with javascript: arr = [] ob = {} From e26d1d6a8d1d107655067a3c38529273f2010c31 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Tue, 15 Oct 2013 19:09:04 -0700 Subject: [PATCH 134/860] fixed calling with keyword arguments that were set as None or zero. --- pythonscript.js | 6 +++--- pythonscript/python_to_pythonjs.py | 3 +++ pythonscript/pythonjs.py | 3 +++ runtime/builtins.py | 2 ++ runtime/pythonpythonjs.py | 5 +++-- tests/test_calling_args_and_kwargs.html | 11 +++++++++-- 6 files changed, 23 insertions(+), 7 deletions(-) diff --git a/pythonscript.js b/pythonscript.js index e942cef..10ffe6f 100644 --- a/pythonscript.js +++ b/pythonscript.js @@ -1,4 +1,4 @@ -// PythonScript Runtime - regenerated on: Mon Oct 14 23:23:48 2013 +// PythonScript Runtime - regenerated on: Tue Oct 15 19:07:52 2013 var jsrange = function(num) { "Emulates Python's range function"; var i, r; @@ -141,7 +141,7 @@ return attr; } -if(attr) { +if(attr !== undefined) { if(typeof(attr) === 'function' && attr.pythonscript_function === undefined && attr.is_wrapper === undefined) { var wrapper = function(args, kwargs) { return attr.apply(object, args); @@ -422,7 +422,7 @@ while(j < argslength) { arg = signature.args[j]; if(kwargs) { kwarg = kwargs[arg]; -if(kwarg) { +if(arg in kwargs) { out[arg] = kwarg; } else { diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index 7551e8b..7ada813 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -494,6 +494,9 @@ def visit_Compare(self, node): def visit_Not(self, node): return ' not ' + def visit_IsNot(self, node): + return ' is not ' + def visit_UnaryOp(self, node): return self.visit(node.op) + self.visit(node.operand) diff --git a/pythonscript/pythonjs.py b/pythonscript/pythonjs.py index b86e2c8..802ecad 100755 --- a/pythonscript/pythonjs.py +++ b/pythonscript/pythonjs.py @@ -253,6 +253,9 @@ def visit_Compare(self, node): def visit_Not(self, node): return '!' + def visit_IsNot(self, node): + return '!==' + def visit_UnaryOp(self, node): return self.visit(node.op) + self.visit(node.operand) diff --git a/runtime/builtins.py b/runtime/builtins.py index 3d6aa8e..7f51619 100644 --- a/runtime/builtins.py +++ b/runtime/builtins.py @@ -1,4 +1,6 @@ + with javascript: + def _create_empty_object(arr): o = Object.create(null) for i in arr: diff --git a/runtime/pythonpythonjs.py b/runtime/pythonpythonjs.py index e17a6b4..9afaeae 100644 --- a/runtime/pythonpythonjs.py +++ b/runtime/pythonpythonjs.py @@ -115,7 +115,7 @@ def wrapper(args,kwargs): return attr.apply(object, args) else: return attr - if attr: ## what about cases where attr is zero? + if attr is not None: ## what about cases where attr is None? if JS("typeof(attr) === 'function' && attr.pythonscript_function === undefined && attr.is_wrapper === undefined"): ## to avoid problems with other generated wrapper funcs not marked with: ## F.pythonscript_function or F.is_wrapper, we could check if object has these props: @@ -289,7 +289,8 @@ def get_arguments(signature, args, kwargs): arg = JS('signature.args[j]') if kwargs: kwarg = kwargs[arg] - if kwarg: + #if kwarg is not None: ## what about cases where the caller wants None + if arg in kwargs: ## TODO, JSObject here should be created with Object.create(null) so that the "in" test will not conflict with internal props like: "constructor", "hasOwnProperty", etc. out[arg] = kwarg elif j < args.length: out[arg] = args[j] diff --git a/tests/test_calling_args_and_kwargs.html b/tests/test_calling_args_and_kwargs.html index f431c62..14523fa 100644 --- a/tests/test_calling_args_and_kwargs.html +++ b/tests/test_calling_args_and_kwargs.html @@ -25,9 +25,16 @@ mixed_args_kwargs(9,9, z=420) test_kwargs(3, 2, 1) + test_kwargs(x=0, y=0, z=None) - test_simple(1,2) - test_simple(1) ## calling with too few args throw a TypeError + a = None + if a is not None: + print 'this should not print' + else: + print 'is not None test ok' + + #test_simple(1,2) + #test_simple(1) ## calling with too few args throw a TypeError From 99da12c0a08e3ec9601f8df533dfbef4c1c2d122 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Wed, 16 Oct 2013 01:27:57 -0700 Subject: [PATCH 135/860] allow instanceof to be called outside of "with javascript", added "new()" so that the "new" js operator can be called from Python, added "a[...]" Ellipsis to have a standard way of wrapping js objects that also will not interfere with user attribute names. updated THREE.js wrapper to use new style. regenerated runtime. --- bindings/three.py | 308 +++++++++--------- pythonscript.js | 9 +- pythonscript/python_to_pythonjs.py | 40 ++- pythonscript/pythonjs.py | 7 + runtime/builtins.py | 3 + tests/helloworld.html | 4 +- tests/test_calling_args_and_kwargs.html | 4 +- tests/test_ellipsis.html | 25 ++ tests/threejs_helloworld.html | 13 +- .../threejs_vector3_operator_overloading.html | 11 +- 10 files changed, 257 insertions(+), 167 deletions(-) create mode 100644 tests/test_ellipsis.html diff --git a/bindings/three.py b/bindings/three.py index eb08329..7225fea 100644 --- a/bindings/three.py +++ b/bindings/three.py @@ -5,84 +5,104 @@ class Color: def __init__(self, red=1.0, green=1.0, blue=1.0, object=None ): if object: - self._color = object + self[...] = object else: - self._color = JS('new THREE.Color()') + with javascript: self[...] = new( THREE.Color() ) self.setRGB(red=red, green=green, blue=blue) def setRGB(self, red=1.0, green=1.0, blue=1.0): - color = self._color - JS('color.setRGB(red, green, blue)') + with javascript: self[...].setRGB(red, green, blue) @property def r(self): - color = self._color - return JS('color.r') + with javascript: return self[...].r @property def g(self): - color = self._color - return JS('color.g') + with javascript: return self[...].g @property def b(self): - color = self._color - return JS('color.b') + with javascript: return self[...].b def clone(self): return Color( red=self.r, green=self.g, blue=self.b ) +class Quaternion: + def __init__(self, object=None ): + if object: + self[...] = object + else: + with javascript: self[...] = new(THREE.Quaternion()) + + @property + def w(self): + with javascript: return self[...].w + @w.setter + def w(self, value): + with javascript: self[...].w = value + + @property + def x(self): + with javascript: return self[...].x + @x.setter + def x(self, value): + with javascript: self[...].x = value + + @property + def y(self): + with javascript: return self[...].y + @y.setter + def y(self, value): + with javascript: self[...].y = value + + @property + def z(self): + with javascript: return self[...].z + @z.setter + def z(self, value): + with javascript: self[...].z = value + class Vector3: def __init__(self, x=0, y=0, z=0, object=None ): if object: - self._vec = object + self[...] = object else: - self._vec = JS('new THREE.Vector3(x,y,z)') + with javascript: self[...] = new(THREE.Vector3(x,y,z)) @property def x(self): - vec = self._vec - return JS('vec.x') + with javascript: return self[...].x @x.setter def x(self, value): - vec = self._vec - JS('vec.x=value') + with javascript: self[...].x = value @property def y(self): - vec = self._vec - return JS('vec.y') + with javascript: return self[...].y @y.setter def y(self, value): - vec = self._vec - JS('vec.y=value') + with javascript: self[...].y = value @property def z(self): - vec = self._vec - return JS('vec.z') + with javascript: return self[...].z @z.setter def z(self, value): - vec = self._vec - JS('vec.z=value') + with javascript: self[...].z = value def setComponent(self, index, value): - vec = self._vec - JS('vec.setComponent(index,value)') + self[...].setComponent(index,value) + def getComponent(self, index): - vec = self._vec - return JS('vec.getComponent(index)') + self[...].getComponent(index) def set(self, x,y,z): - vec = self._vec - JS('vec.set(x,y,z)') + self[...].set(x,y,z) def setX(self, x): - vec = self._vec - JS('vec.setX(x)') + self[...].setX(x) def setY(self, y): - vec = self._vec - JS('vec.setY(y)') + self[...].setY(y) def setZ(self, z): - vec = self._vec - JS('vec.setZ(z)') + self[...].setZ(z) def copy(self, other): assert isinstance(other, Vector3) @@ -91,19 +111,19 @@ def copy(self, other): def add(self, other): assert isinstance(other, Vector3) - #self.x += other.x ## TODO fix inplace property assignment self.set( self.x+other.x, self.y+other.y, self.z+other.z ) return self def __add__(self, other): - if JS("{}.toString.call(other) === '[object Object]'"): + #if JS("{}.toString.call(other) === '[object Object]'"): + if instanceof(other, Object): assert isinstance(other, Vector3) return Vector3( self.x+other.x, self.y+other.y, self.z+other.z ) else: return Vector3( self.x+other, self.y+other, self.z+other ) def __iadd__(self, other): - if JS("{}.toString.call(other) === '[object Object]'"): + if instanceof(other, Object): self.add( other ) else: self.addScalar( other ) @@ -123,14 +143,14 @@ def sub(self, other): return self def __sub__(self, other): - if JS("{}.toString.call(other) === '[object Object]'"): + if instanceof(other, Object): assert isinstance(other, Vector3) return Vector3( self.x-other.x, self.y-other.y, self.z-other.z ) else: return Vector3( self.x-other, self.y-other, self.z-other ) def __isub__(self, other): - if JS("{}.toString.call(other) === '[object Object]'"): + if instanceof(other, Object): self.sub( other ) else: self.set( self.x-other, self.y-other, self.z-other ) @@ -146,14 +166,14 @@ def multiply(self, other): return self def __mul__(self, other): - if JS("{}.toString.call(other) === '[object Object]'"): + if instanceof(other, Object): assert isinstance(other, Vector3) return Vector3( self.x*other.x, self.y*other.y, self.z*other.z ) else: return Vector3( self.x*other, self.y*other, self.z*other ) def __imul__(self, other): - if JS("{}.toString.call(other) === '[object Object]'"): + if instanceof(other, Object): self.multiply( other ) else: self.multiplyScalar( other ) @@ -168,28 +188,23 @@ def multiplyVectors(self, a,b): return self def applyMatrix3(self, m): - vec = self._vec - JS('vec.applyMatrix3(m)') + self[...].applyMatrix3(m[...]) return self def applyMatrix4(self, m): - vec = self._vec - JS('vec.applyMatrix4(m)') + self[...].applyMatrix4(m[...]) return self def applyProjection(self, m): - vec = self._vec - JS('vec.applyProjection(m)') + self[...].applyProjection(m[...]) return self def applyQuaternion(self, q): - vec = self._vec - JS('vec.applyQuaternion(q)') + self[...].applyQuaternion(q[...]) return self def transformDirection(self, m): - vec = self._vec - JS('vec.transformDirection(m)') + self[...].transformDirection(m[...]) return self def divide(self, other): @@ -198,120 +213,97 @@ def divide(self, other): return self def divideScalar(self, s): - vec = self._vec - JS('vec.divideScalar(s)') ## takes care of divide by zero + self[...].divideScalar(s) ## takes care of divide by zero return self def __div__(self, other): - if JS("{}.toString.call(other) === '[object Object]'"): + if instanceof(other, Object): assert isinstance(other, Vector3) return Vector3( self.x/other.x, self.y/other.y, self.z/other.z ) else: return Vector3( self.x/other, self.y/other, self.z/other ) def __idiv__(self, other): - if JS("{}.toString.call(other) === '[object Object]'"): + if instanceof(other, Object): self.divide( other ) else: self.divideScalar( other ) def min(self, s): - vec = self._vec - JS('vec.min(s)') + self[...].min(s) return self def max(self, s): - vec = self._vec - JS('vec.max(s)') + self[...].max(s) return self def clamp(self, s): - vec = self._vec - JS('vec.clamp(s)') + self[...].clamp(s) return self def negate(self): - vec = self._vec - JS('vec.negate()') + self[...].negate() return self def dot(self, v): - vec = self._vec - return JS('vec.dot(v)') + return self[...].dot(v[...]) def lengthSq(self): - vec = self._vec - return JS('vec.lengthSq()') + return self[...].lengthSq() def length(self): - vec = self._vec - return JS('vec.length()') + return self[...].length() def lengthManhattan(self): - vec = self._vec - return JS('vec.lengthManhattan()') + return self[...].lengthManhattan() def normalize(self): - vec = self._vec - JS('vec.normalize()') + self[...].normalize() return self def setLength(self, l): - vec = self._vec - JS('vec.setLength(l)') + self[...].setLength(l) return self def lerp(self, v, alpha): - vec = self._vec - JS('vec.lerp(v, alpha)') + self[...].lerp(v[...], alpha) return self def cross(self, v): ## cross product - vec = self._vec - JS('vec.cross(v)') + self[...].cross(v[...]) return self def crossVectors(self, a,b): - vec = self._vec - JS('vec.crossVectors(a,b)') + self[...].crossVectors(a[...],b[...]) return self def __ixor__(self, other): ## ^= self.cross(other) def angleTo(self, v): - vec = self._vec - return JS('vec.angleTo(v)') + return self[...].angleTo(v[...]) def distanceTo(self, v): - vec = self._vec - return JS('vec.distanceTo(v)') + return self[...].distanceTo(v[...]) def distanceToSquared(self, v): - vec = self._vec - return JS('vec.distanceToSquared(v)') + return self[...].distanceToSquared(v[...]) def getPositionFromMatrix(self, m): - vec = self._vec - JS('vec.getPositionFromMatrix(m)') + self[...].getPositionFromMatrix(m[...]) return self def getScaleFromMatrix(self, m): - vec = self._vec - JS('vec.getScaleFromMatrix(m)') + self[...].getScaleFromMatrix(m[...]) return self def getColumnFromMatrix(self, i, m): - vec = self._vec - JS('vec.getColumnFromMatrix(i,m)') + self[...].getColumnFromMatrix(i,m[...]) return self def equals(self, v): - vec = self._vec - return JS('vec.equals(v)') + return self[...].equals(v[...]) def fromArray(self, a): - vec = self._vec - JS('vec.fromArray(a)') + self[...].fromArray(a) return self def toArray(self): - vec = self._vec - return JS('vec.toArray()') + return self[...].toArray() def clone(self): return Vector3( self.x, self.y, self.z ) @@ -319,107 +311,104 @@ def clone(self): class _ObjectBase: def add(self, child): - ob = self._object - JS('ob.add(child)') + with javascript: + self[...].add( child[...] ) class _Camera( _ObjectBase ): def updateProjectionMatrix(self): - ob = self._object - JS('ob.updateProjectionMatrix()') + with javascript: + self[...].updateProjectionMatrix() class OrthographicCamera( _Camera ): def __init__(self, left, right, top, bottom, near, far): - self._object = JS('new THREE.OrthographicCamera(left, right, top, bottom, near, far)') + #self._object = JS('new THREE.OrthographicCamera(left, right, top, bottom, near, far)') + with javascript: + self[...] = new( THREE.OrthographicCamera(left, right, top, bottom, near, far) ) class PerspectiveCamera( _Camera ): def __init__(self, fov, aspect, near, far): - self._object = JS('new THREE.PerspectiveCamera(fov, aspect, near, far)') + with javascript: + self[...] = new( THREE.PerspectiveCamera(fov, aspect, near, far) ) def setLens(self, focalLength, frameSize): """Uses Focal Length (in mm) to estimate and set FOV * 35mm (fullframe) camera is used if frame size is not specified; * Formula based on http://www.bobatkins.com/photography/technical/field_of_view.html """ - ob = self._object - JS('ob.setLens(focalLength, frameSize)') + self[...].setLens(focalLength, frameSize) def setViewOffset(self, fullWidth, fullHeight, x, y, width, height): ''' Sets an offset in a larger frustum. This is useful for multi-window or multi-monitor/multi-machine setups. ''' - ob = self._object - JS('ob.setViewOffset(fullWidth, fullHeight, x, y, width, height)') + self[...].setViewOffset(fullWidth, fullHeight, x, y, width, height) @property def position(self): - vec = self._object.position + vec = self[...].position return Vector3( object=vec ) - def get_position(self): - vec = self._object.position - return Vector3( object=vec ) class Scene: def __init__(self): - self._scene = JS('new THREE.Scene()') + with javascript: + self[...] = new( THREE.Scene() ) def add(self, child): - scene = self._scene - c = child._object - JS('scene.add(c)') + with javascript: + self[...].add( child[...] ) def updateMatrixWorld(self): - scene = self._scene - JS('scene.updateMatrixWorld()') + with javascript: + self[...].updateMatrixWorld() class _Renderer: def setSize(self, width, height): - renderer = self._renderer - JS('renderer.setSize( width, height )') + with javascript: self[...].setSize( width, height ) def setClearColor(self, red=1.0, green=1.0, blue=1.0, alpha=1.0): - renderer = self._renderer clr = Color( red=red, green=green, blue=blue ) - c = clr._color - JS('renderer.setClearColor( c, alpha)') + with javascript: + self[...].setClearColor( clr[...], alpha) @property def domElement(self): - renderer = self._renderer - return JS('renderer.domElement') + return self[...].domElement def render(self, scn, cam): - renderer = self._renderer - s = scn._scene; c = cam._object - return JS('renderer.render(s, c)') + with javascript: + self[...].render( scn[...], cam[...] ) class CanvasRenderer( _Renderer ): def __init__(self): - self._renderer = JS('new THREE.CanvasRenderer()') + with javascript: + self[...] = new( THREE.CanvasRenderer() ) class CSS3DRenderer( _Renderer ): def __init__(self): - self._renderer = JS('new THREE.CSS3DRenderer()') + with javascript: + self[...] = new( THREE.CSS3DRenderer() ) class WebGLRenderer( _Renderer ): def __init__(self): - self._renderer = JS('new THREE.WebGLRenderer()') + with javascript: + self[...] = new( THREE.WebGLRenderer() ) def getContext(self): - renderer = self._renderer - return JS('renderer.getContext()') + return self[...].getContext() class _ImageUtils: def loadTexture( url ): - return JS('THREE.ImageUtils.loadTexture(url)') + with javascript: + return THREE.ImageUtils.loadTexture(url) def loadTextureCube( urls ): ## TODO THREE.CubeRefractionMapping() @@ -429,38 +418,61 @@ def loadTextureCube( urls ): ImageUtils = _ImageUtils() class _Material: - pass + def __setattr__(self, name, value): + print '__setattr__', name, value + with javascript: + self[...][ name ] = value + + def setValues(self, params): + with javascript: + self[...].setValues( params[...] ) + class MeshBasicMaterial( _Material ): def __init__(self, color=None, wireframe=False): if not color: color = Color() else: #elif isinstance(color, dict): color = Color(red=color['red'], green=color['green'], blue=color['blue']) - clr = color._color - self._object = JS('new THREE.MeshBasicMaterial( {color:clr, wireframe:wireframe} )') + + with javascript: + print 'enter with javascript:' + self[...] = new( THREE.MeshBasicMaterial({color:color[...], wireframe:wireframe}) ) + + @property + def color(self): ## TODO fixme + return Color( object=self[...].color ) + + def get_color(self): + return Color( object=self[...].color ) class CubeGeometry: def __init__(self, width, height, length): - self._object = JS('new THREE.CubeGeometry(width, height, length)') + with javascript: + self[...] = new( THREE.CubeGeometry(width, height, length) ) class Mesh: def __init__(self, geometry, material): - g = geometry._object - m = material._object - self._object = JS('new THREE.Mesh(g,m)') + self.geometry = geometry + self.material = material + with javascript: + self[...] = new( THREE.Mesh(geometry[...], material[...])) @property def position(self): - vec = self._object.position + vec = self[...].position return Vector3( object=vec ) @property def rotation(self): - vec = self._object.rotation + vec = self[...].rotation return Vector3( object=vec ) @property def scale(self): - vec = self._object.scale - return Vector3( object=vec ) \ No newline at end of file + vec = self[...].scale + return Vector3( object=vec ) + + @property + def quaternion(self): + return Quaternion( object=self[...].quaternion ) \ No newline at end of file diff --git a/pythonscript.js b/pythonscript.js index 10ffe6f..99927f1 100644 --- a/pythonscript.js +++ b/pythonscript.js @@ -1,4 +1,4 @@ -// PythonScript Runtime - regenerated on: Tue Oct 15 19:07:52 2013 +// PythonScript Runtime - regenerated on: Tue Oct 15 22:47:06 2013 var jsrange = function(num) { "Emulates Python's range function"; var i, r; @@ -579,6 +579,13 @@ key = backup; return output; } window["json_to_pythonscript"] = json_to_pythonscript +var _JSNew = function(T) { +console.log("_JSNew->", T); +return new T; +} +window["_JSNew"] = _JSNew + +_JSNew.pythonscript_function=true; var _create_empty_object = function(arr) { var o; o = Object.create( null ); diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index 7ada813..a4b171a 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -2,6 +2,7 @@ import os, sys, pickle from types import GeneratorType +import ast from ast import Str from ast import Call from ast import Name @@ -25,7 +26,6 @@ else: from cStringIO import StringIO as StringIO - try: _log_file = open('/tmp/python_to_pythonjs.log', 'wb') except: @@ -41,6 +41,7 @@ def log(txt): GLOBAL_VARIABLE_SCOPE = True log('not using python style variable scope') + class Writer(object): def __init__(self): @@ -72,7 +73,8 @@ def _write(self, code): if not code.startswith('var('): if not code == 'pass': code = """JS('''%s''')"""%code - self.output.write('%s%s\n' % (indentation, code)) + s = '%s%s\n' % (indentation, code) + self.output.write(s.encode('utf-8')) def getvalue(self): s = self.output.getvalue() @@ -552,10 +554,13 @@ def visit_Index(self, node): def visit_Subscript(self, node): name = self.visit(node.value) - if self._with_js: + if isinstance(node.slice, ast.Ellipsis): + return '%s["wrapped"]' %name + + elif self._with_js: return '%s[ %s ]' %(name, self.visit(node.slice)) - if name in self._instances: ## support x[y] operator overloading + elif name in self._instances: ## support x[y] operator overloading klass = self._instances[ name ] if '__getitem__' in self._classes[ klass ]: return '__%s___getitem__( [%s, %s] )' % (klass, name, self.visit(node.slice)) @@ -577,11 +582,15 @@ def visit_Assign(self, node): # XXX: support only one target for subscripts target = node.targets[0] if isinstance(target, Subscript): - if self._with_js: + if isinstance(target.slice, ast.Ellipsis): + code = '%s["wrapped"] = %s' %(self.visit(target.value), self.visit(node.value)) + elif self._with_js: code = '%s[ %s ] = %s' + code = code % (self.visit(target.value), self.visit(target.slice.value), self.visit(node.value)) else: code = "get_attribute(get_attribute(%s, '__setitem__'), '__call__')([%s, %s], JSObject())" - code = code % (self.visit(target.value), self.visit(target.slice.value), self.visit(node.value)) + code = code % (self.visit(target.value), self.visit(target.slice.value), self.visit(node.value)) + writer.write(code) elif isinstance(target, Attribute): @@ -594,8 +603,9 @@ def visit_Assign(self, node): elif hasattr(target.value, 'returns_type'): typedef = self.get_typedef( class_name=target.value.returns_type ) - - if typedef and target.attr in typedef.properties and 'set' in typedef.properties[ target.attr ]: + if self._with_js: + writer.write( '%s.%s=%s' %(target_value, target.attr, self.visit(node.value)) ) + elif typedef and target.attr in typedef.properties and 'set' in typedef.properties[ target.attr ]: setter = typedef.properties[ target.attr ]['set'] writer.write( '%s( [%s, %s] )' %(setter, target_value, self.visit(node.value)) ) elif typedef and target.attr in typedef.class_attributes: @@ -705,10 +715,18 @@ def visit_Expr(self, node): def visit_Call(self, node): if self._with_js: args = list( map(self.visit, node.args) ) - a = ','.join(args) - return '%s( %s )' %( self.visit(node.func), a ) + if isinstance(node.func, Name) and node.func.id == 'new': + assert len(args) == 1 + return ' new %s' %args[0] + + elif isinstance(node.func, Name) and node.func.id == 'JS': ## avoids nested JS + assert len(args) == 1 + return node.args[0].s ## string literal + else: + a = ','.join(args) + return '%s( %s )' %( self.visit(node.func), a ) - if hasattr(node.func, 'id') and node.func.id in ('JS', 'toString', 'JSObject', 'JSArray', 'var'): + if isinstance(node.func, Name) and node.func.id in ('JS', 'toString', 'JSObject', 'JSArray', 'var', 'instanceof'): args = list( map(self.visit, node.args) ) ## map in py3 returns an iterator not a list if node.func.id == 'var': for k in node.keywords: diff --git a/pythonscript/pythonjs.py b/pythonscript/pythonjs.py index 802ecad..e2cd737 100755 --- a/pythonscript/pythonjs.py +++ b/pythonscript/pythonjs.py @@ -135,6 +135,13 @@ def visit_Call(self, node): else: raise SyntaxError( args ) + #elif name == 'new': + # args = map(self.visit, node.args) + # if len(args) == 1: + # return ' new %s' %args[0] + # else: + # raise SyntaxError( args ) + elif name == 'JSObject': if node.keywords: kwargs = map(self.visit, node.keywords) diff --git a/runtime/builtins.py b/runtime/builtins.py index 7f51619..613db56 100644 --- a/runtime/builtins.py +++ b/runtime/builtins.py @@ -1,5 +1,8 @@ with javascript: + def _JSNew(T): + print '_JSNew->', T + return JS("new T") def _create_empty_object(arr): o = Object.create(null) diff --git a/tests/helloworld.html b/tests/helloworld.html index 8a94b12..933d767 100644 --- a/tests/helloworld.html +++ b/tests/helloworld.html @@ -12,8 +12,8 @@ print(a+b) s = '\\n' - #c = s.join( [a,b] ) ## TODO str.join - #print( c ) + c = s.join( [a,b] ) + print( c ) print( a+s+b ) diff --git a/tests/test_calling_args_and_kwargs.html b/tests/test_calling_args_and_kwargs.html index 14523fa..31cd3ff 100644 --- a/tests/test_calling_args_and_kwargs.html +++ b/tests/test_calling_args_and_kwargs.html @@ -33,8 +33,8 @@ else: print 'is not None test ok' - #test_simple(1,2) - #test_simple(1) ## calling with too few args throw a TypeError + test_simple(1,2) + test_simple(1) ## calling with too few args throw a TypeError diff --git a/tests/test_ellipsis.html b/tests/test_ellipsis.html new file mode 100644 index 0000000..219bda4 --- /dev/null +++ b/tests/test_ellipsis.html @@ -0,0 +1,25 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/tests/threejs_helloworld.html b/tests/threejs_helloworld.html index 2071901..7e5bcd6 100644 --- a/tests/threejs_helloworld.html +++ b/tests/threejs_helloworld.html @@ -26,7 +26,9 @@ div.appendChild( ren.domElement ) geo = CubeGeometry( 10, 10, 10 ) - mat = MeshBasicMaterial( color={'red':0.0, 'green':0.9, 'blue':0.1}, wireframe=False ) + print 'geo->', geo + mat = MeshBasicMaterial( color={'red':0.0, 'green':0.0, 'blue':0.0}, wireframe=False ) + print 'mat->', mat mesh = Mesh( geo, mat ) scn.add( mesh ) @@ -36,6 +38,15 @@ requestAnimationFrame( animate ) mesh.rotation.x = mesh.rotation.x + 0.01 mesh.rotation.y = mesh.rotation.y + 0.02 + + #print 'quat.x', mesh.quaternion.x + #print 'quat.y', mesh.quaternion.y + x = mesh.quaternion.x + y = mesh.quaternion.y + z = mesh.quaternion.z + #mesh.material.color.setRGB( x,y,z ) ## TODO make @property work without type system + mesh.material.get_color().setRGB( x,y,z ) + ren.render( scn, cam ) diff --git a/tests/threejs_vector3_operator_overloading.html b/tests/threejs_vector3_operator_overloading.html index 2b79303..ffa05a2 100644 --- a/tests/threejs_vector3_operator_overloading.html +++ b/tests/threejs_vector3_operator_overloading.html @@ -4,7 +4,9 @@ - + + + + + + + + \ No newline at end of file From e80ce2eb12f1fb3820433f176bb8fec2e41caece Mon Sep 17 00:00:00 2001 From: hartsantler Date: Wed, 16 Oct 2013 19:59:56 -0700 Subject: [PATCH 138/860] changed project name to PythonJS in README, changed license to "New BSD". --- COPYING | 504 +--------------------------------------------- README.rst | 26 +-- bindings/three.py | 2 +- setup.py | 4 +- tests/server.py | 7 +- 5 files changed, 28 insertions(+), 515 deletions(-) diff --git a/COPYING b/COPYING index 4362b49..ef6c109 100644 --- a/COPYING +++ b/COPYING @@ -1,502 +1,14 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 +"The New BSD License" - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. +Copyright (c) 2013, Amirouche Boubekki and Brett Hartshorn +All rights reserved. -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Preamble +Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. +Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. +Neither the name of the Amirouche Boubekki or Brett Hartshorn nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/README.rst b/README.rst index 1047278..5598b39 100644 --- a/README.rst +++ b/README.rst @@ -1,14 +1,16 @@ -PythonScript +PythonJS ############ +.. image:: http://3.bp.blogspot.com/-wd0nt-5J3Kg/Ul9RP_zmH5I/AAAAAAAAAd8/LjFdw0riJ0U/s320/pythonjs-v11.png + :dependency: Python 2.7 -:documentaiton: `PythonScript `_ +:documentaiton: `PythonJS `_ :try: `apppyjs `_ Introduction ====== -PythonScript is a Python to Javascript translator written in Python, created by Amirouche Boubekki and Brett Hartshorn. It converts a subset of Python into a subset of Javascript. It features: classes, multiple inheritance, first-class functions, operator overloading, decorators, HTML DOM, and easily integrates with JavaScript and external JavaScript libraries. +PythonJS is a Python to Javascript translator written in Python, created by Amirouche Boubekki and Brett Hartshorn. It converts a subset of Python into a subset of Javascript. It features: classes, multiple inheritance, first-class functions, operator overloading, decorators, HTML DOM, and easily integrates with JavaScript and external JavaScript libraries. Getting Started - Stable Release @@ -42,9 +44,7 @@ Getting Started - Experimental Development Branch Get Source Code:: - git clone https://github.com/hartsantler/PythonScript.git - cd PythonScript - git branch develop + git clone -b develop https://github.com/PythonScript-/PythonJS.git Install Tornado for Python3:: @@ -55,7 +55,7 @@ Install Tornado for Python3:: Run Test Server:: - cd PythonScript/tests + cd PythonJS/tests ./server.py Then open a web browser and go to: http://localhost:8080 @@ -64,7 +64,7 @@ Then open a web browser and go to: http://localhost:8080 Test Server (server.py) ======== -The test server dynamically compiles PythonScript into JavaScript, this greatly speeds up the testing and development process. Any html file you place in the PythonScript/tests directory will become available as a new web-page. When this web-page is requested the server will parse the html and check all the + + + + + + + + \ No newline at end of file diff --git a/tests/test_custom_operators.html b/tests/test_custom_operators.html new file mode 100644 index 0000000..bb8381f --- /dev/null +++ b/tests/test_custom_operators.html @@ -0,0 +1,29 @@ + + + + + + + + + + + \ No newline at end of file From d5608a37dae95f7e8d4a72f6431d8bb780f74421 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Thu, 17 Oct 2013 02:22:04 -0700 Subject: [PATCH 140/860] added support for custom unicode operators --- pythonscript/python_to_pythonjs.py | 30 ++++++++++++++----- pythonscript/pythonjs.py | 6 ++++ tests/test_custom_unicode_operators.html | 37 ++++++++++++++++++++++++ 3 files changed, 65 insertions(+), 8 deletions(-) create mode 100644 tests/test_custom_unicode_operators.html diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index 257c4d0..44b48f0 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -74,7 +74,8 @@ def _write(self, code): if not code == 'pass': code = """JS('''%s''')"""%code s = '%s%s\n' % (indentation, code) - self.output.write(s.encode('utf-8')) + #self.output.write(s.encode('utf-8')) + self.output.write(s) def getvalue(self): s = self.output.getvalue() @@ -190,15 +191,16 @@ def preprocess_custom_operators(self, data): if line.strip().startswith('@custom_operator'): l = line.replace('"', "'") a,b,c = l.split("'") - self._custom_operators[ b ] = None + op = b.decode('utf-8') + self._custom_operators[ op ] = None else: for op in self._custom_operators: - line = line.replace(op, '|u"%s"|'%op) + op = op.encode('utf-8') + line = line.replace(op, '|"%s"|'%op) code.append( line ) data = '\n'.join( code ) - print( data ) return data def setup_builtins(self): @@ -465,8 +467,8 @@ def visit_BinOp(self, node): op,left_operand = self._custom_op_hack right_operand = self.visit(node.right) #return '%s( %s, %s )' %(op, left_operand, right_operand) - if op in self._custom_operators: ## swap name to python function - op = self._custom_operators[ op ] + if op.decode('utf-8') in self._custom_operators: ## swap name to python function + op = self._custom_operators[ op.decode('utf-8') ] return '%s( [%s, %s] )' %(op, left_operand, right_operand) if isinstance(node.left, Name): @@ -529,6 +531,9 @@ def visit_Compare(self, node): comparator = self.visit(node.comparators[0]) return '%s %s %s' % (left, ops, comparator) + def visit_Or(self, node): + return ' or ' + def visit_Not(self, node): return ' not ' @@ -845,8 +850,9 @@ def visit_FunctionDef(self, node): elif isinstance(decorator, Call) and decorator.func.id == 'custom_operator': assert len(decorator.args) == 1 assert isinstance( decorator.args[0], Str ) - op = decorator.args[0].s - assert op in self._custom_operators + op = decorator.args[0].s.decode('utf-8') + if op not in self._custom_operators: + raise RuntimeError( op, self._custom_operators ) self._custom_operators[ op ] = node.name else: @@ -964,6 +970,11 @@ def visit_FunctionDef(self, node): assert not self._with_js writer.write('%s = %s(create_array(%s))' % (node.name, self.visit(decorator), node.name)) + def visit_Continue(self, node): + #return 'continue' + writer.write('continue') + return '' + def visit_For(self, node): if self._with_js: writer.write('for %s in %s:' %(self.visit(node.target),self.visit(node.iter))) @@ -1013,6 +1024,9 @@ def command(): module = module_path = None data = sys.stdin.read() + #data = data.decode('utf-8') + #open('/tmp/testunicode.txt', 'wb').write(data.encode('utf-8')) + if data.startswith('#!'): header = data[ 2 : data.index('\n') ] data = data[ data.index('\n')+1 : ] diff --git a/pythonscript/pythonjs.py b/pythonscript/pythonjs.py index 588b84f..7743b35 100755 --- a/pythonscript/pythonjs.py +++ b/pythonscript/pythonjs.py @@ -269,6 +269,9 @@ def visit_Compare(self, node): comparator = self.visit(node.comparators[0]) return '%s %s %s' % (left, ops, comparator) + def visit_Or(self, node): + return ' || ' + def visit_Not(self, node): return '!' @@ -300,6 +303,9 @@ def visit_For(self, node): for_block = init_iter + 'for (var %s=0; %s < iter.length; %s++) {\n%s}\n' % (target, target, target, body) return for_block + def visit_Continue(self, node): + return 'continue' + def main(script): input = parse(script) diff --git a/tests/test_custom_unicode_operators.html b/tests/test_custom_unicode_operators.html new file mode 100644 index 0000000..be40060 --- /dev/null +++ b/tests/test_custom_unicode_operators.html @@ -0,0 +1,37 @@ + + + + + + + + + + + \ No newline at end of file From 21c9508b20233bae9ee65ec8c82e34cb5560cf54 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Thu, 17 Oct 2013 12:51:11 -0700 Subject: [PATCH 141/860] fixed BoolOp - "if True or True and True:" --- pythonscript/python_to_pythonjs.py | 21 ++++++++++---- pythonscript/pythonjs.py | 14 ++++++++-- tests/test_for_in_list_continue.html | 42 ++++++++++++++++++++++++++++ tests/test_if_and_or.html | 25 +++++++++++++++++ 4 files changed, 94 insertions(+), 8 deletions(-) create mode 100644 tests/test_for_in_list_continue.html create mode 100644 tests/test_if_and_or.html diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index 44b48f0..7cc155c 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -395,6 +395,16 @@ def visit_ClassDef(self, node): writer.write('%s = create_class("%s", window["__%s_parents"], window["__%s_attrs"], window["__%s_properties"])' % (name, name, name, name, name)) + def visit_And(self, node): + return ' and ' + + def visit_Or(self, node): + return ' or ' + + def visit_BoolOp(self, node): + op = self.visit(node.op) + return op.join( [self.visit(v) for v in node.values] ) + def visit_If(self, node): writer.write('if %s:' % self.visit(node.test)) writer.push() @@ -531,9 +541,6 @@ def visit_Compare(self, node): comparator = self.visit(node.comparators[0]) return '%s %s %s' % (left, ops, comparator) - def visit_Or(self, node): - return ' or ' - def visit_Not(self, node): return ' not ' @@ -971,8 +978,11 @@ def visit_FunctionDef(self, node): writer.write('%s = %s(create_array(%s))' % (node.name, self.visit(decorator), node.name)) def visit_Continue(self, node): - #return 'continue' - writer.write('continue') + if self._with_js: + writer.write('continue') + else: + writer.write('%s = get_attribute(__iterator__, "next")(JSArray(), JSObject())' % self._for_iterator_target) + writer.write('continue') return '' def visit_For(self, node): @@ -982,6 +992,7 @@ def visit_For(self, node): map(self.visit, node.body) writer.pull() else: + self._for_iterator_target = node.target.id writer.write('var(__iterator__, %s)' % node.target.id) writer.write('__iterator__ = get_attribute(get_attribute(%s, "__iter__"), "__call__")(JSArray(), JSObject())' % self.visit(node.iter)) writer.write('try:') diff --git a/pythonscript/pythonjs.py b/pythonscript/pythonjs.py index 7743b35..bb218ca 100755 --- a/pythonscript/pythonjs.py +++ b/pythonscript/pythonjs.py @@ -269,9 +269,6 @@ def visit_Compare(self, node): comparator = self.visit(node.comparators[0]) return '%s %s %s' % (left, ops, comparator) - def visit_Or(self, node): - return ' || ' - def visit_Not(self, node): return '!' @@ -281,6 +278,17 @@ def visit_IsNot(self, node): def visit_UnaryOp(self, node): return self.visit(node.op) + self.visit(node.operand) + + def visit_And(self, node): + return ' && ' + + def visit_Or(self, node): + return ' || ' + + def visit_BoolOp(self, node): + op = self.visit(node.op) + return op.join( [self.visit(v) for v in node.values] ) + def visit_If(self, node): test = self.visit(node.test) body = '\n'.join(map(self.visit, node.body)) + '\n' diff --git a/tests/test_for_in_list_continue.html b/tests/test_for_in_list_continue.html new file mode 100644 index 0000000..c6e5169 --- /dev/null +++ b/tests/test_for_in_list_continue.html @@ -0,0 +1,42 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/tests/test_if_and_or.html b/tests/test_if_and_or.html new file mode 100644 index 0000000..8eee717 --- /dev/null +++ b/tests/test_if_and_or.html @@ -0,0 +1,25 @@ + + + + + + + + + + + \ No newline at end of file From bb63dd618fd3331f534b352705cb576031e70274 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Thu, 17 Oct 2013 13:19:24 -0700 Subject: [PATCH 142/860] fixed multiple compare tests: "0 < 10 > -10" --- pythonscript/python_to_pythonjs.py | 9 +++++---- pythonscript/pythonjs.py | 9 +++++---- tests/test_compare.html | 29 +++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 8 deletions(-) create mode 100644 tests/test_compare.html diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index 7cc155c..54c687f 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -536,10 +536,11 @@ def visit_LtE(self, node): return '<=' def visit_Compare(self, node): - left = self.visit(node.left) - ops = self.visit(node.ops[0]) - comparator = self.visit(node.comparators[0]) - return '%s %s %s' % (left, ops, comparator) + comp = [ self.visit(node.left) ] + for i in range( len(node.ops) ): + comp.append( self.visit(node.ops[i]) ) + comp.append( self.visit(node.comparators[i]) ) + return ' '.join( comp ) def visit_Not(self, node): return ' not ' diff --git a/pythonscript/pythonjs.py b/pythonscript/pythonjs.py index bb218ca..98bff0e 100755 --- a/pythonscript/pythonjs.py +++ b/pythonscript/pythonjs.py @@ -264,10 +264,11 @@ def visit_Is(self, node): return '===' def visit_Compare(self, node): - left = self.visit(node.left) - ops = self.visit(node.ops[0]) - comparator = self.visit(node.comparators[0]) - return '%s %s %s' % (left, ops, comparator) + comp = [ self.visit(node.left) ] + for i in range( len(node.ops) ): + comp.append( self.visit(node.ops[i]) ) + comp.append( self.visit(node.comparators[i]) ) + return ' '.join( comp ) def visit_Not(self, node): return '!' diff --git a/tests/test_compare.html b/tests/test_compare.html new file mode 100644 index 0000000..49cea56 --- /dev/null +++ b/tests/test_compare.html @@ -0,0 +1,29 @@ + + + + + + + + + + + \ No newline at end of file From def1204d962ddbed846e157f9f78c2dbe86d1363 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Thu, 17 Oct 2013 16:11:13 -0700 Subject: [PATCH 143/860] fixed "if value in something", added __contains__ method to: tuple, list, and dict --- pythonscript.js | 73 +++++++++++++++++++++++++++++- pythonscript/python_to_pythonjs.py | 21 ++++++--- runtime/builtins.py | 21 +++++++++ tests/test_if_contains.html | 37 +++++++++++++++ 4 files changed, 144 insertions(+), 8 deletions(-) create mode 100644 tests/test_if_contains.html diff --git a/pythonscript.js b/pythonscript.js index 240d533..df899ad 100644 --- a/pythonscript.js +++ b/pythonscript.js @@ -1,4 +1,4 @@ -// PythonScript Runtime - regenerated on: Wed Oct 16 10:03:05 2013 +// PythonScript Runtime - regenerated on: Thu Oct 17 16:09:02 2013 var jsrange = function(num) { "Emulates Python's range function"; var i, r; @@ -755,7 +755,7 @@ var iter = this; for (var char=0; char < iter.length; char++) { var backup = char; char = iter[char]; -if(char in digits) { +if(get_attribute(get_attribute(digits, "__contains__"), "__call__")([char], Object())) { /*pass*/ } else { @@ -1122,6 +1122,29 @@ window["__tuple_get"] = __tuple_get __tuple_get.pythonscript_function = true; window["__tuple_attrs"]["get"] = __tuple_get; +var __tuple___contains__ = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": Object(), "args": create_array("self", "value")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var value = arguments['value']; +var iter = self.__dict__.js_object; +for (var v=0; v < iter.length; v++) { +var backup = v; +v = iter[v]; +if(v == value) { +return true; +} + +v = backup; +} + +return false; +} +window["__tuple___contains__"] = __tuple___contains__ + +__tuple___contains__.pythonscript_function = true; +window["__tuple_attrs"]["__contains__"] = __tuple___contains__; tuple = create_class("tuple", window["__tuple_parents"], window["__tuple_attrs"], window["__tuple_properties"]); var list, __list_attrs, __list_parents; window["__list_attrs"] = Object(); @@ -1419,6 +1442,29 @@ window["__list___len__"] = __list___len__ __list___len__.pythonscript_function = true; window["__list_attrs"]["__len__"] = __list___len__; +var __list___contains__ = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": Object(), "args": create_array("self", "value")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var value = arguments['value']; +var iter = self.__dict__.js_object; +for (var v=0; v < iter.length; v++) { +var backup = v; +v = iter[v]; +if(v == value) { +return true; +} + +v = backup; +} + +return false; +} +window["__list___contains__"] = __list___contains__ + +__list___contains__.pythonscript_function = true; +window["__list_attrs"]["__contains__"] = __list___contains__; list = create_class("list", window["__list_parents"], window["__list_attrs"], window["__list_properties"]); var dict, __dict_attrs, __dict_parents; window["__dict_attrs"] = Object(); @@ -1661,6 +1707,29 @@ window["__dict_values"] = __dict_values __dict_values.pythonscript_function = true; window["__dict_attrs"]["values"] = __dict_values; +var __dict___contains__ = function(args, kwargs) { +var signature, arguments; +signature = {"kwargs": Object(), "args": create_array("self", "value")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var value = arguments['value']; +var iter = Object.keys(self.__dict__.js_object); +for (var v=0; v < iter.length; v++) { +var backup = v; +v = iter[v]; +if(v == value) { +return true; +} + +v = backup; +} + +return false; +} +window["__dict___contains__"] = __dict___contains__ + +__dict___contains__.pythonscript_function = true; +window["__dict_attrs"]["__contains__"] = __dict___contains__; dict = create_class("dict", window["__dict_parents"], window["__dict_attrs"], window["__dict_properties"]); var array, __array_attrs, __array_parents; window["__array_attrs"] = Object(); diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index 54c687f..efb26ff 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -536,10 +536,19 @@ def visit_LtE(self, node): return '<=' def visit_Compare(self, node): - comp = [ self.visit(node.left) ] + left = self.visit(node.left) + comp = [ left ] for i in range( len(node.ops) ): - comp.append( self.visit(node.ops[i]) ) - comp.append( self.visit(node.comparators[i]) ) + if isinstance(node.ops[i], ast.In): + if comp[-1] == left: + comp.pop() + else: + comp.append( ' and ' ) + a = ( self.visit(node.comparators[i]), left ) + comp.append( "get_attribute(get_attribute(%s, '__contains__'), '__call__')([%s], JSObject())" %a ) + else: + comp.append( self.visit(node.ops[i]) ) + comp.append( self.visit(node.comparators[i]) ) return ' '.join( comp ) def visit_Not(self, node): @@ -592,9 +601,9 @@ def visit_Attribute(self, node): return '%s([%s, "%s"])' %(func, node_value, node.attr) else: - return 'get_attribute(%s, "%s")' % (node_value, node.attr) + return 'get_attribute(%s, "%s")' % (node_value, node.attr) ## TODO - double check this else: - return 'get_attribute(%s, "%s")' % (node_value, node.attr) + return 'get_attribute(%s, "%s")' % (node_value, node.attr) ## TODO - double check this def visit_Index(self, node): @@ -624,7 +633,7 @@ def visit_Subscript(self, node): self.visit(node.slice), ) - def visit_Slice(self, node): + def visit_Slice(self, node): ## TODO - test this return "get_attribute(Slice, '__call__')([%s, %s, %s], JSObject())" % (self.visit(node.lower), self.visit(node.upper), self.visit(node.step)) def visit_Assign(self, node): diff --git a/runtime/builtins.py b/runtime/builtins.py index 613db56..2c55c9b 100644 --- a/runtime/builtins.py +++ b/runtime/builtins.py @@ -194,6 +194,14 @@ def get(self, index): ## used by Iterator __array = self.js_object return JS('__array[index]') + def __contains__(self, value): + with javascript: + for v in self.__dict__.js_object: + if v == value: + return True + return False + + class list: def __init__(self, js_object=None): @@ -280,6 +288,12 @@ def __len__(self): __array = self.js_object return JS('__array.length') + def __contains__(self, value): + with javascript: + for v in self.__dict__.js_object: + if v == value: + return True + return False class dict: # http://stackoverflow.com/questions/10892322/javascript-hashtable-use-object-key @@ -387,6 +401,13 @@ def values(self): i += 1 return out + def __contains__(self, value): + with javascript: + for v in Object.keys(self.__dict__.js_object): + if v == value: + return True + return False + # DEPRECATED - see _setup_str_prototype #class str: # diff --git a/tests/test_if_contains.html b/tests/test_if_contains.html new file mode 100644 index 0000000..1396fb1 --- /dev/null +++ b/tests/test_if_contains.html @@ -0,0 +1,37 @@ + + + + + + + + + + + \ No newline at end of file From 5a127008a6fba91fa1d3bd7c6cc4e65e7da7bb1c Mon Sep 17 00:00:00 2001 From: hartsantler Date: Thu, 17 Oct 2013 19:27:47 -0700 Subject: [PATCH 144/860] introduced pythonic style "if in" testing when in "with javascript" mode for JavaScript Array and Object --- pythonscript.js | 88 ++++++++++++++++++++++++------ pythonscript/python_to_pythonjs.py | 9 ++- pythonscript/pythonjs.py | 10 ++++ runtime/builtins.py | 50 ++++++++++++++++- runtime/pythonpythonjs.py | 6 +- tests/test_if_contains.html | 35 +++++++++--- 6 files changed, 170 insertions(+), 28 deletions(-) diff --git a/pythonscript.js b/pythonscript.js index df899ad..67e299e 100644 --- a/pythonscript.js +++ b/pythonscript.js @@ -1,4 +1,4 @@ -// PythonScript Runtime - regenerated on: Thu Oct 17 16:09:02 2013 +// PythonScript Runtime - regenerated on: Thu Oct 17 19:18:22 2013 var jsrange = function(num) { "Emulates Python's range function"; var i, r; @@ -109,6 +109,10 @@ return wrapper; } var attr; +if(attribute == "__contains__") { +attribute = "__CONTAINS__"; +} + attr = object[attribute]; if(object instanceof HTMLDocument) { if(typeof(attr) === 'function') { @@ -142,7 +146,7 @@ return attr; } -if(attr !== undefined) { +if(attribute in object) { if(typeof(attr) === 'function' && attr.pythonscript_function === undefined && attr.is_wrapper === undefined) { var wrapper = function(args, kwargs) { return attr.apply(object, args); @@ -755,7 +759,7 @@ var iter = this; for (var char=0; char < iter.length; char++) { var backup = char; char = iter[char]; -if(get_attribute(get_attribute(digits, "__contains__"), "__call__")([char], Object())) { +if(digits["__contains__"](char)) { /*pass*/ } else { @@ -774,6 +778,42 @@ window["_setup_str_prototype"] = _setup_str_prototype _setup_str_prototype.pythonscript_function = true; _setup_str_prototype(create_array(), Object()); +var _setup_array_prototype = function(args, kwargs) { +var func = function(a) { +var e; +e = _create_empty_object( this ); +if(a in e) { +return true; +} +else { +return false; +} + +} + +Array.prototype.__contains__=func; +} +window["_setup_array_prototype"] = _setup_array_prototype + +_setup_array_prototype.pythonscript_function = true; +_setup_array_prototype(create_array(), Object()); +var _setup_object_prototype = function(args, kwargs) { +var func = function(a) { +if(a in this) { +return true; +} +else { +return false; +} + +} + +Object.prototype.__contains__=func; +} +window["_setup_object_prototype"] = _setup_object_prototype + +_setup_object_prototype.pythonscript_function = true; +_setup_object_prototype(create_array(), Object()); var range = function(args, kwargs) { var i, r; var signature, arguments; @@ -1122,7 +1162,7 @@ window["__tuple_get"] = __tuple_get __tuple_get.pythonscript_function = true; window["__tuple_attrs"]["get"] = __tuple_get; -var __tuple___contains__ = function(args, kwargs) { +var __tuple___CONTAINS__ = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "value")}; arguments = get_arguments(signature, args, kwargs); @@ -1141,10 +1181,10 @@ v = backup; return false; } -window["__tuple___contains__"] = __tuple___contains__ +window["__tuple___CONTAINS__"] = __tuple___CONTAINS__ -__tuple___contains__.pythonscript_function = true; -window["__tuple_attrs"]["__contains__"] = __tuple___contains__; +__tuple___CONTAINS__.pythonscript_function = true; +window["__tuple_attrs"]["__CONTAINS__"] = __tuple___CONTAINS__; tuple = create_class("tuple", window["__tuple_parents"], window["__tuple_attrs"], window["__tuple_properties"]); var list, __list_attrs, __list_parents; window["__list_attrs"] = Object(); @@ -1442,7 +1482,7 @@ window["__list___len__"] = __list___len__ __list___len__.pythonscript_function = true; window["__list_attrs"]["__len__"] = __list___len__; -var __list___contains__ = function(args, kwargs) { +var __list___CONTAINS__ = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "value")}; arguments = get_arguments(signature, args, kwargs); @@ -1461,10 +1501,10 @@ v = backup; return false; } -window["__list___contains__"] = __list___contains__ +window["__list___CONTAINS__"] = __list___CONTAINS__ -__list___contains__.pythonscript_function = true; -window["__list_attrs"]["__contains__"] = __list___contains__; +__list___CONTAINS__.pythonscript_function = true; +window["__list_attrs"]["__CONTAINS__"] = __list___CONTAINS__; list = create_class("list", window["__list_parents"], window["__list_attrs"], window["__list_properties"]); var dict, __dict_attrs, __dict_parents; window["__dict_attrs"] = Object(); @@ -1707,7 +1747,7 @@ window["__dict_values"] = __dict_values __dict_values.pythonscript_function = true; window["__dict_attrs"]["values"] = __dict_values; -var __dict___contains__ = function(args, kwargs) { +var __dict___CONTAINS__ = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "value")}; arguments = get_arguments(signature, args, kwargs); @@ -1726,18 +1766,18 @@ v = backup; return false; } -window["__dict___contains__"] = __dict___contains__ +window["__dict___CONTAINS__"] = __dict___CONTAINS__ -__dict___contains__.pythonscript_function = true; -window["__dict_attrs"]["__contains__"] = __dict___contains__; +__dict___CONTAINS__.pythonscript_function = true; +window["__dict_attrs"]["__CONTAINS__"] = __dict___CONTAINS__; dict = create_class("dict", window["__dict_parents"], window["__dict_attrs"], window["__dict_properties"]); var array, __array_attrs, __array_parents; window["__array_attrs"] = Object(); window["__array_parents"] = create_array(); window["__array_properties"] = Object(); -__array_typecodes = get_attribute(dict, "__call__")([], {"js_object": [{"key": "c", "value": 1}, {"key": "b", "value": 1}, {"key": "B", "value": 1}, {"key": "u", "value": 2}, {"key": "h", "value": 2}, {"key": "H", "value": 2}, {"key": "i", "value": 4}, {"key": "I", "value": 4}, {"key": "l", "value": 4}, {"key": "L", "value": 4}, {"key": "f", "value": 4}, {"key": "d", "value": 8}, {"key": "float32", "value": 4}, {"key": "float16", "value": 2}, {"key": "float8", "value": 1}]}); +__array_typecodes = get_attribute(dict, "__call__")([], {"js_object": [{"key": "c", "value": 1}, {"key": "b", "value": 1}, {"key": "B", "value": 1}, {"key": "u", "value": 2}, {"key": "h", "value": 2}, {"key": "H", "value": 2}, {"key": "i", "value": 4}, {"key": "I", "value": 4}, {"key": "l", "value": 4}, {"key": "L", "value": 4}, {"key": "f", "value": 4}, {"key": "d", "value": 8}, {"key": "float32", "value": 4}, {"key": "float16", "value": 2}, {"key": "float8", "value": 1}, {"key": "int32", "value": 4}, {"key": "uint32", "value": 4}, {"key": "int16", "value": 2}, {"key": "uint16", "value": 2}, {"key": "int8", "value": 1}, {"key": "uint8", "value": 1}]}); window["__array_attrs"]["typecodes"] = __array_typecodes; -__array_typecode_names = get_attribute(dict, "__call__")([], {"js_object": [{"key": "c", "value": "Int8"}, {"key": "b", "value": "Int8"}, {"key": "B", "value": "Uint8"}, {"key": "u", "value": "Uint16"}, {"key": "h", "value": "Int16"}, {"key": "H", "value": "Uint16"}, {"key": "i", "value": "Int32"}, {"key": "I", "value": "Uint32"}, {"key": "f", "value": "Float32"}, {"key": "d", "value": "Float64"}, {"key": "float32", "value": "Float32"}, {"key": "float16", "value": "Int16"}, {"key": "float8", "value": "Int8"}]}); +__array_typecode_names = get_attribute(dict, "__call__")([], {"js_object": [{"key": "c", "value": "Int8"}, {"key": "b", "value": "Int8"}, {"key": "B", "value": "Uint8"}, {"key": "u", "value": "Uint16"}, {"key": "h", "value": "Int16"}, {"key": "H", "value": "Uint16"}, {"key": "i", "value": "Int32"}, {"key": "I", "value": "Uint32"}, {"key": "f", "value": "Float32"}, {"key": "d", "value": "Float64"}, {"key": "float32", "value": "Float32"}, {"key": "float16", "value": "Int16"}, {"key": "float8", "value": "Int8"}, {"key": "int32", "value": "Int32"}, {"key": "uint32", "value": "Uint32"}, {"key": "int16", "value": "Int16"}, {"key": "uint16", "value": "Uint16"}, {"key": "int8", "value": "Int8"}, {"key": "uint8", "value": "Uint8"}]}); window["__array_attrs"]["typecode_names"] = __array_typecode_names; var __array___init__ = function(args, kwargs) { var size, buff; @@ -1825,6 +1865,20 @@ window["__array___len__"] = __array___len__ __array___len__.pythonscript_function = true; window["__array_attrs"]["__len__"] = __array___len__; +var __array___CONTAINS__ = function(args, kwargs) { +var lst; +var signature, arguments; +signature = {"kwargs": Object(), "args": create_array("self", "value")}; +arguments = get_arguments(signature, args, kwargs); +var self = arguments['self']; +var value = arguments['value']; +lst = get_attribute(self, "to_list")(create_array(), Object()); +return get_attribute(get_attribute(lst, "__contains__"), "__call__")([value], Object()); +} +window["__array___CONTAINS__"] = __array___CONTAINS__ + +__array___CONTAINS__.pythonscript_function = true; +window["__array_attrs"]["__CONTAINS__"] = __array___CONTAINS__; var __array___getitem__ = function(args, kwargs) { var func_name, step, dataview, func, offset; var signature, arguments; diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index efb26ff..272e54a 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -362,6 +362,10 @@ def visit_ClassDef(self, node): for item in node.body: if isinstance(item, FunctionDef): log(' method: %s'%item.name) + + if item.name == '__contains__': ## this is required because we added Object.prototype.__contains__ + item.name = item.name.upper() + self._classes[ name ].append( item.name ) item_name = item.name item.original_name = item.name @@ -545,7 +549,10 @@ def visit_Compare(self, node): else: comp.append( ' and ' ) a = ( self.visit(node.comparators[i]), left ) - comp.append( "get_attribute(get_attribute(%s, '__contains__'), '__call__')([%s], JSObject())" %a ) + if self._with_js: + comp.append( "%s['__contains__'](%s)" %a ) + else: + comp.append( "get_attribute(get_attribute(%s, '__contains__'), '__call__')([%s], JSObject())" %a ) else: comp.append( self.visit(node.ops[i]) ) comp.append( self.visit(node.comparators[i]) ) diff --git a/pythonscript/pythonjs.py b/pythonscript/pythonjs.py index 98bff0e..3ab0e7d 100755 --- a/pythonscript/pythonjs.py +++ b/pythonscript/pythonjs.py @@ -298,6 +298,16 @@ def visit_If(self, node): return 'if(%s) {\n%s}\nelse {\n%s}\n' % (test, body, orelse) return 'if(%s) {\n%s}\n' % (test, body) + def visit_Dict(self, node): + a = [] + for i in range( len(node.keys) ): + k = self.visit( node.keys[ i ] ) + v = self.visit( node.values[i] ) + a.append( '%s:%s'%(k,v) ) + b = ','.join( a ) + return '{ %s }' %b + + def visit_For(self, node): target = node.target.id iter = self.visit(node.iter) diff --git a/runtime/builtins.py b/runtime/builtins.py index 2c55c9b..ea0e5db 100644 --- a/runtime/builtins.py +++ b/runtime/builtins.py @@ -84,9 +84,36 @@ def func(): else: return False return True - _setup_str_prototype() +def _setup_array_prototype(): + + with javascript: + + @Array.prototype.__contains__ + def func(a): + e = _create_empty_object( this ) + if JS("a in e"): ## JS() so that we don't call __contains__ again + return True + else: + return False + +_setup_array_prototype() + +def _setup_object_prototype(): + + with javascript: + + @Object.prototype.__contains__ + def func(a): + if JS("a in this"): ## JS() so that we don't call __contains__ again + return True + else: + return False + +_setup_object_prototype() + + def range(num): """Emulates Python's range function""" var(i, r) @@ -436,6 +463,13 @@ class array: 'float32':4, 'float16':2, 'float8' :1, + + 'int32' :4, + 'uint32' :4, + 'int16' :2, + 'uint16' :2, + 'int8' :1, + 'uint8' :1, } typecode_names = { 'c': 'Int8', @@ -453,7 +487,15 @@ class array: 'float32': 'Float32', 'float16': 'Int16', - 'float8' : 'Int8' + 'float8' : 'Int8', + + 'int32' : 'Int32', + 'uint32' : 'Uint32', + 'int16' : 'Int16', + 'uint16' : 'Uint16', + 'int8' : 'Int8', + 'uint8' : 'Uint8', + } def __init__(self, typecode, initializer=None, little_endian=False): self.typecode = typecode @@ -486,6 +528,10 @@ def __init__(self, typecode, initializer=None, little_endian=False): def __len__(self): return self.length + def __contains__(self, value): + lst = self.to_list() + return value in lst + def __getitem__(self, index): step = self.itemsize offset = step * index diff --git a/runtime/pythonpythonjs.py b/runtime/pythonpythonjs.py index 0369a49..993c029 100644 --- a/runtime/pythonpythonjs.py +++ b/runtime/pythonpythonjs.py @@ -97,6 +97,9 @@ def wrapper(args,kwargs): return object.apply(None, args) return wrapper var(attr) + if attribute == '__contains__': + attribute = '__CONTAINS__' ## we need this ugly hack because we have added javascript Object.prototype.__contains__ + attr = object[attribute] if JS("object instanceof HTMLDocument"): @@ -116,7 +119,8 @@ def wrapper(args,kwargs): return attr.apply(object, args) else: return attr - if attr is not None: ## what about cases where attr is None? + #if attr is not None: ## what about cases where attr is None? + if attribute in object: if JS("typeof(attr) === 'function' && attr.pythonscript_function === undefined && attr.is_wrapper === undefined"): ## to avoid problems with other generated wrapper funcs not marked with: ## F.pythonscript_function or F.is_wrapper, we could check if object has these props: diff --git a/tests/test_if_contains.html b/tests/test_if_contains.html index 1396fb1..5d86a91 100644 --- a/tests/test_if_contains.html +++ b/tests/test_if_contains.html @@ -14,17 +14,38 @@ if name in self.__dict__: return True +class B: + pass + def test(): print 'testing dict' - if 1 in {1:True}: print 'in dict ok' + if 1 in {1:True}: print 'in dict OK' print 'testing tuple' - if 1 in (1,2,3): print 'in tuple ok' + if 1 in (1,2,3): print 'in tuple OK' print 'testing list' - if 1 in [1,2,3]: print 'in list ok' - - #with javascript: - # if 1 in [1,2,3]: print 'in javascript this will not work' ## TODO, should we make this work? - # if 1 in {1:True}: print 'in javascript-object ok' + if 1 in [1,2,3]: print 'in list OK' + print 'testing int32 array' + if 1 in array('int32', [1,2,3,4]): print 'in array OK' + print 'testing overloaded custom class A' + a = A() + if 'x' in a: print 'instance of overloaded A OK' + + with javascript: + print 'testing in Array' + arr = [1,2,3] + jsob = {1:True} + if 1 in arr: print 'in Array ok' + if 1 in jsob: print 'in javascript-object ok' + + if 1 in [1,2]: print 'in literal Array ok' + if 'xx' in {xx:True}: print 'in literal jsobject ok' + + b = B() + #if '__name__' in b: print 'this will throw an error because B is lacking a __contains__ method' + with javascript: + if '__class__' in b: + print 'this is allowed because we are within-javascript where the rules are slightly different' + print 'class name of instance b:', b['__class__']['__name__'] print 'test complete' From 74a03460d9bead2fb1a136322bfb28a42f10893d Mon Sep 17 00:00:00 2001 From: hartsantler Date: Fri, 18 Oct 2013 00:24:22 -0700 Subject: [PATCH 145/860] list comprehensions --- README.rst | 2 +- pythonscript.js | 19 ++++++++++++-- pythonscript/python_to_pythonjs.py | 40 ++++++++++++++++++++++++++++++ runtime/builtins.py | 12 +++++++++ runtime/pythonpythonjs.py | 4 +-- tests/test_list_comprehension.html | 37 +++++++++++++++++++++++++++ 6 files changed, 109 insertions(+), 5 deletions(-) create mode 100644 tests/test_list_comprehension.html diff --git a/README.rst b/README.rst index 5598b39..edc7711 100644 --- a/README.rst +++ b/README.rst @@ -10,7 +10,7 @@ PythonJS Introduction ====== -PythonJS is a Python to Javascript translator written in Python, created by Amirouche Boubekki and Brett Hartshorn. It converts a subset of Python into a subset of Javascript. It features: classes, multiple inheritance, first-class functions, operator overloading, decorators, HTML DOM, and easily integrates with JavaScript and external JavaScript libraries. +PythonJS is a Python to Javascript translator written in Python, created by Amirouche Boubekki and Brett Hartshorn. It converts a subset of Python into a subset of Javascript. It features: list comprehensions, classes, multiple inheritance, first-class functions, operator overloading, decorators, HTML DOM, and easily integrates with JavaScript and external JavaScript libraries. Getting Started - Stable Release diff --git a/pythonscript.js b/pythonscript.js index 67e299e..a630935 100644 --- a/pythonscript.js +++ b/pythonscript.js @@ -1,4 +1,4 @@ -// PythonScript Runtime - regenerated on: Thu Oct 17 19:18:22 2013 +// PythonScript Runtime - regenerated on: Fri Oct 18 00:14:12 2013 var jsrange = function(num) { "Emulates Python's range function"; var i, r; @@ -146,7 +146,7 @@ return attr; } -if(attribute in object) { +if(attr !== undefined) { if(typeof(attr) === 'function' && attr.pythonscript_function === undefined && attr.is_wrapper === undefined) { var wrapper = function(args, kwargs) { return attr.apply(object, args); @@ -687,6 +687,16 @@ window["str"] = str str.pythonscript_function = true; var _setup_str_prototype = function(args, kwargs) { "\n Extend JavaScript String.prototype with methods that implement the Python str API.\n The decorator @String.prototype.[name] assigns the function to the prototype,\n and ensures that the special 'this' variable will work.\n "; +var func = function(idx) { +return this[ idx ]; +} + +String.prototype.__getitem__=func; +var func = function() { +return this.length; +} + +String.prototype.__len__=func; var func = function(a) { if(this.substring(0, a.length) == a) { return true; @@ -792,6 +802,11 @@ return false; } Array.prototype.__contains__=func; +var func = function() { +return this.length; +} + +Array.prototype.__len__=func; } window["_setup_array_prototype"] = _setup_array_prototype diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index 272e54a..f8b41ce 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -306,6 +306,46 @@ def visit_List(self, node): else: return 'get_attribute(list, "__call__")([], JSObject(js_object=%s))' %a + def visit_ListComp(self, node): + writer.write('var(__comprehension__)') + writer.write('__comprehension__ = JSArray()') + + length = len( node.generators ) + a = ['idx%s'%i for i in range(length)] + writer.write('var( %s )' %','.join(a) ) + a = ['iter%s'%i for i in range(length)] + writer.write('var( %s )' %','.join(a) ) + a = ['get%s'%i for i in range(length)] + writer.write('var( %s )' %','.join(a) ) + + generators = list( node.generators ) + self._gen_comp( generators, node ) + + return 'get_attribute(list, "__call__")([], JSObject(js_object=__comprehension__))' + + + def _gen_comp(self, generators, node): + gen = generators.pop() + if len(gen.ifs): raise NotImplementedError ## TODO + id = len(generators) + assert isinstance(gen.target, Name) + writer.write('idx%s = 0'%id) + writer.write('iter%s = %s' %(id, self.visit(gen.iter)) ) + writer.write('get%s = get_attribute(iter%s, "__getitem__")'%(id,id) ) + writer.write('while idx%s < get_attribute(len, "__call__")([iter%s], JSObject()):' %(id,id) ) + writer.push() + + writer.write('var(%s)'%gen.target.id) + writer.write('%s=get%s( [idx%s], JSObject() )' %(gen.target.id, id,id) ) + + if generators: + self._gen_comp( generators, node ) + else: + writer.write('__comprehension__.push( %s )' %self.visit(node.elt) ) + + writer.write('idx%s+=1' %id ) + writer.pull() + def visit_In(self, node): return ' in ' diff --git a/runtime/builtins.py b/runtime/builtins.py index ea0e5db..6a6d851 100644 --- a/runtime/builtins.py +++ b/runtime/builtins.py @@ -35,6 +35,14 @@ def _setup_str_prototype(): ''' with javascript: + @String.prototype.__getitem__ + def func(idx): + return this[ idx ] + + @String.prototype.__len__ + def func(): + return this.length + @String.prototype.startswith def func(a): if this.substring(0, a.length) == a: @@ -98,6 +106,10 @@ def func(a): else: return False + @Array.prototype.__len__ + def func(): + return this.length + _setup_array_prototype() def _setup_object_prototype(): diff --git a/runtime/pythonpythonjs.py b/runtime/pythonpythonjs.py index 993c029..6ee38a0 100644 --- a/runtime/pythonpythonjs.py +++ b/runtime/pythonpythonjs.py @@ -119,8 +119,8 @@ def wrapper(args,kwargs): return attr.apply(object, args) else: return attr - #if attr is not None: ## what about cases where attr is None? - if attribute in object: + #if attribute in object: ## in test not allowed with javascript-string + if attr is not None: ## what about cases where attr is None? if JS("typeof(attr) === 'function' && attr.pythonscript_function === undefined && attr.is_wrapper === undefined"): ## to avoid problems with other generated wrapper funcs not marked with: ## F.pythonscript_function or F.is_wrapper, we could check if object has these props: diff --git a/tests/test_list_comprehension.html b/tests/test_list_comprehension.html new file mode 100644 index 0000000..1177fdf --- /dev/null +++ b/tests/test_list_comprehension.html @@ -0,0 +1,37 @@ + + + + + + + + + + + \ No newline at end of file From 0096924e61b34073afc335370007f7668ec23d6e Mon Sep 17 00:00:00 2001 From: hartsantler Date: Fri, 18 Oct 2013 01:23:41 -0700 Subject: [PATCH 146/860] fixed calling functions with variable number of arguments, *args. --- pythonscript.js | 10 ++++- runtime/pythonpythonjs.py | 7 +++- tests/test_calling_variable_kwargs.html | 49 +++++++++++++++++++++++++ 3 files changed, 62 insertions(+), 4 deletions(-) create mode 100644 tests/test_calling_variable_kwargs.html diff --git a/pythonscript.js b/pythonscript.js index a630935..02bcdd7 100644 --- a/pythonscript.js +++ b/pythonscript.js @@ -1,4 +1,4 @@ -// PythonScript Runtime - regenerated on: Fri Oct 18 00:14:12 2013 +// PythonScript Runtime - regenerated on: Fri Oct 18 01:22:00 2013 var jsrange = function(num) { "Emulates Python's range function"; var i, r; @@ -454,8 +454,14 @@ argslength = 0; } if(args.length > signature.args.length) { +if(signature.vararg) { +/*pass*/ +} +else { console.log("ERROR args:", args, "kwargs:", kwargs, "sig:", signature); -throw TypeError("function called with wrong number of arguments"); +throw TypeError("function called with too many arguments"); +} + } j = 0; diff --git a/runtime/pythonpythonjs.py b/runtime/pythonpythonjs.py index 6ee38a0..0748542 100644 --- a/runtime/pythonpythonjs.py +++ b/runtime/pythonpythonjs.py @@ -310,8 +310,11 @@ def get_arguments(signature, args, kwargs): argslength = 0 if args.length > signature.args.length: - print 'ERROR args:', args, 'kwargs:', kwargs, 'sig:', signature - raise TypeError('function called with wrong number of arguments') + if signature.vararg: + pass + else: + print 'ERROR args:', args, 'kwargs:', kwargs, 'sig:', signature + raise TypeError('function called with too many arguments') j = 0 while j < argslength: diff --git a/tests/test_calling_variable_kwargs.html b/tests/test_calling_variable_kwargs.html new file mode 100644 index 0000000..f484057 --- /dev/null +++ b/tests/test_calling_variable_kwargs.html @@ -0,0 +1,49 @@ + + + + + + + + + + + \ No newline at end of file From 866b199b0be7115bd5f3266dec47b29b0d886361 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Fri, 18 Oct 2013 01:57:01 -0700 Subject: [PATCH 147/860] updated THREE.js wrapper to use **kwargs to initialize a Material --- bindings/three.py | 21 ++++++++++++++------- pythonscript.js | 5 ++++- runtime/builtins.py | 4 ++++ tests/threejs_helloworld.html | 2 +- 4 files changed, 23 insertions(+), 9 deletions(-) diff --git a/bindings/three.py b/bindings/three.py index 6c143f0..3ec73b4 100644 --- a/bindings/three.py +++ b/bindings/three.py @@ -418,24 +418,31 @@ def loadTextureCube( urls ): ImageUtils = _ImageUtils() class _Material: + def __init__(self, **kwargs): + params = kwargs ## no need to copy + keys = kwargs.keys() + if 'color' in keys: + color = kwargs['color'] + color = Color(red=color['red'], green=color['green'], blue=color['blue']) + params['color'] = color[...] + + self._reset_material( params ) ## subclasses need to implement this + def __setattr__(self, name, value): print '__setattr__', name, value with javascript: self[...][ name ] = value - def setValues(self, params): + def setValues(self, **params): with javascript: self[...].setValues( params[...] ) class MeshBasicMaterial( _Material ): - def __init__(self, color=None, wireframe=False): - if not color: color = Color() - else: #elif isinstance(color, dict): - color = Color(red=color['red'], green=color['green'], blue=color['blue']) - + def _reset_material(self, params): with javascript: - self[...] = new( THREE.MeshBasicMaterial({color:color[...], wireframe:wireframe}) ) + ## the three.js API takes an javascript-object as params to configure the material + self[...] = new( THREE.MeshBasicMaterial( params[...] ) ) @property def color(self): diff --git a/pythonscript.js b/pythonscript.js index 02bcdd7..87f7708 100644 --- a/pythonscript.js +++ b/pythonscript.js @@ -1,4 +1,4 @@ -// PythonScript Runtime - regenerated on: Fri Oct 18 01:22:00 2013 +// PythonScript Runtime - regenerated on: Fri Oct 18 01:51:32 2013 var jsrange = function(num) { "Emulates Python's range function"; var i, r; @@ -1534,6 +1534,7 @@ window["__dict_properties"] = Object(); __dict_UID = 0; window["__dict_attrs"]["UID"] = __dict_UID; var __dict___init__ = function(args, kwargs) { +var jsob; var signature, arguments; signature = {"kwargs": {"js_object": undefined}, "args": create_array("self", "js_object")}; arguments = get_arguments(signature, args, kwargs); @@ -1562,6 +1563,8 @@ else { self["__dict__"]["js_object"] = Object(); } +jsob = self["__dict__"]["js_object"]; +self["wrapped"] = jsob; } window["__dict___init__"] = __dict___init__ diff --git a/runtime/builtins.py b/runtime/builtins.py index 6a6d851..a04f13b 100644 --- a/runtime/builtins.py +++ b/runtime/builtins.py @@ -354,6 +354,10 @@ def __init__(self, js_object=None): else: self.js_object = JSObject() + jsob = self.js_object + with javascript: + self[...] = jsob + def get(self, key, _default=None): __dict = self.js_object if JS("typeof(key) === 'object'"): diff --git a/tests/threejs_helloworld.html b/tests/threejs_helloworld.html index 0bc48e5..67dc724 100644 --- a/tests/threejs_helloworld.html +++ b/tests/threejs_helloworld.html @@ -27,7 +27,7 @@ geo = CubeGeometry( 10, 10, 10 ) print 'geo->', geo - mat = MeshBasicMaterial( color={'red':0.0, 'green':0.0, 'blue':0.0}, wireframe=False ) + mat = MeshBasicMaterial( color={'red':0.0, 'green':0.0, 'blue':0.0}, wireframe=True ) print 'mat->', mat mesh = Mesh( geo, mat ) scn.add( mesh ) From d445cfe2d30d05602f125ee256711b143ab82870 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Fri, 18 Oct 2013 02:09:29 -0700 Subject: [PATCH 148/860] updated THREE.js wrapper, added mesh Material types. --- bindings/three.py | 55 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/bindings/three.py b/bindings/three.py index 3ec73b4..010a983 100644 --- a/bindings/three.py +++ b/bindings/three.py @@ -449,6 +449,61 @@ def color(self): return Color( object=self[...].color ) +class MeshLambertMaterial( _Material ): + def _reset_material(self, params): + with javascript: + self[...] = new( THREE.MeshLambertMaterial( params[...] ) ) + + @property + def color(self): + return Color( object=self[...].color ) + @property + def ambient(self): + return Color( object=self[...].ambient ) + @property + def emissive(self): + return Color( object=self[...].emissive ) + + +class MeshPhongMaterial( _Material ): + def _reset_material(self, params): + with javascript: + self[...] = new( THREE.MeshPhongMaterial( params[...] ) ) + + @property + def color(self): + return Color( object=self[...].color ) + @property + def ambient(self): + return Color( object=self[...].ambient ) + @property + def emissive(self): + return Color( object=self[...].emissive ) + @property + def specular(self): + return Color( object=self[...].specular ) + + +class MeshNormalMaterial( _Material ): + def _reset_material(self, params): + with javascript: + self[...] = new( THREE.MeshNormalMaterial( params[...] ) ) + + +class MeshDepthMaterial( _Material ): + def _reset_material(self, params): + with javascript: + self[...] = new( THREE.MeshDepthMaterial( params[...] ) ) + + + +class ShaderMaterial( _Material ): + def _reset_material(self, params): + with javascript: + self[...] = new( THREE.ShaderMaterial( params[...] ) ) + + + class CubeGeometry: def __init__(self, width, height, length): with javascript: From 17be6bcfff55a595ffd883bf02c0aede6be44370 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Fri, 18 Oct 2013 17:33:21 -0700 Subject: [PATCH 149/860] THREE.js bindings: new TextGeometry wrapper and test. --- bindings/three.py | 45 ++++++++++++++++++- tests/server.py | 18 +++++++- tests/threejs_TextGeometry.html | 78 +++++++++++++++++++++++++++++++++ 3 files changed, 137 insertions(+), 4 deletions(-) create mode 100644 tests/threejs_TextGeometry.html diff --git a/bindings/three.py b/bindings/three.py index 010a983..18bfbdd 100644 --- a/bindings/three.py +++ b/bindings/three.py @@ -428,8 +428,11 @@ def __init__(self, **kwargs): self._reset_material( params ) ## subclasses need to implement this + def __getattr__(self, name): + with javascript: + return self[...][ name ] + def __setattr__(self, name, value): - print '__setattr__', name, value with javascript: self[...][ name ] = value @@ -502,14 +505,52 @@ def _reset_material(self, params): with javascript: self[...] = new( THREE.ShaderMaterial( params[...] ) ) +class _Geometry: + def __getattr__(self, name): + with javascript: + return self[...][ name ] + + def __setattr__(self, name, value): + with javascript: + self[...][ name ] = value +class CubeGeometry( _Geometry ): -class CubeGeometry: def __init__(self, width, height, length): with javascript: self[...] = new( THREE.CubeGeometry(width, height, length) ) +class ExtrudeGeometry( _Geometry ): + def __init__(self, shapes, options ): + with javascript: + self[...] = new( THREE.ExtrudeGeometry( shapes[...], options[...] ) ) + + def addShape(self, shape, options ): + with javascript: + self[...].addShape( shape[...], options[...] ) + +class TextGeometry( ExtrudeGeometry ): + def __init__(self, text, size=100, curveSegments=4, font='helvetiker', weight='normal', style='normal', height=50, bevelThickness=10, bevelSize=8, bevelEnabled=False ): + assert weight in ('normal','bold') + assert style in ('normal', 'italics') + params = { + 'size':size, ## FontUtils.generateShapes + 'curveSegments':curveSegments, + 'font' : font, + 'weight': weight, + 'style' : style, + 'height': height, ## ExtrudeGeometry.call + 'bevelThickness' : bevelThickness, + 'bevelSize' : bevelSize, + 'bevelEnabled' : bevelEnabled + } + with javascript: + self[...] = new( THREE.TextGeometry( text, params[...] ) ) + + + + class Mesh: def __init__(self, geometry, material): self.geometry = geometry diff --git a/tests/server.py b/tests/server.py index 5e3361a..77c3536 100755 --- a/tests/server.py +++ b/tests/server.py @@ -88,7 +88,9 @@ def get_main_page(): root = PATHS['webroot'] r = ['index'] r.append( '
    ' ) - for name in os.listdir( root ): + files = os.listdir( root ) + files.sort() + for name in files: if name == os.path.split(__file__)[-1]: continue path = os.path.join( root, name ) if os.path.isfile( path ): @@ -222,7 +224,19 @@ def get(self, path=None): LIBS = dict( three = {'three.min.js' : os.path.expanduser( '~/three.js/build/three.min.js')}, - tween = {'tween' : os.path.expanduser( '~/tween.js/build/tween.min.js')}, + tween = {'tween.min.js' : os.path.expanduser( '~/tween.js/build/tween.min.js')}, + fonts = { + 'gentilis_bold.typeface.js' : os.path.expanduser( '~/three.js/examples/fonts/gentilis_bold.typeface.js'), + 'gentilis_regular.typeface.js' : os.path.expanduser( '~/three.js/examples/fonts/gentilis_regular.typeface.js'), + 'optimer_bold.typeface.js' : os.path.expanduser( '~/three.js/examples/fonts/optimer_bold.typeface.js'), + 'optimer_regular.typeface.js' : os.path.expanduser( '~/three.js/examples/fonts/optimer_regular.typeface.js'), + 'helvetiker_bold.typeface.js' : os.path.expanduser( '~/three.js/examples/fonts/helvetiker_bold.typeface.js'), + 'helvetiker_regular.typeface.js' : os.path.expanduser( '~/three.js/examples/fonts/helvetiker_regular.typeface.js'), + 'droid_sans_regular.typeface.js' : os.path.expanduser( '~/three.js/examples/fonts/droid/droid_sans_regular.typeface.js'), + 'droid_sans_bold.typeface.js' : os.path.expanduser( '~/three.js/examples/fonts/droid/droid_sans_bold.typeface.js'), + 'droid_serif_regular.typeface.js' : os.path.expanduser( '~/three.js/examples/fonts/droid/droid_serif_regular.typeface.js'), + 'droid_serif_bold.typeface.js' : os.path.expanduser( '~/three.js/examples/fonts/droid/droid_serif_bold.typeface.js'), + } ) class LibsHandler( tornado.web.RequestHandler ): diff --git a/tests/threejs_TextGeometry.html b/tests/threejs_TextGeometry.html new file mode 100644 index 0000000..14a6b25 --- /dev/null +++ b/tests/threejs_TextGeometry.html @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 80e83f6df97556bb749e58e184fdd41e6e3e49c0 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Fri, 18 Oct 2013 22:34:35 -0700 Subject: [PATCH 150/860] fixed class attribute lookup for grandparents, and "self.some_class_attr" now returns the correct class attribute if redefined by the subclass. updated THREE.js bindings and added new materials test. --- bindings/three.py | 20 +++-- pythonscript.js | 116 ++++++++++++++++++++++------- pythonscript/python_to_pythonjs.py | 20 ++++- runtime/builtins.py | 22 ++++-- runtime/pythonpythonjs.py | 44 +++++++---- tests/test_class_attributes.html | 52 +++++++++++++ tests/threejs_materials.html | 82 ++++++++++++++++++++ 7 files changed, 299 insertions(+), 57 deletions(-) create mode 100644 tests/test_class_attributes.html create mode 100644 tests/threejs_materials.html diff --git a/bindings/three.py b/bindings/three.py index 18bfbdd..5fd42b5 100644 --- a/bindings/three.py +++ b/bindings/three.py @@ -418,13 +418,16 @@ def loadTextureCube( urls ): ImageUtils = _ImageUtils() class _Material: + _color_props = [] + def __init__(self, **kwargs): params = kwargs ## no need to copy keys = kwargs.keys() - if 'color' in keys: - color = kwargs['color'] - color = Color(red=color['red'], green=color['green'], blue=color['blue']) - params['color'] = color[...] + for name in self._color_props: ## subclasses can redefine this + if name in keys: + color = kwargs[ name ] + color = Color(red=color['red'], green=color['green'], blue=color['blue']) + params[ name ] = color[...] self._reset_material( params ) ## subclasses need to implement this @@ -442,6 +445,8 @@ def setValues(self, **params): class MeshBasicMaterial( _Material ): + _color_props = ['color'] + def _reset_material(self, params): with javascript: ## the three.js API takes an javascript-object as params to configure the material @@ -453,6 +458,8 @@ def color(self): class MeshLambertMaterial( _Material ): + _color_props = ['color', 'ambient', 'emissive'] + def _reset_material(self, params): with javascript: self[...] = new( THREE.MeshLambertMaterial( params[...] ) ) @@ -469,6 +476,8 @@ def emissive(self): class MeshPhongMaterial( _Material ): + _color_props = ['color', 'ambient', 'emissive', 'specular'] + def _reset_material(self, params): with javascript: self[...] = new( THREE.MeshPhongMaterial( params[...] ) ) @@ -499,12 +508,13 @@ def _reset_material(self, params): self[...] = new( THREE.MeshDepthMaterial( params[...] ) ) - class ShaderMaterial( _Material ): def _reset_material(self, params): with javascript: self[...] = new( THREE.ShaderMaterial( params[...] ) ) + + class _Geometry: def __getattr__(self, name): with javascript: diff --git a/pythonscript.js b/pythonscript.js index 87f7708..83f7d1a 100644 --- a/pythonscript.js +++ b/pythonscript.js @@ -1,4 +1,4 @@ -// PythonScript Runtime - regenerated on: Fri Oct 18 01:51:32 2013 +// PythonScript Runtime - regenerated on: Fri Oct 18 22:30:54 2013 var jsrange = function(num) { "Emulates Python's range function"; var i, r; @@ -266,13 +266,11 @@ return attr; } bases = __class__.bases; -var iter = jsrange(bases.length); -for (var i=0; i < iter.length; i++) { -var backup = i; -i = iter[i]; -var base, attr; -base = bases[i]; -attr = get_attribute(base, attribute); +var iter = bases; +for (var base=0; base < iter.length; base++) { +var backup = base; +base = iter[base]; +attr = _get_upstream_attribute(base, attribute); if(attr) { if({}.toString.call(attr) === '[object Function]') { var method = function() { @@ -297,7 +295,7 @@ return attr; } -i = backup; +base = backup; } if("__getattr__" in __dict__) { @@ -309,7 +307,7 @@ for (var base=0; base < iter.length; base++) { var backup = base; base = iter[base]; var f; -f = _get_upstream_method(base, "__getattr__"); +f = _get_upstream_attribute(base, "__getattr__"); if(f) { return f([object, attribute]); } @@ -368,21 +366,21 @@ return undefined; } window["get_attribute"] = get_attribute -var _get_upstream_method = function(base, method) { -if(method in base.__dict__) { -return base.__dict__[method]; +var _get_upstream_attribute = function(base, attr) { +if(attr in base.__dict__) { +return base.__dict__[attr]; } var iter = base.bases; for (var parent=0; parent < iter.length; parent++) { var backup = parent; parent = iter[parent]; -return _get_upstream_method(parent, method); +return _get_upstream_attribute(parent, attr); parent = backup; } } -window["_get_upstream_method"] = _get_upstream_method +window["_get_upstream_attribute"] = _get_upstream_attribute var set_attribute = function(object, attribute, value) { "Set an attribute on an object by updating its __dict__ property"; @@ -626,6 +624,7 @@ key = backup; return output; } window["json_to_pythonscript"] = json_to_pythonscript +_PythonJS_UID = 0; var _JSNew = function(T) { console.log("_JSNew->", T); return new T; @@ -652,6 +651,7 @@ _create_empty_object.pythonscript_function=true; var int = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("a")}; +signature["function_name"] = "int"; arguments = get_arguments(signature, args, kwargs); var a = arguments['a']; if(a instanceof String) { @@ -668,6 +668,7 @@ int.pythonscript_function = true; var float = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("a")}; +signature["function_name"] = "float"; arguments = get_arguments(signature, args, kwargs); var a = arguments['a']; if(a instanceof String) { @@ -684,6 +685,7 @@ float.pythonscript_function = true; var str = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("s")}; +signature["function_name"] = "str"; arguments = get_arguments(signature, args, kwargs); var s = arguments['s']; return "" + s; @@ -839,6 +841,7 @@ var range = function(args, kwargs) { var i, r; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("num")}; +signature["function_name"] = "range"; arguments = get_arguments(signature, args, kwargs); var num = arguments['num']; "Emulates Python's range function"; @@ -865,6 +868,7 @@ StopIteration = create_class("StopIteration", window["__StopIteration_parents"], var len = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("obj")}; +signature["function_name"] = "len"; arguments = get_arguments(signature, args, kwargs); var obj = arguments['obj']; return get_attribute(obj, "__len__")(create_array(), Object()); @@ -875,6 +879,7 @@ len.pythonscript_function = true; var next = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("obj")}; +signature["function_name"] = "next"; arguments = get_arguments(signature, args, kwargs); var obj = arguments['obj']; return get_attribute(obj, "next")(create_array(), Object()); @@ -886,6 +891,7 @@ var map = function(args, kwargs) { var out; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("func", "objs")}; +signature["function_name"] = "map"; arguments = get_arguments(signature, args, kwargs); var func = arguments['func']; var objs = arguments['objs']; @@ -903,6 +909,7 @@ var min = function(args, kwargs) { var a; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("lst")}; +signature["function_name"] = "min"; arguments = get_arguments(signature, args, kwargs); var lst = arguments['lst']; a = undefined; @@ -940,6 +947,7 @@ var max = function(args, kwargs) { var a; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("lst")}; +signature["function_name"] = "max"; arguments = get_arguments(signature, args, kwargs); var lst = arguments['lst']; a = undefined; @@ -976,6 +984,7 @@ max.pythonscript_function = true; var abs = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("num")}; +signature["function_name"] = "abs"; arguments = get_arguments(signature, args, kwargs); var num = arguments['num']; return Math.abs(num); @@ -986,6 +995,7 @@ abs.pythonscript_function = true; var ord = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("char")}; +signature["function_name"] = "ord"; arguments = get_arguments(signature, args, kwargs); var char = arguments['char']; return char.charCodeAt(0); @@ -996,6 +1006,7 @@ ord.pythonscript_function = true; var chr = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("num")}; +signature["function_name"] = "chr"; arguments = get_arguments(signature, args, kwargs); var num = arguments['num']; return String.fromCharCode(num); @@ -1010,6 +1021,7 @@ window["__Iterator_properties"] = Object(); var __Iterator___init__ = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "obj", "index")}; +signature["function_name"] = "__Iterator___init__"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var obj = arguments['obj']; @@ -1025,6 +1037,7 @@ var __Iterator_next = function(args, kwargs) { var index, length, item; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self")}; +signature["function_name"] = "__Iterator_next"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; index = self["__dict__"]["index"]; @@ -1055,6 +1068,7 @@ window["__tuple_properties"] = Object(); var __tuple___init__ = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {"js_object": undefined}, "args": create_array("self", "js_object")}; +signature["function_name"] = "__tuple___init__"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var js_object = arguments['js_object']; @@ -1084,6 +1098,7 @@ var __tuple___getitem__ = function(args, kwargs) { var __array; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "index")}; +signature["function_name"] = "__tuple___getitem__"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var index = arguments['index']; @@ -1097,6 +1112,7 @@ window["__tuple_attrs"]["__getitem__"] = __tuple___getitem__; var __tuple___iter__ = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self")}; +signature["function_name"] = "__tuple___iter__"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var __args_4, __kwargs_4; @@ -1112,6 +1128,7 @@ var __tuple___len__ = function(args, kwargs) { var __array; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self")}; +signature["function_name"] = "__tuple___len__"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var __array; @@ -1126,6 +1143,7 @@ var __tuple_index = function(args, kwargs) { var __array; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "obj")}; +signature["function_name"] = "__tuple_index"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var obj = arguments['obj']; @@ -1140,6 +1158,7 @@ var __tuple_count = function(args, kwargs) { var i; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "obj")}; +signature["function_name"] = "__tuple_count"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var obj = arguments['obj']; @@ -1173,6 +1192,7 @@ var __tuple_get = function(args, kwargs) { var __array; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "index")}; +signature["function_name"] = "__tuple_get"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var index = arguments['index']; @@ -1186,6 +1206,7 @@ window["__tuple_attrs"]["get"] = __tuple_get; var __tuple___CONTAINS__ = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "value")}; +signature["function_name"] = "__tuple___CONTAINS__"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var value = arguments['value']; @@ -1214,6 +1235,7 @@ window["__list_properties"] = Object(); var __list___init__ = function(args, kwargs) { var signature, arguments; signature = {"kwargs": {"js_object": undefined}, "args": create_array("self", "js_object")}; +signature["function_name"] = "__list___init__"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var js_object = arguments['js_object']; @@ -1233,6 +1255,7 @@ var __list___getitem__ = function(args, kwargs) { var __array; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "index")}; +signature["function_name"] = "__list___getitem__"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var index = arguments['index']; @@ -1247,6 +1270,7 @@ var __list___setitem__ = function(args, kwargs) { var __array; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "index", "value")}; +signature["function_name"] = "__list___setitem__"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var index = arguments['index']; @@ -1262,6 +1286,7 @@ var __list_append = function(args, kwargs) { var __array; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "obj")}; +signature["function_name"] = "__list_append"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var obj = arguments['obj']; @@ -1276,6 +1301,7 @@ window["__list_attrs"]["append"] = __list_append; var __list_extend = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "other")}; +signature["function_name"] = "__list_extend"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var other = arguments['other']; @@ -1307,6 +1333,7 @@ var __list_insert = function(args, kwargs) { var __array; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "index", "obj")}; +signature["function_name"] = "__list_insert"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var index = arguments['index']; @@ -1323,6 +1350,7 @@ var __list_remove = function(args, kwargs) { var index, __array; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "obj")}; +signature["function_name"] = "__list_remove"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var obj = arguments['obj']; @@ -1342,6 +1370,7 @@ var __list_pop = function(args, kwargs) { var __array; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self")}; +signature["function_name"] = "__list_pop"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var __array; @@ -1356,6 +1385,7 @@ var __list_index = function(args, kwargs) { var __array; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "obj")}; +signature["function_name"] = "__list_index"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var obj = arguments['obj']; @@ -1371,6 +1401,7 @@ var __list_count = function(args, kwargs) { var i; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "obj")}; +signature["function_name"] = "__list_count"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var obj = arguments['obj']; @@ -1404,6 +1435,7 @@ var __list_reverse = function(args, kwargs) { var __array; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self")}; +signature["function_name"] = "__list_reverse"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var __array; @@ -1418,6 +1450,7 @@ var __list_shift = function(args, kwargs) { var __array; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self")}; +signature["function_name"] = "__list_shift"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var __array; @@ -1432,6 +1465,7 @@ var __list_slice = function(args, kwargs) { var __array; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "start", "end")}; +signature["function_name"] = "__list_slice"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var start = arguments['start']; @@ -1447,6 +1481,7 @@ window["__list_attrs"]["slice"] = __list_slice; var __list___iter__ = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self")}; +signature["function_name"] = "__list___iter__"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var __args_7, __kwargs_7; @@ -1462,6 +1497,7 @@ var __list_get = function(args, kwargs) { var __array; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "index")}; +signature["function_name"] = "__list_get"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var index = arguments['index']; @@ -1477,6 +1513,7 @@ var __list_set = function(args, kwargs) { var __array; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "index", "value")}; +signature["function_name"] = "__list_set"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var index = arguments['index']; @@ -1493,6 +1530,7 @@ var __list___len__ = function(args, kwargs) { var __array; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self")}; +signature["function_name"] = "__list___len__"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var __array; @@ -1506,6 +1544,7 @@ window["__list_attrs"]["__len__"] = __list___len__; var __list___CONTAINS__ = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "value")}; +signature["function_name"] = "__list___CONTAINS__"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var value = arguments['value']; @@ -1537,6 +1576,7 @@ var __dict___init__ = function(args, kwargs) { var jsob; var signature, arguments; signature = {"kwargs": {"js_object": undefined}, "args": create_array("self", "js_object")}; +signature["function_name"] = "__dict___init__"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var js_object = arguments['js_object']; @@ -1574,6 +1614,7 @@ var __dict_get = function(args, kwargs) { var __dict; var signature, arguments; signature = {"kwargs": {"_default": undefined}, "args": create_array("self", "key", "_default")}; +signature["function_name"] = "__dict_get"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var key = arguments['key']; @@ -1613,6 +1654,7 @@ var __dict_set = function(args, kwargs) { var __dict; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "key", "value")}; +signature["function_name"] = "__dict_set"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var key = arguments['key']; @@ -1620,9 +1662,9 @@ var value = arguments['value']; __dict = self["__dict__"]["js_object"]; if(typeof(key) === 'object') { if(key.uid === undefined) { -uid = self["__class__"]["__dict__"]["UID"]; +uid = _PythonJS_UID; key.uid = uid; -self["__class__"]["__dict__"]["UID"] += 1 +_PythonJS_UID += 1 } var uid = key.uid; @@ -1631,9 +1673,9 @@ __dict["@"+uid] = value; else { if(typeof(key) === 'function') { if(key.uid === undefined) { -uid = self["__class__"]["__dict__"]["UID"]; +uid = _PythonJS_UID; key.uid = uid; -self["__class__"]["__dict__"]["UID"] += 1 +_PythonJS_UID += 1 } var uid = key.uid; @@ -1654,6 +1696,7 @@ var __dict___len__ = function(args, kwargs) { var __dict; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self")}; +signature["function_name"] = "__dict___len__"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; __dict = self["__dict__"]["js_object"]; @@ -1667,6 +1710,7 @@ var __dict___getitem__ = function(args, kwargs) { var __dict; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "key")}; +signature["function_name"] = "__dict___getitem__"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var key = arguments['key']; @@ -1695,6 +1739,7 @@ var __dict___setitem__ = function(args, kwargs) { var __dict; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "key", "value")}; +signature["function_name"] = "__dict___setitem__"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var key = arguments['key']; @@ -1702,9 +1747,9 @@ var value = arguments['value']; __dict = self["__dict__"]["js_object"]; if(typeof(key) === 'object') { if(key.uid === undefined) { -uid = self["__class__"]["__dict__"]["UID"]; +uid = _PythonJS_UID; key.uid = uid; -self["__class__"]["__dict__"]["UID"] += 1 +_PythonJS_UID += 1 } var uid = key.uid; @@ -1713,9 +1758,9 @@ __dict["@"+uid] = value; else { if(typeof(key) === 'function') { if(key.uid === undefined) { -uid = self["__class__"]["__dict__"]["UID"]; +uid = _PythonJS_UID; key.uid = uid; -self["__class__"]["__dict__"]["UID"] += 1 +_PythonJS_UID += 1 } var uid = key.uid; @@ -1736,6 +1781,7 @@ var __dict_keys = function(args, kwargs) { var __dict, __keys, out; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self")}; +signature["function_name"] = "__dict_keys"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; __dict = self["__dict__"]["js_object"]; @@ -1752,6 +1798,7 @@ var __dict_values = function(args, kwargs) { var __dict, __keys, i, out; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self")}; +signature["function_name"] = "__dict_values"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; __dict = self["__dict__"]["js_object"]; @@ -1774,6 +1821,7 @@ window["__dict_attrs"]["values"] = __dict_values; var __dict___CONTAINS__ = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "value")}; +signature["function_name"] = "__dict___CONTAINS__"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var value = arguments['value']; @@ -1807,13 +1855,14 @@ var __array___init__ = function(args, kwargs) { var size, buff; var signature, arguments; signature = {"kwargs": {"initializer": undefined, "little_endian": false}, "args": create_array("self", "typecode", "initializer", "little_endian")}; +signature["function_name"] = "__array___init__"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var typecode = arguments['typecode']; var initializer = arguments['initializer']; var little_endian = arguments['little_endian']; self["__dict__"]["typecode"] = typecode; -self["__dict__"]["itemsize"] = get_attribute(self["__class__"]["__dict__"]["typecodes"], "__getitem__")([typecode], Object()); +self["__dict__"]["itemsize"] = get_attribute(get_attribute(self, "typecodes"), "__getitem__")([typecode], Object()); self["__dict__"]["little_endian"] = little_endian; if(initializer) { var __args_10, __kwargs_10; @@ -1881,6 +1930,7 @@ window["__array_attrs"]["__init__"] = __array___init__; var __array___len__ = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self")}; +signature["function_name"] = "__array___len__"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; return self["__dict__"]["length"]; @@ -1893,6 +1943,7 @@ var __array___CONTAINS__ = function(args, kwargs) { var lst; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "value")}; +signature["function_name"] = "__array___CONTAINS__"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var value = arguments['value']; @@ -1907,13 +1958,14 @@ var __array___getitem__ = function(args, kwargs) { var func_name, step, dataview, func, offset; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "index")}; +signature["function_name"] = "__array___getitem__"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var index = arguments['index']; step = self["__dict__"]["itemsize"]; offset = step * index; dataview = self["__dict__"]["dataview"]; -func_name = "get" + get_attribute(self["__class__"]["__dict__"]["typecode_names"], "__getitem__")([self["__dict__"]["typecode"]], Object()); +func_name = "get" + get_attribute(get_attribute(self, "typecode_names"), "__getitem__")([self["__dict__"]["typecode"]], Object()); func = dataview[func_name].bind(dataview); if(offset < self["__dict__"]["bytes"]) { value = func(offset); @@ -1942,6 +1994,7 @@ var __array___setitem__ = function(args, kwargs) { var func_name, step, dataview, func, offset; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "index", "value")}; +signature["function_name"] = "__array___setitem__"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var index = arguments['index']; @@ -1953,7 +2006,7 @@ index = self["__dict__"]["length"] + index - 1; offset = step * index; dataview = self["__dict__"]["dataview"]; -func_name = "set" + get_attribute(self["__class__"]["__dict__"]["typecode_names"], "__getitem__")([self["__dict__"]["typecode"]], Object()); +func_name = "set" + get_attribute(get_attribute(self, "typecode_names"), "__getitem__")([self["__dict__"]["typecode"]], Object()); func = dataview[func_name].bind(dataview); if(offset < self["__dict__"]["bytes"]) { if(self["__dict__"]["typecode"] == "float8") { @@ -1980,6 +2033,7 @@ window["__array_attrs"]["__setitem__"] = __array___setitem__; var __array___iter__ = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self")}; +signature["function_name"] = "__array___iter__"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var __args_20, __kwargs_20; @@ -1994,6 +2048,7 @@ window["__array_attrs"]["__iter__"] = __array___iter__; var __array_get = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "index")}; +signature["function_name"] = "__array_get"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var index = arguments['index']; @@ -2007,6 +2062,7 @@ var __array_fromlist = function(args, kwargs) { var typecode, func_name, dataview, length, step, func, size; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "lst")}; +signature["function_name"] = "__array_fromlist"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var lst = arguments['lst']; @@ -2018,7 +2074,7 @@ step = self["__dict__"]["itemsize"]; typecode = self["__dict__"]["typecode"]; size = length * step; dataview = self["__dict__"]["dataview"]; -func_name = "set" + get_attribute(self["__class__"]["__dict__"]["typecode_names"], "__getitem__")([typecode], Object()); +func_name = "set" + get_attribute(get_attribute(self, "typecode_names"), "__getitem__")([typecode], Object()); func = dataview[func_name].bind(dataview); if(size <= self["__dict__"]["bytes"]) { i = 0; @@ -2053,6 +2109,7 @@ var __array_resize = function(args, kwargs) { var source, new_buff, target, new_size, buff; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "length")}; +signature["function_name"] = "__array_resize"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var length = arguments['length']; @@ -2075,6 +2132,7 @@ var __array_append = function(args, kwargs) { var length; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "value")}; +signature["function_name"] = "__array_append"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var value = arguments['value']; @@ -2092,6 +2150,7 @@ window["__array_attrs"]["append"] = __array_append; var __array_extend = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "lst")}; +signature["function_name"] = "__array_extend"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var lst = arguments['lst']; @@ -2123,6 +2182,7 @@ var __array_to_array = function(args, kwargs) { var i, arr; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self")}; +signature["function_name"] = "__array_to_array"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; arr = create_array(); @@ -2142,6 +2202,7 @@ var __array_to_list = function(args, kwargs) { var lst; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self")}; +signature["function_name"] = "__array_to_list"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; lst = get_attribute(list, "__call__")(create_array(), Object()); @@ -2156,6 +2217,7 @@ var __array_to_ascii = function(args, kwargs) { var i, length, arr, string; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self")}; +signature["function_name"] = "__array_to_ascii"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; string = ""; diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index f8b41ce..bcc1a0c 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -624,10 +624,17 @@ def visit_Attribute(self, node): if getter in self._function_return_types: node.returns_type = self._function_return_types[getter] return '%s( [%s] )' %(getter, node_value) - elif node.attr in typedef.class_attributes: + + elif node.attr in typedef.class_attributes and not typedef.check_for_parent_with( class_attribute=node.attr ) and node_value != 'self': + ## This optimization breaks when a subclass redefines a class attribute, + ## but we need it for inplace assignment operators, this is safe only when + ## other parent classes have not defined the same class attribute. + ## This is also not safe when node_value is "self". return "%s['__class__']['__dict__']['%s']" %(node_value, node.attr) + elif node.attr in typedef.attributes: return "%s['__dict__']['%s']" %(node_value, node.attr) + elif '__getattr__' in typedef.methods: func = typedef.get_pythonjs_function_name( '__getattr__' ) return '%s([%s, "%s"])' %(func, node_value, node.attr) @@ -638,10 +645,16 @@ def visit_Attribute(self, node): if getter in self._function_return_types: node.returns_type = self._function_return_types[getter] return '%s( [%s] )' %(getter, node_value) + elif typedef.check_for_parent_with( class_attribute=node.attr ): #return 'get_attribute(%s, "%s")' % (node_value, node.attr) ## get_attribute is broken with grandparent class attributes - parent = typedef.check_for_parent_with( class_attribute=node.attr ) - return "window['__%s_attrs']['%s']" %(parent.name, node.attr) + if node.attr in typedef.class_attributes: + ## this might not be always correct + return "%s['__class__']['__dict__']['%s']" %(node_value, node.attr) + else: + parent = typedef.check_for_parent_with( class_attribute=node.attr ) + return "window['__%s_attrs']['%s']" %(parent.name, node.attr) + elif typedef.check_for_parent_with( method='__getattr__' ): parent = typedef.check_for_parent_with( method='__getattr__' ) func = parent.get_pythonjs_function_name( '__getattr__' ) @@ -991,6 +1004,7 @@ def visit_FunctionDef(self, node): # create a JS Object to store the value of each parameter signature = ', '.join(map(lambda x: '%s=%s' % (self.visit(x.arg), self.visit(x.value)), keywords)) writer.write('signature = JSObject(%s)' % signature) + writer.write('signature["function_name"] = "%s"' %node.name) writer.write('arguments = get_arguments(signature, args, kwargs)') # # then for each argument assign its value for arg in node.args.args: diff --git a/runtime/builtins.py b/runtime/builtins.py index a04f13b..7c6a7e4 100644 --- a/runtime/builtins.py +++ b/runtime/builtins.py @@ -1,3 +1,5 @@ +_PythonJS_UID = 0 + with javascript: def _JSNew(T): @@ -375,19 +377,21 @@ def get(self, key, _default=None): return _default def set(self, key, value): + global _PythonJS_UID + __dict = self.js_object if JS("typeof(key) === 'object'"): if JS("key.uid === undefined"): - uid = self.UID + uid = _PythonJS_UID JS("key.uid = uid") - self.UID += 1 + _PythonJS_UID += 1 JS('var uid = key.uid') JS('__dict["@"+uid] = value') elif JS("typeof(key) === 'function'"): if JS("key.uid === undefined"): - uid = self.UID + uid = _PythonJS_UID JS("key.uid = uid") - self.UID += 1 + _PythonJS_UID += 1 JS('var uid = key.uid') JS('__dict["@"+uid] = value') else: @@ -409,19 +413,21 @@ def __getitem__(self, key): return JS('__dict[key]') def __setitem__(self, key, value): + global _PythonJS_UID + __dict = self.js_object if JS("typeof(key) === 'object'"): if JS("key.uid === undefined"): - uid = self.UID + uid = _PythonJS_UID JS("key.uid = uid") - self.UID += 1 + _PythonJS_UID += 1 JS('var uid = key.uid') JS('__dict["@"+uid] = value') elif JS("typeof(key) === 'function'"): if JS("key.uid === undefined"): - uid = self.UID + uid = _PythonJS_UID JS("key.uid = uid") - self.UID += 1 + _PythonJS_UID += 1 JS('var uid = key.uid') JS('__dict["@"+uid] = value') else: diff --git a/runtime/pythonpythonjs.py b/runtime/pythonpythonjs.py index 0748542..0297ea7 100644 --- a/runtime/pythonpythonjs.py +++ b/runtime/pythonpythonjs.py @@ -142,7 +142,7 @@ def wrapper(args,kwargs): return attr.apply(object, args) ## THIS IS CORRECT __dict__ = __class__.__dict__ attr = __dict__[attribute] if attr: - __get__ = get_attribute(attr, '__get__') + __get__ = get_attribute(attr, '__get__') ## what are data descriptors? if __get__: return __get__([object, __class__]) bases = __class__.bases @@ -182,7 +182,6 @@ def wrapper(args,kwargs): return attr.apply(object, args) ## THIS IS CORRECT if attribute in __class__.__properties__: ## @property decorators return __class__.__properties__[ attribute ]( [object] ) - #var(__dict__) __dict__ = __class__.__dict__ attr = __dict__[attribute] #if attr: @@ -202,10 +201,9 @@ def method(): return attr bases = __class__.bases - for i in jsrange(bases.length): - var(base, attr) - base = bases[i] - attr = get_attribute(base, attribute) + + for base in bases: + attr = _get_upstream_attribute(base, attribute) if attr: if JS("{}.toString.call(attr) === '[object Function]'"): def method(): @@ -221,18 +219,36 @@ def method(): else: return attr + + #for i in jsrange(bases.length): ## this calls get_attribute, ugly! + # var(base, attr) + # base = bases[i] + # attr = get_attribute(base, attribute) + # if attr: + # if JS("{}.toString.call(attr) === '[object Function]'"): + # def method(): + # var(args) + # args = arguments + # if(args.length > 0): + # args[0].splice(0, 0, object) + # else: + # args = [object] + # return attr.apply(None, args) + # method.is_wrapper = True + # return method + # else: + # return attr + if '__getattr__' in __dict__: return __dict__['__getattr__']( [object, attribute]) for base in bases: - #print 'checking base', base - #if '__getattr__' in base.__dict__: - # return base.__dict__['__getattr__']( [object, attribute] ) var( f ) - f = _get_upstream_method(base, '__getattr__') + f = _get_upstream_attribute(base, '__getattr__') if f: return f( [object, attribute] ) + if JS('object instanceof Array'): if attribute == '__getitem__': def wrapper(args,kwargs): return object[ args[0] ] @@ -254,11 +270,11 @@ def wrapper(args,kwargs): object[ args[0] ] = args[1] return None # XXX: raise AttributeError instead -def _get_upstream_method(base, method): - if method in base.__dict__: - return base.__dict__[ method ] +def _get_upstream_attribute(base, attr): + if attr in base.__dict__: + return base.__dict__[ attr ] for parent in base.bases: - return _get_upstream_method(parent, method) + return _get_upstream_attribute(parent, attr) diff --git a/tests/test_class_attributes.html b/tests/test_class_attributes.html new file mode 100644 index 0000000..07c84b0 --- /dev/null +++ b/tests/test_class_attributes.html @@ -0,0 +1,52 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/tests/threejs_materials.html b/tests/threejs_materials.html new file mode 100644 index 0000000..915bcc2 --- /dev/null +++ b/tests/threejs_materials.html @@ -0,0 +1,82 @@ + + + + + + + + + + + + + \ No newline at end of file From c9a119afc137b856f8268d50bcadc970e19c2489 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Fri, 18 Oct 2013 23:02:11 -0700 Subject: [PATCH 151/860] THREE.js binding: added PointLight --- bindings/three.py | 24 ++++++++++++++++++++++-- tests/threejs_materials.html | 6 +++++- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/bindings/three.py b/bindings/three.py index 5fd42b5..00f4937 100644 --- a/bindings/three.py +++ b/bindings/three.py @@ -397,9 +397,12 @@ def __init__(self): class WebGLRenderer( _Renderer ): - def __init__(self): + def __init__(self, antialias=False ): + ## note: antialias may not work depending on hardware and/or browser support, + ## for example: Chrome 27 fails, while on the same machine FireFox 20 works. + with javascript: - self[...] = new( THREE.WebGLRenderer() ) + self[...] = new( THREE.WebGLRenderer( {antialias:antialias}) ) def getContext(self): return self[...].getContext() @@ -417,6 +420,23 @@ def loadTextureCube( urls ): ImageUtils = _ImageUtils() + +class _Light: + def __init__(self, color=None, energy=None): + self._reset_light() + +class PointLight( _Light ): + def _reset_light(self): + color = Color() + with javascript: + self[...] = new( THREE.PointLight( color[...], 1.5 ) ) + + @property + def position(self): + vec = self[...].position + return Vector3( object=vec ) + + class _Material: _color_props = [] diff --git a/tests/threejs_materials.html b/tests/threejs_materials.html index 915bcc2..8824465 100644 --- a/tests/threejs_materials.html +++ b/tests/threejs_materials.html @@ -22,10 +22,14 @@ cam.position.z = 40 cam.position.x = 5 - ren = WebGLRenderer() + ren = WebGLRenderer( antialias=True ) ren.setSize( width, height ) ren.setClearColor( red=0.5, green=0.5, blue=0.5 ) + light = PointLight() + light.position.set( 0, 100, 90 ) + scn.add( light ) + div.appendChild( ren.domElement ) for i in range(3): From ab32fcd6dfbb6a2520c16775e39eb57fb4ac28c1 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Sat, 19 Oct 2013 01:53:18 -0700 Subject: [PATCH 152/860] WebSocket, simple server implementation and new test: test_websocket.html --- tests/server.py | 16 ++++++++++++++- tests/test_websocket.html | 43 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 tests/test_websocket.html diff --git a/tests/server.py b/tests/server.py index 77c3536..80cc1e1 100755 --- a/tests/server.py +++ b/tests/server.py @@ -13,6 +13,7 @@ import tornado.ioloop import tornado.web +import tornado.websocket import os, sys, subprocess, datetime PATHS = dict( @@ -29,7 +30,6 @@ ) - def python_to_pythonjs( src, module=None, global_variable_scope=False ): cmdheader = '#!%s' %PATHS['module_cache'] if module: @@ -255,7 +255,21 @@ def get(self, path=None): self.write( data ) +class WebSocketHandler(tornado.websocket.WebSocketHandler): + def open(self): + print( self.request.connection ) + + def on_message(self, msg): + print('on message', msg) + self.write_message('hello client') + + def on_close(self): + print('websocket closed') + self.close() + + Handlers = [ + (r'/websocket', WebSocketHandler), (r'/libs/(.*)', LibsHandler), (r'/(.*)', MainHandler), ## order is important, this comes last. ] diff --git a/tests/test_websocket.html b/tests/test_websocket.html new file mode 100644 index 0000000..f67044d --- /dev/null +++ b/tests/test_websocket.html @@ -0,0 +1,43 @@ + + + + + + + + + + + \ No newline at end of file From 16ccd52b1f5fdfda193149c01ad63c9a9c3d52e4 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Sat, 19 Oct 2013 16:39:48 -0700 Subject: [PATCH 153/860] adding support for simple Lambda functions. --- pythonscript/python_to_pythonjs.py | 7 +++++++ pythonscript/pythonjs.py | 5 +++++ tests/test_lambda.html | 25 +++++++++++++++++++++++++ 3 files changed, 37 insertions(+) create mode 100644 tests/test_lambda.html diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index bcc1a0c..4ae7dc5 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -897,6 +897,13 @@ def visit_Call(self, node): else: ## this could be a dangerous optimization ## return '%s( JSArray(), JSObject() )' %name + def visit_Lambda(self, node): + args = [self.visit(a) for a in node.args.args] + if self._with_js: + return '(function (%s) {%s})' %(','.join(args), self.visit(node.body)) + else: + return 'lambda %s: %s' %(','.join(args), self.visit(node.body)) + def visit_FunctionDef(self, node): property_decorator = None decorators = [] diff --git a/pythonscript/pythonjs.py b/pythonscript/pythonjs.py index 3ab0e7d..9f83b9b 100755 --- a/pythonscript/pythonjs.py +++ b/pythonscript/pythonjs.py @@ -59,6 +59,11 @@ def visit_ExceptHandler(self, node): out += '}\n' return out + def visit_Lambda(self, node): + args = [self.visit(a) for a in node.args.args] + return '(function (%s) {%s})' %(','.join(args), self.visit(node.body)) + + def visit_FunctionDef(self, node): if not hasattr(self, '_function_stack'): ## track nested functions ## self._function_stack = [] diff --git a/tests/test_lambda.html b/tests/test_lambda.html new file mode 100644 index 0000000..18a3ae3 --- /dev/null +++ b/tests/test_lambda.html @@ -0,0 +1,25 @@ + + + + + + + + + + + \ No newline at end of file From f5154ac17973b4dbd64870917de4246bb6e206cc Mon Sep 17 00:00:00 2001 From: hartsantler Date: Sat, 19 Oct 2013 19:23:26 -0700 Subject: [PATCH 154/860] fixed calling lambda function from outside of "with javascript" --- pythonscript/python_to_pythonjs.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index 4ae7dc5..0a0dafd 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -856,11 +856,14 @@ def visit_Call(self, node): args = ', '.join(args) return '%s(%s)' % (node.func.id, args) else: - + call_has_args_only = len(node.args) and not (len(node.keywords) or node.starargs or node.kwargs) call_has_args = len(node.args) or len(node.keywords) or node.starargs or node.kwargs name = self.visit(node.func) - if call_has_args: + if call_has_args_only: ## lambda only supports simple args for now. + args = ', '.join(map(self.visit, node.args)) + + elif call_has_args: args = ', '.join(map(self.visit, node.args)) kwargs = ', '.join(map(lambda x: '%s=%s' % (x.arg, self.visit(x.value)), node.keywords)) args_name = '__args_%s' % self.identifier @@ -870,7 +873,7 @@ def visit_Call(self, node): self.identifier += 1 if name in ('list', 'tuple'): - writer.write( '%s = JS("%s.__dict__.js_object")' % (args_name, args)) + writer.append( '%s = JS("%s.__dict__.js_object")' % (args_name, args)) else: writer.append('%s = JSArray(%s)' % (args_name, args)) @@ -883,7 +886,10 @@ def visit_Call(self, node): code = "JS('for (var name in %s) { %s[name] = %s[name]; }')" % (kwargs, kwargs_name, kwargs) writer.append(code) - if call_has_args: + if call_has_args_only: + return 'get_attribute(%s, "__call__")([%s], JSObject())' % (name, args) + + elif call_has_args: if name == 'dict': return 'get_attribute(%s, "__call__")(%s, JSObject(js_object=%s))' % (name, args_name, kwargs_name) elif name in ('list', 'tuple'): From eb9d9af229a86d10e170dd25fd205e0581c15818 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Sat, 19 Oct 2013 21:29:42 -0700 Subject: [PATCH 155/860] server.py can now compile Python and send the JavaScript back to the client over a websocket. --- bindings/websocket.py | 49 ++++++++++++++++++++++ tests/server.py | 14 +++++-- tests/test_websocket.html | 77 +++++++++++++++++++++++------------ tests/test_websocket_raw.html | 45 ++++++++++++++++++++ 4 files changed, 157 insertions(+), 28 deletions(-) create mode 100644 bindings/websocket.py create mode 100644 tests/test_websocket_raw.html diff --git a/bindings/websocket.py b/bindings/websocket.py new file mode 100644 index 0000000..dbb8af7 --- /dev/null +++ b/bindings/websocket.py @@ -0,0 +1,49 @@ +def on_open_default(): + print 'websocket open' + +def on_close_default(): + print 'websocket close' + + + +class websocket: + def __init__(self, addr='ws://localhost:8080/websocket', on_open=None, on_close=None, on_json_message=None, on_binary_message=None): + if not on_open: + on_open = on_open_default + if not on_close: + on_close = on_close_default + + with javascript: + ws = new( WebSocket(addr) ) + ws.binaryType = 'arraybuffer' + ws.onmessage = lambda evt: self.__class__.__dict__.on_message([self,evt]) + ws.onopen = on_open + ws.onclose = on_close + self[...] = ws + + self.on_json_message = on_json_message + self.on_binary_message = on_binary_message + + def on_message(self, event): + bin = None + ob = None + + with javascript: + print 'on message', event + if instanceof(event.data, ArrayBuffer): + print 'got binary bytes', event.data.byteLength + bin = new(Uint8Array(event.data)) + else: + print 'got text' + print event.data + ob = JSON.parse( event.data ) + + if bin: + self.on_binary_message( bin ) + elif ob: + self.on_json_message( ob ) + + + def send_json_message(self, ob): + with javascript: + self[...].send( JSON.stringify(ob) ) \ No newline at end of file diff --git a/tests/server.py b/tests/server.py index 80cc1e1..04dcde5 100755 --- a/tests/server.py +++ b/tests/server.py @@ -14,7 +14,7 @@ import tornado.ioloop import tornado.web import tornado.websocket -import os, sys, subprocess, datetime +import os, sys, subprocess, datetime, json PATHS = dict( webroot = os.path.dirname(os.path.abspath(__file__)), @@ -261,11 +261,19 @@ def open(self): def on_message(self, msg): print('on message', msg) - self.write_message('hello client') + ob = json.loads( msg ) + if isinstance(ob, dict): + if 'command' in ob: + if ob['command'] == 'compile': + js = python_to_javascript( ob['code'] ) + self.write_message( {'eval':js}) + else: + self.write_message('"hello client"') def on_close(self): print('websocket closed') - self.close() + if self.ws_connection: + self.close() Handlers = [ diff --git a/tests/test_websocket.html b/tests/test_websocket.html index f67044d..14f97c7 100644 --- a/tests/test_websocket.html +++ b/tests/test_websocket.html @@ -1,43 +1,70 @@ + - + +

    Python Input

    + +

    + + +

    +

    JavaScript Output

    + + \ No newline at end of file diff --git a/tests/test_websocket_raw.html b/tests/test_websocket_raw.html new file mode 100644 index 0000000..9ebdca5 --- /dev/null +++ b/tests/test_websocket_raw.html @@ -0,0 +1,45 @@ + + + + + + + + + + + \ No newline at end of file From 494463846c7e6936638c968daefe5ad4d55bc996 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Sat, 19 Oct 2013 22:39:06 -0700 Subject: [PATCH 156/860] integrated ace.js editor, removed "__contains__" hack from Object.prototype (this was incompatible with ace.js - and likely other js libraries) --- pythonscript.js | 127 ++++----------------------- pythonscript/python_to_pythonjs.py | 3 +- runtime/builtins.py | 24 ++--- tests/server.py | 7 +- tests/test_websocket_ace_editor.html | 91 +++++++++++++++++++ 5 files changed, 130 insertions(+), 122 deletions(-) create mode 100644 tests/test_websocket_ace_editor.html diff --git a/pythonscript.js b/pythonscript.js index 83f7d1a..9c1d623 100644 --- a/pythonscript.js +++ b/pythonscript.js @@ -1,4 +1,4 @@ -// PythonScript Runtime - regenerated on: Fri Oct 18 22:30:54 2013 +// PythonScript Runtime - regenerated on: Sat Oct 19 22:24:57 2013 var jsrange = function(num) { "Emulates Python's range function"; var i, r; @@ -820,23 +820,6 @@ window["_setup_array_prototype"] = _setup_array_prototype _setup_array_prototype.pythonscript_function = true; _setup_array_prototype(create_array(), Object()); -var _setup_object_prototype = function(args, kwargs) { -var func = function(a) { -if(a in this) { -return true; -} -else { -return false; -} - -} - -Object.prototype.__contains__=func; -} -window["_setup_object_prototype"] = _setup_object_prototype - -_setup_object_prototype.pythonscript_function = true; -_setup_object_prototype(create_array(), Object()); var range = function(args, kwargs) { var i, r; var signature, arguments; @@ -849,10 +832,7 @@ var i, r; i = 0; r = get_attribute(list, "__call__")(create_array(), Object()); while(i < num) { -var __args_0, __kwargs_0; -__args_0 = create_array(i); -__kwargs_0 = Object(); -get_attribute(get_attribute(r, "append"), "__call__")(__args_0, __kwargs_0); +get_attribute(get_attribute(r, "append"), "__call__")([i], Object()); i += 1 } return r; @@ -896,10 +876,7 @@ arguments = get_arguments(signature, args, kwargs); var func = arguments['func']; var objs = arguments['objs']; out = get_attribute(list, "__call__")(create_array(), Object()); -var __args_1, __kwargs_1; -__args_1 = create_array(func, get_attribute(objs, "js_object")); -__kwargs_1 = Object(); -set_attribute(out, "js_object", get_attribute(map, "__call__")(__args_1, __kwargs_1)); +set_attribute(out, "js_object", get_attribute(map, "__call__")([func, get_attribute(objs, "js_object")], Object())); return out; } window["map"] = map @@ -1041,18 +1018,12 @@ signature["function_name"] = "__Iterator_next"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; index = self["__dict__"]["index"]; -var __args_2, __kwargs_2; -__args_2 = create_array(self["__dict__"]["obj"]); -__kwargs_2 = Object(); -length = get_attribute(len, "__call__")(__args_2, __kwargs_2); +length = get_attribute(len, "__call__")([self["__dict__"]["obj"]], Object()); if(index == length) { throw StopIteration; } -var __args_3, __kwargs_3; -__args_3 = create_array(self["__dict__"]["index"]); -__kwargs_3 = Object(); -item = get_attribute(get_attribute(self["__dict__"]["obj"], "get"), "__call__")(__args_3, __kwargs_3); +item = get_attribute(get_attribute(self["__dict__"]["obj"], "get"), "__call__")([self["__dict__"]["index"]], Object()); self["__dict__"]["index"] = self["__dict__"]["index"] + 1; return item; } @@ -1115,10 +1086,7 @@ signature = {"kwargs": Object(), "args": create_array("self")}; signature["function_name"] = "__tuple___iter__"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; -var __args_4, __kwargs_4; -__args_4 = create_array(self, 0); -__kwargs_4 = Object(); -return get_attribute(Iterator, "__call__")(__args_4, __kwargs_4); +return get_attribute(Iterator, "__call__")([self, 0], Object()); } window["__tuple___iter__"] = __tuple___iter__ @@ -1310,10 +1278,7 @@ __iterator__ = get_attribute(get_attribute(other, "__iter__"), "__call__")(creat try { obj = get_attribute(__iterator__, "next")(create_array(), Object()); while(true) { -var __args_5, __kwargs_5; -__args_5 = create_array(obj); -__kwargs_5 = Object(); -get_attribute(get_attribute(self, "append"), "__call__")(__args_5, __kwargs_5); +get_attribute(get_attribute(self, "append"), "__call__")([obj], Object()); obj = get_attribute(__iterator__, "next")(create_array(), Object()); } } @@ -1355,10 +1320,7 @@ arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var obj = arguments['obj']; var __array; -var __args_6, __kwargs_6; -__args_6 = create_array(obj); -__kwargs_6 = Object(); -index = get_attribute(get_attribute(self, "index"), "__call__")(__args_6, __kwargs_6); +index = get_attribute(get_attribute(self, "index"), "__call__")([obj], Object()); __array = get_attribute(self, "js_object"); __array.splice(index, 1); } @@ -1484,10 +1446,7 @@ signature = {"kwargs": Object(), "args": create_array("self")}; signature["function_name"] = "__list___iter__"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; -var __args_7, __kwargs_7; -__args_7 = create_array(self, 0); -__kwargs_7 = Object(); -return get_attribute(Iterator, "__call__")(__args_7, __kwargs_7); +return get_attribute(Iterator, "__call__")([self, 0], Object()); } window["__list___iter__"] = __list___iter__ @@ -1587,10 +1546,7 @@ i = 0; while(i < get_attribute(js_object, "length")) { var key = js_object[i]["key"]; var value = js_object[i]["value"]; -var __args_8, __kwargs_8; -__args_8 = create_array(key, value); -__kwargs_8 = Object(); -get_attribute(get_attribute(self, "set"), "__call__")(__args_8, __kwargs_8); +get_attribute(get_attribute(self, "set"), "__call__")([key, value], Object()); i += 1 } } @@ -1806,10 +1762,7 @@ __keys = Object.keys(__dict); out = get_attribute(list, "__call__")(create_array(), Object()); i = 0; while(i < get_attribute(__keys, "length")) { -var __args_9, __kwargs_9; -__args_9 = create_array(__dict[ __keys[i] ]); -__kwargs_9 = Object(); -get_attribute(get_attribute(out, "append"), "__call__")(__args_9, __kwargs_9); +get_attribute(get_attribute(out, "append"), "__call__")([__dict[ __keys[i] ]], Object()); i += 1 } return out; @@ -1865,43 +1818,16 @@ self["__dict__"]["typecode"] = typecode; self["__dict__"]["itemsize"] = get_attribute(get_attribute(self, "typecodes"), "__getitem__")([typecode], Object()); self["__dict__"]["little_endian"] = little_endian; if(initializer) { -var __args_10, __kwargs_10; -__args_10 = create_array(initializer); -__kwargs_10 = Object(); -self["__dict__"]["length"] = get_attribute(len, "__call__")(__args_10, __kwargs_10); +self["__dict__"]["length"] = get_attribute(len, "__call__")([initializer], Object()); self["__dict__"]["bytes"] = self["__dict__"]["length"] * self["__dict__"]["itemsize"]; if(self["__dict__"]["typecode"] == "float8") { -var __args_11, __kwargs_11; -__args_11 = create_array(initializer); -__kwargs_11 = Object(); -var __args_12, __kwargs_12; -__args_12 = create_array(get_attribute(min, "__call__")(__args_11, __kwargs_11)); -__kwargs_12 = Object(); -var __args_13, __kwargs_13; -__args_13 = create_array(initializer); -__kwargs_13 = Object(); -var __args_14, __kwargs_14; -__args_14 = create_array(get_attribute(list, "__call__")([], {"js_object": [get_attribute(abs, "__call__")(__args_12, __kwargs_12), get_attribute(max, "__call__")(__args_13, __kwargs_13)]})); -__kwargs_14 = Object(); -self["__dict__"]["_scale"] = get_attribute(max, "__call__")(__args_14, __kwargs_14); +self["__dict__"]["_scale"] = get_attribute(max, "__call__")([get_attribute(list, "__call__")([], {"js_object": [get_attribute(abs, "__call__")([get_attribute(min, "__call__")([initializer], Object())], Object()), get_attribute(max, "__call__")([initializer], Object())]})], Object()); self["__dict__"]["_norm_get"] = self["__dict__"]["_scale"] / 127; self["__dict__"]["_norm_set"] = 1.0 / self["__dict__"]["_norm_get"]; } else { if(self["__dict__"]["typecode"] == "float16") { -var __args_15, __kwargs_15; -__args_15 = create_array(initializer); -__kwargs_15 = Object(); -var __args_16, __kwargs_16; -__args_16 = create_array(get_attribute(min, "__call__")(__args_15, __kwargs_15)); -__kwargs_16 = Object(); -var __args_17, __kwargs_17; -__args_17 = create_array(initializer); -__kwargs_17 = Object(); -var __args_18, __kwargs_18; -__args_18 = create_array(get_attribute(list, "__call__")([], {"js_object": [get_attribute(abs, "__call__")(__args_16, __kwargs_16), get_attribute(max, "__call__")(__args_17, __kwargs_17)]})); -__kwargs_18 = Object(); -self["__dict__"]["_scale"] = get_attribute(max, "__call__")(__args_18, __kwargs_18); +self["__dict__"]["_scale"] = get_attribute(max, "__call__")([get_attribute(list, "__call__")([], {"js_object": [get_attribute(abs, "__call__")([get_attribute(min, "__call__")([initializer], Object())], Object()), get_attribute(max, "__call__")([initializer], Object())]})], Object()); self["__dict__"]["_norm_get"] = self["__dict__"]["_scale"] / 32767; self["__dict__"]["_norm_set"] = 1.0 / self["__dict__"]["_norm_get"]; } @@ -1918,10 +1844,7 @@ size = self["__dict__"]["bytes"]; buff = new ArrayBuffer(size); self["__dict__"]["dataview"] = new DataView(buff); self["__dict__"]["buffer"] = buff; -var __args_19, __kwargs_19; -__args_19 = create_array(initializer); -__kwargs_19 = Object(); -get_attribute(get_attribute(self, "fromlist"), "__call__")(__args_19, __kwargs_19); +get_attribute(get_attribute(self, "fromlist"), "__call__")([initializer], Object()); } window["__array___init__"] = __array___init__ @@ -2036,10 +1959,7 @@ signature = {"kwargs": Object(), "args": create_array("self")}; signature["function_name"] = "__array___iter__"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; -var __args_20, __kwargs_20; -__args_20 = create_array(self, 0); -__kwargs_20 = Object(); -return get_attribute(Iterator, "__call__")(__args_20, __kwargs_20); +return get_attribute(Iterator, "__call__")([self, 0], Object()); } window["__array___iter__"] = __array___iter__ @@ -2066,10 +1986,7 @@ signature["function_name"] = "__array_fromlist"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var lst = arguments['lst']; -var __args_21, __kwargs_21; -__args_21 = create_array(lst); -__kwargs_21 = Object(); -length = get_attribute(len, "__call__")(__args_21, __kwargs_21); +length = get_attribute(len, "__call__")([lst], Object()); step = self["__dict__"]["itemsize"]; typecode = self["__dict__"]["typecode"]; size = length * step; @@ -2137,10 +2054,7 @@ arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var value = arguments['value']; length = self["__dict__"]["length"]; -var __args_22, __kwargs_22; -__args_22 = create_array(self["__dict__"]["length"] + 1); -__kwargs_22 = Object(); -get_attribute(get_attribute(self, "resize"), "__call__")(__args_22, __kwargs_22); +get_attribute(get_attribute(self, "resize"), "__call__")([self["__dict__"]["length"] + 1], Object()); get_attribute(get_attribute(self, "__setitem__"), "__call__")([length, value], Object()); } window["__array_append"] = __array_append @@ -2159,10 +2073,7 @@ __iterator__ = get_attribute(get_attribute(lst, "__iter__"), "__call__")(create_ try { value = get_attribute(__iterator__, "next")(create_array(), Object()); while(true) { -var __args_23, __kwargs_23; -__args_23 = create_array(value); -__kwargs_23 = Object(); -get_attribute(get_attribute(self, "append"), "__call__")(__args_23, __kwargs_23); +get_attribute(get_attribute(self, "append"), "__call__")([value], Object()); value = get_attribute(__iterator__, "next")(create_array(), Object()); } } diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index 0a0dafd..53aab1c 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -589,7 +589,8 @@ def visit_Compare(self, node): else: comp.append( ' and ' ) a = ( self.visit(node.comparators[i]), left ) - if self._with_js: + if self._with_js: ## this makes "if 'x' in Array" work like Python: "if 'x' in list" - TODO fix this for js-objects + comp.append( '%s in %s or' %(a[1], a[0]) ) ## this is ugly, but it works comp.append( "%s['__contains__'](%s)" %a ) else: comp.append( "get_attribute(get_attribute(%s, '__contains__'), '__call__')([%s], JSObject())" %a ) diff --git a/runtime/builtins.py b/runtime/builtins.py index 7c6a7e4..2b48c97 100644 --- a/runtime/builtins.py +++ b/runtime/builtins.py @@ -114,18 +114,18 @@ def func(): _setup_array_prototype() -def _setup_object_prototype(): - - with javascript: - - @Object.prototype.__contains__ - def func(a): - if JS("a in this"): ## JS() so that we don't call __contains__ again - return True - else: - return False - -_setup_object_prototype() +#def _setup_object_prototype(): ## TODO fix code that had used with-javascript: if 'x' in ob +# +# with javascript: +# +# @Object.prototype.__contains__ +# def func(a): +# if JS("a in this"): ## JS() so that we don't call __contains__ again +# return True +# else: +# return False +# +#_setup_object_prototype() ## this is not safe with external libraries like ace.js def range(num): diff --git a/tests/server.py b/tests/server.py index 04dcde5..4b3dfbb 100755 --- a/tests/server.py +++ b/tests/server.py @@ -236,7 +236,12 @@ def get(self, path=None): 'droid_sans_bold.typeface.js' : os.path.expanduser( '~/three.js/examples/fonts/droid/droid_sans_bold.typeface.js'), 'droid_serif_regular.typeface.js' : os.path.expanduser( '~/three.js/examples/fonts/droid/droid_serif_regular.typeface.js'), 'droid_serif_bold.typeface.js' : os.path.expanduser( '~/three.js/examples/fonts/droid/droid_serif_bold.typeface.js'), - } + }, + ace = { + 'ace.js': os.path.expanduser( '~/ace-builds/src-noconflict/ace.js'), + 'theme-monokai.js':os.path.expanduser( '~/ace-builds/src-noconflict/theme-monokai.js'), + 'mode-python.js':os.path.expanduser( '~/ace-builds/src-noconflict/mode-python.js'), + }, ) class LibsHandler( tornado.web.RequestHandler ): diff --git a/tests/test_websocket_ace_editor.html b/tests/test_websocket_ace_editor.html new file mode 100644 index 0000000..05e4349 --- /dev/null +++ b/tests/test_websocket_ace_editor.html @@ -0,0 +1,91 @@ + + + + + + + + + + + + + +

    Python Input

    +
    +a = [] +for i in range(10): + a.append( i*i ) + +print a +
    + +

    + + +

    + +

    JavaScript Output

    + + + + + + \ No newline at end of file From e348c64333f6774cd40cccacb70942f5c9dfbb0c Mon Sep 17 00:00:00 2001 From: hartsantler Date: Sun, 20 Oct 2013 00:25:27 -0700 Subject: [PATCH 157/860] added three.js simple code editor using ace.js --- tests/test_websocket_ace_editor.html | 30 +++- tests/threejs_code_editor.html | 214 +++++++++++++++++++++++++++ 2 files changed, 236 insertions(+), 8 deletions(-) create mode 100644 tests/threejs_code_editor.html diff --git a/tests/test_websocket_ace_editor.html b/tests/test_websocket_ace_editor.html index 05e4349..f6612de 100644 --- a/tests/test_websocket_ace_editor.html +++ b/tests/test_websocket_ace_editor.html @@ -2,13 +2,25 @@ @@ -62,7 +74,8 @@ -

    Python Input

    +

    PythonJS Editor

    +
    a = [] for i in range(10): @@ -71,21 +84,22 @@

    Python Input

    print a
    + +

    -

    JavaScript Output

    - + \ No newline at end of file diff --git a/tests/threejs_code_editor.html b/tests/threejs_code_editor.html new file mode 100644 index 0000000..aaa9e6f --- /dev/null +++ b/tests/threejs_code_editor.html @@ -0,0 +1,214 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    PythonJS Editor

    + +
    +from three import * +from random import random + +Meshes = [] + +def test(): + global ren, scn, cam, mesh, txtmesh + + div = document.getElementById( 'THREE_container' ) + if div.firstChild: + div.removeChild( div.firstChild ) + + width = 1090; height = 240 + scn = Scene() + cam = PerspectiveCamera( 45, width/height, 0.01, 10000) + cam.position.z = 100 + cam.position.x = 5 + + ren = WebGLRenderer() + ren.setSize( width, height ) + ren.setClearColor( red=0.7, green=0.7, blue=0.7 ) + + div.appendChild( ren.domElement ) + + light = PointLight() + light.position.set( 0, 100, 90 ) + scn.add( light ) + + geo = CubeGeometry( 10, 10, 10 ) + mat = MeshBasicMaterial( + color={'red':0.0, 'green':0.0, 'blue':0.0}, + wireframe=True, + wireframeLinewidth=2 + ) + mesh = Mesh( geo, mat ) + mesh.position.y = -10 + scn.add( mesh ) + + + for i in range(2): + if i == 0: + mat = MeshLambertMaterial( + color = {'red':0.3, 'green':0.3, 'blue':0.3}, + emissive = {'red':0.6, 'green':0.1, 'blue':0.1} + ) + elif i == 1: + mat = MeshPhongMaterial( + color = {'red':random(), 'green':random(), 'blue':random()}, + emissive = {'red':0.1, 'green':0.5, 'blue':0.1}, + specular = {'red':0.1, 'green':0.5, 'blue':0.9}, + shininess = 50, + perPixel = True, + metal = True, + ) + + geo = CubeGeometry( 10, 20, 10 ) + m = Mesh( geo, mat ) + scn.add( m ) + Meshes.append( m ) + if i == 0: m.position.x = -150 + else: m.position.x = 150 + + txtgeo = TextGeometry( 'PythonJS', size=15, height=3.5 ) + txtmat = MeshPhongMaterial( color={'red':1.0, 'green':1.0, 'blue':1.0}, wireframe=False ) + txtmesh = Mesh( txtgeo, txtmat ) + scn.add( txtmesh ) + + animate() + + +def animate(): + requestAnimationFrame( animate ) + + txtmesh.rotation.y = txtmesh.rotation.y - 0.01 + + for m in Meshes: + m.rotation.x = m.rotation.x + 0.02 + m.rotation.y = m.rotation.y + 0.01 + + x = m.quaternion.x + y = m.quaternion.y + z = m.quaternion.z + m.material.color.setRGB( x,y,z ) + + mesh.rotation.x = mesh.rotation.x + 0.01 + mesh.rotation.y = mesh.rotation.y + 0.02 + + x = mesh.quaternion.x + y = mesh.quaternion.y + z = mesh.quaternion.z + mesh.material.color.setRGB( x,y,z ) + + ren.render( scn, cam ) +
    + + + +

    + + + +

    + + + + + +
    +
    + + + \ No newline at end of file From 4e01792dde131645c53003b72c25de82e9045e2c Mon Sep 17 00:00:00 2001 From: Amirouche Boubekki Date: Sun, 20 Oct 2013 14:56:04 +0200 Subject: [PATCH 158/860] Python3 compatibility fix --- pythonscript/pythonscript.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pythonscript/pythonscript.py b/pythonscript/pythonscript.py index d6cdfb1..8232a02 100755 --- a/pythonscript/pythonscript.py +++ b/pythonscript/pythonscript.py @@ -10,7 +10,7 @@ def main(script): def command(): - print main(sys.stdin.read()) + print(main(sys.stdin.read())) if __name__ == '__main__': From 51def420e54014e886aec87a8095535905e3f52c Mon Sep 17 00:00:00 2001 From: Amirouche Boubekki Date: Sun, 20 Oct 2013 15:09:48 +0200 Subject: [PATCH 159/860] automatic unittest suite --- bindings/jquery.py.js | 1038 +++++++++-------- pythonscript.js | 13 +- pythonscript/pythonscript.py | 4 +- runtests.py | 50 + unittests/0001-simple-function-call.py | 5 + .../0001-simple-function-call.py.expected | 2 + .../0002-full-signature-function-call.py | 12 + ...2-full-signature-function-call.py.expected | 12 + unittests/0003-for-loop.py | 2 + unittests/0003-for-loop.py.expected | 10 + unittests/0004-try-except.py | 4 + unittests/0004-try-except.py.expected | 1 + unittests/0005-simple-generator.py | 6 + unittests/0005-simple-generator.py.expected | 5 + unittests/unittests | 6 + 15 files changed, 695 insertions(+), 475 deletions(-) create mode 100755 runtests.py create mode 100644 unittests/0001-simple-function-call.py create mode 100644 unittests/0001-simple-function-call.py.expected create mode 100644 unittests/0002-full-signature-function-call.py create mode 100644 unittests/0002-full-signature-function-call.py.expected create mode 100644 unittests/0003-for-loop.py create mode 100644 unittests/0003-for-loop.py.expected create mode 100644 unittests/0004-try-except.py create mode 100644 unittests/0004-try-except.py.expected create mode 100644 unittests/0005-simple-generator.py create mode 100644 unittests/0005-simple-generator.py.expected create mode 100644 unittests/unittests diff --git a/bindings/jquery.py.js b/bindings/jquery.py.js index ce8614a..69e1369 100644 --- a/bindings/jquery.py.js +++ b/bindings/jquery.py.js @@ -1,117 +1,129 @@ var J, __J_attrs, __J_parents; -__J_attrs = Object(); -__J_parents = create_array(); +window["__J_attrs"] = Object(); +window["__J_parents"] = create_array(); +window["__J_properties"] = Object(); var __J___init__ = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "arg")}; +signature["function_name"] = "__J___init__"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var arg = arguments['arg']; -set_attribute(self, "j", jQuery(arg)); +self["__dict__"]["j"] = jQuery(arg); } +window["__J___init__"] = __J___init__ -__J_attrs.__init__ = __J___init__; +__J___init__.pythonscript_function = true; +window["__J_attrs"]["__init__"] = __J___init__; var __J_add = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "arg")}; +signature["function_name"] = "__J_add"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var arg = arguments['arg']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.add(arg); -var __args_0, __kwargs_0; -__args_0 = create_array(o); -__kwargs_0 = Object(); -return get_attribute(J, "__call__")(__args_0, __kwargs_0); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_add"] = __J_add -__J_attrs.add = __J_add; +__J_add.pythonscript_function = true; +window["__J_attrs"]["add"] = __J_add; var __J_add_class = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "klass")}; +signature["function_name"] = "__J_add_class"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var klass = arguments['klass']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.addClass(klass); -var __args_1, __kwargs_1; -__args_1 = create_array(o); -__kwargs_1 = Object(); -return get_attribute(J, "__call__")(__args_1, __kwargs_1); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_add_class"] = __J_add_class -__J_attrs.add_class = __J_add_class; +__J_add_class.pythonscript_function = true; +window["__J_attrs"]["add_class"] = __J_add_class; var __J_after = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "arg")}; +signature["function_name"] = "__J_after"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var arg = arguments['arg']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.after(arg); -var __args_2, __kwargs_2; -__args_2 = create_array(o); -__kwargs_2 = Object(); -return get_attribute(J, "__call__")(__args_2, __kwargs_2); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_after"] = __J_after -__J_attrs.after = __J_after; +__J_after.pythonscript_function = true; +window["__J_attrs"]["after"] = __J_after; var __J_animate = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "properties", "duration", "easing", "complete")}; +signature["function_name"] = "__J_animate"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var properties = arguments['properties']; var duration = arguments['duration']; var easing = arguments['easing']; var complete = arguments['complete']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.animate(properties, duration, easing, complete); -var __args_3, __kwargs_3; -__args_3 = create_array(o); -__kwargs_3 = Object(); -return get_attribute(J, "__call__")(__args_3, __kwargs_3); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_animate"] = __J_animate -__J_attrs.animate = __J_animate; +__J_animate.pythonscript_function = true; +window["__J_attrs"]["animate"] = __J_animate; var __J_append = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "arg")}; +signature["function_name"] = "__J_append"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var arg = arguments['arg']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.append(arg); -var __args_4, __kwargs_4; -__args_4 = create_array(o); -__kwargs_4 = Object(); -return get_attribute(J, "__call__")(__args_4, __kwargs_4); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_append"] = __J_append -__J_attrs.append = __J_append; +__J_append.pythonscript_function = true; +window["__J_attrs"]["append"] = __J_append; var __J_append_to = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "arg")}; +signature["function_name"] = "__J_append_to"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var arg = arguments['arg']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.appendTo(arg); -var __args_5, __kwargs_5; -__args_5 = create_array(o); -__kwargs_5 = Object(); -return get_attribute(J, "__call__")(__args_5, __kwargs_5); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_append_to"] = __J_append_to -__J_attrs.append_to = __J_append_to; +__J_append_to.pythonscript_function = true; +window["__J_attrs"]["append_to"] = __J_append_to; var __J_attr = function(args, kwargs) { +var j; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "key", "value")}; +signature["function_name"] = "__J_attr"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var key = arguments['key']; var value = arguments['value']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; if(value == undefined) { j.attr(key); } @@ -120,537 +132,576 @@ j.attr(key, value); } } +window["__J_attr"] = __J_attr -__J_attrs.attr = __J_attr; +__J_attr.pythonscript_function = true; +window["__J_attrs"]["attr"] = __J_attr; var __J_before = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "arg")}; +signature["function_name"] = "__J_before"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var arg = arguments['arg']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.before(arg); -var __args_6, __kwargs_6; -__args_6 = create_array(o); -__kwargs_6 = Object(); -return get_attribute(J, "__call__")(__args_6, __kwargs_6); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_before"] = __J_before -__J_attrs.before = __J_before; +__J_before.pythonscript_function = true; +window["__J_attrs"]["before"] = __J_before; var __J_bind = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "event_type", "event_data", "handler")}; +signature["function_name"] = "__J_bind"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var event_type = arguments['event_type']; var event_data = arguments['event_data']; var handler = arguments['handler']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.bind(event_type, event_data, adapt_arguments(handler)); -var __args_7, __kwargs_7; -__args_7 = create_array(o); -__kwargs_7 = Object(); -return get_attribute(J, "__call__")(__args_7, __kwargs_7); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_bind"] = __J_bind -__J_attrs.bind = __J_bind; +__J_bind.pythonscript_function = true; +window["__J_attrs"]["bind"] = __J_bind; var __J_blur = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "handler")}; +signature["function_name"] = "__J_blur"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.blur(adapt_arguments(handler)); -var __args_8, __kwargs_8; -__args_8 = create_array(o); -__kwargs_8 = Object(); -return get_attribute(J, "__call__")(__args_8, __kwargs_8); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_blur"] = __J_blur -__J_attrs.blur = __J_blur; +__J_blur.pythonscript_function = true; +window["__J_attrs"]["blur"] = __J_blur; var __J_change = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "handler")}; +signature["function_name"] = "__J_change"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.change(adapt_arguments(handler)); -var __args_9, __kwargs_9; -__args_9 = create_array(o); -__kwargs_9 = Object(); -return get_attribute(J, "__call__")(__args_9, __kwargs_9); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_change"] = __J_change -__J_attrs.change = __J_change; +__J_change.pythonscript_function = true; +window["__J_attrs"]["change"] = __J_change; var __J_children = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "selector")}; +signature["function_name"] = "__J_children"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var selector = arguments['selector']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.children(selector); -var __args_10, __kwargs_10; -__args_10 = create_array(o); -__kwargs_10 = Object(); -return get_attribute(J, "__call__")(__args_10, __kwargs_10); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_children"] = __J_children -__J_attrs.children = __J_children; +__J_children.pythonscript_function = true; +window["__J_attrs"]["children"] = __J_children; var __J_click = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "handler")}; +signature["function_name"] = "__J_click"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.click(adapt_arguments(handler)); -var __args_11, __kwargs_11; -__args_11 = create_array(o); -__kwargs_11 = Object(); -return get_attribute(J, "__call__")(__args_11, __kwargs_11); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_click"] = __J_click -__J_attrs.click = __J_click; +__J_click.pythonscript_function = true; +window["__J_attrs"]["click"] = __J_click; var __J_clone = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "with_data_and_events")}; +signature["function_name"] = "__J_clone"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var with_data_and_events = arguments['with_data_and_events']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.clone(with_data_and_events); -var __args_12, __kwargs_12; -__args_12 = create_array(o); -__kwargs_12 = Object(); -return get_attribute(J, "__call__")(__args_12, __kwargs_12); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_clone"] = __J_clone -__J_attrs.clone = __J_clone; +__J_clone.pythonscript_function = true; +window["__J_attrs"]["clone"] = __J_clone; var __J_contents = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "e")}; +signature["function_name"] = "__J_contents"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var e = arguments['e']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.contents(); -var __args_13, __kwargs_13; -__args_13 = create_array(o); -__kwargs_13 = Object(); -return get_attribute(J, "__call__")(__args_13, __kwargs_13); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_contents"] = __J_contents -__J_attrs.contents = __J_contents; +__J_contents.pythonscript_function = true; +window["__J_attrs"]["contents"] = __J_contents; var __J_css = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "name", "value")}; +signature["function_name"] = "__J_css"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var name = arguments['name']; var value = arguments['value']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.css(name, value); -var __args_14, __kwargs_14; -__args_14 = create_array(o); -__kwargs_14 = Object(); -return get_attribute(J, "__call__")(__args_14, __kwargs_14); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_css"] = __J_css -__J_attrs.css = __J_css; +__J_css.pythonscript_function = true; +window["__J_attrs"]["css"] = __J_css; var __J_data = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "key", "value")}; +signature["function_name"] = "__J_data"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var key = arguments['key']; var value = arguments['value']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.data(key, value); -var __args_15, __kwargs_15; -__args_15 = create_array(o); -__kwargs_15 = Object(); -return get_attribute(J, "__call__")(__args_15, __kwargs_15); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_data"] = __J_data -__J_attrs.data = __J_data; +__J_data.pythonscript_function = true; +window["__J_attrs"]["data"] = __J_data; var __J_double_click = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "handler")}; +signature["function_name"] = "__J_double_click"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.dbclick(adapt_arguments(handler)); -var __args_16, __kwargs_16; -__args_16 = create_array(o); -__kwargs_16 = Object(); -return get_attribute(J, "__call__")(__args_16, __kwargs_16); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_double_click"] = __J_double_click -__J_attrs.double_click = __J_double_click; +__J_double_click.pythonscript_function = true; +window["__J_attrs"]["double_click"] = __J_double_click; var __J_delay = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "time", "queue_name")}; +signature["function_name"] = "__J_delay"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var time = arguments['time']; var queue_name = arguments['queue_name']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.delay(time, queue_name); -var __args_17, __kwargs_17; -__args_17 = create_array(o); -__kwargs_17 = Object(); -return get_attribute(J, "__call__")(__args_17, __kwargs_17); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_delay"] = __J_delay -__J_attrs.delay = __J_delay; +__J_delay.pythonscript_function = true; +window["__J_attrs"]["delay"] = __J_delay; var __J_dequeue = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "queue_name")}; +signature["function_name"] = "__J_dequeue"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var queue_name = arguments['queue_name']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.dequeue(queue_name); -var __args_18, __kwargs_18; -__args_18 = create_array(o); -__kwargs_18 = Object(); -return get_attribute(J, "__call__")(__args_18, __kwargs_18); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_dequeue"] = __J_dequeue -__J_attrs.dequeue = __J_dequeue; +__J_dequeue.pythonscript_function = true; +window["__J_attrs"]["dequeue"] = __J_dequeue; var __J_detach = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "selector")}; +signature["function_name"] = "__J_detach"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var selector = arguments['selector']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.detach(selector); -var __args_19, __kwargs_19; -__args_19 = create_array(o); -__kwargs_19 = Object(); -return get_attribute(J, "__call__")(__args_19, __kwargs_19); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_detach"] = __J_detach -__J_attrs.detach = __J_detach; +__J_detach.pythonscript_function = true; +window["__J_attrs"]["detach"] = __J_detach; var __J_each = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "handler")}; +signature["function_name"] = "__J_each"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; -j = get_attribute(self, "j"); +"Iterate over a jQuery object, executing a function for each matched element that takes index and element (js object) as argument"; +j = self["__dict__"]["j"]; o = j.each(adapt_arguments(handler)); -var __args_20, __kwargs_20; -__args_20 = create_array(o); -__kwargs_20 = Object(); -return get_attribute(J, "__call__")(__args_20, __kwargs_20); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_each"] = __J_each -__J_attrs.each = __J_each; +__J_each.pythonscript_function = true; +window["__J_attrs"]["each"] = __J_each; var __J_end = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "handler")}; +signature["function_name"] = "__J_end"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.end(handler); -var __args_21, __kwargs_21; -__args_21 = create_array(o); -__kwargs_21 = Object(); -return get_attribute(J, "__call__")(__args_21, __kwargs_21); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_end"] = __J_end -__J_attrs.end = __J_end; +__J_end.pythonscript_function = true; +window["__J_attrs"]["end"] = __J_end; var __J_eq = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "index")}; +signature["function_name"] = "__J_eq"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var index = arguments['index']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.eq(index); -var __args_22, __kwargs_22; -__args_22 = create_array(o); -__kwargs_22 = Object(); -return get_attribute(J, "__call__")(__args_22, __kwargs_22); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_eq"] = __J_eq -__J_attrs.eq = __J_eq; +__J_eq.pythonscript_function = true; +window["__J_attrs"]["eq"] = __J_eq; var __J_error = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "handler")}; +signature["function_name"] = "__J_error"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.error(adapt_arguments(handler)); -var __args_23, __kwargs_23; -__args_23 = create_array(o); -__kwargs_23 = Object(); -return get_attribute(J, "__call__")(__args_23, __kwargs_23); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_error"] = __J_error -__J_attrs.error = __J_error; +__J_error.pythonscript_function = true; +window["__J_attrs"]["error"] = __J_error; var __J_fade_in = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "duration", "complete")}; +signature["function_name"] = "__J_fade_in"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var duration = arguments['duration']; var complete = arguments['complete']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.fadeIn(duration, complete); -var __args_24, __kwargs_24; -__args_24 = create_array(o); -__kwargs_24 = Object(); -return get_attribute(J, "__call__")(__args_24, __kwargs_24); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_fade_in"] = __J_fade_in -__J_attrs.fade_in = __J_fade_in; +__J_fade_in.pythonscript_function = true; +window["__J_attrs"]["fade_in"] = __J_fade_in; var __J_fade_out = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "duration", "complete")}; +signature["function_name"] = "__J_fade_out"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var duration = arguments['duration']; var complete = arguments['complete']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.fadeOut(duration, adapt_arguments(complete)); -var __args_25, __kwargs_25; -__args_25 = create_array(o); -__kwargs_25 = Object(); -return get_attribute(J, "__call__")(__args_25, __kwargs_25); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_fade_out"] = __J_fade_out -__J_attrs.fade_out = __J_fade_out; +__J_fade_out.pythonscript_function = true; +window["__J_attrs"]["fade_out"] = __J_fade_out; var __J_fadeTo = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "duration", "opacity", "complete")}; +signature["function_name"] = "__J_fadeTo"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var duration = arguments['duration']; var opacity = arguments['opacity']; var complete = arguments['complete']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.fade_to(duration, opacity, adapt_arguments(complete)); -var __args_26, __kwargs_26; -__args_26 = create_array(o); -__kwargs_26 = Object(); -return get_attribute(J, "__call__")(__args_26, __kwargs_26); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_fadeTo"] = __J_fadeTo -__J_attrs.fadeTo = __J_fadeTo; +__J_fadeTo.pythonscript_function = true; +window["__J_attrs"]["fadeTo"] = __J_fadeTo; var __J_fade_toggle = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "duration", "easing", "complete")}; +signature["function_name"] = "__J_fade_toggle"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var duration = arguments['duration']; var easing = arguments['easing']; var complete = arguments['complete']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.fade_toggle(duration, easing, complete); -var __args_27, __kwargs_27; -__args_27 = create_array(o); -__kwargs_27 = Object(); -return get_attribute(J, "__call__")(__args_27, __kwargs_27); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_fade_toggle"] = __J_fade_toggle -__J_attrs.fade_toggle = __J_fade_toggle; +__J_fade_toggle.pythonscript_function = true; +window["__J_attrs"]["fade_toggle"] = __J_fade_toggle; var __J_filter = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "selector")}; +signature["function_name"] = "__J_filter"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var selector = arguments['selector']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.filter(selector); -var __args_28, __kwargs_28; -__args_28 = create_array(o); -__kwargs_28 = Object(); -return get_attribute(J, "__call__")(__args_28, __kwargs_28); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_filter"] = __J_filter -__J_attrs.filter = __J_filter; +__J_filter.pythonscript_function = true; +window["__J_attrs"]["filter"] = __J_filter; var __J_finish = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "queue")}; +signature["function_name"] = "__J_finish"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var queue = arguments['queue']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.finish(queue); -var __args_29, __kwargs_29; -__args_29 = create_array(o); -__kwargs_29 = Object(); -return get_attribute(J, "__call__")(__args_29, __kwargs_29); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_finish"] = __J_finish -__J_attrs.finish = __J_finish; +__J_finish.pythonscript_function = true; +window["__J_attrs"]["finish"] = __J_finish; var __J_find = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "selector")}; +signature["function_name"] = "__J_find"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var selector = arguments['selector']; var j, o; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.find(selector); -var __args_30, __kwargs_30; -__args_30 = create_array(o); -__kwargs_30 = Object(); -return get_attribute(J, "__call__")(__args_30, __kwargs_30); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_find"] = __J_find -__J_attrs.find = __J_find; +__J_find.pythonscript_function = true; +window["__J_attrs"]["find"] = __J_find; var __J_first = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self")}; +signature["function_name"] = "__J_first"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.first(); -var __args_31, __kwargs_31; -__args_31 = create_array(o); -__kwargs_31 = Object(); -return get_attribute(J, "__call__")(__args_31, __kwargs_31); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_first"] = __J_first -__J_attrs.first = __J_first; +__J_first.pythonscript_function = true; +window["__J_attrs"]["first"] = __J_first; var __J_focus = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "handler")}; +signature["function_name"] = "__J_focus"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.focus(adapt_arguments(handler)); -var __args_32, __kwargs_32; -__args_32 = create_array(o); -__kwargs_32 = Object(); -return get_attribute(J, "__call__")(__args_32, __kwargs_32); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_focus"] = __J_focus -__J_attrs.focus = __J_focus; +__J_focus.pythonscript_function = true; +window["__J_attrs"]["focus"] = __J_focus; var __J_focus_in = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "handler")}; +signature["function_name"] = "__J_focus_in"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.focusIn(adapt_arguments(handler)); -var __args_33, __kwargs_33; -__args_33 = create_array(o); -__kwargs_33 = Object(); -return get_attribute(J, "__call__")(__args_33, __kwargs_33); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_focus_in"] = __J_focus_in -__J_attrs.focus_in = __J_focus_in; +__J_focus_in.pythonscript_function = true; +window["__J_attrs"]["focus_in"] = __J_focus_in; var __J_focus_out = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "handler")}; +signature["function_name"] = "__J_focus_out"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.focusOut(adapt_arguments(handler)); -var __args_34, __kwargs_34; -__args_34 = create_array(o); -__kwargs_34 = Object(); -return get_attribute(J, "__call__")(__args_34, __kwargs_34); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_focus_out"] = __J_focus_out -__J_attrs.focus_out = __J_focus_out; +__J_focus_out.pythonscript_function = true; +window["__J_attrs"]["focus_out"] = __J_focus_out; var __J_get = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "index")}; +signature["function_name"] = "__J_get"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var index = arguments['index']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.get(index); -var __args_35, __kwargs_35; -__args_35 = create_array(o); -__kwargs_35 = Object(); -return get_attribute(J, "__call__")(__args_35, __kwargs_35); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_get"] = __J_get -__J_attrs.get = __J_get; +__J_get.pythonscript_function = true; +window["__J_attrs"]["get"] = __J_get; var __J_has_class = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "name")}; +signature["function_name"] = "__J_has_class"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var name = arguments['name']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.has_class(selector); -var __args_36, __kwargs_36; -__args_36 = create_array(o); -__kwargs_36 = Object(); -return get_attribute(J, "__call__")(__args_36, __kwargs_36); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_has_class"] = __J_has_class -__J_attrs.has_class = __J_has_class; +__J_has_class.pythonscript_function = true; +window["__J_attrs"]["has_class"] = __J_has_class; var __J_height = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "value")}; +signature["function_name"] = "__J_height"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var value = arguments['value']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.height(value); -var __args_37, __kwargs_37; -__args_37 = create_array(o); -__kwargs_37 = Object(); -return get_attribute(J, "__call__")(__args_37, __kwargs_37); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_height"] = __J_height -__J_attrs.height = __J_height; +__J_height.pythonscript_function = true; +window["__J_attrs"]["height"] = __J_height; var __J_hide = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "duration", "complete")}; +signature["function_name"] = "__J_hide"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var duration = arguments['duration']; var complete = arguments['complete']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.hide(duration, complete); -var __args_38, __kwargs_38; -__args_38 = create_array(o); -__kwargs_38 = Object(); -return get_attribute(J, "__call__")(__args_38, __kwargs_38); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_hide"] = __J_hide -__J_attrs.hide = __J_hide; +__J_hide.pythonscript_function = true; +window["__J_attrs"]["hide"] = __J_hide; var __J_hover = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "handler")}; +signature["function_name"] = "__J_hover"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.hover(adapt_arguments(handler)); -var __args_39, __kwargs_39; -__args_39 = create_array(o); -__kwargs_39 = Object(); -return get_attribute(J, "__call__")(__args_39, __kwargs_39); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_hover"] = __J_hover -__J_attrs.hover = __J_hover; +__J_hover.pythonscript_function = true; +window["__J_attrs"]["hover"] = __J_hover; var __J_html = function(args, kwargs) { +var j; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "value")}; +signature["function_name"] = "__J_html"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var value = arguments['value']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; if(value != undefined) { o = j.html(value); } @@ -660,357 +711,380 @@ o = j.html(); return o; } +window["__J_html"] = __J_html -__J_attrs.html = __J_html; +__J_html.pythonscript_function = true; +window["__J_attrs"]["html"] = __J_html; var __J_index = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "selector")}; +signature["function_name"] = "__J_index"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var selector = arguments['selector']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.index(selector); -var __args_40, __kwargs_40; -__args_40 = create_array(o); -__kwargs_40 = Object(); -return get_attribute(J, "__call__")(__args_40, __kwargs_40); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_index"] = __J_index -__J_attrs.index = __J_index; +__J_index.pythonscript_function = true; +window["__J_attrs"]["index"] = __J_index; var __J_inner_height = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self")}; +signature["function_name"] = "__J_inner_height"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.innerHeight(); -var __args_41, __kwargs_41; -__args_41 = create_array(o); -__kwargs_41 = Object(); -return get_attribute(J, "__call__")(__args_41, __kwargs_41); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_inner_height"] = __J_inner_height -__J_attrs.inner_height = __J_inner_height; +__J_inner_height.pythonscript_function = true; +window["__J_attrs"]["inner_height"] = __J_inner_height; var __J_inner_width = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self")}; +signature["function_name"] = "__J_inner_width"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.innerWidth(); -var __args_42, __kwargs_42; -__args_42 = create_array(o); -__kwargs_42 = Object(); -return get_attribute(J, "__call__")(__args_42, __kwargs_42); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_inner_width"] = __J_inner_width -__J_attrs.inner_width = __J_inner_width; +__J_inner_width.pythonscript_function = true; +window["__J_attrs"]["inner_width"] = __J_inner_width; var __J_insert_after = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "target")}; +signature["function_name"] = "__J_insert_after"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var target = arguments['target']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.insertAfter(target); -var __args_43, __kwargs_43; -__args_43 = create_array(o); -__kwargs_43 = Object(); -return get_attribute(J, "__call__")(__args_43, __kwargs_43); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_insert_after"] = __J_insert_after -__J_attrs.insert_after = __J_insert_after; +__J_insert_after.pythonscript_function = true; +window["__J_attrs"]["insert_after"] = __J_insert_after; var __J_insert_before = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "target")}; +signature["function_name"] = "__J_insert_before"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var target = arguments['target']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.insertBefore(selector); -var __args_44, __kwargs_44; -__args_44 = create_array(o); -__kwargs_44 = Object(); -return get_attribute(J, "__call__")(__args_44, __kwargs_44); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_insert_before"] = __J_insert_before -__J_attrs.insert_before = __J_insert_before; +__J_insert_before.pythonscript_function = true; +window["__J_attrs"]["insert_before"] = __J_insert_before; var __J_is_ = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "name")}; +signature["function_name"] = "__J_is_"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var name = arguments['name']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.is(selector); -var __args_45, __kwargs_45; -__args_45 = create_array(o); -__kwargs_45 = Object(); -return get_attribute(J, "__call__")(__args_45, __kwargs_45); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_is_"] = __J_is_ -__J_attrs.is_ = __J_is_; +__J_is_.pythonscript_function = true; +window["__J_attrs"]["is_"] = __J_is_; var __J_keydown = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "handler")}; +signature["function_name"] = "__J_keydown"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.keydown(adapt_arguments(handler)); -var __args_46, __kwargs_46; -__args_46 = create_array(o); -__kwargs_46 = Object(); -return get_attribute(J, "__call__")(__args_46, __kwargs_46); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_keydown"] = __J_keydown -__J_attrs.keydown = __J_keydown; +__J_keydown.pythonscript_function = true; +window["__J_attrs"]["keydown"] = __J_keydown; var __J_keypress = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "handler")}; +signature["function_name"] = "__J_keypress"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.keypress(adapt_arguments(handler)); -var __args_47, __kwargs_47; -__args_47 = create_array(o); -__kwargs_47 = Object(); -return get_attribute(J, "__call__")(__args_47, __kwargs_47); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_keypress"] = __J_keypress -__J_attrs.keypress = __J_keypress; +__J_keypress.pythonscript_function = true; +window["__J_attrs"]["keypress"] = __J_keypress; var __J_keyup = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "handler")}; +signature["function_name"] = "__J_keyup"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.keyup(adapt_arguments(handler)); -var __args_48, __kwargs_48; -__args_48 = create_array(o); -__kwargs_48 = Object(); -return get_attribute(J, "__call__")(__args_48, __kwargs_48); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_keyup"] = __J_keyup -__J_attrs.keyup = __J_keyup; +__J_keyup.pythonscript_function = true; +window["__J_attrs"]["keyup"] = __J_keyup; var __J_last = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "handler")}; +signature["function_name"] = "__J_last"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.last(adapt_arguments(handler)); -var __args_49, __kwargs_49; -__args_49 = create_array(o); -__kwargs_49 = Object(); -return get_attribute(J, "__call__")(__args_49, __kwargs_49); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_last"] = __J_last -__J_attrs.last = __J_last; +__J_last.pythonscript_function = true; +window["__J_attrs"]["last"] = __J_last; var __J_on = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "event", "handler")}; +signature["function_name"] = "__J_on"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var event = arguments['event']; var handler = arguments['handler']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.on(event, adapt_arguments(handler)); -var __args_50, __kwargs_50; -__args_50 = create_array(o); -__kwargs_50 = Object(); -return get_attribute(J, "__call__")(__args_50, __kwargs_50); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_on"] = __J_on -__J_attrs.on = __J_on; +__J_on.pythonscript_function = true; +window["__J_attrs"]["on"] = __J_on; var __J_load = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "url", "data", "complete")}; +signature["function_name"] = "__J_load"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var url = arguments['url']; var data = arguments['data']; var complete = arguments['complete']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.load(url, data, complete); -var __args_51, __kwargs_51; -__args_51 = create_array(o); -__kwargs_51 = Object(); -return get_attribute(J, "__call__")(__args_51, __kwargs_51); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_load"] = __J_load -__J_attrs.load = __J_load; +__J_load.pythonscript_function = true; +window["__J_attrs"]["load"] = __J_load; var __J_select = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "handler")}; +signature["function_name"] = "__J_select"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.select(adapt_arguments(handler)); -var __args_52, __kwargs_52; -__args_52 = create_array(o); -__kwargs_52 = Object(); -return get_attribute(J, "__call__")(__args_52, __kwargs_52); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_select"] = __J_select -__J_attrs.select = __J_select; +__J_select.pythonscript_function = true; +window["__J_attrs"]["select"] = __J_select; var __J_show = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "duration", "complete")}; +signature["function_name"] = "__J_show"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var duration = arguments['duration']; var complete = arguments['complete']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.show(duration, complete); -var __args_53, __kwargs_53; -__args_53 = create_array(o); -__kwargs_53 = Object(); -return get_attribute(J, "__call__")(__args_53, __kwargs_53); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_show"] = __J_show -__J_attrs.show = __J_show; +__J_show.pythonscript_function = true; +window["__J_attrs"]["show"] = __J_show; var __J_siblings = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "selector")}; +signature["function_name"] = "__J_siblings"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var selector = arguments['selector']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.select(adapt_arguments(handler)); -var __args_54, __kwargs_54; -__args_54 = create_array(o); -__kwargs_54 = Object(); -return get_attribute(J, "__call__")(__args_54, __kwargs_54); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_siblings"] = __J_siblings -__J_attrs.siblings = __J_siblings; +__J_siblings.pythonscript_function = true; +window["__J_attrs"]["siblings"] = __J_siblings; var __J_size = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self")}; +signature["function_name"] = "__J_size"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.size(); -var __args_55, __kwargs_55; -__args_55 = create_array(o); -__kwargs_55 = Object(); -return get_attribute(J, "__call__")(__args_55, __kwargs_55); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_size"] = __J_size -__J_attrs.size = __J_size; +__J_size.pythonscript_function = true; +window["__J_attrs"]["size"] = __J_size; var __J_slice = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "start", "end")}; +signature["function_name"] = "__J_slice"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var start = arguments['start']; var end = arguments['end']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.slice(start, end); -var __args_56, __kwargs_56; -__args_56 = create_array(o); -__kwargs_56 = Object(); -return get_attribute(J, "__call__")(__args_56, __kwargs_56); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_slice"] = __J_slice -__J_attrs.slice = __J_slice; +__J_slice.pythonscript_function = true; +window["__J_attrs"]["slice"] = __J_slice; var __J_slide_down = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "duration", "complete")}; +signature["function_name"] = "__J_slide_down"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var duration = arguments['duration']; var complete = arguments['complete']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.slideDown(duration, adapt_arguments(complete)); -var __args_57, __kwargs_57; -__args_57 = create_array(o); -__kwargs_57 = Object(); -return get_attribute(J, "__call__")(__args_57, __kwargs_57); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_slide_down"] = __J_slide_down -__J_attrs.slide_down = __J_slide_down; +__J_slide_down.pythonscript_function = true; +window["__J_attrs"]["slide_down"] = __J_slide_down; var __J_slide_toggle = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "duration", "complete")}; +signature["function_name"] = "__J_slide_toggle"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var duration = arguments['duration']; var complete = arguments['complete']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.slideToggle(duration, adapt_arguments(complete)); -var __args_58, __kwargs_58; -__args_58 = create_array(o); -__kwargs_58 = Object(); -return get_attribute(J, "__call__")(__args_58, __kwargs_58); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_slide_toggle"] = __J_slide_toggle -__J_attrs.slide_toggle = __J_slide_toggle; +__J_slide_toggle.pythonscript_function = true; +window["__J_attrs"]["slide_toggle"] = __J_slide_toggle; var __J_slide_up = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "duration", "complete")}; +signature["function_name"] = "__J_slide_up"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var duration = arguments['duration']; var complete = arguments['complete']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.slideUp(duration, adapt_arguments(complete)); -var __args_59, __kwargs_59; -__args_59 = create_array(o); -__kwargs_59 = Object(); -return get_attribute(J, "__call__")(__args_59, __kwargs_59); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_slide_up"] = __J_slide_up -__J_attrs.slide_up = __J_slide_up; +__J_slide_up.pythonscript_function = true; +window["__J_attrs"]["slide_up"] = __J_slide_up; var __J_stop = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "clear_queue", "jump_to_end")}; +signature["function_name"] = "__J_stop"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var clear_queue = arguments['clear_queue']; var jump_to_end = arguments['jump_to_end']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.stop(clear_queue, jump_to_end); -var __args_60, __kwargs_60; -__args_60 = create_array(o); -__kwargs_60 = Object(); -return get_attribute(J, "__call__")(__args_60, __kwargs_60); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_stop"] = __J_stop -__J_attrs.stop = __J_stop; +__J_stop.pythonscript_function = true; +window["__J_attrs"]["stop"] = __J_stop; var __J_submit = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "clear_queue", "jump_to_end")}; +signature["function_name"] = "__J_submit"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var clear_queue = arguments['clear_queue']; var jump_to_end = arguments['jump_to_end']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.submit(clear_queue, jump_to_end); -var __args_61, __kwargs_61; -__args_61 = create_array(o); -__kwargs_61 = Object(); -return get_attribute(J, "__call__")(__args_61, __kwargs_61); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_submit"] = __J_submit -__J_attrs.submit = __J_submit; +__J_submit.pythonscript_function = true; +window["__J_attrs"]["submit"] = __J_submit; var __J_text = function(args, kwargs) { +var j; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "text")}; +signature["function_name"] = "__J_text"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var text = arguments['text']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; if(text != undefined) { -var __args_62, __kwargs_62; -__args_62 = create_array(j.text(text)); -__kwargs_62 = Object(); -o = get_attribute(J, "__call__")(__args_62, __kwargs_62); +o = get_attribute(J, "__call__")([j.text(text)], Object()); } else { o = j.text(); @@ -1018,77 +1092,85 @@ o = j.text(); return o; } +window["__J_text"] = __J_text -__J_attrs.text = __J_text; +__J_text.pythonscript_function = true; +window["__J_attrs"]["text"] = __J_text; var __J_toggle = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "duration", "complete")}; +signature["function_name"] = "__J_toggle"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var duration = arguments['duration']; var complete = arguments['complete']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.toggle(duration, complete); -var __args_63, __kwargs_63; -__args_63 = create_array(o); -__kwargs_63 = Object(); -return get_attribute(J, "__call__")(__args_63, __kwargs_63); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_toggle"] = __J_toggle -__J_attrs.toggle = __J_toggle; +__J_toggle.pythonscript_function = true; +window["__J_attrs"]["toggle"] = __J_toggle; var __J_toggle_class = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "class_name")}; +signature["function_name"] = "__J_toggle_class"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var class_name = arguments['class_name']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.toggleClass(class_name); -var __args_64, __kwargs_64; -__args_64 = create_array(o); -__kwargs_64 = Object(); -return get_attribute(J, "__call__")(__args_64, __kwargs_64); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_toggle_class"] = __J_toggle_class -__J_attrs.toggle_class = __J_toggle_class; +__J_toggle_class.pythonscript_function = true; +window["__J_attrs"]["toggle_class"] = __J_toggle_class; var __J_trigger = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "event")}; +signature["function_name"] = "__J_trigger"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var event = arguments['event']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.trigger(event); -var __args_65, __kwargs_65; -__args_65 = create_array(o); -__kwargs_65 = Object(); -return get_attribute(J, "__call__")(__args_65, __kwargs_65); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_trigger"] = __J_trigger -__J_attrs.trigger = __J_trigger; +__J_trigger.pythonscript_function = true; +window["__J_attrs"]["trigger"] = __J_trigger; var __J_unbind = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "event", "handler")}; +signature["function_name"] = "__J_unbind"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var event = arguments['event']; var handler = arguments['handler']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.unbind(event, adapt_arguments(handler)); -var __args_66, __kwargs_66; -__args_66 = create_array(o); -__kwargs_66 = Object(); -return get_attribute(J, "__call__")(__args_66, __kwargs_66); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_unbind"] = __J_unbind -__J_attrs.unbind = __J_unbind; +__J_unbind.pythonscript_function = true; +window["__J_attrs"]["unbind"] = __J_unbind; var __J_value = function(args, kwargs) { +var j; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "value")}; +signature["function_name"] = "__J_value"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var value = arguments['value']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; if(value === undefined) { o = j.val(); } @@ -1098,160 +1180,178 @@ o = j.val(value); return o; } +window["__J_value"] = __J_value -__J_attrs.value = __J_value; +__J_value.pythonscript_function = true; +window["__J_attrs"]["value"] = __J_value; var __J_width = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "value")}; +signature["function_name"] = "__J_width"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var value = arguments['value']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.width(value); -var __args_67, __kwargs_67; -__args_67 = create_array(o); -__kwargs_67 = Object(); -return get_attribute(J, "__call__")(__args_67, __kwargs_67); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_width"] = __J_width -__J_attrs.width = __J_width; +__J_width.pythonscript_function = true; +window["__J_attrs"]["width"] = __J_width; var __J_length = function(args, kwargs) { +var j; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self")}; +signature["function_name"] = "__J_length"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; return j.length(); } +window["__J_length"] = __J_length -__J_attrs.length = __J_length; +__J_length.pythonscript_function = true; +window["__J_attrs"]["length"] = __J_length; var __J_map = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "func")}; +signature["function_name"] = "__J_map"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var func = arguments['func']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.map(adapt_arguments(func)); -var __args_68, __kwargs_68; -__args_68 = create_array(o); -__kwargs_68 = Object(); -return get_attribute(J, "__call__")(__args_68, __kwargs_68); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_map"] = __J_map -__J_attrs.map = __J_map; +__J_map.pythonscript_function = true; +window["__J_attrs"]["map"] = __J_map; var __J_mousedown = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "handler")}; +signature["function_name"] = "__J_mousedown"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.mousedown(adapt_arguments(handler)); -var __args_69, __kwargs_69; -__args_69 = create_array(o); -__kwargs_69 = Object(); -return get_attribute(J, "__call__")(__args_69, __kwargs_69); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_mousedown"] = __J_mousedown -__J_attrs.mousedown = __J_mousedown; +__J_mousedown.pythonscript_function = true; +window["__J_attrs"]["mousedown"] = __J_mousedown; var __J_mouseenter = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "handler")}; +signature["function_name"] = "__J_mouseenter"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.mouseenter(adapt_arguments(handler)); -var __args_70, __kwargs_70; -__args_70 = create_array(o); -__kwargs_70 = Object(); -return get_attribute(J, "__call__")(__args_70, __kwargs_70); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_mouseenter"] = __J_mouseenter -__J_attrs.mouseenter = __J_mouseenter; +__J_mouseenter.pythonscript_function = true; +window["__J_attrs"]["mouseenter"] = __J_mouseenter; var __J_mouseleave = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "handler")}; +signature["function_name"] = "__J_mouseleave"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.mouseleave(adapt_arguments(handler)); -var __args_71, __kwargs_71; -__args_71 = create_array(o); -__kwargs_71 = Object(); -return get_attribute(J, "__call__")(__args_71, __kwargs_71); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_mouseleave"] = __J_mouseleave -__J_attrs.mouseleave = __J_mouseleave; +__J_mouseleave.pythonscript_function = true; +window["__J_attrs"]["mouseleave"] = __J_mouseleave; var __J_mousemove = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "handler")}; +signature["function_name"] = "__J_mousemove"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.mousemove(adapt_arguments(handler)); -var __args_72, __kwargs_72; -__args_72 = create_array(o); -__kwargs_72 = Object(); -return get_attribute(J, "__call__")(__args_72, __kwargs_72); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_mousemove"] = __J_mousemove -__J_attrs.mousemove = __J_mousemove; +__J_mousemove.pythonscript_function = true; +window["__J_attrs"]["mousemove"] = __J_mousemove; var __J_mouseout = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "handler")}; +signature["function_name"] = "__J_mouseout"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.mouseout(adapt_arguments(handler)); -var __args_73, __kwargs_73; -__args_73 = create_array(o); -__kwargs_73 = Object(); -return get_attribute(J, "__call__")(__args_73, __kwargs_73); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_mouseout"] = __J_mouseout -__J_attrs.mouseout = __J_mouseout; +__J_mouseout.pythonscript_function = true; +window["__J_attrs"]["mouseout"] = __J_mouseout; var __J_mouseover = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "handler")}; +signature["function_name"] = "__J_mouseover"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.mouseover(adapt_arguments(handler)); -var __args_74, __kwargs_74; -__args_74 = create_array(o); -__kwargs_74 = Object(); -return get_attribute(J, "__call__")(__args_74, __kwargs_74); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_mouseover"] = __J_mouseover -__J_attrs.mouseover = __J_mouseover; +__J_mouseover.pythonscript_function = true; +window["__J_attrs"]["mouseover"] = __J_mouseover; var __J_mouseup = function(args, kwargs) { +var j, o; var signature, arguments; signature = {"kwargs": Object(), "args": create_array("self", "handler")}; +signature["function_name"] = "__J_mouseup"; arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var handler = arguments['handler']; -j = get_attribute(self, "j"); +j = self["__dict__"]["j"]; o = j.mouseup(adapt_arguments(handler)); -var __args_75, __kwargs_75; -__args_75 = create_array(o); -__kwargs_75 = Object(); -return get_attribute(J, "__call__")(__args_75, __kwargs_75); +return get_attribute(J, "__call__")([o], Object()); } +window["__J_mouseup"] = __J_mouseup -__J_attrs.mouseup = __J_mouseup; -J = create_class("J", __J_parents, __J_attrs); +__J_mouseup.pythonscript_function = true; +window["__J_attrs"]["mouseup"] = __J_mouseup; +J = create_class("J", window["__J_parents"], window["__J_attrs"], window["__J_properties"]); var ajax = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("url", "settings")}; +signature["function_name"] = "ajax"; arguments = get_arguments(signature, args, kwargs); var url = arguments['url']; var settings = arguments['settings']; return jQuery.ajax(url, settings); } +window["ajax"] = ajax +ajax.pythonscript_function = true; diff --git a/pythonscript.js b/pythonscript.js index 9c1d623..1191b7b 100644 --- a/pythonscript.js +++ b/pythonscript.js @@ -1,4 +1,8 @@ -// PythonScript Runtime - regenerated on: Sat Oct 19 22:24:57 2013 + + + + + var jsrange = function(num) { "Emulates Python's range function"; var i, r; @@ -623,7 +627,8 @@ key = backup; return output; } -window["json_to_pythonscript"] = json_to_pythonscript +window["json_to_pythonscript"] = json_to_pythonscript + _PythonJS_UID = 0; var _JSNew = function(T) { console.log("_JSNew->", T); @@ -777,7 +782,7 @@ var iter = this; for (var char=0; char < iter.length; char++) { var backup = char; char = iter[char]; -if(digits["__contains__"](char)) { +if(char in digits || digits["__contains__"](char)) { /*pass*/ } else { @@ -2147,4 +2152,4 @@ window["__array_to_ascii"] = __array_to_ascii __array_to_ascii.pythonscript_function = true; window["__array_attrs"]["to_ascii"] = __array_to_ascii; -array = create_class("array", window["__array_parents"], window["__array_attrs"], window["__array_properties"]); \ No newline at end of file +array = create_class("array", window["__array_parents"], window["__array_attrs"], window["__array_properties"]); diff --git a/pythonscript/pythonscript.py b/pythonscript/pythonscript.py index 8232a02..9c9151c 100755 --- a/pythonscript/pythonscript.py +++ b/pythonscript/pythonscript.py @@ -1,8 +1,8 @@ #!/usr/bin/env python import sys -from python_to_pythonjs import main as python_to_pythonjs -from pythonjs import main as pythonjs +from .python_to_pythonjs import main as python_to_pythonjs +from .pythonjs import main as pythonjs def main(script): diff --git a/runtests.py b/runtests.py new file mode 100755 index 0000000..781d289 --- /dev/null +++ b/runtests.py @@ -0,0 +1,50 @@ +#!/usr/bin/env python +import os +from difflib import Differ + +from envoy import run + +from pythonscript.pythonscript import main as pythonjs + + +ROOT = os.path.join(os.path.dirname(__file__), 'unittests') + +with open('pythonscript.js') as f: + PYTHONJS = f.read() + +MOCK = """ +// MOCK START +window = {}; +HTMLDocument = HTMLElement = function() {}; +// MOCK END +""" + + +if __name__ == '__main__': + for test in os.listdir(ROOT): + if test.endswith('.py'): + filepath = os.path.join(ROOT, test) + with open(filepath) as f: + script = f.read() + exec_script = test + 'exec.js' + exec_script = os.path.join('/tmp', exec_script) + with open(exec_script, 'w') as f: + f.write(MOCK) + f.write(PYTHONJS) + f.write(pythonjs(script)) + r = run('nodejs %s' % exec_script) + if r.status_code != 0: + print(r.std_err) + print('%s ERROR :(' % test) + else: + expected = os.path.join(ROOT, test + '.expected') + with open(expected) as f: + expected = f.read() + if expected == r.std_out: + print('%s PASS :)' % test) + else: + compare = Differ().compare + diff = compare(expected.split('\n'), r.std_out.split('\n')) + for line in diff: + print(line) + print('%s FAILED :(' % test) diff --git a/unittests/0001-simple-function-call.py b/unittests/0001-simple-function-call.py new file mode 100644 index 0000000..9be5440 --- /dev/null +++ b/unittests/0001-simple-function-call.py @@ -0,0 +1,5 @@ +def func(a, b, c): + print a, b, c + return a+b+c + +print func(1, 2, 3) diff --git a/unittests/0001-simple-function-call.py.expected b/unittests/0001-simple-function-call.py.expected new file mode 100644 index 0000000..00747e9 --- /dev/null +++ b/unittests/0001-simple-function-call.py.expected @@ -0,0 +1,2 @@ +1 2 3 +6 diff --git a/unittests/0002-full-signature-function-call.py b/unittests/0002-full-signature-function-call.py new file mode 100644 index 0000000..d75b7eb --- /dev/null +++ b/unittests/0002-full-signature-function-call.py @@ -0,0 +1,12 @@ +def func(a, b, c=3, d=4, *args, **kwargs): + print a, b, c, d, len(args), len(kwargs) + return a+b+c+d + +print '>>> func(1,2)' +print func(1,2) +print '>>> func(11,22,33,44,55,66)' +print func(11,22,33,44,55,66) +print '>>> func(1, 2, e=True)' +print func(1, 2, e=True) +print '>>> func(11,22,33,44,55,66,e=True,f=True)' +print func(11,22,33,44,55,66,e=True,f=True) diff --git a/unittests/0002-full-signature-function-call.py.expected b/unittests/0002-full-signature-function-call.py.expected new file mode 100644 index 0000000..665bd39 --- /dev/null +++ b/unittests/0002-full-signature-function-call.py.expected @@ -0,0 +1,12 @@ +>>> func(1,2) +1 2 3 4 0 0 +10 +>>> func(11,22,33,44,55,66) +11 22 33 44 2 0 +110 +>>> func(1, 2, e=True) +1 2 3 4 0 1 +10 +>>> func(11,22,33,44,55,66,e=True,f=True) +11 22 33 44 2 2 +110 diff --git a/unittests/0003-for-loop.py b/unittests/0003-for-loop.py new file mode 100644 index 0000000..ba67932 --- /dev/null +++ b/unittests/0003-for-loop.py @@ -0,0 +1,2 @@ +for i in range(10): + print i diff --git a/unittests/0003-for-loop.py.expected b/unittests/0003-for-loop.py.expected new file mode 100644 index 0000000..8b1acc1 --- /dev/null +++ b/unittests/0003-for-loop.py.expected @@ -0,0 +1,10 @@ +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 diff --git a/unittests/0004-try-except.py b/unittests/0004-try-except.py new file mode 100644 index 0000000..3b12241 --- /dev/null +++ b/unittests/0004-try-except.py @@ -0,0 +1,4 @@ +try: + raise Exception() +except: + print 'yeah' diff --git a/unittests/0004-try-except.py.expected b/unittests/0004-try-except.py.expected new file mode 100644 index 0000000..72e7760 --- /dev/null +++ b/unittests/0004-try-except.py.expected @@ -0,0 +1 @@ +yeah diff --git a/unittests/0005-simple-generator.py b/unittests/0005-simple-generator.py new file mode 100644 index 0000000..5211162 --- /dev/null +++ b/unittests/0005-simple-generator.py @@ -0,0 +1,6 @@ +def generator(): + for i in range(5): + yield i * 10 + +for i in generator(): + print i diff --git a/unittests/0005-simple-generator.py.expected b/unittests/0005-simple-generator.py.expected new file mode 100644 index 0000000..1df85d4 --- /dev/null +++ b/unittests/0005-simple-generator.py.expected @@ -0,0 +1,5 @@ +0 +10 +20 +30 +40 diff --git a/unittests/unittests b/unittests/unittests new file mode 100644 index 0000000..038569c --- /dev/null +++ b/unittests/unittests @@ -0,0 +1,6 @@ + /home/amirouche/src/pythonscript/PythonJS/unittests: + total used in directory 16 available 662690304 + drwxr-xr-x 2 amirouche amirouche 4096 oct. 20 12:53 . + drwxr-xr-x 11 amirouche amirouche 4096 oct. 20 12:52 .. + -rw-r--r-- 1 amirouche amirouche 68 oct. 20 12:53 0001-simple-function-call.py + -rw-r--r-- 1 amirouche amirouche 18 oct. 20 12:53 0001-function-call.py~ From 6f44528ae9b66eeab341ba3d382766f1bd153ee9 Mon Sep 17 00:00:00 2001 From: Amirouche Boubekki Date: Sun, 20 Oct 2013 17:15:40 +0200 Subject: [PATCH 160/860] Automatically turn callbacks into something than makes sens for pythonjs --- pythonscript.js | 4 ++++ pythonscript/pythonscript.py | 4 ++-- runtime/pythonpythonjs.py | 5 +++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/pythonscript.js b/pythonscript.js index 1191b7b..fcd50a0 100644 --- a/pythonscript.js +++ b/pythonscript.js @@ -251,6 +251,10 @@ var method = function() { var args; args = arguments; if(args.length > 0) { +if({}.toString.call(args[0]) != '[object Array]') { +args[0] = [args[0]]; +} + args[0].splice(0, 0, object); } else { diff --git a/pythonscript/pythonscript.py b/pythonscript/pythonscript.py index 9c9151c..8232a02 100755 --- a/pythonscript/pythonscript.py +++ b/pythonscript/pythonscript.py @@ -1,8 +1,8 @@ #!/usr/bin/env python import sys -from .python_to_pythonjs import main as python_to_pythonjs -from .pythonjs import main as pythonjs +from python_to_pythonjs import main as python_to_pythonjs +from pythonjs import main as pythonjs def main(script): diff --git a/runtime/pythonpythonjs.py b/runtime/pythonpythonjs.py index 0297ea7..a3cc044 100644 --- a/runtime/pythonpythonjs.py +++ b/runtime/pythonpythonjs.py @@ -191,6 +191,11 @@ def method(): var(args) args = arguments if args.length > 0: + # if it's not an array convert to an array + # this happens when a function/method is feed as callback + # of javascript code + if JS("{}.toString.call(args[0]) != '[object Array]'"): + args[0] = [args[0]] args[0].splice(0, 0, object) else: args = [object] From c03bc6bffdfd816c6eed9bec128b2199a6fe2e59 Mon Sep 17 00:00:00 2001 From: Amirouche Boubekki Date: Mon, 21 Oct 2013 01:01:52 +0200 Subject: [PATCH 161/860] added somex.pythonscript_function in pythonpythonjs.py --- pythonscript.js | 4 ++++ runtime/pythonpythonjs.py | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pythonscript.js b/pythonscript.js index fcd50a0..67f0eb0 100644 --- a/pythonscript.js +++ b/pythonscript.js @@ -547,6 +547,7 @@ return get_attribute(object, attribute); } window["getattr"] = getattr +getattr.pythonscript_function = true; var setattr = function(args, kwargs) { var object, attribute, value; object = args[0]; @@ -556,6 +557,7 @@ return set_attribute(object, attribute, value); } window["setattr"] = setattr +setattr.pythonscript_function = true; var issubclass = function(args, kwargs) { var C, B, base; C = args[0]; @@ -580,6 +582,7 @@ return false; } window["issubclass"] = issubclass +issubclass.pythonscript_function = true; var isinstance = function(args, kwargs) { var object_class, object, klass; object = args[0]; @@ -593,6 +596,7 @@ return issubclass(create_array(object_class, klass)); } window["isinstance"] = isinstance +isinstance.pythonscript_function = true; var json_to_pythonscript = function(json) { var jstype, item, output; jstype = typeof json; diff --git a/runtime/pythonpythonjs.py b/runtime/pythonpythonjs.py index a3cc044..11c2d3c 100644 --- a/runtime/pythonpythonjs.py +++ b/runtime/pythonpythonjs.py @@ -382,7 +382,7 @@ def getattr(args, kwargs): object = args[0] attribute = args[1] return get_attribute(object, attribute) - +getattr.pythonscript_function = True def setattr(args, kwargs): var(object, attribute, value) @@ -390,7 +390,7 @@ def setattr(args, kwargs): attribute = args[1] value = args[2] return set_attribute(object, attribute, value) - +setattr.pythonscript_function = True def issubclass(args, kwargs): var(C, B, base) @@ -403,7 +403,7 @@ def issubclass(args, kwargs): if issubclass([base, B], JSObject()): return True return False - +issubclass.pythonscript_function = True def isinstance(args, kwargs): var(object_class, object, klass) @@ -413,7 +413,7 @@ def isinstance(args, kwargs): if object_class is None: return False return issubclass(create_array(object_class, klass)) - +isinstance.pythonscript_function = True # not part of Python, but it's here because it's easier to write # in PythonJS From 6d7d1174f43affa6829569e2ff0ae6c1045821d3 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Sun, 20 Oct 2013 18:53:00 -0700 Subject: [PATCH 162/860] fixed string.isdigit, deprecated _create_empty_object. fixed "in" javascript test for things without special "__contains__" --- README.rst | 2 +- pythonscript.js | 74 ++++++++++--------- pythonscript/python_to_pythonjs.py | 3 +- runtime/builtins.py | 28 ++++--- runtime/pythonpythonjs.py | 30 +++----- tests/property_decorator.html | 31 +++++++- tests/test_string.html | 2 + ...js_nested_attribute_lookup_decorators.html | 2 +- 8 files changed, 102 insertions(+), 70 deletions(-) diff --git a/README.rst b/README.rst index edc7711..163217d 100644 --- a/README.rst +++ b/README.rst @@ -44,7 +44,7 @@ Getting Started - Experimental Development Branch Get Source Code:: - git clone -b develop https://github.com/PythonScript-/PythonJS.git + git clone -b develop https://github.com/PythonJS/PythonJS.git Install Tornado for Python3:: diff --git a/pythonscript.js b/pythonscript.js index 67f0eb0..297a3e9 100644 --- a/pythonscript.js +++ b/pythonscript.js @@ -1,8 +1,4 @@ - - - - - +// PythonScript Runtime - regenerated on: Sun Oct 20 18:46:57 2013 var jsrange = function(num) { "Emulates Python's range function"; var i, r; @@ -306,6 +302,19 @@ return attr; base = backup; } +var iter = bases; +for (var base=0; base < iter.length; base++) { +var backup = base; +base = iter[base]; +var getter; +getter = _get_upstream_property(base, attribute); +if(getter) { +return getter([object]); +} + +base = backup; +} + if("__getattr__" in __dict__) { return __dict__["__getattr__"]([object, attribute]); } @@ -390,6 +399,22 @@ parent = backup; } window["_get_upstream_attribute"] = _get_upstream_attribute +var _get_upstream_property = function(base, attr) { +if(attr in base.__properties__) { +return base.__properties__[attr]; +} + +var iter = base.bases; +for (var parent=0; parent < iter.length; parent++) { +var backup = parent; +parent = iter[parent]; +return _get_upstream_property(parent, attr); +parent = backup; +} + +} +window["_get_upstream_property"] = _get_upstream_property + var set_attribute = function(object, attribute, value) { "Set an attribute on an object by updating its __dict__ property"; var __dict__, __class__; @@ -635,32 +660,14 @@ key = backup; return output; } -window["json_to_pythonscript"] = json_to_pythonscript - +window["json_to_pythonscript"] = json_to_pythonscript _PythonJS_UID = 0; var _JSNew = function(T) { -console.log("_JSNew->", T); return new T; } window["_JSNew"] = _JSNew _JSNew.pythonscript_function=true; -var _create_empty_object = function(arr) { -var o; -o = Object.create( null ); -var iter = arr; -for (var i=0; i < iter.length; i++) { -var backup = i; -i = iter[i]; -o[ i ] = true; -i = backup; -} - -return o; -} -window["_create_empty_object"] = _create_empty_object - -_create_empty_object.pythonscript_function=true; var int = function(args, kwargs) { var signature, arguments; signature = {"kwargs": Object(), "args": create_array("a")}; @@ -785,12 +792,12 @@ return this.indexOf( a ); String.prototype.index=func; var func = function() { var digits; -digits = _create_empty_object( ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] ); +digits = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]; var iter = this; for (var char=0; char < iter.length; char++) { var backup = char; char = iter[char]; -if(char in digits || digits["__contains__"](char)) { +if(char in digits || Object.hasOwnProperty(digits, "__contains__") && digits["__contains__"](char)) { /*pass*/ } else { @@ -811,15 +818,16 @@ _setup_str_prototype.pythonscript_function = true; _setup_str_prototype(create_array(), Object()); var _setup_array_prototype = function(args, kwargs) { var func = function(a) { -var e; -e = _create_empty_object( this ); -if(a in e) { +var i; +i = 0; +while(i < this.length) { +if(this[i] == a) { return true; } -else { -return false; -} +i += 1; +} +return false; } Array.prototype.__contains__=func; @@ -2160,4 +2168,4 @@ window["__array_to_ascii"] = __array_to_ascii __array_to_ascii.pythonscript_function = true; window["__array_attrs"]["to_ascii"] = __array_to_ascii; -array = create_class("array", window["__array_parents"], window["__array_attrs"], window["__array_properties"]); +array = create_class("array", window["__array_parents"], window["__array_attrs"], window["__array_properties"]); \ No newline at end of file diff --git a/pythonscript/python_to_pythonjs.py b/pythonscript/python_to_pythonjs.py index 53aab1c..f7cf17b 100755 --- a/pythonscript/python_to_pythonjs.py +++ b/pythonscript/python_to_pythonjs.py @@ -392,7 +392,7 @@ def visit_ClassDef(self, node): writer.write('window["__%s_properties"] = JSObject()' % name) for base in node.bases: - code = '__%s_parents.push(%s)' % (name, self.visit(base)) + code = 'window["__%s_parents"].push(%s)' % (name, self.visit(base)) writer.write(code) if isinstance(base, Name): self._class_parents[ name ].add( base.id ) @@ -591,6 +591,7 @@ def visit_Compare(self, node): a = ( self.visit(node.comparators[i]), left ) if self._with_js: ## this makes "if 'x' in Array" work like Python: "if 'x' in list" - TODO fix this for js-objects comp.append( '%s in %s or' %(a[1], a[0]) ) ## this is ugly, but it works + comp.append( 'Object.hasOwnProperty(%s, "__contains__") and' %a[0]) comp.append( "%s['__contains__'](%s)" %a ) else: comp.append( "get_attribute(get_attribute(%s, '__contains__'), '__call__')([%s], JSObject())" %a ) diff --git a/runtime/builtins.py b/runtime/builtins.py index 2b48c97..a9c3067 100644 --- a/runtime/builtins.py +++ b/runtime/builtins.py @@ -3,14 +3,18 @@ with javascript: def _JSNew(T): - print '_JSNew->', T return JS("new T") - def _create_empty_object(arr): - o = Object.create(null) - for i in arr: - o[ i ] = True - return o + ## This can not be trusted because Object.hasOwnProperty will fail on an empty object with + ## TypeError: Cannot convert object to primitive value + ## It was not a good idea in the first place to try to use Javascript's "in" operator to + ## test if something had an attribute, because if something was a string that throws an error + ## note: Object.hasOwnProperty always returns false with strings and numbers. + #def _create_empty_object(arr): + # o = Object.create(null) + # for i in arr: + # o[ i ] = True + # return o def int(a): with javascript: @@ -88,7 +92,7 @@ def func(a): @String.prototype.isdigit def func(): - digits = _create_empty_object( ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'] ) + digits = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'] for char in this: if char in digits: pass else: return False @@ -102,11 +106,11 @@ def _setup_array_prototype(): @Array.prototype.__contains__ def func(a): - e = _create_empty_object( this ) - if JS("a in e"): ## JS() so that we don't call __contains__ again - return True - else: - return False + i = 0 + while i < this.length: + if this[i] == a: return True + i += 1 + return False @Array.prototype.__len__ def func(): diff --git a/runtime/pythonpythonjs.py b/runtime/pythonpythonjs.py index 11c2d3c..00f23df 100644 --- a/runtime/pythonpythonjs.py +++ b/runtime/pythonpythonjs.py @@ -224,25 +224,11 @@ def method(): else: return attr - - #for i in jsrange(bases.length): ## this calls get_attribute, ugly! - # var(base, attr) - # base = bases[i] - # attr = get_attribute(base, attribute) - # if attr: - # if JS("{}.toString.call(attr) === '[object Function]'"): - # def method(): - # var(args) - # args = arguments - # if(args.length > 0): - # args[0].splice(0, 0, object) - # else: - # args = [object] - # return attr.apply(None, args) - # method.is_wrapper = True - # return method - # else: - # return attr + for base in bases: ## upstream property getters come before __getattr__ + var( getter ) + getter = _get_upstream_property(base, attribute) + if getter: + return getter( [object] ) if '__getattr__' in __dict__: return __dict__['__getattr__']( [object, attribute]) @@ -281,7 +267,11 @@ def _get_upstream_attribute(base, attr): for parent in base.bases: return _get_upstream_attribute(parent, attr) - +def _get_upstream_property(base, attr): + if attr in base.__properties__: + return base.__properties__[ attr ] + for parent in base.bases: + return _get_upstream_property(parent, attr) def set_attribute(object, attribute, value): """Set an attribute on an object by updating its __dict__ property""" diff --git a/tests/property_decorator.html b/tests/property_decorator.html index 494d6ae..8ce5fd0 100644 --- a/tests/property_decorator.html +++ b/tests/property_decorator.html @@ -2,10 +2,12 @@ - diff --git a/tests/test_string.html b/tests/test_string.html index d587389..73cebbe 100644 --- a/tests/test_string.html +++ b/tests/test_string.html @@ -37,9 +37,11 @@ print a.upper() print 'LOWERED'.lower() print a.index( 'e' ) + print 'testing isdigit' print a, '.isdigit->', a.isdigit() print '100.isdigit->', '100'.isdigit() + print 'testing functional style str(x)' s = str('functional style ok') print s e = str( 100 ) diff --git a/tests/threejs_nested_attribute_lookup_decorators.html b/tests/threejs_nested_attribute_lookup_decorators.html index 930043d..b6e54a8 100644 --- a/tests/threejs_nested_attribute_lookup_decorators.html +++ b/tests/threejs_nested_attribute_lookup_decorators.html @@ -10,7 +10,7 @@ from three import * def test(): - cam = PerspectiveCamera( 45, 640, 480, 0.01, 10000) + cam = PerspectiveCamera( 45, 640/480, 0.01, 10000) p = cam.position p.z = 100 print( p.z ) From e68a1b39e3074bc3eb9a67809d3aa83b2907ed0a Mon Sep 17 00:00:00 2001 From: hartsantler Date: Sun, 20 Oct 2013 20:23:29 -0700 Subject: [PATCH 163/860] fixed init tuple from list, or another tuple. --- pythonscript.js | 20 +++++++++++++++++- runtime/builtins.py | 7 +++++++ tests/test_isinstance.html | 42 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 tests/test_isinstance.html diff --git a/pythonscript.js b/pythonscript.js index 297a3e9..ddf18a7 100644 --- a/pythonscript.js +++ b/pythonscript.js @@ -1,4 +1,4 @@ -// PythonScript Runtime - regenerated on: Sun Oct 20 18:46:57 2013 +// PythonScript Runtime - regenerated on: Sun Oct 20 20:22:04 2013 var jsrange = function(num) { "Emulates Python's range function"; var i, r; @@ -1073,6 +1073,22 @@ while(i < length) { arr.push( js_object[i] ); i += 1 } +} +else { +if(js_object) { +if(get_attribute(isinstance, "__call__")([js_object, list], Object())) { +self["__dict__"]["js_object"] = get_attribute(js_object, "js_object"); +} +else { +if(get_attribute(isinstance, "__call__")([js_object, tuple], Object())) { +self["__dict__"]["js_object"] = get_attribute(js_object, "js_object"); +} +else { +throw TypeError; +} + +} + } else { if(js_object) { @@ -1081,6 +1097,8 @@ throw TypeError; } +} + } window["__tuple___init__"] = __tuple___init__ diff --git a/runtime/builtins.py b/runtime/builtins.py index a9c3067..afbf192 100644 --- a/runtime/builtins.py +++ b/runtime/builtins.py @@ -209,6 +209,13 @@ def __init__(self, js_object=None): while i < length: JS('arr.push( js_object[i] )') i += 1 + elif js_object: + if isinstance( js_object, list): + self.js_object = js_object.js_object + elif isinstance( js_object, tuple): + self.js_object = js_object.js_object + else: + raise TypeError elif js_object: raise TypeError diff --git a/tests/test_isinstance.html b/tests/test_isinstance.html new file mode 100644 index 0000000..3709c6b --- /dev/null +++ b/tests/test_isinstance.html @@ -0,0 +1,42 @@ + + + + + + + + + + \ No newline at end of file From 78a18267b6a6980d85b00097a792c46cdf8223c2 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Sun, 20 Oct 2013 20:30:10 -0700 Subject: [PATCH 164/860] fixed init list from another list or tuple --- pythonscript.js | 14 +++++++++++++- runtime/builtins.py | 7 ++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/pythonscript.js b/pythonscript.js index ddf18a7..dd6e46a 100644 --- a/pythonscript.js +++ b/pythonscript.js @@ -1,4 +1,4 @@ -// PythonScript Runtime - regenerated on: Sun Oct 20 20:22:04 2013 +// PythonScript Runtime - regenerated on: Sun Oct 20 20:29:29 2013 var jsrange = function(num) { "Emulates Python's range function"; var i, r; @@ -1247,7 +1247,19 @@ arguments = get_arguments(signature, args, kwargs); var self = arguments['self']; var js_object = arguments['js_object']; if(js_object) { +if(js_object instanceof Array) { set_attribute(self, "js_object", js_object); +} +else { +if(get_attribute(isinstance, "__call__")([js_object, list], Object()) || get_attribute(isinstance, "__call__")([js_object, tuple], Object())) { +set_attribute(self, "js_object", get_attribute(js_object, "js_object")); +} +else { +throw TypeError; +} + +} + } else { set_attribute(self, "js_object", create_array()); diff --git a/runtime/builtins.py b/runtime/builtins.py index afbf192..c9f122d 100644 --- a/runtime/builtins.py +++ b/runtime/builtins.py @@ -258,7 +258,12 @@ class list: def __init__(self, js_object=None): if js_object: - self.js_object = js_object + if JS('js_object instanceof Array'): + self.js_object = js_object + elif isinstance(js_object, list) or isinstance(js_object, tuple): + self.js_object = js_object.js_object + else: + raise TypeError else: self.js_object = JSArray() From 99f4598ec5f42191d765b166596870f8d9931eb2 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Sun, 20 Oct 2013 21:22:48 -0700 Subject: [PATCH 165/860] tested all the html tests, everything passes. everything looks stable. regenerated runtime. init lists and tuple from other lists or tuple should copy their data, not share the underlying array. --- pythonscript.js | 49 +++++++++++++++++++++++++++++---- runtime/builtins.py | 16 ++++++++--- tests/first-class_function.html | 4 +-- 3 files changed, 58 insertions(+), 11 deletions(-) diff --git a/pythonscript.js b/pythonscript.js index dd6e46a..d9926d5 100644 --- a/pythonscript.js +++ b/pythonscript.js @@ -1,4 +1,4 @@ -// PythonScript Runtime - regenerated on: Sun Oct 20 20:29:29 2013 +// PythonScript Runtime - regenerated on: Sun Oct 20 21:20:01 2013 var jsrange = function(num) { "Emulates Python's range function"; var i, r; @@ -1077,11 +1077,32 @@ i += 1 else { if(js_object) { if(get_attribute(isinstance, "__call__")([js_object, list], Object())) { -self["__dict__"]["js_object"] = get_attribute(js_object, "js_object"); +self["__dict__"]["js_object"] = get_attribute(get_attribute(get_attribute(js_object, "js_object"), "slice"), "__call__")([0], Object()); } else { if(get_attribute(isinstance, "__call__")([js_object, tuple], Object())) { -self["__dict__"]["js_object"] = get_attribute(js_object, "js_object"); +self["__dict__"]["js_object"] = get_attribute(get_attribute(get_attribute(js_object, "js_object"), "slice"), "__call__")([0], Object()); +} +else { +if(get_attribute(isinstance, "__call__")([js_object, array], Object())) { +arr = create_array(); +var __iterator__, v; +__iterator__ = get_attribute(get_attribute(js_object, "__iter__"), "__call__")(create_array(), Object()); +try { +v = get_attribute(__iterator__, "next")(create_array(), Object()); +while(true) { +arr.push( v ); +v = get_attribute(__iterator__, "next")(create_array(), Object()); +} +} +catch(__exception__) { +if (__exception__ == StopIteration || isinstance([__exception__, StopIteration])) { +/*pass*/ +} + +} + +self["__dict__"]["js_object"] = arr; } else { throw TypeError; @@ -1089,6 +1110,8 @@ throw TypeError; } +} + } else { if(js_object) { @@ -1251,8 +1274,24 @@ if(js_object instanceof Array) { set_attribute(self, "js_object", js_object); } else { -if(get_attribute(isinstance, "__call__")([js_object, list], Object()) || get_attribute(isinstance, "__call__")([js_object, tuple], Object())) { -set_attribute(self, "js_object", get_attribute(js_object, "js_object")); +if(get_attribute(isinstance, "__call__")([js_object, list], Object()) || get_attribute(isinstance, "__call__")([js_object, tuple], Object()) || get_attribute(isinstance, "__call__")([js_object, array], Object())) { +set_attribute(self, "js_object", create_array()); +var __iterator__, v; +__iterator__ = get_attribute(get_attribute(js_object, "__iter__"), "__call__")(create_array(), Object()); +try { +v = get_attribute(__iterator__, "next")(create_array(), Object()); +while(true) { +get_attribute(get_attribute(self, "append"), "__call__")([v], Object()); +v = get_attribute(__iterator__, "next")(create_array(), Object()); +} +} +catch(__exception__) { +if (__exception__ == StopIteration || isinstance([__exception__, StopIteration])) { +/*pass*/ +} + +} + } else { throw TypeError; diff --git a/runtime/builtins.py b/runtime/builtins.py index c9f122d..b85bb2d 100644 --- a/runtime/builtins.py +++ b/runtime/builtins.py @@ -211,9 +211,15 @@ def __init__(self, js_object=None): i += 1 elif js_object: if isinstance( js_object, list): - self.js_object = js_object.js_object + self.js_object = js_object.js_object.slice(0) elif isinstance( js_object, tuple): - self.js_object = js_object.js_object + self.js_object = js_object.js_object.slice(0) + elif isinstance( js_object, array): + arr = JSArray() + for v in js_object: + with javascript: + arr.push( v ) + self.js_object = arr else: raise TypeError elif js_object: @@ -260,8 +266,10 @@ def __init__(self, js_object=None): if js_object: if JS('js_object instanceof Array'): self.js_object = js_object - elif isinstance(js_object, list) or isinstance(js_object, tuple): - self.js_object = js_object.js_object + elif isinstance(js_object, list) or isinstance(js_object, tuple) or isinstance(js_object, array): + self.js_object = JSArray() + for v in js_object: + self.append( v ) else: raise TypeError else: diff --git a/tests/first-class_function.html b/tests/first-class_function.html index 974c847..16fed79 100644 --- a/tests/first-class_function.html +++ b/tests/first-class_function.html @@ -2,7 +2,7 @@ - + + + + + + + + + + \ No newline at end of file From 647f257b48f1be05d3e3d63959251896fc7e6ec3 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Mon, 21 Oct 2013 04:37:36 -0700 Subject: [PATCH 168/860] testing Google Blockly --- tests/blockly_code_editor.html | 237 +++++++++++++++++++++++++++++++++ tests/server.py | 18 ++- 2 files changed, 254 insertions(+), 1 deletion(-) create mode 100644 tests/blockly_code_editor.html diff --git a/tests/blockly_code_editor.html b/tests/blockly_code_editor.html new file mode 100644 index 0000000..c6ef1d4 --- /dev/null +++ b/tests/blockly_code_editor.html @@ -0,0 +1,237 @@ + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + +
    +... +
    + + + +

    + + + +

    + + + + + + + \ No newline at end of file diff --git a/tests/server.py b/tests/server.py index 4b3dfbb..f7d66ff 100755 --- a/tests/server.py +++ b/tests/server.py @@ -176,6 +176,11 @@ def regenerate_runtime(): file.close() return src + +ResourcePaths = [] +if os.path.isdir( os.path.expanduser('~/blockly-read-only') ): + ResourcePaths.append( os.path.expanduser('~/blockly-read-only') ) + class MainHandler( tornado.web.RequestHandler ): def get(self, path=None): print('path', path) @@ -219,7 +224,18 @@ def get(self, path=None): self.write( data ) else: - self.write('Hello World') + found = False + for root in ResourcePaths: + local_path = os.path.join( root, path ) + if os.path.isfile(local_path): + data = open(local_path, 'rb').read() + self.set_header("Content-Length", len(data)) + self.write( data ) + found = True + break + + if not found: + print( 'FILE NOT FOUND', path) LIBS = dict( From 3cd65bf8cfc45f34c92f6b696dc1867ab23764e1 Mon Sep 17 00:00:00 2001 From: hartsantler Date: Mon, 21 Oct 2013 05:07:33 -0700 Subject: [PATCH 169/860] Google Blockly editor now outputs Python code to Ace Editor on block updates. --- tests/blockly_code_editor.html | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/blockly_code_editor.html b/tests/blockly_code_editor.html index c6ef1d4..0e4ca92 100644 --- a/tests/blockly_code_editor.html +++ b/tests/blockly_code_editor.html @@ -28,6 +28,8 @@ + + @@ -207,6 +209,12 @@ {path: './', toolbox: document.getElementById('toolbox')} ); +function update_ace_editor() { + var code = Blockly.Python.workspaceToCode(); + editor.setValue( code ); +} +Blockly.addChangeListener( update_ace_editor ); + From 4df77027f159f075385939a0b9aeb22558420d06 Mon Sep 17 00:00:00 2001 From: Amirouche Boubekki Date: Mon, 21 Oct 2013 20:44:04 +0200 Subject: [PATCH 170/860] doc update --- doc/foundation/layout.html | 73 - .../static/css/accessibility_foundicons.css | 132 - .../css/accessibility_foundicons_ie7.css | 110 - doc/foundation/static/css/app.css | 67 - doc/foundation/static/css/foundation.css | 3760 ------- doc/foundation/static/css/foundation.min.css | 1 - .../css/general_enclosed_foundicons.css | 216 - .../css/general_enclosed_foundicons_ie7.css | 194 - .../static/css/general_foundicons.css | 216 - .../static/css/general_foundicons_ie7.css | 194 - .../static/css/social_foundicons.css | 148 - .../static/css/social_foundicons_ie7.css | 126 - .../static/fonts/accessibility_foundicons.eot | Bin 15316 -> 0 bytes .../static/fonts/accessibility_foundicons.svg | 15 - .../static/fonts/accessibility_foundicons.ttf | Bin 15056 -> 0 bytes .../fonts/accessibility_foundicons.woff | Bin 9188 -> 0 bytes .../fonts/general_enclosed_foundicons.eot | Bin 18912 -> 0 bytes .../fonts/general_enclosed_foundicons.svg | 15 - .../fonts/general_enclosed_foundicons.ttf | Bin 18640 -> 0 bytes .../fonts/general_enclosed_foundicons.woff | Bin 9536 -> 0 bytes .../static/fonts/general_foundicons.eot | Bin 15724 -> 0 bytes .../static/fonts/general_foundicons.svg | 15 - .../static/fonts/general_foundicons.ttf | Bin 15488 -> 0 bytes .../static/fonts/general_foundicons.woff | Bin 9728 -> 0 bytes .../static/fonts/social_foundicons.eot | Bin 17112 -> 0 bytes .../static/fonts/social_foundicons.svg | 15 - .../static/fonts/social_foundicons.ttf | Bin 16880 -> 0 bytes .../static/fonts/social_foundicons.woff | Bin 10644 -> 0 bytes doc/foundation/static/humans.txt | 8 - doc/foundation/static/img/.gitkeep | 1 - doc/foundation/static/img/subtle_carbon.png | Bin 112 -> 0 bytes doc/foundation/static/index.html | 143 - doc/foundation/static/js/foundation.min.js | 10 - .../static/js/foundation/foundation.alerts.js | 50 - .../js/foundation/foundation.clearing.js | 478 - .../static/js/foundation/foundation.cookie.js | 74 - .../js/foundation/foundation.dropdown.js | 122 - .../static/js/foundation/foundation.forms.js | 395 - .../js/foundation/foundation.joyride.js | 615 -- .../static/js/foundation/foundation.js | 331 - .../js/foundation/foundation.magellan.js | 130 - .../static/js/foundation/foundation.orbit.js | 357 - .../js/foundation/foundation.placeholder.js | 159 - .../static/js/foundation/foundation.reveal.js | 272 - .../js/foundation/foundation.section.js | 240 - .../js/foundation/foundation.tooltips.js | 195 - .../static/js/foundation/foundation.topbar.js | 215 - .../static/js/vendor/custom.modernizr.js | 4 - doc/foundation/static/js/vendor/jquery.js | 9597 ----------------- doc/foundation/static/js/vendor/zepto.js | 1884 ---- doc/foundation/static/robots.txt | 4 - doc/not-much/base.html | 30 + doc/{foundation => not-much}/globaltoc.html | 0 doc/not-much/layout.html | 1 + doc/{foundation => not-much}/localtoc.html | 0 doc/{foundation => not-much}/relations.html | 0 doc/{foundation => not-much}/searchbox.html | 0 doc/{foundation => not-much}/sourcelink.html | 0 doc/not-much/static/Apache License.txt | 201 + doc/not-much/static/DroidSerif-Bold.ttf | Bin 0 -> 48880 bytes doc/not-much/static/DroidSerif-BoldItalic.ttf | Bin 0 -> 45652 bytes doc/not-much/static/DroidSerif-Italic.ttf | Bin 0 -> 40416 bytes doc/not-much/static/DroidSerif.ttf | Bin 0 -> 43648 bytes .../static/GUST e-foundry License.txt | 29 + .../static/LeagueGothic-CondensedItalic.otf | Bin 0 -> 30076 bytes .../static/LeagueGothic-CondensedRegular.otf | Bin 0 -> 25752 bytes doc/not-much/static/LeagueGothic-Italic.otf | Bin 0 -> 22648 bytes doc/not-much/static/LeagueGothic-Regular.otf | Bin 0 -> 24472 bytes doc/not-much/static/SIL Open Font License.txt | 43 + doc/not-much/static/app.css | 33 + doc/not-much/static/bg2.png | Bin 0 -> 5825 bytes doc/not-much/static/bootstrap-theme.css | 384 + doc/not-much/static/bootstrap.LICENSE | 176 + doc/not-much/static/bootstrap.css | 6805 ++++++++++++ doc/not-much/static/highlighting.css | 61 + .../static}/leaguegothic-regular-webfont.ttf | Bin .../css => not-much/static}/normalize.css | 4 +- doc/not-much/static/not-much.css | 50 + doc/not-much/static/texgyrecursor-bold.otf | Bin 0 -> 106380 bytes .../static/texgyrecursor-bolditalic.otf | Bin 0 -> 110212 bytes doc/not-much/static/texgyrecursor-italic.otf | Bin 0 -> 102336 bytes doc/not-much/static/texgyrecursor-regular.otf | Bin 0 -> 101136 bytes doc/{foundation => not-much}/theme.conf | 3 +- doc/source/changelog.rst | 18 + doc/source/conf.py | 19 +- doc/source/howtos.rst | 31 +- doc/source/index.rst | 27 +- doc/source/internals.rst | 26 +- 88 files changed, 7876 insertions(+), 20646 deletions(-) delete mode 100644 doc/foundation/layout.html delete mode 100644 doc/foundation/static/css/accessibility_foundicons.css delete mode 100644 doc/foundation/static/css/accessibility_foundicons_ie7.css delete mode 100644 doc/foundation/static/css/app.css delete mode 100644 doc/foundation/static/css/foundation.css delete mode 100644 doc/foundation/static/css/foundation.min.css delete mode 100644 doc/foundation/static/css/general_enclosed_foundicons.css delete mode 100644 doc/foundation/static/css/general_enclosed_foundicons_ie7.css delete mode 100644 doc/foundation/static/css/general_foundicons.css delete mode 100644 doc/foundation/static/css/general_foundicons_ie7.css delete mode 100644 doc/foundation/static/css/social_foundicons.css delete mode 100644 doc/foundation/static/css/social_foundicons_ie7.css delete mode 100644 doc/foundation/static/fonts/accessibility_foundicons.eot delete mode 100644 doc/foundation/static/fonts/accessibility_foundicons.svg delete mode 100644 doc/foundation/static/fonts/accessibility_foundicons.ttf delete mode 100644 doc/foundation/static/fonts/accessibility_foundicons.woff delete mode 100644 doc/foundation/static/fonts/general_enclosed_foundicons.eot delete mode 100644 doc/foundation/static/fonts/general_enclosed_foundicons.svg delete mode 100644 doc/foundation/static/fonts/general_enclosed_foundicons.ttf delete mode 100644 doc/foundation/static/fonts/general_enclosed_foundicons.woff delete mode 100644 doc/foundation/static/fonts/general_foundicons.eot delete mode 100644 doc/foundation/static/fonts/general_foundicons.svg delete mode 100644 doc/foundation/static/fonts/general_foundicons.ttf delete mode 100644 doc/foundation/static/fonts/general_foundicons.woff delete mode 100644 doc/foundation/static/fonts/social_foundicons.eot delete mode 100644 doc/foundation/static/fonts/social_foundicons.svg delete mode 100644 doc/foundation/static/fonts/social_foundicons.ttf delete mode 100644 doc/foundation/static/fonts/social_foundicons.woff delete mode 100644 doc/foundation/static/humans.txt delete mode 100644 doc/foundation/static/img/.gitkeep delete mode 100644 doc/foundation/static/img/subtle_carbon.png delete mode 100644 doc/foundation/static/index.html delete mode 100644 doc/foundation/static/js/foundation.min.js delete mode 100644 doc/foundation/static/js/foundation/foundation.alerts.js delete mode 100644 doc/foundation/static/js/foundation/foundation.clearing.js delete mode 100644 doc/foundation/static/js/foundation/foundation.cookie.js delete mode 100644 doc/foundation/static/js/foundation/foundation.dropdown.js delete mode 100644 doc/foundation/static/js/foundation/foundation.forms.js delete mode 100644 doc/foundation/static/js/foundation/foundation.joyride.js delete mode 100644 doc/foundation/static/js/foundation/foundation.js delete mode 100644 doc/foundation/static/js/foundation/foundation.magellan.js delete mode 100644 doc/foundation/static/js/foundation/foundation.orbit.js delete mode 100644 doc/foundation/static/js/foundation/foundation.placeholder.js delete mode 100644 doc/foundation/static/js/foundation/foundation.reveal.js delete mode 100644 doc/foundation/static/js/foundation/foundation.section.js delete mode 100644 doc/foundation/static/js/foundation/foundation.tooltips.js delete mode 100644 doc/foundation/static/js/foundation/foundation.topbar.js delete mode 100644 doc/foundation/static/js/vendor/custom.modernizr.js delete mode 100644 doc/foundation/static/js/vendor/jquery.js delete mode 100644 doc/foundation/static/js/vendor/zepto.js delete mode 100644 doc/foundation/static/robots.txt create mode 100644 doc/not-much/base.html rename doc/{foundation => not-much}/globaltoc.html (100%) create mode 100644 doc/not-much/layout.html rename doc/{foundation => not-much}/localtoc.html (100%) rename doc/{foundation => not-much}/relations.html (100%) rename doc/{foundation => not-much}/searchbox.html (100%) rename doc/{foundation => not-much}/sourcelink.html (100%) create mode 100644 doc/not-much/static/Apache License.txt create mode 100644 doc/not-much/static/DroidSerif-Bold.ttf create mode 100644 doc/not-much/static/DroidSerif-BoldItalic.ttf create mode 100644 doc/not-much/static/DroidSerif-Italic.ttf create mode 100644 doc/not-much/static/DroidSerif.ttf create mode 100644 doc/not-much/static/GUST e-foundry License.txt create mode 100644 doc/not-much/static/LeagueGothic-CondensedItalic.otf create mode 100644 doc/not-much/static/LeagueGothic-CondensedRegular.otf create mode 100644 doc/not-much/static/LeagueGothic-Italic.otf create mode 100644 doc/not-much/static/LeagueGothic-Regular.otf create mode 100644 doc/not-much/static/SIL Open Font License.txt create mode 100644 doc/not-much/static/app.css create mode 100644 doc/not-much/static/bg2.png create mode 100644 doc/not-much/static/bootstrap-theme.css create mode 100644 doc/not-much/static/bootstrap.LICENSE create mode 100644 doc/not-much/static/bootstrap.css create mode 100644 doc/not-much/static/highlighting.css rename doc/{foundation/static/fonts => not-much/static}/leaguegothic-regular-webfont.ttf (100%) mode change 100644 => 100755 rename doc/{foundation/static/css => not-much/static}/normalize.css (99%) create mode 100644 doc/not-much/static/not-much.css create mode 100644 doc/not-much/static/texgyrecursor-bold.otf create mode 100644 doc/not-much/static/texgyrecursor-bolditalic.otf create mode 100644 doc/not-much/static/texgyrecursor-italic.otf create mode 100644 doc/not-much/static/texgyrecursor-regular.otf rename doc/{foundation => not-much}/theme.conf (89%) diff --git a/doc/foundation/layout.html b/doc/foundation/layout.html deleted file mode 100644 index 3415471..0000000 --- a/doc/foundation/layout.html +++ /dev/null @@ -1,73 +0,0 @@ -{% extends "basic/layout.html" %} -{% set script_files = script_files %} -{% set css_files = css_files + ['_static/css/foundation.min.css', '_static/css/app.css'] %} - -{%- block doctype -%} - -{%- endblock %} - -{%- block extrahead %} - - - - -{% endblock %} - -{# Silence the sidebar's, relbar's #} -{% block header %}{% endblock %} -{% block sidebar1 %}{% endblock %} -{% block sidebar2 %}{% endblock %} -{% block relbar1 %}{% endblock %} -{% block relbar2 %}{% endblock %} -{% block sidebarsourcelink %}{% endblock %} - -{% block content %} -
    -
    -
    {% block body %}{% endblock %}
    -
    - -
    -
    -
    -{% endblock %} - -{%- block footer %} -
    -
    -

    - Back to top - {% if theme_source_link_position == "footer" %} -
    - {% include "sourcelink.html" %} - {% endif %} -

    -

    - {%- if show_copyright %} - {%- if hasdoc('copyright') %} - {% trans path=pathto('copyright'), copyright=copyright|e %}© Copyright {{ copyright }}.{% endtrans %}
    - {%- else %} - {% trans copyright=copyright|e %}© Copyright {{ copyright }}.{% endtrans %}
    - {%- endif %} - {%- endif %} - {%- if last_updated %} - {% trans last_updated=last_updated|e %}Last updated on {{ last_updated }}.{% endtrans %}
    - {%- endif %} - {%- if show_sphinx %} - {% trans sphinx_version=sphinx_version|e %}Created using Sphinx {{ sphinx_version }}.{% endtrans %}
    - {%- endif %} -

    -
    -
    -{%- endblock %} diff --git a/doc/foundation/static/css/accessibility_foundicons.css b/doc/foundation/static/css/accessibility_foundicons.css deleted file mode 100644 index c2a844c..0000000 --- a/doc/foundation/static/css/accessibility_foundicons.css +++ /dev/null @@ -1,132 +0,0 @@ -/* font-face */ -@font-face { - font-family: "AccessibilityFoundicons"; - src: url("../fonts/accessibility_foundicons.eot"); - src: url("../fonts/accessibility_foundicons.eot?#iefix") format("embedded-opentype"), url("../fonts/accessibility_foundicons.woff") format("woff"), url("../fonts/accessibility_foundicons.ttf") format("truetype"), url("../fonts/accessibility_foundicons.svg#AccessibilityFoundicons") format("svg"); - font-weight: normal; - font-style: normal; -} - -/* global foundicon styles */ -[class*="foundicon-"] { - display: inline; - width: auto; - height: auto; - line-height: inherit; - vertical-align: baseline; - background-image: none; - background-position: 0 0; - background-repeat: repeat; -} - -[class*="foundicon-"]:before { - font-family: "AccessibilityFoundicons"; - font-weight: normal; - font-style: normal; - text-decoration: inherit; -} - -/* icons */ -.foundicon-wheelchair:before { - content: "\f000"; -} - -.foundicon-speaker:before { - content: "\f001"; -} - -.foundicon-fontsize:before { - content: "\f002"; -} - -.foundicon-eject:before { - content: "\f003"; -} - -.foundicon-view-mode:before { - content: "\f004"; -} - -.foundicon-eyeball:before { - content: "\f005"; -} - -.foundicon-asl:before { - content: "\f006"; -} - -.foundicon-person:before { - content: "\f007"; -} - -.foundicon-question:before { - content: "\f008"; -} - -.foundicon-adult:before { - content: "\f009"; -} - -.foundicon-child:before { - content: "\f00a"; -} - -.foundicon-glasses:before { - content: "\f00b"; -} - -.foundicon-cc:before { - content: "\f00c"; -} - -.foundicon-blind:before { - content: "\f00d"; -} - -.foundicon-braille:before { - content: "\f00e"; -} - -.foundicon-iphone-home:before { - content: "\f00f"; -} - -.foundicon-w3c:before { - content: "\f010"; -} - -.foundicon-css:before { - content: "\f011"; -} - -.foundicon-key:before { - content: "\f012"; -} - -.foundicon-hearing-impaired:before { - content: "\f013"; -} - -.foundicon-male:before { - content: "\f014"; -} - -.foundicon-female:before { - content: "\f015"; -} - -.foundicon-network:before { - content: "\f016"; -} - -.foundicon-guidedog:before { - content: "\f017"; -} - -.foundicon-universal-access:before { - content: "\f018"; -} - -.foundicon-elevator:before { - content: "\f019"; -} diff --git a/doc/foundation/static/css/accessibility_foundicons_ie7.css b/doc/foundation/static/css/accessibility_foundicons_ie7.css deleted file mode 100644 index 699d805..0000000 --- a/doc/foundation/static/css/accessibility_foundicons_ie7.css +++ /dev/null @@ -1,110 +0,0 @@ -/* general icons for IE7 */ -[class*="foundicon-"] { - font-family: "AccessibilityFoundicons"; - font-weight: normal; - font-style: normal; -} - -.foundicon-wheelchair { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-speaker { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-fontsize { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-eject { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-view-mode { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-eyeball { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-asl { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-person { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-question { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-adult { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-child { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-glasses { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-cc { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-blind { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-braille { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-iphone-home { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-w3c { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-css { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-key { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-hearing-impaired { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-male { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-female { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-network { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-guidedog { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-universal-access { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-elevator { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} diff --git a/doc/foundation/static/css/app.css b/doc/foundation/static/css/app.css deleted file mode 100644 index 24cd60f..0000000 --- a/doc/foundation/static/css/app.css +++ /dev/null @@ -1,67 +0,0 @@ -@font-face { - font-family: "League Gothic"; - src: url("../fonts/leaguegothic-regular-webfont.ttf"); - font-weight: normal; - font-style: normal; -} - -body { - background: url('../img/subtle_carbon.png'); - color: white; -} - -.top-bara .name h1 a { - font-weight: normal; -} - - -.highlight { - padding: 10px; - margin-bottom: 10px; -} - -.section ul { - padding-left: 20px; -} - -.warning { - border: 1px solid red; - background-color: rgba(255, 0, 0, 0.1); -} - -h1, h2, h3, h4, h5, .top-bar .name h1 a { - font-family: "League Gothic", Impact, sans; - font-weight: normal; - color: white; -} - -.top-bar, .top-bar ul, .top-bar-section .has-form { - background: none repeat scroll 0 0 transparent; -} - -.container .row { - background-color: rgba(0, 0, 0, 0.3); -} - -.note { - border: 1px solid #2BA6CB; - background-color: rgba(46, 166, 203, 0.3); -} - -.hightlight { - margin-bottom: 1em; -} - -.versionchanged { - border: 1px solid white; - background-color: rgba(255, 255, 255, 0.3); - padding: 5px; -} - -.versionmodified { - font-weight: bold; -} - -.pre { - color: #E44D26; -} \ No newline at end of file diff --git a/doc/foundation/static/css/foundation.css b/doc/foundation/static/css/foundation.css deleted file mode 100644 index 650d2fb..0000000 --- a/doc/foundation/static/css/foundation.css +++ /dev/null @@ -1,3760 +0,0 @@ -*, -*:before, -*:after { - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - box-sizing: border-box; } - -html, -body { - font-size: 16px; } - -body { - background: white; - color: #222222; - padding: 0; - margin: 0; - font-family: "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif; - font-weight: normal; - font-style: normal; - line-height: 1; - position: relative; - -webkit-font-smoothing: antialiased; } - -a:focus { - outline: none; } - -img, -object, -embed { - max-width: 100%; - height: auto; } - -object, -embed { - height: 100%; } - -img { - -ms-interpolation-mode: bicubic; } - -#map_canvas img, -#map_canvas embed, -#map_canvas object, -.map_canvas img, -.map_canvas embed, -.map_canvas object { - max-width: none !important; } - -.left { - float: left !important; } - -.right { - float: right !important; } - -.text-left { - text-align: left !important; } - -.text-right { - text-align: right !important; } - -.text-center { - text-align: center !important; } - -.text-justify { - text-align: justify !important; } - -.hide { - display: none; } - -img { - display: inline-block; } - -textarea { - height: auto; - min-height: 50px; } - -select { - width: 100%; } - -/* Grid HTML Classes */ -.row { - width: 100%; - margin-left: auto; - margin-right: auto; - margin-top: 0; - margin-bottom: 0; - max-width: 62.5em; - *zoom: 1; } - .row:before, .row:after { - content: " "; - display: table; } - .row:after { - clear: both; } - .row .column, - .row .columns { - position: relative; - padding-left: 0.9375em; - padding-right: 0.9375em; - width: 100%; } - .row.collapse .column, - .row.collapse .columns { - position: relative; - padding-left: 0; - padding-right: 0; } - .row .row { - width: auto; - margin-left: -0.9375em; - margin-right: -0.9375em; - margin-top: 0; - margin-bottom: 0; - max-width: none; - *zoom: 1; } - .row .row:before, .row .row:after { - content: " "; - display: table; } - .row .row:after { - clear: both; } - .row .row.collapse { - width: auto; - margin: 0; - max-width: none; - *zoom: 1; } - .row .row.collapse:before, .row .row.collapse:after { - content: " "; - display: table; } - .row .row.collapse:after { - clear: both; } - -@media only screen { - .row .column, - .row .columns { - position: relative; - padding-left: 0.9375em; - padding-right: 0.9375em; - float: left; } - - .row .small-1 { - position: relative; - width: 8.33333%; } - - .row .small-2 { - position: relative; - width: 16.66667%; } - - .row .small-3 { - position: relative; - width: 25%; } - - .row .small-4 { - position: relative; - width: 33.33333%; } - - .row .small-5 { - position: relative; - width: 41.66667%; } - - .row .small-6 { - position: relative; - width: 50%; } - - .row .small-7 { - position: relative; - width: 58.33333%; } - - .row .small-8 { - position: relative; - width: 66.66667%; } - - .row .small-9 { - position: relative; - width: 75%; } - - .row .small-10 { - position: relative; - width: 83.33333%; } - - .row .small-11 { - position: relative; - width: 91.66667%; } - - .row .small-12 { - position: relative; - width: 100%; } - - .row .small-offset-1 { - position: relative; - margin-left: 8.33333%; } - - .row .small-offset-2 { - position: relative; - margin-left: 16.66667%; } - - .row .small-offset-3 { - position: relative; - margin-left: 25%; } - - .row .small-offset-4 { - position: relative; - margin-left: 33.33333%; } - - .row .small-offset-5 { - position: relative; - margin-left: 41.66667%; } - - .row .small-offset-6 { - position: relative; - margin-left: 50%; } - - .row .small-offset-7 { - position: relative; - margin-left: 58.33333%; } - - .row .small-offset-8 { - position: relative; - margin-left: 66.66667%; } - - .row .small-offset-9 { - position: relative; - margin-left: 75%; } - - .row .small-offset-10 { - position: relative; - margin-left: 83.33333%; } - - [class*="column"] + [class*="column"]:last-child { - float: right; } - - [class*="column"] + [class*="column"].end { - float: left; } - - .column.small-centered, - .columns.small-centered { - position: relative; - margin-left: auto; - margin-right: auto; - float: none; } } -/* Styles for screens that are atleast 768px; */ -@media only screen and (min-width: 48em) { - .row .large-1 { - position: relative; - width: 8.33333%; } - - .row .large-2 { - position: relative; - width: 16.66667%; } - - .row .large-3 { - position: relative; - width: 25%; } - - .row .large-4 { - position: relative; - width: 33.33333%; } - - .row .large-5 { - position: relative; - width: 41.66667%; } - - .row .large-6 { - position: relative; - width: 50%; } - - .row .large-7 { - position: relative; - width: 58.33333%; } - - .row .large-8 { - position: relative; - width: 66.66667%; } - - .row .large-9 { - position: relative; - width: 75%; } - - .row .large-10 { - position: relative; - width: 83.33333%; } - - .row .large-11 { - position: relative; - width: 91.66667%; } - - .row .large-12 { - position: relative; - width: 100%; } - - .row .large-offset-1 { - position: relative; - margin-left: 8.33333%; } - - .row .large-offset-2 { - position: relative; - margin-left: 16.66667%; } - - .row .large-offset-3 { - position: relative; - margin-left: 25%; } - - .row .large-offset-4 { - position: relative; - margin-left: 33.33333%; } - - .row .large-offset-5 { - position: relative; - margin-left: 41.66667%; } - - .row .large-offset-6 { - position: relative; - margin-left: 50%; } - - .row .large-offset-7 { - position: relative; - margin-left: 58.33333%; } - - .row .large-offset-8 { - position: relative; - margin-left: 66.66667%; } - - .row .large-offset-9 { - position: relative; - margin-left: 75%; } - - .row .large-offset-10 { - position: relative; - margin-left: 83.33333%; } - - .push-2 { - position: relative; - left: 16.66667%; - right: auto; } - - .pull-2 { - position: relative; - right: 16.66667%; - left: auto; } - - .push-3 { - position: relative; - left: 25%; - right: auto; } - - .pull-3 { - position: relative; - right: 25%; - left: auto; } - - .push-4 { - position: relative; - left: 33.33333%; - right: auto; } - - .pull-4 { - position: relative; - right: 33.33333%; - left: auto; } - - .push-5 { - position: relative; - left: 41.66667%; - right: auto; } - - .pull-5 { - position: relative; - right: 41.66667%; - left: auto; } - - .push-6 { - position: relative; - left: 50%; - right: auto; } - - .pull-6 { - position: relative; - right: 50%; - left: auto; } - - .push-7 { - position: relative; - left: 58.33333%; - right: auto; } - - .pull-7 { - position: relative; - right: 58.33333%; - left: auto; } - - .push-8 { - position: relative; - left: 66.66667%; - right: auto; } - - .pull-8 { - position: relative; - right: 66.66667%; - left: auto; } - - .push-9 { - position: relative; - left: 75%; - right: auto; } - - .pull-9 { - position: relative; - right: 75%; - left: auto; } - - .push-10 { - position: relative; - left: 83.33333%; - right: auto; } - - .pull-10 { - position: relative; - right: 83.33333%; - left: auto; } - - .small-push-2 { - left: inherit; } - - .small-pull-2 { - right: inherit; } - - .small-push-3 { - left: inherit; } - - .small-pull-3 { - right: inherit; } - - .small-push-4 { - left: inherit; } - - .small-pull-4 { - right: inherit; } - - .small-push-5 { - left: inherit; } - - .small-pull-5 { - right: inherit; } - - .small-push-6 { - left: inherit; } - - .small-pull-6 { - right: inherit; } - - .small-push-7 { - left: inherit; } - - .small-pull-7 { - right: inherit; } - - .small-push-8 { - left: inherit; } - - .small-pull-8 { - right: inherit; } - - .small-push-9 { - left: inherit; } - - .small-pull-9 { - right: inherit; } - - .small-push-10 { - left: inherit; } - - .small-pull-10 { - right: inherit; } - - .column.large-centered, - .columns.large-centered { - position: relative; - margin-left: auto; - margin-right: auto; - float: none; } } -/* Foundation Visibility HTML Classes */ -.show-for-small, -.show-for-medium-down, -.show-for-large-down { - display: inherit !important; } - -.show-for-medium, -.show-for-medium-up, -.show-for-large, -.show-for-large-up, -.show-for-xlarge { - display: none !important; } - -.hide-for-medium, -.hide-for-medium-up, -.hide-for-large, -.hide-for-large-up, -.hide-for-xlarge { - display: inherit !important; } - -.hide-for-small, -.hide-for-medium-down, -.hide-for-large-down { - display: none !important; } - -/* Specific visilbity for tables */ -table.show-for-small, table.show-for-medium-down, table.show-for-large-down, table.hide-for-medium, table.hide-for-medium-up, table.hide-for-large, table.hide-for-large-up, table.hide-for-xlarge { - display: table; } - -thead.show-for-small, thead.show-for-medium-down, thead.show-for-large-down, thead.hide-for-medium, thead.hide-for-medium-up, thead.hide-for-large, thead.hide-for-large-up, thead.hide-for-xlarge { - display: table-header-group !important; } - -tbody.show-for-small, tbody.show-for-medium-down, tbody.show-for-large-down, tbody.hide-for-medium, tbody.hide-for-medium-up, tbody.hide-for-large, tbody.hide-for-large-up, tbody.hide-for-xlarge { - display: table-row-group !important; } - -tr.show-for-small, tr.show-for-medium-down, tr.show-for-large-down, tr.hide-for-medium, tr.hide-for-medium-up, tr.hide-for-large, tr.hide-for-large-up, tr.hide-for-xlarge { - display: table-row !important; } - -td.show-for-small, td.show-for-medium-down, td.show-for-large-down, td.hide-for-medium, td.hide-for-medium-up, td.hide-for-large, td.hide-for-large-up, td.hide-for-xlarge, -th.show-for-small, -th.show-for-medium-down, -th.show-for-large-down, -th.hide-for-medium, -th.hide-for-medium-up, -th.hide-for-large, -th.hide-for-large-up, -th.hide-for-xlarge { - display: table-cell !important; } - -/* Medium Displays: 768px - 1279px */ -@media only screen and (min-width: 48em) { - .show-for-medium, - .show-for-medium-up { - display: inherit !important; } - - .show-for-small { - display: none !important; } - - .hide-for-small { - display: inherit !important; } - - .hide-for-medium, - .hide-for-medium-up { - display: none !important; } - - /* Specific visilbity for tables */ - table.show-for-medium, table.show-for-medium-up, table.hide-for-small { - display: table; } - - thead.show-for-medium, thead.show-for-medium-up, thead.hide-for-small { - display: table-header-group !important; } - - tbody.show-for-medium, tbody.show-for-medium-up, tbody.hide-for-small { - display: table-row-group !important; } - - tr.show-for-medium, tr.show-for-medium-up, tr.hide-for-small { - display: table-row !important; } - - td.show-for-medium, td.show-for-medium-up, td.hide-for-small, - th.show-for-medium, - th.show-for-medium-up, - th.hide-for-small { - display: table-cell !important; } } -/* Large Displays: 1280px - 1440px */ -@media only screen and (min-width: 80em) { - .show-for-large, - .show-for-large-up { - display: inherit !important; } - - .show-for-medium, - .show-for-medium-down { - display: none !important; } - - .hide-for-medium, - .hide-for-medium-down { - display: inherit !important; } - - .hide-for-large, - .hide-for-large-up { - display: none !important; } - - /* Specific visilbity for tables */ - table.show-for-large, table.show-for-large-up, table.hide-for-medium, table.hide-for-medium-down { - display: table; } - - thead.show-for-large, thead.show-for-large-up, thead.hide-for-medium, thead.hide-for-medium-down { - display: table-header-group !important; } - - tbody.show-for-large, tbody.show-for-large-up, tbody.hide-for-medium, tbody.hide-for-medium-down { - display: table-row-group !important; } - - tr.show-for-large, tr.show-for-large-up, tr.hide-for-medium, tr.hide-for-medium-down { - display: table-row !important; } - - td.show-for-large, td.show-for-large-up, td.hide-for-medium, td.hide-for-medium-down, - th.show-for-large, - th.show-for-large-up, - th.hide-for-medium, - th.hide-for-medium-down { - display: table-cell !important; } } -/* X-Large Displays: 1400px and up */ -@media only screen and (min-width: 90em) { - .show-for-xlarge { - display: inherit !important; } - - .show-for-large, - .show-for-large-down { - display: none !important; } - - .hide-for-large, - .hide-for-large-down { - display: inherit !important; } - - .hide-for-xlarge { - display: none !important; } - - /* Specific visilbity for tables */ - table.show-for-xlarge, table.hide-for-large, table.hide-for-large-down { - display: table; } - - thead.show-for-xlarge, thead.hide-for-large, thead.hide-for-large-down { - display: table-header-group !important; } - - tbody.show-for-xlarge, tbody.hide-for-large, tbody.hide-for-large-down { - display: table-row-group !important; } - - tr.show-for-xlarge, tr.hide-for-large, tr.hide-for-large-down { - display: table-row !important; } - - td.show-for-xlarge, td.hide-for-large, td.hide-for-large-down, - th.show-for-xlarge, - th.hide-for-large, - th.hide-for-large-down { - display: table-cell !important; } } -/* Orientation targeting */ -.show-for-landscape, -.hide-for-portrait { - display: inherit !important; } - -.hide-for-landscape, -.show-for-portrait { - display: none !important; } - -/* Specific visilbity for tables */ -table.hide-for-landscape, table.show-for-portrait { - display: table; } - -thead.hide-for-landscape, thead.show-for-portrait { - display: table-header-group !important; } - -tbody.hide-for-landscape, tbody.show-for-portrait { - display: table-row-group !important; } - -tr.hide-for-landscape, tr.show-for-portrait { - display: table-row !important; } - -td.hide-for-landscape, td.show-for-portrait, -th.hide-for-landscape, -th.show-for-portrait { - display: table-cell !important; } - -@media only screen and (orientation: landscape) { - .show-for-landscape, - .hide-for-portrait { - display: inherit !important; } - - .hide-for-landscape, - .show-for-portrait { - display: none !important; } - - /* Specific visilbity for tables */ - table.show-for-landscape, table.hide-for-portrait { - display: table; } - - thead.show-for-landscape, thead.hide-for-portrait { - display: table-header-group !important; } - - tbody.show-for-landscape, tbody.hide-for-portrait { - display: table-row-group !important; } - - tr.show-for-landscape, tr.hide-for-portrait { - display: table-row !important; } - - td.show-for-landscape, td.hide-for-portrait, - th.show-for-landscape, - th.hide-for-portrait { - display: table-cell !important; } } -@media only screen and (orientation: portrait) { - .show-for-portrait, - .hide-for-landscape { - display: inherit !important; } - - .hide-for-portrait, - .show-for-landscape { - display: none !important; } - - /* Specific visilbity for tables */ - table.show-for-portrait, table.hide-for-landscape { - display: table; } - - thead.show-for-portrait, thead.hide-for-landscape { - display: table-header-group !important; } - - tbody.show-for-portrait, tbody.hide-for-landscape { - display: table-row-group !important; } - - tr.show-for-portrait, tr.hide-for-landscape { - display: table-row !important; } - - td.show-for-portrait, td.hide-for-landscape, - th.show-for-portrait, - th.hide-for-landscape { - display: table-cell !important; } } -/* Touch-enabled device targeting */ -.show-for-touch { - display: none !important; } - -.hide-for-touch { - display: inherit !important; } - -.touch .show-for-touch { - display: inherit !important; } - -.touch .hide-for-touch { - display: none !important; } - -/* Specific visilbity for tables */ -table.hide-for-touch { - display: table; } - -.touch table.show-for-touch { - display: table; } - -thead.hide-for-touch { - display: table-header-group !important; } - -.touch thead.show-for-touch { - display: table-header-group !important; } - -tbody.hide-for-touch { - display: table-row-group !important; } - -.touch tbody.show-for-touch { - display: table-row-group !important; } - -tr.hide-for-touch { - display: table-row !important; } - -.touch tr.show-for-touch { - display: table-row !important; } - -td.hide-for-touch { - display: table-cell !important; } - -.touch td.show-for-touch { - display: table-cell !important; } - -th.hide-for-touch { - display: table-cell !important; } - -.touch th.show-for-touch { - display: table-cell !important; } - -/* Foundation Block Grids for below small breakpoint */ -@media only screen { - [class*="block-grid-"] { - display: block; - overflow: hidden; - padding: 0; - margin: 0 -10px; } - [class*="block-grid-"] > li { - display: block; - height: auto; - float: left; - padding: 0 10px 10px; } - - .small-block-grid-1 > li { - width: 100%; - padding: 0 10px 10px; } - .small-block-grid-1 > li:nth-of-type(1n+1) { - clear: both; } - - .small-block-grid-2 > li { - width: 50%; - padding: 0 10px 10px; } - .small-block-grid-2 > li:nth-of-type(2n+1) { - clear: both; } - - .small-block-grid-3 > li { - width: 33.33333%; - padding: 0 10px 10px; } - .small-block-grid-3 > li:nth-of-type(3n+1) { - clear: both; } - - .small-block-grid-4 > li { - width: 25%; - padding: 0 10px 10px; } - .small-block-grid-4 > li:nth-of-type(4n+1) { - clear: both; } - - .small-block-grid-5 > li { - width: 20%; - padding: 0 10px 10px; } - .small-block-grid-5 > li:nth-of-type(5n+1) { - clear: both; } - - .small-block-grid-6 > li { - width: 16.66667%; - padding: 0 10px 10px; } - .small-block-grid-6 > li:nth-of-type(6n+1) { - clear: both; } - - .small-block-grid-7 > li { - width: 14.28571%; - padding: 0 10px 10px; } - .small-block-grid-7 > li:nth-of-type(7n+1) { - clear: both; } - - .small-block-grid-8 > li { - width: 12.5%; - padding: 0 10px 10px; } - .small-block-grid-8 > li:nth-of-type(8n+1) { - clear: both; } - - .small-block-grid-9 > li { - width: 11.11111%; - padding: 0 10px 10px; } - .small-block-grid-9 > li:nth-of-type(9n+1) { - clear: both; } - - .small-block-grid-10 > li { - width: 10%; - padding: 0 10px 10px; } - .small-block-grid-10 > li:nth-of-type(10n+1) { - clear: both; } - - .small-block-grid-11 > li { - width: 9.09091%; - padding: 0 10px 10px; } - .small-block-grid-11 > li:nth-of-type(11n+1) { - clear: both; } - - .small-block-grid-12 > li { - width: 8.33333%; - padding: 0 10px 10px; } - .small-block-grid-12 > li:nth-of-type(12n+1) { - clear: both; } } -/* Foundation Block Grids for above small breakpoint */ -@media only screen and (min-width: 48em) { - .large-block-grid-1 > li { - width: 100%; - padding: 0 10px 10px; } - .large-block-grid-1 > li:nth-of-type(1n+1) { - clear: both; } - - .large-block-grid-2 > li { - width: 50%; - padding: 0 10px 10px; } - .large-block-grid-2 > li:nth-of-type(2n+1) { - clear: both; } - - .large-block-grid-3 > li { - width: 33.33333%; - padding: 0 10px 10px; } - .large-block-grid-3 > li:nth-of-type(3n+1) { - clear: both; } - - .large-block-grid-4 > li { - width: 25%; - padding: 0 10px 10px; } - .large-block-grid-4 > li:nth-of-type(4n+1) { - clear: both; } - - .large-block-grid-5 > li { - width: 20%; - padding: 0 10px 10px; } - .large-block-grid-5 > li:nth-of-type(5n+1) { - clear: both; } - - .large-block-grid-6 > li { - width: 16.66667%; - padding: 0 10px 10px; } - .large-block-grid-6 > li:nth-of-type(6n+1) { - clear: both; } - - .large-block-grid-7 > li { - width: 14.28571%; - padding: 0 10px 10px; } - .large-block-grid-7 > li:nth-of-type(7n+1) { - clear: both; } - - .large-block-grid-8 > li { - width: 12.5%; - padding: 0 10px 10px; } - .large-block-grid-8 > li:nth-of-type(8n+1) { - clear: both; } - - .large-block-grid-9 > li { - width: 11.11111%; - padding: 0 10px 10px; } - .large-block-grid-9 > li:nth-of-type(9n+1) { - clear: both; } - - .large-block-grid-10 > li { - width: 10%; - padding: 0 10px 10px; } - .large-block-grid-10 > li:nth-of-type(10n+1) { - clear: both; } - - .large-block-grid-11 > li { - width: 9.09091%; - padding: 0 10px 10px; } - .large-block-grid-11 > li:nth-of-type(11n+1) { - clear: both; } - - .large-block-grid-12 > li { - width: 8.33333%; - padding: 0 10px 10px; } - .large-block-grid-12 > li:nth-of-type(12n+1) { - clear: both; } - - [class*="small-block-grid-"] > li { - clear: none !important; } } -p.lead { - font-size: 1.21875em; - line-height: 1.6; } - -.subheader { - line-height: 1.4; - color: #6f6f6f; - font-weight: 300; - margin-top: 0.2em; - margin-bottom: 0.5em; } - -/* Typography resets */ -div, -dl, -dt, -dd, -ul, -ol, -li, -h1, -h2, -h3, -h4, -h5, -h6, -pre, -form, -p, -blockquote, -th, -td { - margin: 0; - padding: 0; - direction: ltr; } - -/* Default Link Styles */ -a { - color: #2ba6cb; - text-decoration: none; - line-height: inherit; } - a:hover, a:focus { - color: #2795b6; } - a img { - border: none; } - -/* Default paragraph styles */ -p { - font-family: inherit; - font-weight: normal; - font-size: 1em; - line-height: 1.6; - margin-bottom: 1.25em; } - p aside { - font-size: 0.875em; - line-height: 1.35; - font-style: italic; } - -/* Default header styles */ -h1, h2, h3, h4, h5, h6 { - font-family: "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif; - font-weight: bold; - font-style: normal; - color: #222222; - text-rendering: optimizeLegibility; - margin-top: 0.2em; - margin-bottom: 0.5em; - line-height: 1.2125em; } - h1 small, h2 small, h3 small, h4 small, h5 small, h6 small { - font-size: 60%; - color: #6f6f6f; - line-height: 0; } - -h1 { - font-size: 2.125em; } - -h2 { - font-size: 1.6875em; } - -h3 { - font-size: 1.375em; } - -h4 { - font-size: 1.125em; } - -h5 { - font-size: 1.125em; } - -h6 { - font-size: 1em; } - -hr { - border: solid #dddddd; - border-width: 1px 0 0; - clear: both; - margin: 1.25em 0 1.1875em; - height: 0; } - -/* Helpful Typography Defaults */ -em, -i { - font-style: italic; - line-height: inherit; } - -strong, -b { - font-weight: bold; - line-height: inherit; } - -small { - font-size: 60%; - line-height: inherit; } - -code { - font-family: Consolas, "Liberation Mono", Courier, monospace; - font-weight: bold; - color: #7f0a0c; } - -/* Lists */ -ul, -ol, -dl { - font-size: 1em; - line-height: 1.6; - margin-bottom: 1.25em; - list-style-position: outside; - font-family: inherit; } - -/* Unordered Lists */ -ul li ul, -ul li ol { - margin-left: 1.25em; - margin-bottom: 0; - font-size: 1em; - /* Override nested font-size change */ } -ul.square li ul, ul.circle li ul, ul.disc li ul { - list-style: inherit; } -ul.square { - list-style-type: square; } -ul.circle { - list-style-type: circle; } -ul.disc { - list-style-type: disc; } -ul.no-bullet { - list-style: none; } - -/* Ordered Lists */ -ol li ul, -ol li ol { - margin-left: 1.25em; - margin-bottom: 0; } - -/* Definition Lists */ -dl dt { - margin-bottom: 0.3em; - font-weight: bold; } -dl dd { - margin-bottom: 0.75em; } - -/* Abbreviations */ -abbr, -acronym { - text-transform: uppercase; - font-size: 90%; - color: #222222; - border-bottom: 1px dotted #dddddd; - cursor: help; } - -abbr { - text-transform: none; } - -/* Blockquotes */ -blockquote { - margin: 0 0 1.25em; - padding: 0.5625em 1.25em 0 1.1875em; - border-left: 1px solid #dddddd; } - blockquote cite { - display: block; - font-size: 0.8125em; - color: #555555; } - blockquote cite:before { - content: "\2014 \0020"; } - blockquote cite a, - blockquote cite a:visited { - color: #555555; } - -blockquote, -blockquote p { - line-height: 1.6; - color: #6f6f6f; } - -/* Microformats */ -.vcard { - display: inline-block; - margin: 0 0 1.25em 0; - border: 1px solid #dddddd; - padding: 0.625em 0.75em; } - .vcard li { - margin: 0; - display: block; } - .vcard .fn { - font-weight: bold; - font-size: 0.9375em; } - -.vevent .summary { - font-weight: bold; } -.vevent abbr { - cursor: default; - text-decoration: none; - font-weight: bold; - border: none; - padding: 0 0.0625em; } - -@media only screen and (min-width: 48em) { - h1, h2, h3, h4, h5, h6 { - line-height: 1.4; } - - h1 { - font-size: 2.75em; } - - h2 { - font-size: 2.3125em; } - - h3 { - font-size: 1.6875em; } - - h4 { - font-size: 1.4375em; } } -/* - * Print styles. - * - * Inlined to avoid required HTTP connection: www.phpied.com/delay-loading-your-print-css/ - * Credit to Paul Irish and HTML5 Boilerplate (html5boilerplate.com) -*/ -.print-only { - display: none !important; } - -@media print { - * { - background: transparent !important; - color: black !important; - /* Black prints faster: h5bp.com/s */ - box-shadow: none !important; - text-shadow: none !important; } - - a, - a:visited { - text-decoration: underline; } - - a[href]:after { - content: " (" attr(href) ")"; } - - abbr[title]:after { - content: " (" attr(title) ")"; } - - .ir a:after, - a[href^="javascript:"]:after, - a[href^="#"]:after { - content: ""; } - - pre, - blockquote { - border: 1px solid #999999; - page-break-inside: avoid; } - - thead { - display: table-header-group; - /* h5bp.com/t */ } - - tr, - img { - page-break-inside: avoid; } - - img { - max-width: 100% !important; } - - @page { - margin: 0.5cm; } - - p, - h2, - h3 { - orphans: 3; - widows: 3; } - - h2, - h3 { - page-break-after: avoid; } - - .hide-on-print { - display: none !important; } - - .print-only { - display: block !important; } - - .hide-for-print { - display: none !important; } - - .show-for-print { - display: inherit !important; } } -.button { - border-style: solid; - border-width: 1px; - cursor: pointer; - font-family: inherit; - font-weight: bold; - line-height: 1; - margin: 0 0 1.25em; - position: relative; - text-decoration: none; - text-align: center; - display: inline-block; - padding-top: 0.75em; - padding-right: 1.5em; - padding-bottom: 0.8125em; - padding-left: 1.5em; - font-size: 1em; - background-color: #2ba6cb; - border-color: #2284a1; - color: white; } - .button:hover, .button:focus { - background-color: #2284a1; } - .button:hover, .button:focus { - color: white; } - .button.secondary { - background-color: #e9e9e9; - border-color: #d0d0d0; - color: #333333; } - .button.secondary:hover, .button.secondary:focus { - background-color: #d0d0d0; } - .button.secondary:hover, .button.secondary:focus { - color: #333333; } - .button.success { - background-color: #5da423; - border-color: #457a1a; - color: white; } - .button.success:hover, .button.success:focus { - background-color: #457a1a; } - .button.success:hover, .button.success:focus { - color: white; } - .button.alert { - background-color: #c60f13; - border-color: #970b0e; - color: white; } - .button.alert:hover, .button.alert:focus { - background-color: #970b0e; } - .button.alert:hover, .button.alert:focus { - color: white; } - .button.large { - padding-top: 1em; - padding-right: 2em; - padding-bottom: 1.0625em; - padding-left: 2em; - font-size: 1.25em; } - .button.small { - padding-top: 0.5625em; - padding-right: 1.125em; - padding-bottom: 0.625em; - padding-left: 1.125em; - font-size: 0.8125em; } - .button.tiny { - padding-top: 0.4375em; - padding-right: 0.875em; - padding-bottom: 0.5em; - padding-left: 0.875em; - font-size: 0.6875em; } - .button.expand { - padding-top: 0.75em; - padding-right: 1.5em; - padding-bottom: 0.8125em; - padding-left: 1.5em; - font-size: 1em; - padding-top: 0.75em; - padding-right: 0px; - padding-bottom: 0.8125em; - padding-left: 0px; - width: 100%; } - .button.left-align { - text-align: left; - text-indent: 0.75em; } - .button.right-align { - text-align: right; - padding-right: 0.75em; } - .button.disabled, .button[disabled] { - background-color: #2ba6cb; - border-color: #2284a1; - color: white; - cursor: default; - opacity: 0.6; - -webkit-box-shadow: none; - box-shadow: none; } - .button.disabled:hover, .button.disabled:focus, .button[disabled]:hover, .button[disabled]:focus { - background-color: #2284a1; } - .button.disabled:hover, .button.disabled:focus, .button[disabled]:hover, .button[disabled]:focus { - color: white; } - .button.disabled:hover, .button.disabled:focus, .button[disabled]:hover, .button[disabled]:focus { - background-color: #2ba6cb; } - .button.disabled.secondary, .button[disabled].secondary { - background-color: #e9e9e9; - border-color: #d0d0d0; - color: #333333; - cursor: default; - opacity: 0.6; - -webkit-box-shadow: none; - box-shadow: none; } - .button.disabled.secondary:hover, .button.disabled.secondary:focus, .button[disabled].secondary:hover, .button[disabled].secondary:focus { - background-color: #d0d0d0; } - .button.disabled.secondary:hover, .button.disabled.secondary:focus, .button[disabled].secondary:hover, .button[disabled].secondary:focus { - color: #333333; } - .button.disabled.secondary:hover, .button.disabled.secondary:focus, .button[disabled].secondary:hover, .button[disabled].secondary:focus { - background-color: #e9e9e9; } - .button.disabled.success, .button[disabled].success { - background-color: #5da423; - border-color: #457a1a; - color: white; - cursor: default; - opacity: 0.6; - -webkit-box-shadow: none; - box-shadow: none; } - .button.disabled.success:hover, .button.disabled.success:focus, .button[disabled].success:hover, .button[disabled].success:focus { - background-color: #457a1a; } - .button.disabled.success:hover, .button.disabled.success:focus, .button[disabled].success:hover, .button[disabled].success:focus { - color: white; } - .button.disabled.success:hover, .button.disabled.success:focus, .button[disabled].success:hover, .button[disabled].success:focus { - background-color: #5da423; } - .button.disabled.alert, .button[disabled].alert { - background-color: #c60f13; - border-color: #970b0e; - color: white; - cursor: default; - opacity: 0.6; - -webkit-box-shadow: none; - box-shadow: none; } - .button.disabled.alert:hover, .button.disabled.alert:focus, .button[disabled].alert:hover, .button[disabled].alert:focus { - background-color: #970b0e; } - .button.disabled.alert:hover, .button.disabled.alert:focus, .button[disabled].alert:hover, .button[disabled].alert:focus { - color: white; } - .button.disabled.alert:hover, .button.disabled.alert:focus, .button[disabled].alert:hover, .button[disabled].alert:focus { - background-color: #c60f13; } - -input.button, -button.button { - padding-top: 0.8125em; - padding-bottom: 0.75em; } - input.button.tiny, - button.button.tiny { - padding-top: 0.5em; - padding-bottom: 0.4375em; } - input.button.small, - button.button.small { - padding-top: 0.625em; - padding-bottom: 0.5625em; } - input.button.large, - button.button.large { - padding-top: 1.03125em; - padding-bottom: 1.03125em; } - -@media only screen { - .button { - -webkit-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset; - box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset; - -webkit-transition: background-color 300ms ease-out; - -moz-transition: background-color 300ms ease-out; - transition: background-color 300ms ease-out; } - .button:active { - -webkit-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2) inset; - box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2) inset; } - .button.radius { - -webkit-border-radius: 3px; - border-radius: 3px; } - .button.round { - -webkit-border-radius: 1000px; - border-radius: 1000px; } } -@media only screen and (min-width: 48em) { - .button { - display: inline-block; } } -/* Standard Forms */ -form { - margin: 0 0 1em; } - -/* Using forms within rows, we need to set some defaults */ -form .row .row { - margin: -0.5em; } - form .row .row .column, - form .row .row .columns { - padding: 0 0.5em; } - form .row .row.collapse { - margin: 0; } - form .row .row.collapse .column, - form .row .row.collapse .columns { - padding: 0; } -form .row input.column, -form .row input.columns { - padding-left: 0.5em; } - -form .row .row { - margin: 0; } - -/* Label Styles */ -label { - font-size: 0.875em; - color: #4d4d4d; - cursor: pointer; - display: block; - font-weight: 500; - margin-bottom: 0.1875em; } - label.right { - float: none; - text-align: right; } - label.inline { - margin: 0 0 1em 0; - padding: 0.625em 0; } - -/* Attach elements to the beginning or end of an input */ -.prefix, -.postfix { - display: block; - position: relative; - z-index: 2; - text-align: center; - width: 100%; - padding-top: 0; - padding-bottom: 0; - border-style: solid; - border-width: 1px; - overflow: hidden; - font-size: 0.875em; - height: 2.3125em; - line-height: 2.3125em; } - -/* Adjust padding, alignment and radius if pre/post element is a button */ -.postfix.button { - padding-left: 0; - padding-right: 0; - padding-top: 0; - padding-bottom: 0; - text-align: center; - line-height: 2.125em; } - -.prefix.button { - padding-left: 0; - padding-right: 0; - padding-top: 0; - padding-bottom: 0; - text-align: center; - line-height: 2.125em; } - -.prefix.button.radius { - -webkit-border-radius: 0; - border-radius: 0; - -moz-border-radius-bottomleft: 3px; - -moz-border-radius-topleft: 3px; - -webkit-border-bottom-left-radius: 3px; - -webkit-border-top-left-radius: 3px; - border-bottom-left-radius: 3px; - border-top-left-radius: 3px; } - -.postfix.button.radius { - -webkit-border-radius: 0; - border-radius: 0; - -moz-border-radius-topright: 3px; - -moz-border-radius-bottomright: 3px; - -webkit-border-top-right-radius: 3px; - -webkit-border-bottom-right-radius: 3px; - border-top-right-radius: 3px; - border-bottom-right-radius: 3px; } - -.prefix.button.round { - -webkit-border-radius: 0; - border-radius: 0; - -moz-border-radius-bottomleft: 1000px; - -moz-border-radius-topleft: 1000px; - -webkit-border-bottom-left-radius: 1000px; - -webkit-border-top-left-radius: 1000px; - border-bottom-left-radius: 1000px; - border-top-left-radius: 1000px; } - -.postfix.button.round { - -webkit-border-radius: 0; - border-radius: 0; - -moz-border-radius-topright: 1000px; - -moz-border-radius-bottomright: 1000px; - -webkit-border-top-right-radius: 1000px; - -webkit-border-bottom-right-radius: 1000px; - border-top-right-radius: 1000px; - border-bottom-right-radius: 1000px; } - -/* Separate prefix and postfix styles when on span so buttons keep their own */ -span.prefix { - background: #f2f2f2; - border-color: #d9d9d9; - border-right: none; - color: #333333; } - span.prefix.radius { - -webkit-border-radius: 0; - border-radius: 0; - -moz-border-radius-bottomleft: 3px; - -moz-border-radius-topleft: 3px; - -webkit-border-bottom-left-radius: 3px; - -webkit-border-top-left-radius: 3px; - border-bottom-left-radius: 3px; - border-top-left-radius: 3px; } - -span.postfix { - background: #f2f2f2; - border-color: #cccccc; - border-left: none; - color: #333333; } - span.postfix.radius { - -webkit-border-radius: 0; - border-radius: 0; - -moz-border-radius-topright: 3px; - -moz-border-radius-bottomright: 3px; - -webkit-border-top-right-radius: 3px; - -webkit-border-bottom-right-radius: 3px; - border-top-right-radius: 3px; - border-bottom-right-radius: 3px; } - -/* Input groups will automatically style first and last elements of the group */ -.input-group.radius > *:first-child, .input-group.radius > *:first-child * { - -webkit-border-radius: 0; - border-radius: 0; - -moz-border-radius-bottomleft: 3px; - -moz-border-radius-topleft: 3px; - -webkit-border-bottom-left-radius: 3px; - -webkit-border-top-left-radius: 3px; - border-bottom-left-radius: 3px; - border-top-left-radius: 3px; } -.input-group.radius > *:last-child, .input-group.radius > *:last-child * { - -webkit-border-radius: 0; - border-radius: 0; - -moz-border-radius-topright: 3px; - -moz-border-radius-bottomright: 3px; - -webkit-border-top-right-radius: 3px; - -webkit-border-bottom-right-radius: 3px; - border-top-right-radius: 3px; - border-bottom-right-radius: 3px; } -.input-group.round > *:first-child, .input-group.round > *:first-child * { - -webkit-border-radius: 0; - border-radius: 0; - -moz-border-radius-bottomleft: 1000px; - -moz-border-radius-topleft: 1000px; - -webkit-border-bottom-left-radius: 1000px; - -webkit-border-top-left-radius: 1000px; - border-bottom-left-radius: 1000px; - border-top-left-radius: 1000px; } -.input-group.round > *:last-child, .input-group.round > *:last-child * { - -webkit-border-radius: 0; - border-radius: 0; - -moz-border-radius-topright: 1000px; - -moz-border-radius-bottomright: 1000px; - -webkit-border-top-right-radius: 1000px; - -webkit-border-bottom-right-radius: 1000px; - border-top-right-radius: 1000px; - border-bottom-right-radius: 1000px; } - -/* We use this to get basic styling on all basic form elements */ -input[type="text"], -input[type="password"], -input[type="date"], -input[type="datetime"], -input[type="datetime-local"], -input[type="month"], -input[type="week"], -input[type="email"], -input[type="number"], -input[type="search"], -input[type="tel"], -input[type="time"], -input[type="url"], -textarea { - background-color: white; - font-family: inherit; - border: 1px solid #cccccc; - -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); - box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); - color: rgba(0, 0, 0, 0.75); - display: block; - font-size: 0.875em; - margin: 0 0 1em 0; - padding: 0.5em; - height: 2.3125em; - width: 100%; - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - box-sizing: border-box; - -webkit-transition: all 0.15s linear; - -moz-transition: all 0.15s linear; - transition: all 0.15s linear; } - input[type="text"]:focus, - input[type="password"]:focus, - input[type="date"]:focus, - input[type="datetime"]:focus, - input[type="datetime-local"]:focus, - input[type="month"]:focus, - input[type="week"]:focus, - input[type="email"]:focus, - input[type="number"]:focus, - input[type="search"]:focus, - input[type="tel"]:focus, - input[type="time"]:focus, - input[type="url"]:focus, - textarea:focus { - background: #fafafa; - border-color: #999999; - outline: none; } - input[type="text"][disabled], - input[type="password"][disabled], - input[type="date"][disabled], - input[type="datetime"][disabled], - input[type="datetime-local"][disabled], - input[type="month"][disabled], - input[type="week"][disabled], - input[type="email"][disabled], - input[type="number"][disabled], - input[type="search"][disabled], - input[type="tel"][disabled], - input[type="time"][disabled], - input[type="url"][disabled], - textarea[disabled] { - background-color: #dddddd; } - -/* We add basic fieldset styling */ -fieldset { - border: solid 1px #dddddd; - padding: 1.25em; - margin: 1.125em 0; } - fieldset legend { - font-weight: bold; - background: white; - padding: 0 0.1875em; - margin: 0; - margin-left: -0.1875em; } - -/* Error Handling */ -.error input, -input.error, -.error textarea, -textarea.error { - border-color: #c60f13; - background-color: rgba(198, 15, 19, 0.1); } - .error input:focus, - input.error:focus, - .error textarea:focus, - textarea.error:focus { - background: #fafafa; - border-color: #999999; } - -.error label, -label.error { - color: #c60f13; } - -.error small, -small.error { - display: block; - padding: 0.375em 0.25em; - margin-top: -1.3125em; - margin-bottom: 1em; - font-size: 0.75em; - font-weight: bold; - background: #c60f13; - color: white; } - -/* Custom Checkbox and Radio Inputs */ -form.custom .custom { - display: inline-block; - width: 16px; - height: 16px; - position: relative; - top: 2px; - border: solid 1px #cccccc; - background: white; } - form.custom .custom.radio { - -webkit-border-radius: 1000px; - border-radius: 1000px; } - form.custom .custom.checkbox:before { - content: ""; - display: block; - line-height: 0.8; - height: 14px; - width: 14px; - text-align: center; - position: absolute; - top: 0; - left: 0; - font-size: 14px; - color: #fff; } - form.custom .custom.radio.checked:before { - content: ""; - display: block; - width: 8px; - height: 8px; - -webkit-border-radius: 1000px; - border-radius: 1000px; - background: #222222; - position: relative; - top: 3px; - left: 3px; } - form.custom .custom.checkbox.checked:before { - content: "\00d7"; - color: #222222; } - -/* Custom Select Options and Dropdowns */ -form.custom { - /* Custom input, disabled */ } - form.custom .custom.dropdown { - display: block; - position: relative; - top: 0; - height: 2.3125em; - margin-bottom: 1.25em; - margin-top: 0px; - padding: 0px; - width: 100%; - background: white; - background: -moz-linear-gradient(top, white 0%, #f3f3f3 100%); - background: -webkit-linear-gradient(top, white 0%, #f3f3f3 100%); - background: linear-gradient(to bottom, white 0%, #f3f3f3 100%); - -webkit-box-shadow: none; - box-shadow: none; - font-size: 0.875em; - vertical-align: top; } - form.custom .custom.dropdown ul { - overflow-y: auto; - max-height: 200px; } - form.custom .custom.dropdown .current { - cursor: default; - white-space: nowrap; - line-height: 2.25em; - color: rgba(0, 0, 0, 0.75); - text-decoration: none; - overflow: hidden; - display: block; - margin-left: 0.5em; - margin-right: 2.3125em; } - form.custom .custom.dropdown .selector { - cursor: default; - position: absolute; - width: 2.5em; - height: 2.3125em; - display: block; - right: 0; - top: 0; } - form.custom .custom.dropdown .selector:after { - content: ""; - display: block; - content: ""; - display: block; - width: 0; - height: 0; - border: solid 5px; - border-color: #aaaaaa transparent transparent transparent; - position: absolute; - left: 0.9375em; - top: 50%; - margin-top: -3px; } - form.custom .custom.dropdown:hover a.selector:after, form.custom .custom.dropdown.open a.selector:after { - content: ""; - display: block; - width: 0; - height: 0; - border: solid 5px; - border-color: #222222 transparent transparent transparent; } - form.custom .custom.dropdown .disabled { - color: #888888; } - form.custom .custom.dropdown .disabled:hover { - background: transparent; - color: #888888; } - form.custom .custom.dropdown .disabled:hover:after { - display: none; } - form.custom .custom.dropdown.open ul { - display: block; - z-index: 10; - min-width: 100%; - -moz-box-sizing: content-box; - -webkit-box-sizing: content-box; - box-sizing: content-box; } - form.custom .custom.dropdown.small { - max-width: 134px; } - form.custom .custom.dropdown.medium { - max-width: 254px; } - form.custom .custom.dropdown.large { - max-width: 434px; } - form.custom .custom.dropdown.expand { - width: 100% !important; } - form.custom .custom.dropdown.open.small ul { - min-width: 134px; - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - box-sizing: border-box; } - form.custom .custom.dropdown.open.medium ul { - min-width: 254px; - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - box-sizing: border-box; } - form.custom .custom.dropdown.open.large ul { - min-width: 434px; - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - box-sizing: border-box; } - form.custom .custom.dropdown ul { - position: absolute; - width: auto; - display: none; - margin: 0; - left: -1px; - top: auto; - -webkit-box-shadow: 0 2px 2px 0px rgba(0, 0, 0, 0.1); - box-shadow: 0 2px 2px 0px rgba(0, 0, 0, 0.1); - margin: 0; - padding: 0; - background: white; - border: solid 1px #cccccc; - font-size: 16px; } - form.custom .custom.dropdown ul li { - color: #555555; - font-size: 0.875em; - cursor: default; - padding-top: 0.25em; - padding-bottom: 0.25em; - padding-left: 0.375em; - padding-right: 2.375em; - min-height: 1.5em; - line-height: 1.5em; - margin: 0; - white-space: nowrap; - list-style: none; } - form.custom .custom.dropdown ul li.selected { - background: #eeeeee; - color: black; } - form.custom .custom.dropdown ul li:hover { - background-color: #e4e4e4; - color: black; } - form.custom .custom.dropdown ul li.selected:hover { - background: #eeeeee; - cursor: default; - color: black; } - form.custom .custom.dropdown ul.show { - display: block; } - form.custom .custom.disabled { - background-color: #dddddd; } - -/* Button Groups */ -.button-group { - list-style: none; - margin: 0; - *zoom: 1; } - .button-group:before, .button-group:after { - content: " "; - display: table; } - .button-group:after { - clear: both; } - .button-group li { - margin: 0 0 0 -1px; - float: left; } - .button-group li:first-child { - margin-left: 0; } - .button-group.radius li:first-child > a, .button-group.radius li:first-child > button { - -webkit-border-radius: 0; - border-radius: 0; - -moz-border-radius-bottomleft: 3px; - -moz-border-radius-topleft: 3px; - -webkit-border-bottom-left-radius: 3px; - -webkit-border-top-left-radius: 3px; - border-bottom-left-radius: 3px; - border-top-left-radius: 3px; } - .button-group.radius li:last-child > a, .button-group.radius li:last-child > button { - -webkit-border-radius: 0; - border-radius: 0; - -moz-border-radius-topright: 3px; - -moz-border-radius-bottomright: 3px; - -webkit-border-top-right-radius: 3px; - -webkit-border-bottom-right-radius: 3px; - border-top-right-radius: 3px; - border-bottom-right-radius: 3px; } - .button-group.round li:first-child > a, .button-group.round li:first-child > button { - -webkit-border-radius: 0; - border-radius: 0; - -moz-border-radius-bottomleft: 1000px; - -moz-border-radius-topleft: 1000px; - -webkit-border-bottom-left-radius: 1000px; - -webkit-border-top-left-radius: 1000px; - border-bottom-left-radius: 1000px; - border-top-left-radius: 1000px; } - .button-group.round li:last-child > a, .button-group.round li:last-child > button { - -webkit-border-radius: 0; - border-radius: 0; - -moz-border-radius-topright: 1000px; - -moz-border-radius-bottomright: 1000px; - -webkit-border-top-right-radius: 1000px; - -webkit-border-bottom-right-radius: 1000px; - border-top-right-radius: 1000px; - border-bottom-right-radius: 1000px; } - .button-group.even-2 li { - width: 50%; } - .button-group.even-2 li .button { - width: 100%; } - .button-group.even-3 li { - width: 33.33333%; } - .button-group.even-3 li .button { - width: 100%; } - .button-group.even-4 li { - width: 25%; } - .button-group.even-4 li .button { - width: 100%; } - .button-group.even-5 li { - width: 20%; } - .button-group.even-5 li .button { - width: 100%; } - .button-group.even-6 li { - width: 16.66667%; } - .button-group.even-6 li .button { - width: 100%; } - .button-group.even-7 li { - width: 14.28571%; } - .button-group.even-7 li .button { - width: 100%; } - .button-group.even-8 li { - width: 12.5%; } - .button-group.even-8 li .button { - width: 100%; } - -.button-bar { - *zoom: 1; } - .button-bar:before, .button-bar:after { - content: " "; - display: table; } - .button-bar:after { - clear: both; } - .button-bar .button-group { - float: left; - margin-right: 0.625em; } - .button-bar .button-group div { - overflow: hidden; } - -/* Dropdown Button */ -.dropdown.button { - position: relative; - padding-right: 3.1875em; } - .dropdown.button:before { - position: absolute; - content: ""; - width: 0; - height: 0; - display: block; - border-style: solid; - border-color: white transparent transparent transparent; - top: 50%; } - .dropdown.button:before { - border-width: 0.5625em; - right: 1.5em; - margin-top: -0.25em; } - .dropdown.button:before { - border-color: white transparent transparent transparent; } - .dropdown.button.tiny { - padding-right: 2.1875em; } - .dropdown.button.tiny:before { - border-width: 0.4375em; - right: 0.875em; - margin-top: -0.15625em; } - .dropdown.button.tiny:before { - border-color: white transparent transparent transparent; } - .dropdown.button.small { - padding-right: 2.8125em; } - .dropdown.button.small:before { - border-width: 0.5625em; - right: 1.125em; - margin-top: -0.21875em; } - .dropdown.button.small:before { - border-color: white transparent transparent transparent; } - .dropdown.button.large { - padding-right: 4em; } - .dropdown.button.large:before { - border-width: 0.625em; - right: 1.75em; - margin-top: -0.3125em; } - .dropdown.button.large:before { - border-color: white transparent transparent transparent; } - .dropdown.button.secondary:before { - border-color: #333333 transparent transparent transparent; } - -/* Split Buttons */ -.split.button { - position: relative; - padding-right: 4.8em; } - .split.button span { - display: block; - height: 100%; - position: absolute; - right: 0; - top: 0; - border-left: solid 1px; } - .split.button span:before { - position: absolute; - content: ""; - width: 0; - height: 0; - display: block; - border-style: solid; - left: 50%; } - .split.button span:active { - background-color: rgba(0, 0, 0, 0.1); } - .split.button span { - border-left-color: #1e728c; } - .split.button span { - width: 3em; } - .split.button span:before { - border-width: 0.5625em; - top: 1.125em; - margin-left: -0.5625em; } - .split.button span:before { - border-color: white transparent transparent transparent; } - .split.button.secondary span { - border-left-color: #c3c3c3; } - .split.button.secondary span:before { - border-color: white transparent transparent transparent; } - .split.button.alert span { - border-left-color: #7f0a0c; } - .split.button.success span { - border-left-color: #396516; } - .split.button.tiny { - padding-right: 3.9375em; } - .split.button.tiny span { - width: 2.84375em; } - .split.button.tiny span:before { - border-width: 0.4375em; - top: 0.875em; - margin-left: -0.3125em; } - .split.button.small { - padding-right: 3.9375em; } - .split.button.small span { - width: 2.8125em; } - .split.button.small span:before { - border-width: 0.5625em; - top: 0.84375em; - margin-left: -0.5625em; } - .split.button.large { - padding-right: 6em; } - .split.button.large span { - width: 3.75em; } - .split.button.large span:before { - border-width: 0.625em; - top: 1.3125em; - margin-left: -0.5625em; } - .split.button.secondary span:before { - border-color: #333333 transparent transparent transparent; } - .split.button.radius span { - -webkit-border-radius: 0; - border-radius: 0; - -moz-border-radius-topright: 3px; - -moz-border-radius-bottomright: 3px; - -webkit-border-top-right-radius: 3px; - -webkit-border-bottom-right-radius: 3px; - border-top-right-radius: 3px; - border-bottom-right-radius: 3px; } - .split.button.round span { - -webkit-border-radius: 0; - border-radius: 0; - -moz-border-radius-topright: 1000px; - -moz-border-radius-bottomright: 1000px; - -webkit-border-top-right-radius: 1000px; - -webkit-border-bottom-right-radius: 1000px; - border-top-right-radius: 1000px; - border-bottom-right-radius: 1000px; } - -/* Flex Video */ -.flex-video { - position: relative; - padding-top: 1.5625em; - padding-bottom: 67.5%; - height: 0; - margin-bottom: 1em; - overflow: hidden; } - .flex-video.widescreen { - padding-bottom: 57.25%; } - .flex-video.vimeo { - padding-top: 0; } - .flex-video iframe, - .flex-video object, - .flex-video embed, - .flex-video video { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; } - -/* Sections */ -.section-container { - width: 100%; - display: block; - margin-bottom: 1.25em; - border: 1px solid #cccccc; - border-top: none; } - .section-container section, - .section-container .section { - border-top: 1px solid #cccccc; - position: relative; } - .section-container section .title, - .section-container .section .title { - top: 0; - cursor: pointer; - width: 100%; - margin: 0; - background-color: #efefef; } - .section-container section .title a, - .section-container .section .title a { - padding: 0.9375em; - display: inline-block; - color: #333333; - font-size: 0.875em; - white-space: nowrap; - width: 100%; } - .section-container section .title:hover, - .section-container .section .title:hover { - background-color: #e2e2e2; } - .section-container section .content, - .section-container .section .content { - display: none; - padding: 0.9375em; - background-color: white; } - .section-container section .content > *:last-child, - .section-container .section .content > *:last-child { - margin-bottom: 0; } - .section-container section .content > *:first-child, - .section-container .section .content > *:first-child { - padding-top: 0; } - .section-container section .content > *:last-child, - .section-container .section .content > *:last-child { - padding-bottom: 0; } - .section-container section.active .content, - .section-container .section.active .content { - display: block; } - .section-container section.active .title, - .section-container .section.active .title { - background: #d5d5d5; } - -@media only screen and (min-width: 48em) { - .section-container.accordion .section { - padding-top: 0 !important; } - - .section-container.vertical-nav { - border: 1px solid #cccccc; - border-top: none; } - .section-container.vertical-nav section, - .section-container.vertical-nav .section { - padding-top: 0 !important; } - .section-container.vertical-nav section .title a, - .section-container.vertical-nav .section .title a { - display: block; - width: 100%; } - .section-container.vertical-nav section .content, - .section-container.vertical-nav .section .content { - display: none; } - .section-container.vertical-nav section.active .content, - .section-container.vertical-nav .section.active .content { - display: block; - position: absolute; - left: 100%; - top: -1px; - z-index: 999; - min-width: 12.5em; - border: 1px solid #cccccc; } - - .section-container.horizontal-nav { - position: relative; - background: #efefef; - border: 1px solid #cccccc; } - .section-container.horizontal-nav section, - .section-container.horizontal-nav .section { - padding-top: 0; - border: 0; - position: static; } - .section-container.horizontal-nav section .title, - .section-container.horizontal-nav .section .title { - width: auto; - border: 1px solid #cccccc; - border-left: 0; - top: -1px; - position: absolute; - z-index: 1; } - .section-container.horizontal-nav section .title a, - .section-container.horizontal-nav .section .title a { - width: 100%; } - .section-container.horizontal-nav section .content, - .section-container.horizontal-nav .section .content { - display: none; } - .section-container.horizontal-nav section.active .content, - .section-container.horizontal-nav .section.active .content { - display: block; - position: absolute; - z-index: 999; - left: 0; - top: -2px; - min-width: 12.5em; - border: 1px solid #cccccc; } - - .section-container.tabs { - border: 0; - position: relative; } - .section-container.tabs section, - .section-container.tabs .section { - padding-top: 0; - border: 0; - position: static; } - .section-container.tabs section .title, - .section-container.tabs .section .title { - width: auto; - border: 1px solid #cccccc; - border-right: 0; - border-bottom: 0; - position: absolute; - z-index: 1; } - .section-container.tabs section .title a, - .section-container.tabs .section .title a { - width: 100%; } - .section-container.tabs section:last-child .title, - .section-container.tabs .section:last-child .title { - border-right: 1px solid #cccccc; } - .section-container.tabs section .content, - .section-container.tabs .section .content { - border: 1px solid #cccccc; - position: absolute; - z-index: 10; - top: -1px; } - .section-container.tabs section.active .title, - .section-container.tabs .section.active .title { - background-color: white; - z-index: 11; - border-bottom: 0; } - .section-container.tabs section.active .content, - .section-container.tabs .section.active .content { - position: relative; } } -/* Wrapped around .top-bar to contain to grid width */ -.contain-to-grid { - width: 100%; - background: #111111; } - -.fixed { - width: 100%; - left: 0; - position: fixed; - top: 0; - z-index: 99; } - -.top-bar { - overflow: hidden; - height: 45px; - line-height: 45px; - position: relative; - background: #111111; } - .top-bar ul { - margin-bottom: 0; - list-style: none; } - .top-bar .row { - max-width: none; } - .top-bar form, - .top-bar input { - margin-bottom: 0; } - .top-bar input { - height: 2.45em; } - .top-bar .button { - padding-top: .5em; - padding-bottom: .5em; - margin-bottom: 0; } - .top-bar .title-area { - position: relative; } - .top-bar .name { - height: 45px; - margin: 0; - font-size: 16px; } - .top-bar .name h1 { - line-height: 45px; - font-size: 1.0625em; - margin: 0; } - .top-bar .name h1 a { - font-weight: bold; - color: white; - width: 50%; - display: block; - padding: 0 15px; } - .top-bar .toggle-topbar { - position: absolute; - right: 0; - top: 0; } - .top-bar .toggle-topbar a { - color: white; - text-transform: uppercase; - font-size: 0.8125em; - font-weight: bold; - position: relative; - display: block; - padding: 0 15px; - height: 45px; - line-height: 45px; } - .top-bar .toggle-topbar.menu-icon { - right: 15px; - top: 50%; - margin-top: -16px; - padding-left: 40px; } - .top-bar .toggle-topbar.menu-icon a { - text-indent: -48px; - width: 34px; - height: 34px; - line-height: 33px; - padding: 0; - color: white; } - .top-bar .toggle-topbar.menu-icon a span { - position: absolute; - right: 0; - display: block; - width: 16px; - height: 0; - -webkit-box-shadow: 0 10px 0 1px white, 0 16px 0 1px white, 0 22px 0 1px white; - box-shadow: 0 10px 0 1px white, 0 16px 0 1px white, 0 22px 0 1px white; } - .top-bar.expanded { - height: auto; - background: transparent; } - .top-bar.expanded .title-area { - background: #111111; } - .top-bar.expanded .toggle-topbar a { - color: #888888; } - .top-bar.expanded .toggle-topbar a span { - -webkit-box-shadow: 0 10px 0 1px #888888, 0 16px 0 1px #888888, 0 22px 0 1px #888888; - box-shadow: 0 10px 0 1px #888888, 0 16px 0 1px #888888, 0 22px 0 1px #888888; } - -.top-bar-section { - left: 0; - position: relative; - width: auto; - -webkit-transition: left 300ms ease-out; - -moz-transition: left 300ms ease-out; - transition: left 300ms ease-out; } - .top-bar-section ul { - width: 100%; - height: auto; - display: block; - background: #333333; - font-size: 16px; - margin: 0; } - .top-bar-section .divider { - border-bottom: solid 1px #4d4d4d; - border-top: solid 1px #1a1a1a; - clear: both; - height: 1px; - width: 100%; } - .top-bar-section ul li > a { - display: block; - width: 100%; - color: white; - padding: 12px 0 12px 0; - padding-left: 15px; - font-size: 0.8125em; - font-weight: bold; - background: #333333; } - .top-bar-section ul li > a:hover { - background: #2b2b2b; } - .top-bar-section ul li > a.button { - background: #2ba6cb; - font-size: 0.8125em; } - .top-bar-section ul li > a.button:hover { - background: #2284a1; } - .top-bar-section ul li > a.button.secondary { - background: #e9e9e9; } - .top-bar-section ul li > a.button.secondary:hover { - background: #d0d0d0; } - .top-bar-section ul li > a.button.success { - background: #5da423; } - .top-bar-section ul li > a.button.success:hover { - background: #457a1a; } - .top-bar-section ul li > a.button.alert { - background: #c60f13; } - .top-bar-section ul li > a.button.alert:hover { - background: #970b0e; } - .top-bar-section ul li.active a { - background: #2b2b2b; } - .top-bar-section .has-form { - padding: 15px; } - .top-bar-section .has-dropdown { - position: relative; } - .top-bar-section .has-dropdown > a:after { - content: ""; - display: block; - width: 0; - height: 0; - border: solid 5px; - border-color: transparent transparent transparent rgba(255, 255, 255, 0.5); - margin-right: 15px; - margin-top: -4.5px; - position: absolute; - top: 50%; - right: 0; } - .top-bar-section .has-dropdown.moved { - position: static; } - .top-bar-section .has-dropdown.moved > .dropdown { - visibility: visible; } - .top-bar-section .dropdown { - position: absolute; - left: 100%; - top: 0; - visibility: hidden; - z-index: 99; } - .top-bar-section .dropdown li { - width: 100%; } - .top-bar-section .dropdown li a { - font-weight: normal; - padding: 8px 15px; } - .top-bar-section .dropdown li.title h5 { - margin-bottom: 0; } - .top-bar-section .dropdown li.title h5 a { - color: white; - line-height: 22.5px; - display: block; } - .top-bar-section .dropdown label { - padding: 8px 15px 2px; - margin-bottom: 0; - text-transform: uppercase; - color: #555555; - font-weight: bold; - font-size: 0.625em; } - -.top-bar-js-breakpoint { - width: 58.75em !important; - visibility: hidden; } - -.js-generated { - display: block; } - -@media only screen and (min-width: 58.75em) { - .top-bar { - background: #111111; - *zoom: 1; - overflow: visible; } - .top-bar:before, .top-bar:after { - content: " "; - display: table; } - .top-bar:after { - clear: both; } - .top-bar .toggle-topbar { - display: none; } - .top-bar .title-area { - float: left; } - .top-bar .name h1 a { - width: auto; } - .top-bar input, - .top-bar .button { - line-height: 2em; - font-size: 0.875em; - height: 2em; - padding: 0 10px; - position: relative; - top: 8px; } - .top-bar.expanded { - background: #111111; } - - .contain-to-grid .top-bar { - max-width: 62.5em; - margin: 0 auto; } - - .top-bar-section { - -webkit-transition: none 0 0; - -moz-transition: none 0 0; - transition: none 0 0; - left: 0 !important; } - .top-bar-section ul { - width: auto; - height: auto !important; - display: inline; } - .top-bar-section ul li { - float: left; } - .top-bar-section ul li .js-generated { - display: none; } - .top-bar-section li a:not(.button) { - padding: 0 15px; - line-height: 45px; - background: #111111; } - .top-bar-section li a:not(.button):hover { - background: black; } - .top-bar-section .has-dropdown > a { - padding-right: 35px !important; } - .top-bar-section .has-dropdown > a:after { - content: ""; - display: block; - width: 0; - height: 0; - border: solid 5px; - border-color: rgba(255, 255, 255, 0.5) transparent transparent transparent; - margin-top: -2.5px; } - .top-bar-section .has-dropdown.moved { - position: relative; } - .top-bar-section .has-dropdown.moved > .dropdown { - visibility: hidden; } - .top-bar-section .has-dropdown:hover > .dropdown, .top-bar-section .has-dropdown:active > .dropdown { - visibility: visible; } - .top-bar-section .has-dropdown .dropdown li.has-dropdown > a:after { - border: none; - content: "\00bb"; - margin-top: -7px; - right: 5px; } - .top-bar-section .dropdown { - left: 0; - top: auto; - background: transparent; } - .top-bar-section .dropdown li a { - line-height: 1; - white-space: nowrap; - padding: 7px 15px; - background: #1e1e1e; } - .top-bar-section .dropdown li label { - white-space: nowrap; - background: #1e1e1e; } - .top-bar-section .dropdown li .dropdown { - left: 100%; - top: 0; } - .top-bar-section > ul > .divider { - border-bottom: none; - border-top: none; - border-right: solid 1px #2b2b2b; - border-left: solid 1px black; - clear: none; - height: 45px; - width: 0px; } - .top-bar-section .has-form { - background: #111111; - padding: 0 15px; - height: 45px; } - .top-bar-section ul.right li .dropdown { - left: auto; - right: 0; } - .top-bar-section ul.right li .dropdown li .dropdown { - right: 100%; } } -.orbit-container { - overflow: hidden; - width: 100%; - position: relative; - background: whitesmoke; } - .orbit-container .orbit-slides-container { - list-style: none; - margin: 0; - padding: 0; - position: relative; } - .orbit-container .orbit-slides-container img { - display: block; } - .orbit-container .orbit-slides-container > * { - position: relative; - float: left; - height: 100%; } - .orbit-container .orbit-slides-container > * .orbit-caption { - position: absolute; - bottom: 0; - background-color: black; - background-color: rgba(0, 0, 0, 0.6); - color: #fff; - width: 100%; - padding: 10px 14px; - font-size: 0.875em; } - .orbit-container .orbit-slides-container > * .orbit-caption * { - color: white; } - .orbit-container .orbit-slide-number { - position: absolute; - top: 10px; - left: 10px; - font-size: 12px; } - .orbit-container .orbit-slide-number span { - font-weight: 700; } - .orbit-container .orbit-timer { - position: absolute; - top: 10px; - right: 10px; - height: 6px; - width: 100px; } - .orbit-container .orbit-timer .orbit-progress { - height: 100%; - background-color: black; - background-color: rgba(0, 0, 0, 0.6); - display: block; - width: 0%; } - .orbit-container .orbit-timer > span { - display: none; - position: absolute; - top: 10px; - right: 0px; - width: 11px; - height: 14px; - border: solid 4px black; - border-top: none; - border-bottom: none; } - .orbit-container .orbit-timer.paused > span { - right: -6px; - top: 9px; - width: 11px; - height: 14px; - border: solid 8px; - border-color: transparent transparent transparent black; } - .orbit-container:hover .orbit-timer > span { - display: block; } - .orbit-container .orbit-prev, - .orbit-container .orbit-next { - position: absolute; - top: 50%; - margin-top: -25px; - background-color: black; - background-color: rgba(0, 0, 0, 0.6); - width: 50px; - height: 60px; - line-height: 50px; - color: white; - text-indent: -9999px !important; } - .orbit-container .orbit-prev > span, - .orbit-container .orbit-next > span { - position: absolute; - top: 50%; - margin-top: -16px; - display: block; - width: 0; - height: 0; - border: solid 16px; } - .orbit-container .orbit-prev { - left: 0; } - .orbit-container .orbit-prev > span { - border-color: transparent white transparent transparent; } - .orbit-container .orbit-prev:hover > span { - border-color: transparent #cccccc transparent transparent; } - .orbit-container .orbit-next { - right: 0; } - .orbit-container .orbit-next > span { - border-color: transparent transparent transparent white; - left: 50%; - margin-left: -8px; } - .orbit-container .orbit-next:hover > span { - border-color: transparent transparent transparent #cccccc; } - -.orbit-bullets { - margin: 0 auto 30px auto; - overflow: hidden; - position: relative; - top: 10px; } - .orbit-bullets li { - display: block; - width: 18px; - height: 18px; - background: #fff; - float: left; - margin-right: 6px; - border: solid 2px black; - -webkit-border-radius: 1000px; - border-radius: 1000px; } - .orbit-bullets li.active { - background: #000; } - .orbit-bullets li:last-child { - margin-right: 0; } - -.touch .orbit-container .orbit-prev, -.touch .orbit-container .orbit-next { - display: none; } -.touch .orbit-bullets { - display: none; } - -@media only screen and (min-width: 48em) { - .touch .orbit-container .orbit-prev, - .touch .orbit-container .orbit-next { - display: inherit; } - .touch .orbit-bullets { - display: block; } } -.reveal-modal-bg { - position: fixed; - height: 100%; - width: 100%; - background: black; - background: rgba(0, 0, 0, 0.45); - z-index: 98; - display: none; - top: 0; - left: 0; } - -.reveal-modal { - visibility: hidden; - display: none; - position: absolute; - left: 50%; - z-index: 99; - height: auto; - background-color: #fff; - margin-left: -40%; - width: 80%; - background-color: white; - padding: 1.25em; - border: solid 1px #666666; - -webkit-box-shadow: 0 0 10px rgba(0, 0, 0, 0.4); - box-shadow: 0 0 10px rgba(0, 0, 0, 0.4); - top: 50px; } - .reveal-modal .column, - .reveal-modal .columns { - min-width: 0; } - .reveal-modal > :first-child { - margin-top: 0; } - .reveal-modal > :last-child { - margin-bottom: 0; } - .reveal-modal .close-reveal-modal { - font-size: 1.375em; - line-height: 1; - position: absolute; - top: 0.5em; - right: 0.6875em; - color: #aaaaaa; - font-weight: bold; - cursor: pointer; } - -@media only screen and (min-width: 48em) { - .reveal-modal { - padding: 1.875em; - top: 6.25em; } - .reveal-modal.small { - margin-left: -15%; - width: 30%; } - .reveal-modal.medium { - margin-left: -20%; - width: 40%; } - .reveal-modal.large { - margin-left: -30%; - width: 60%; } - .reveal-modal.xlarge { - margin-left: -35%; - width: 70%; } - .reveal-modal.expand { - margin-left: -47.5%; - width: 95%; } } -@media print { - div:not(.reveal-modal) { - display: none; } } -/* Foundation Joyride */ -.joyride-list { - display: none; } - -/* Default styles for the container */ -.joyride-tip-guide { - display: none; - position: absolute; - background: black; - color: white; - z-index: 101; - top: 0; - left: 2.5%; - font-family: inherit; - font-weight: normal; - width: 95%; } - -.lt-ie9 .joyride-tip-guide { - max-width: 800px; - left: 50%; - margin-left: -400px; } - -.joyride-content-wrapper { - width: 100%; - padding: 1.125em 1.25em 1.5em; } - .joyride-content-wrapper .button { - margin-bottom: 0 !important; } - -/* Add a little css triangle pip, older browser just miss out on the fanciness of it */ -.joyride-tip-guide .joyride-nub { - display: block; - position: absolute; - left: 22px; - width: 0; - height: 0; - border: solid 14px; } - .joyride-tip-guide .joyride-nub.top { - border-color: black; - border-top-color: transparent !important; - border-left-color: transparent !important; - border-right-color: transparent !important; - top: -28px; - bottom: none; } - .joyride-tip-guide .joyride-nub.bottom { - border-color: black !important; - border-bottom-color: transparent !important; - border-left-color: transparent !important; - border-right-color: transparent !important; - bottom: -28px; - bottom: none; } - .joyride-tip-guide .joyride-nub.right { - right: -28px; } - .joyride-tip-guide .joyride-nub.left { - left: -28px; } - -/* Typography */ -.joyride-tip-guide h1, -.joyride-tip-guide h2, -.joyride-tip-guide h3, -.joyride-tip-guide h4, -.joyride-tip-guide h5, -.joyride-tip-guide h6 { - line-height: 1.25; - margin: 0; - font-weight: bold; - color: white; } - -.joyride-tip-guide p { - margin: 0 0 1.125em 0; - font-size: 0.875em; - line-height: 1.3; } - -.joyride-timer-indicator-wrap { - width: 50px; - height: 3px; - border: solid 1px #555555; - position: absolute; - right: 1.0625em; - bottom: 1em; } - -.joyride-timer-indicator { - display: block; - width: 0; - height: inherit; - background: #666666; } - -.joyride-close-tip { - position: absolute; - right: 12px; - top: 10px; - color: #777777 !important; - text-decoration: none; - font-size: 30px; - font-weight: normal; - line-height: 0.5 !important; } - .joyride-close-tip:hover, .joyride-close-tip:focus { - color: #eeeeee !important; } - -.joyride-modal-bg { - position: fixed; - height: 100%; - width: 100%; - background: transparent; - background: rgba(0, 0, 0, 0.5); - z-index: 100; - display: none; - top: 0; - left: 0; - cursor: pointer; } - -/* Styles for screens that are atleast 768px; */ -@media only screen and (min-width: 48em) { - .joyride-tip-guide { - width: 300px; - left: 0; } - .joyride-tip-guide .joyride-nub.bottom { - border-color: black !important; - border-bottom-color: transparent !important; - border-left-color: transparent !important; - border-right-color: transparent !important; - bottom: -28px; - bottom: none; } - .joyride-tip-guide .joyride-nub.right { - border-color: black !important; - border-top-color: transparent !important; - border-right-color: transparent !important; - border-bottom-color: transparent !important; - top: 22px; - bottom: none; - left: auto; - right: -28px; } - .joyride-tip-guide .joyride-nub.left { - border-color: black !important; - border-top-color: transparent !important; - border-left-color: transparent !important; - border-bottom-color: transparent !important; - top: 22px; - left: -28px; - right: auto; - bottom: none; } } -/* Clearing Styles */ -[data-clearing] { - *zoom: 1; - margin-bottom: 0; } - [data-clearing]:before, [data-clearing]:after { - content: " "; - display: table; } - [data-clearing]:after { - clear: both; } - -.clearing-blackout { - background: #111111; - position: fixed; - width: 100%; - height: 100%; - top: 0; - left: 0; - z-index: 998; } - .clearing-blackout .clearing-close { - display: block; } - -.clearing-container { - position: relative; - z-index: 998; - height: 100%; - overflow: hidden; - margin: 0; } - -.visible-img { - height: 95%; - position: relative; } - .visible-img img { - position: absolute; - left: 50%; - top: 50%; - margin-left: -50%; - max-height: 100%; - max-width: 100%; } - -.clearing-caption { - color: white; - line-height: 1.3; - margin-bottom: 0; - text-align: center; - bottom: 0; - background: #111111; - width: 100%; - padding: 10px 30px; - position: absolute; - left: 0; } - -.clearing-close { - z-index: 999; - padding-left: 20px; - padding-top: 10px; - font-size: 40px; - line-height: 1; - color: white; - display: none; } - .clearing-close:hover, .clearing-close:focus { - color: #ccc; } - -.clearing-assembled .clearing-container { - height: 100%; } - .clearing-assembled .clearing-container .carousel > ul { - display: none; } - -@media only screen and (min-width: 48em) { - .clearing-main-left, - .clearing-main-right { - position: absolute; - height: 100%; - width: 40px; - top: 0; } - .clearing-main-left > span, - .clearing-main-right > span { - position: absolute; - top: 50%; - display: block; - width: 0; - height: 0; - border: solid 16px; } - - .clearing-main-left { - left: 0; } - .clearing-main-left > span { - left: 5px; - border-color: transparent white transparent transparent; } - - .clearing-main-right { - right: 0; } - .clearing-main-right > span { - border-color: transparent transparent transparent white; } - - .clearing-main-left.disabled, - .clearing-main-right.disabled { - opacity: 0.5; } - - .clearing-feature ~ li { - display: none; } - - .clearing-assembled .clearing-container .carousel { - background: #111111; - height: 150px; - margin-top: 5px; } - .clearing-assembled .clearing-container .carousel > ul { - display: block; - z-index: 999; - width: 200%; - height: 100%; - margin-left: 0; - position: relative; - left: 0; } - .clearing-assembled .clearing-container .carousel > ul li { - display: block; - width: 175px; - height: inherit; - padding: 0; - float: left; - overflow: hidden; - margin-right: 1px; - position: relative; - cursor: pointer; - opacity: 0.4; } - .clearing-assembled .clearing-container .carousel > ul li.fix-height img { - min-height: 100%; - height: 100%; - max-width: none; } - .clearing-assembled .clearing-container .carousel > ul li a.th { - border: none; - -webkit-box-shadow: none; - box-shadow: none; - display: block; } - .clearing-assembled .clearing-container .carousel > ul li img { - cursor: pointer !important; - min-width: 100% !important; } - .clearing-assembled .clearing-container .carousel > ul li.visible { - opacity: 1; } - .clearing-assembled .clearing-container .visible-img { - background: #111111; - overflow: hidden; - height: 75%; } - - .clearing-close { - position: absolute; - top: 10px; - right: 20px; - padding-left: 0; - padding-top: 0; } } -/* Foundation Alerts */ -.alert-box { - border-style: solid; - border-width: 1px; - display: block; - font-weight: bold; - margin-bottom: 1.25em; - position: relative; - padding: 0.6875em 1.3125em 0.75em 0.6875em; - font-size: 0.875em; - background-color: #2ba6cb; - border-color: #2284a1; - color: white; } - .alert-box .close { - font-size: 1.375em; - padding: 5px 4px 4px; - line-height: 0; - position: absolute; - top: 0.4375em; - right: 0.3125em; - color: #333333; - opacity: 0.3; } - .alert-box .close:hover, .alert-box .close:focus { - opacity: 0.5; } - .alert-box.radius { - -webkit-border-radius: 3px; - border-radius: 3px; } - .alert-box.round { - -webkit-border-radius: 1000px; - border-radius: 1000px; } - .alert-box.success { - background-color: #5da423; - border-color: #457a1a; - color: white; } - .alert-box.alert { - background-color: #c60f13; - border-color: #970b0e; - color: white; } - .alert-box.secondary { - background-color: #e9e9e9; - border-color: #d0d0d0; - color: #505050; } - -/* Breadcrumbs */ -.breadcrumbs { - display: block; - padding: 0.375em 0.875em 0.5625em; - overflow: hidden; - margin-left: 0; - list-style: none; - border-style: solid; - border-width: 1px; - background-color: #f6f6f6; - border-color: gainsboro; - -webkit-border-radius: 3px; - border-radius: 3px; } - .breadcrumbs li { - margin: 0; - padding: 0 0.75em 0 0; - float: left; } - .breadcrumbs li:hover a, .breadcrumbs li:focus a { - text-decoration: underline; } - .breadcrumbs li a, - .breadcrumbs li span { - font-size: 0.6875em; - padding-left: 0.75em; - text-transform: uppercase; - color: #2ba6cb; } - .breadcrumbs li.current a { - cursor: default; - color: #333333; } - .breadcrumbs li.current:hover a, .breadcrumbs li.current:focus a { - text-decoration: none; } - .breadcrumbs li.unavailable a { - color: #999999; } - .breadcrumbs li.unavailable:hover a, - .breadcrumbs li.unavailable a:focus { - text-decoration: none; - color: #999999; - cursor: default; } - .breadcrumbs li:before { - content: "/"; - color: #aaaaaa; - position: relative; - top: 1px; } - .breadcrumbs li:first-child a, .breadcrumbs li:first-child span { - padding-left: 0; } - .breadcrumbs li:first-child:before { - content: ""; } - -/* Keystroke Characters */ -.keystroke, -kbd { - background-color: #ededed; - border-color: #dbdbdb; - color: #222222; - border-style: solid; - border-width: 1px; - margin: 0; - font-family: "Consolas", "Menlo", "Courier", monospace; - font-size: 0.9375em; - padding: 0.125em 0.25em 0em; - -webkit-border-radius: 3px; - border-radius: 3px; } - -/* Labels */ -.label { - font-weight: 500; - text-align: center; - text-decoration: none; - line-height: 1; - white-space: nowrap; - display: inline; - position: relative; - padding: 0.1875em 0.625em 0.25em; - font-size: 0.875em; - background-color: #2ba6cb; - color: #fff; } - .label.radius { - -webkit-border-radius: 3px; - border-radius: 3px; } - .label.round { - -webkit-border-radius: 1000px; - border-radius: 1000px; } - .label.alert { - background-color: #c60f13; - color: #fff; } - .label.success { - background-color: #5da423; - color: #fff; } - .label.secondary { - background-color: #e9e9e9; - color: #333; } - -/* Inline Lists */ -.inline-list { - margin: 0 0 1.0625em -1.375em; - padding: 0; - list-style: none; - overflow: hidden; } - .inline-list > li { - list-style: none; - float: left; - margin-left: 1.375em; - display: block; } - .inline-list > li > * { - display: block; } - -/* Pagination */ -.pagination { - display: block; - height: 1.5em; - margin-left: -0.3125em; } - .pagination li { - display: block; - float: left; - height: 1.5em; - color: #222222; - font-size: 0.875em; - margin-left: 0.3125em; } - .pagination li a { - display: block; - padding: 0.0625em 0.4375em 0.0625em; - color: #999999; } - .pagination li:hover a, - .pagination li a:focus { - background: #e6e6e6; } - .pagination li.unavailable a { - cursor: default; - color: #999999; } - .pagination li.unavailable:hover a, .pagination li.unavailable a:focus { - background: transparent; } - .pagination li.current a { - background: #2ba6cb; - color: white; - font-weight: bold; - cursor: default; } - .pagination li.current a:hover, .pagination li.current a:focus { - background: #2ba6cb; } - -.pagination-centered { - text-align: center; } - .pagination-centered ul > li { - float: none; - display: inline-block; } - -/* Panels */ -.panel { - border-style: solid; - border-width: 1px; - border-color: #d9d9d9; - margin-bottom: 1.25em; - padding: 1.25em; - background: #f2f2f2; } - .panel h1, .panel h2, .panel h3, .panel h4, .panel h5, .panel h6, .panel p { - color: #333333; } - .panel > :first-child { - margin-top: 0; } - .panel > :last-child { - margin-bottom: 0; } - .panel h1, .panel h2, .panel h3, .panel h4, .panel h5, .panel h6 { - line-height: 1; - margin-bottom: 0.625em; } - .panel h1.subheader, .panel h2.subheader, .panel h3.subheader, .panel h4.subheader, .panel h5.subheader, .panel h6.subheader { - line-height: 1.4; } - .panel.callout { - border-style: solid; - border-width: 1px; - border-color: #2284a1; - margin-bottom: 1.25em; - padding: 1.25em; - background: #2ba6cb; - -webkit-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset; - box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset; } - .panel.callout h1, .panel.callout h2, .panel.callout h3, .panel.callout h4, .panel.callout h5, .panel.callout h6, .panel.callout p { - color: white; } - .panel.callout > :first-child { - margin-top: 0; } - .panel.callout > :last-child { - margin-bottom: 0; } - .panel.callout h1, .panel.callout h2, .panel.callout h3, .panel.callout h4, .panel.callout h5, .panel.callout h6 { - line-height: 1; - margin-bottom: 0.625em; } - .panel.callout h1.subheader, .panel.callout h2.subheader, .panel.callout h3.subheader, .panel.callout h4.subheader, .panel.callout h5.subheader, .panel.callout h6.subheader { - line-height: 1.4; } - .panel.radius { - -webkit-border-radius: 3px; - border-radius: 3px; } - -/* Pricing Tables */ -.pricing-table { - border: solid 1px #dddddd; - margin-left: 0; - margin-bottom: 1.25em; } - .pricing-table * { - list-style: none; - line-height: 1; } - .pricing-table .title { - background-color: #dddddd; - padding: 0.9375em 1.25em; - text-align: center; - color: #333333; - font-weight: bold; - font-size: 1em; } - .pricing-table .price { - background-color: #eeeeee; - padding: 0.9375em 1.25em; - text-align: center; - color: #333333; - font-weight: normal; - font-size: 1.25em; } - .pricing-table .description { - background-color: white; - padding: 0.9375em; - text-align: center; - color: #777777; - font-size: 0.75em; - font-weight: normal; - line-height: 1.4; - border-bottom: dotted 1px #dddddd; } - .pricing-table .bullet-item { - background-color: white; - padding: 0.9375em; - text-align: center; - color: #333333; - font-size: 0.875em; - font-weight: normal; - border-bottom: dotted 1px #dddddd; } - .pricing-table .cta-button { - background-color: whitesmoke; - text-align: center; - padding: 1.25em 1.25em 0; } - -/* Progress Bar */ -.progress { - background-color: transparent; - height: 1.5625em; - border: 1px solid #cccccc; - padding: 0.125em; - margin-bottom: 0.625em; } - .progress .meter { - background: #2ba6cb; - height: 100%; - display: block; } - .progress.secondary .meter { - background: #e9e9e9; - height: 100%; - display: block; } - .progress.success .meter { - background: #5da423; - height: 100%; - display: block; } - .progress.alert .meter { - background: #c60f13; - height: 100%; - display: block; } - .progress.radius { - -webkit-border-radius: 3px; - border-radius: 3px; } - .progress.radius .meter { - -webkit-border-radius: 2px; - border-radius: 2px; } - .progress.round { - -webkit-border-radius: 1000px; - border-radius: 1000px; } - .progress.round .meter { - -webkit-border-radius: 999px; - border-radius: 999px; } - -/* Side Nav */ -.side-nav { - display: block; - margin: 0; - padding: 0.875em 0; - list-style-type: none; - list-style-position: inside; } - .side-nav li { - margin: 0 0 0.4375em 0; - font-size: 0.875em; } - .side-nav li a { - display: block; - color: #2ba6cb; } - .side-nav li.active a { - color: #4d4d4d; - font-weight: bold; } - .side-nav li.divider { - border-top: 1px solid; - height: 0; - padding: 0; - list-style: none; - border-top-color: #e6e6e6; } - -/* Side Nav */ -.sub-nav { - display: block; - width: auto; - overflow: hidden; - margin: -0.25em 0 1.125em; - padding-top: 0.25em; - margin-right: 0; - margin-left: -0.5625em; } - .sub-nav dt, - .sub-nav dd { - float: left; - display: inline; - margin-left: 0.5625em; - margin-bottom: 0.625em; - font-weight: normal; - font-size: 0.875em; } - .sub-nav dt a, - .sub-nav dd a { - color: #999999; - text-decoration: none; } - .sub-nav dt.active a, - .sub-nav dd.active a { - -webkit-border-radius: 1000px; - border-radius: 1000px; - font-weight: bold; - background: #2ba6cb; - padding: 0.1875em 0.5625em; - cursor: default; - color: white; } - -/* Foundation Switches */ -@media only screen { - .switch { - position: relative; - width: 100%; - padding: 0; - display: block; - overflow: hidden; - border-style: solid; - border-width: 1px; - margin-bottom: 1.25em; - -webkit-animation: webkitSiblingBugfix infinite 1s; - height: 36px; - background: white; - border-color: #cccccc; } - .switch label { - position: relative; - left: 0; - z-index: 2; - float: left; - width: 50%; - height: 100%; - margin: 0; - text-align: right; - font-weight: bold; - text-align: left; - -webkit-transition: all 0.1s ease-out; - -moz-transition: all 0.1s ease-out; - transition: all 0.1s ease-out; } - .switch input { - position: absolute; - z-index: 3; - opacity: 0; - width: 100%; - height: 100%; } - .switch input:hover, .switch input:focus { - cursor: pointer; } - .switch > span { - position: absolute; - top: -1px; - left: -1px; - z-index: 1; - display: block; - padding: 0; - border-width: 1px; - border-style: solid; - -webkit-transition: all 0.1s ease-out; - -moz-transition: all 0.1s ease-out; - transition: all 0.1s ease-out; } - .switch input:not(:checked) + label { - opacity: 0; } - .switch input:checked { - display: none !important; } - .switch input { - left: 0; - display: block !important; } - .switch input:first-of-type + label, - .switch input:first-of-type + span + label { - left: -50%; } - .switch input:first-of-type:checked + label, - .switch input:first-of-type:checked + span + label { - left: 0%; } - .switch input:last-of-type + label, - .switch input:last-of-type + span + label { - right: -50%; - left: auto; - text-align: right; } - .switch input:last-of-type:checked + label, - .switch input:last-of-type:checked + span + label { - right: 0%; - left: auto; } - .switch span.custom { - display: none !important; } - .switch label { - padding: 0 0.375em; - line-height: 2.3em; - font-size: 0.875em; } - .switch input:first-of-type:checked ~ span { - left: 100%; - margin-left: -2.1875em; } - .switch > span { - width: 2.25em; - height: 2.25em; } - .switch > span { - border-color: #b3b3b3; - background: white; - background: -moz-linear-gradient(top, white 0%, #f2f2f2 100%); - background: -webkit-linear-gradient(top, white 0%, #f2f2f2 100%); - background: linear-gradient(to bottom, white 0%, #f2f2f2 100%); - -webkit-box-shadow: 2px 0 10px 0 rgba(0, 0, 0, 0.07), 1000px 0 0 1000px #e1f5d1, -2px 0 10px 0 rgba(0, 0, 0, 0.07), -1000px 0 0 1000px whitesmoke; - box-shadow: 2px 0 10px 0 rgba(0, 0, 0, 0.07), 1000px 0 0 980px #e1f5d1, -2px 0 10px 0 rgba(0, 0, 0, 0.07), -1000px 0 0 1000px whitesmoke; } - .switch:hover > span, .switch:focus > span { - background: white; - background: -moz-linear-gradient(top, white 0%, #e6e6e6 100%); - background: -webkit-linear-gradient(top, white 0%, #e6e6e6 100%); - background: linear-gradient(to bottom, white 0%, #e6e6e6 100%); } - .switch:active { - background: transparent; } - .switch.large { - height: 44px; } - .switch.large label { - padding: 0 0.375em; - line-height: 2.3em; - font-size: 1.0625em; } - .switch.large input:first-of-type:checked ~ span { - left: 100%; - margin-left: -2.6875em; } - .switch.large > span { - width: 2.75em; - height: 2.75em; } - .switch.small { - height: 28px; } - .switch.small label { - padding: 0 0.375em; - line-height: 2.1em; - font-size: 0.75em; } - .switch.small input:first-of-type:checked ~ span { - left: 100%; - margin-left: -1.6875em; } - .switch.small > span { - width: 1.75em; - height: 1.75em; } - .switch.tiny { - height: 22px; } - .switch.tiny label { - padding: 0 0.375em; - line-height: 1.9em; - font-size: 0.6875em; } - .switch.tiny input:first-of-type:checked ~ span { - left: 100%; - margin-left: -1.3125em; } - .switch.tiny > span { - width: 1.375em; - height: 1.375em; } - .switch.radius { - -webkit-border-radius: 4px; - border-radius: 4px; } - .switch.radius > span { - -webkit-border-radius: 3px; - border-radius: 3px; } - .switch.round { - -webkit-border-radius: 1000px; - border-radius: 1000px; } - .switch.round > span { - -webkit-border-radius: 999px; - border-radius: 999px; } - .switch.round label { - padding: 0 0.5625em; } - - @-webkit-keyframes webkitSiblingBugfix { - from { - position: relative; } - - to { - position: relative; } } } -[data-magellan-expedition] { - background: white; - z-index: 997; - min-width: 100%; - padding: 10px; } - [data-magellan-expedition] .sub-nav { - margin-bottom: 0; } - [data-magellan-expedition] .sub-nav dd { - margin-bottom: 0; } - -/* Tables */ -table { - background: white; - margin-bottom: 1.25em; - border: solid 1px #dddddd; } - table thead, - table tfoot { - background: whitesmoke; - font-weight: bold; } - table thead tr th, - table thead tr td, - table tfoot tr th, - table tfoot tr td { - padding: 0.5em 0.625em 0.625em; - font-size: 0.875em; - color: #222222; - text-align: left; } - table tr th, - table tr td { - padding: 0.5625em 0.625em; - font-size: 0.875em; - color: #222222; } - table tr.even, table tr.alt, table tr:nth-of-type(even) { - background: #f9f9f9; } - table thead tr th, - table tfoot tr th, - table tbody tr td, - table tr td, - table tfoot tr td { - display: table-cell; - line-height: 1.125em; } - -/* Image Thumbnails */ -.th { - display: inline-block; - border: solid 4px white; - -webkit-box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2); - box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2); - -webkit-transition: all 200ms ease-out; - -moz-transition: all 200ms ease-out; - transition: all 200ms ease-out; } - .th:hover, .th:focus { - -webkit-box-shadow: 0 0 6px 1px rgba(43, 166, 203, 0.5); - box-shadow: 0 0 6px 1px rgba(43, 166, 203, 0.5); } - .th.radius { - -webkit-border-radius: 3px; - border-radius: 3px; } - -/* Tooltips */ -.has-tip { - border-bottom: dotted 1px #cccccc; - cursor: help; - font-weight: bold; - color: #333333; } - .has-tip:hover, .has-tip:focus { - border-bottom: dotted 1px #196177; - color: #2ba6cb; } - .has-tip.tip-left, .has-tip.tip-right { - float: none !important; } - -.tooltip { - display: none; - position: absolute; - z-index: 999; - font-weight: bold; - font-size: 0.9375em; - line-height: 1.3; - padding: 0.5em; - max-width: 85%; - left: 50%; - width: 100%; - color: white; - background: black; - -webkit-border-radius: 3px; - border-radius: 3px; } - .tooltip > .nub { - display: block; - position: absolute; - width: 0; - height: 0; - border: solid 5px; - border-color: transparent transparent black transparent; - top: -10px; } - .tooltip.opened { - color: #2ba6cb !important; - border-bottom: dotted 1px #196177 !important; } - -.tap-to-close { - display: block; - font-size: 0.625em; - color: #888888; - font-weight: normal; } - -@media only screen and (min-width: 48em) { - .tooltip > .nub { - border-color: transparent transparent black transparent; - top: -10px; } - .tooltip.tip-top > .nub { - border-color: black transparent transparent transparent; - top: auto; - bottom: -10px; } - .tooltip.tip-left, .tooltip.tip-right { - float: none !important; } - .tooltip.tip-left > .nub { - border-color: transparent transparent transparent black; - right: -10px; - left: auto; - top: 50%; - margin-top: -5px; } - .tooltip.tip-right > .nub { - border-color: transparent black transparent transparent; - right: auto; - left: -10px; - top: 50%; - margin-top: -5px; } } -@media only screen and (max-width: 767px) { - .f-dropdown { - max-width: 100%; - left: 0; } } -/* Foundation Dropdowns */ -.f-dropdown { - position: absolute; - left: -9999px; - top: -9999px; - list-style: none; - width: 100%; - max-height: none; - height: auto; - background: white; - border: solid 1px #cccccc; - font-size: 16px; - z-index: 99; - margin-top: 2px; - max-width: 200px; } - .f-dropdown *:first-child { - margin-top: 0; } - .f-dropdown *:last-child { - margin-bottom: 0; } - .f-dropdown:before { - content: ""; - display: block; - width: 0; - height: 0; - border: solid 6px; - border-color: transparent transparent white transparent; - position: absolute; - top: -12px; - left: 10px; - z-index: 99; } - .f-dropdown:after { - content: ""; - display: block; - width: 0; - height: 0; - border: solid 7px; - border-color: transparent transparent #cccccc transparent; - position: absolute; - top: -14px; - left: 9px; - z-index: 98; } - .f-dropdown li { - font-size: 0.875em; - cursor: pointer; - padding: 0.3125em 0.625em; - line-height: 1.125em; - margin: 0; } - .f-dropdown li:hover, .f-dropdown li:focus { - background: #eeeeee; } - .f-dropdown li a { - color: #555555; } - .f-dropdown.content { - position: absolute; - left: -9999px; - top: -9999px; - list-style: none; - padding: 1.25em; - width: 100%; - height: auto; - max-height: none; - background: white; - border: solid 1px #cccccc; - font-size: 16px; - z-index: 99; - max-width: 200px; } - .f-dropdown.content *:first-child { - margin-top: 0; } - .f-dropdown.content *:last-child { - margin-bottom: 0; } - .f-dropdown.tiny { - max-width: 200px; } - .f-dropdown.small { - max-width: 300px; } - .f-dropdown.medium { - max-width: 500px; } - .f-dropdown.large { - max-width: 800px; } diff --git a/doc/foundation/static/css/foundation.min.css b/doc/foundation/static/css/foundation.min.css deleted file mode 100644 index d308b21..0000000 --- a/doc/foundation/static/css/foundation.min.css +++ /dev/null @@ -1 +0,0 @@ -*,*:before,*:after{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}html,body{font-size:16px}body{background:#fff;color:#222;padding:0;margin:0;font-family:"Helvetica Neue","Helvetica",Helvetica,Arial,sans-serif;font-weight:normal;font-style:normal;line-height:1;position:relative;-webkit-font-smoothing:antialiased}a:focus{outline:none}img,object,embed{max-width:100%;height:auto}object,embed{height:100%}img{-ms-interpolation-mode:bicubic}#map_canvas img,#map_canvas embed,#map_canvas object,.map_canvas img,.map_canvas embed,.map_canvas object{max-width:none !important}.left{float:left !important}.right{float:right !important}.text-left{text-align:left !important}.text-right{text-align:right !important}.text-center{text-align:center !important}.text-justify{text-align:justify !important}.hide{display:none}img{display:inline-block}textarea{height:auto;min-height:50px}select{width:100%}.row{width:100%;margin-left:auto;margin-right:auto;margin-top:0;margin-bottom:0;max-width:62.5em;*zoom:1}.row:before,.row:after{content:" ";display:table}.row:after{clear:both}.row .column,.row .columns{position:relative;padding-left:0.9375em;padding-right:0.9375em;width:100%}.row.collapse .column,.row.collapse .columns{position:relative;padding-left:0;padding-right:0}.row .row{width:auto;margin-left:-0.9375em;margin-right:-0.9375em;margin-top:0;margin-bottom:0;max-width:none;*zoom:1}.row .row:before,.row .row:after{content:" ";display:table}.row .row:after{clear:both}.row .row.collapse{width:auto;margin:0;max-width:none;*zoom:1}.row .row.collapse:before,.row .row.collapse:after{content:" ";display:table}.row .row.collapse:after{clear:both}@media only screen{.row .column,.row .columns{position:relative;padding-left:0.9375em;padding-right:0.9375em;float:left}.row .small-1{position:relative;width:8.33333%}.row .small-2{position:relative;width:16.66667%}.row .small-3{position:relative;width:25%}.row .small-4{position:relative;width:33.33333%}.row .small-5{position:relative;width:41.66667%}.row .small-6{position:relative;width:50%}.row .small-7{position:relative;width:58.33333%}.row .small-8{position:relative;width:66.66667%}.row .small-9{position:relative;width:75%}.row .small-10{position:relative;width:83.33333%}.row .small-11{position:relative;width:91.66667%}.row .small-12{position:relative;width:100%}.row .small-offset-1{position:relative;margin-left:8.33333%}.row .small-offset-2{position:relative;margin-left:16.66667%}.row .small-offset-3{position:relative;margin-left:25%}.row .small-offset-4{position:relative;margin-left:33.33333%}.row .small-offset-5{position:relative;margin-left:41.66667%}.row .small-offset-6{position:relative;margin-left:50%}.row .small-offset-7{position:relative;margin-left:58.33333%}.row .small-offset-8{position:relative;margin-left:66.66667%}.row .small-offset-9{position:relative;margin-left:75%}.row .small-offset-10{position:relative;margin-left:83.33333%}[class*="column"]+[class*="column"]:last-child{float:right}[class*="column"]+[class*="column"].end{float:left}.column.small-centered,.columns.small-centered{position:relative;margin-left:auto;margin-right:auto;float:none}}@media only screen and (min-width: 48em){.row .large-1{position:relative;width:8.33333%}.row .large-2{position:relative;width:16.66667%}.row .large-3{position:relative;width:25%}.row .large-4{position:relative;width:33.33333%}.row .large-5{position:relative;width:41.66667%}.row .large-6{position:relative;width:50%}.row .large-7{position:relative;width:58.33333%}.row .large-8{position:relative;width:66.66667%}.row .large-9{position:relative;width:75%}.row .large-10{position:relative;width:83.33333%}.row .large-11{position:relative;width:91.66667%}.row .large-12{position:relative;width:100%}.row .large-offset-1{position:relative;margin-left:8.33333%}.row .large-offset-2{position:relative;margin-left:16.66667%}.row .large-offset-3{position:relative;margin-left:25%}.row .large-offset-4{position:relative;margin-left:33.33333%}.row .large-offset-5{position:relative;margin-left:41.66667%}.row .large-offset-6{position:relative;margin-left:50%}.row .large-offset-7{position:relative;margin-left:58.33333%}.row .large-offset-8{position:relative;margin-left:66.66667%}.row .large-offset-9{position:relative;margin-left:75%}.row .large-offset-10{position:relative;margin-left:83.33333%}.push-2{position:relative;left:16.66667%;right:auto}.pull-2{position:relative;right:16.66667%;left:auto}.push-3{position:relative;left:25%;right:auto}.pull-3{position:relative;right:25%;left:auto}.push-4{position:relative;left:33.33333%;right:auto}.pull-4{position:relative;right:33.33333%;left:auto}.push-5{position:relative;left:41.66667%;right:auto}.pull-5{position:relative;right:41.66667%;left:auto}.push-6{position:relative;left:50%;right:auto}.pull-6{position:relative;right:50%;left:auto}.push-7{position:relative;left:58.33333%;right:auto}.pull-7{position:relative;right:58.33333%;left:auto}.push-8{position:relative;left:66.66667%;right:auto}.pull-8{position:relative;right:66.66667%;left:auto}.push-9{position:relative;left:75%;right:auto}.pull-9{position:relative;right:75%;left:auto}.push-10{position:relative;left:83.33333%;right:auto}.pull-10{position:relative;right:83.33333%;left:auto}.small-push-2{left:inherit}.small-pull-2{right:inherit}.small-push-3{left:inherit}.small-pull-3{right:inherit}.small-push-4{left:inherit}.small-pull-4{right:inherit}.small-push-5{left:inherit}.small-pull-5{right:inherit}.small-push-6{left:inherit}.small-pull-6{right:inherit}.small-push-7{left:inherit}.small-pull-7{right:inherit}.small-push-8{left:inherit}.small-pull-8{right:inherit}.small-push-9{left:inherit}.small-pull-9{right:inherit}.small-push-10{left:inherit}.small-pull-10{right:inherit}.column.large-centered,.columns.large-centered{position:relative;margin-left:auto;margin-right:auto;float:none}}.show-for-small,.show-for-medium-down,.show-for-large-down{display:inherit !important}.show-for-medium,.show-for-medium-up,.show-for-large,.show-for-large-up,.show-for-xlarge{display:none !important}.hide-for-medium,.hide-for-medium-up,.hide-for-large,.hide-for-large-up,.hide-for-xlarge{display:inherit !important}.hide-for-small,.hide-for-medium-down,.hide-for-large-down{display:none !important}table.show-for-small,table.show-for-medium-down,table.show-for-large-down,table.hide-for-medium,table.hide-for-medium-up,table.hide-for-large,table.hide-for-large-up,table.hide-for-xlarge{display:table}thead.show-for-small,thead.show-for-medium-down,thead.show-for-large-down,thead.hide-for-medium,thead.hide-for-medium-up,thead.hide-for-large,thead.hide-for-large-up,thead.hide-for-xlarge{display:table-header-group !important}tbody.show-for-small,tbody.show-for-medium-down,tbody.show-for-large-down,tbody.hide-for-medium,tbody.hide-for-medium-up,tbody.hide-for-large,tbody.hide-for-large-up,tbody.hide-for-xlarge{display:table-row-group !important}tr.show-for-small,tr.show-for-medium-down,tr.show-for-large-down,tr.hide-for-medium,tr.hide-for-medium-up,tr.hide-for-large,tr.hide-for-large-up,tr.hide-for-xlarge{display:table-row !important}td.show-for-small,td.show-for-medium-down,td.show-for-large-down,td.hide-for-medium,td.hide-for-medium-up,td.hide-for-large,td.hide-for-large-up,td.hide-for-xlarge,th.show-for-small,th.show-for-medium-down,th.show-for-large-down,th.hide-for-medium,th.hide-for-medium-up,th.hide-for-large,th.hide-for-large-up,th.hide-for-xlarge{display:table-cell !important}@media only screen and (min-width: 48em){.show-for-medium,.show-for-medium-up{display:inherit !important}.show-for-small{display:none !important}.hide-for-small{display:inherit !important}.hide-for-medium,.hide-for-medium-up{display:none !important}table.show-for-medium,table.show-for-medium-up,table.hide-for-small{display:table}thead.show-for-medium,thead.show-for-medium-up,thead.hide-for-small{display:table-header-group !important}tbody.show-for-medium,tbody.show-for-medium-up,tbody.hide-for-small{display:table-row-group !important}tr.show-for-medium,tr.show-for-medium-up,tr.hide-for-small{display:table-row !important}td.show-for-medium,td.show-for-medium-up,td.hide-for-small,th.show-for-medium,th.show-for-medium-up,th.hide-for-small{display:table-cell !important}}@media only screen and (min-width: 80em){.show-for-large,.show-for-large-up{display:inherit !important}.show-for-medium,.show-for-medium-down{display:none !important}.hide-for-medium,.hide-for-medium-down{display:inherit !important}.hide-for-large,.hide-for-large-up{display:none !important}table.show-for-large,table.show-for-large-up,table.hide-for-medium,table.hide-for-medium-down{display:table}thead.show-for-large,thead.show-for-large-up,thead.hide-for-medium,thead.hide-for-medium-down{display:table-header-group !important}tbody.show-for-large,tbody.show-for-large-up,tbody.hide-for-medium,tbody.hide-for-medium-down{display:table-row-group !important}tr.show-for-large,tr.show-for-large-up,tr.hide-for-medium,tr.hide-for-medium-down{display:table-row !important}td.show-for-large,td.show-for-large-up,td.hide-for-medium,td.hide-for-medium-down,th.show-for-large,th.show-for-large-up,th.hide-for-medium,th.hide-for-medium-down{display:table-cell !important}}@media only screen and (min-width: 90em){.show-for-xlarge{display:inherit !important}.show-for-large,.show-for-large-down{display:none !important}.hide-for-large,.hide-for-large-down{display:inherit !important}.hide-for-xlarge{display:none !important}table.show-for-xlarge,table.hide-for-large,table.hide-for-large-down{display:table}thead.show-for-xlarge,thead.hide-for-large,thead.hide-for-large-down{display:table-header-group !important}tbody.show-for-xlarge,tbody.hide-for-large,tbody.hide-for-large-down{display:table-row-group !important}tr.show-for-xlarge,tr.hide-for-large,tr.hide-for-large-down{display:table-row !important}td.show-for-xlarge,td.hide-for-large,td.hide-for-large-down,th.show-for-xlarge,th.hide-for-large,th.hide-for-large-down{display:table-cell !important}}.show-for-landscape,.hide-for-portrait{display:inherit !important}.hide-for-landscape,.show-for-portrait{display:none !important}table.hide-for-landscape,table.show-for-portrait{display:table}thead.hide-for-landscape,thead.show-for-portrait{display:table-header-group !important}tbody.hide-for-landscape,tbody.show-for-portrait{display:table-row-group !important}tr.hide-for-landscape,tr.show-for-portrait{display:table-row !important}td.hide-for-landscape,td.show-for-portrait,th.hide-for-landscape,th.show-for-portrait{display:table-cell !important}@media only screen and (orientation: landscape){.show-for-landscape,.hide-for-portrait{display:inherit !important}.hide-for-landscape,.show-for-portrait{display:none !important}table.show-for-landscape,table.hide-for-portrait{display:table}thead.show-for-landscape,thead.hide-for-portrait{display:table-header-group !important}tbody.show-for-landscape,tbody.hide-for-portrait{display:table-row-group !important}tr.show-for-landscape,tr.hide-for-portrait{display:table-row !important}td.show-for-landscape,td.hide-for-portrait,th.show-for-landscape,th.hide-for-portrait{display:table-cell !important}}@media only screen and (orientation: portrait){.show-for-portrait,.hide-for-landscape{display:inherit !important}.hide-for-portrait,.show-for-landscape{display:none !important}table.show-for-portrait,table.hide-for-landscape{display:table}thead.show-for-portrait,thead.hide-for-landscape{display:table-header-group !important}tbody.show-for-portrait,tbody.hide-for-landscape{display:table-row-group !important}tr.show-for-portrait,tr.hide-for-landscape{display:table-row !important}td.show-for-portrait,td.hide-for-landscape,th.show-for-portrait,th.hide-for-landscape{display:table-cell !important}}.show-for-touch{display:none !important}.hide-for-touch{display:inherit !important}.touch .show-for-touch{display:inherit !important}.touch .hide-for-touch{display:none !important}table.hide-for-touch{display:table}.touch table.show-for-touch{display:table}thead.hide-for-touch{display:table-header-group !important}.touch thead.show-for-touch{display:table-header-group !important}tbody.hide-for-touch{display:table-row-group !important}.touch tbody.show-for-touch{display:table-row-group !important}tr.hide-for-touch{display:table-row !important}.touch tr.show-for-touch{display:table-row !important}td.hide-for-touch{display:table-cell !important}.touch td.show-for-touch{display:table-cell !important}th.hide-for-touch{display:table-cell !important}.touch th.show-for-touch{display:table-cell !important}@media only screen{[class*="block-grid-"]{display:block;overflow:hidden;padding:0;margin:0 -10px}[class*="block-grid-"]>li{display:block;height:auto;float:left;padding:0 10px 10px}.small-block-grid-1>li{width:100%;padding:0 10px 10px}.small-block-grid-1>li:nth-of-type(1n+1){clear:both}.small-block-grid-2>li{width:50%;padding:0 10px 10px}.small-block-grid-2>li:nth-of-type(2n+1){clear:both}.small-block-grid-3>li{width:33.33333%;padding:0 10px 10px}.small-block-grid-3>li:nth-of-type(3n+1){clear:both}.small-block-grid-4>li{width:25%;padding:0 10px 10px}.small-block-grid-4>li:nth-of-type(4n+1){clear:both}.small-block-grid-5>li{width:20%;padding:0 10px 10px}.small-block-grid-5>li:nth-of-type(5n+1){clear:both}.small-block-grid-6>li{width:16.66667%;padding:0 10px 10px}.small-block-grid-6>li:nth-of-type(6n+1){clear:both}.small-block-grid-7>li{width:14.28571%;padding:0 10px 10px}.small-block-grid-7>li:nth-of-type(7n+1){clear:both}.small-block-grid-8>li{width:12.5%;padding:0 10px 10px}.small-block-grid-8>li:nth-of-type(8n+1){clear:both}.small-block-grid-9>li{width:11.11111%;padding:0 10px 10px}.small-block-grid-9>li:nth-of-type(9n+1){clear:both}.small-block-grid-10>li{width:10%;padding:0 10px 10px}.small-block-grid-10>li:nth-of-type(10n+1){clear:both}.small-block-grid-11>li{width:9.09091%;padding:0 10px 10px}.small-block-grid-11>li:nth-of-type(11n+1){clear:both}.small-block-grid-12>li{width:8.33333%;padding:0 10px 10px}.small-block-grid-12>li:nth-of-type(12n+1){clear:both}}@media only screen and (min-width: 48em){.large-block-grid-1>li{width:100%;padding:0 10px 10px}.large-block-grid-1>li:nth-of-type(1n+1){clear:both}.large-block-grid-2>li{width:50%;padding:0 10px 10px}.large-block-grid-2>li:nth-of-type(2n+1){clear:both}.large-block-grid-3>li{width:33.33333%;padding:0 10px 10px}.large-block-grid-3>li:nth-of-type(3n+1){clear:both}.large-block-grid-4>li{width:25%;padding:0 10px 10px}.large-block-grid-4>li:nth-of-type(4n+1){clear:both}.large-block-grid-5>li{width:20%;padding:0 10px 10px}.large-block-grid-5>li:nth-of-type(5n+1){clear:both}.large-block-grid-6>li{width:16.66667%;padding:0 10px 10px}.large-block-grid-6>li:nth-of-type(6n+1){clear:both}.large-block-grid-7>li{width:14.28571%;padding:0 10px 10px}.large-block-grid-7>li:nth-of-type(7n+1){clear:both}.large-block-grid-8>li{width:12.5%;padding:0 10px 10px}.large-block-grid-8>li:nth-of-type(8n+1){clear:both}.large-block-grid-9>li{width:11.11111%;padding:0 10px 10px}.large-block-grid-9>li:nth-of-type(9n+1){clear:both}.large-block-grid-10>li{width:10%;padding:0 10px 10px}.large-block-grid-10>li:nth-of-type(10n+1){clear:both}.large-block-grid-11>li{width:9.09091%;padding:0 10px 10px}.large-block-grid-11>li:nth-of-type(11n+1){clear:both}.large-block-grid-12>li{width:8.33333%;padding:0 10px 10px}.large-block-grid-12>li:nth-of-type(12n+1){clear:both}[class*="small-block-grid-"]>li{clear:none !important}}p.lead{font-size:1.21875em;line-height:1.6}.subheader{line-height:1.4;color:#6f6f6f;font-weight:300;margin-top:0.2em;margin-bottom:0.5em}div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,p,blockquote,th,td{margin:0;padding:0;direction:ltr}a{color:#2ba6cb;text-decoration:none;line-height:inherit}a:hover,a:focus{color:#2795b6}a img{border:none}p{font-family:inherit;font-weight:normal;font-size:1em;line-height:1.6;margin-bottom:1.25em}p aside{font-size:0.875em;line-height:1.35;font-style:italic}h1,h2,h3,h4,h5,h6{font-family:"Helvetica Neue","Helvetica",Helvetica,Arial,sans-serif;font-weight:bold;font-style:normal;color:#222;text-rendering:optimizeLegibility;margin-top:0.2em;margin-bottom:0.5em;line-height:1.2125em}h1 small,h2 small,h3 small,h4 small,h5 small,h6 small{font-size:60%;color:#6f6f6f;line-height:0}h1{font-size:2.125em}h2{font-size:1.6875em}h3{font-size:1.375em}h4{font-size:1.125em}h5{font-size:1.125em}h6{font-size:1em}hr{border:solid #ddd;border-width:1px 0 0;clear:both;margin:1.25em 0 1.1875em;height:0}em,i{font-style:italic;line-height:inherit}strong,b{font-weight:bold;line-height:inherit}small{font-size:60%;line-height:inherit}code{font-family:Consolas,"Liberation Mono",Courier,monospace;font-weight:bold;color:#7f0a0c}ul,ol,dl{font-size:1em;line-height:1.6;margin-bottom:1.25em;list-style-position:outside;font-family:inherit}ul li ul,ul li ol{margin-left:1.25em;margin-bottom:0;font-size:1em}ul.square li ul,ul.circle li ul,ul.disc li ul{list-style:inherit}ul.square{list-style-type:square}ul.circle{list-style-type:circle}ul.disc{list-style-type:disc}ul.no-bullet{list-style:none}ol li ul,ol li ol{margin-left:1.25em;margin-bottom:0}dl dt{margin-bottom:0.3em;font-weight:bold}dl dd{margin-bottom:0.75em}abbr,acronym{text-transform:uppercase;font-size:90%;color:#222;border-bottom:1px dotted #ddd;cursor:help}abbr{text-transform:none}blockquote{margin:0 0 1.25em;padding:0.5625em 1.25em 0 1.1875em;border-left:1px solid #ddd}blockquote cite{display:block;font-size:0.8125em;color:#555}blockquote cite:before{content:"\2014 \0020"}blockquote cite a,blockquote cite a:visited{color:#555}blockquote,blockquote p{line-height:1.6;color:#6f6f6f}.vcard{display:inline-block;margin:0 0 1.25em 0;border:1px solid #ddd;padding:0.625em 0.75em}.vcard li{margin:0;display:block}.vcard .fn{font-weight:bold;font-size:0.9375em}.vevent .summary{font-weight:bold}.vevent abbr{cursor:default;text-decoration:none;font-weight:bold;border:none;padding:0 0.0625em}@media only screen and (min-width: 48em){h1,h2,h3,h4,h5,h6{line-height:1.4}h1{font-size:2.75em}h2{font-size:2.3125em}h3{font-size:1.6875em}h4{font-size:1.4375em}}.print-only{display:none !important}@media print{*{background:transparent !important;color:#000 !important;box-shadow:none !important;text-shadow:none !important}a,a:visited{text-decoration:underline}a[href]:after{content:" (" attr(href) ")"}abbr[title]:after{content:" (" attr(title) ")"}.ir a:after,a[href^="javascript:"]:after,a[href^="#"]:after{content:""}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100% !important}@page{margin:0.5cm}p,h2,h3{orphans:3;widows:3}h2,h3{page-break-after:avoid}.hide-on-print{display:none !important}.print-only{display:block !important}.hide-for-print{display:none !important}.show-for-print{display:inherit !important}}.button{border-style:solid;border-width:1px;cursor:pointer;font-family:inherit;font-weight:bold;line-height:1;margin:0 0 1.25em;position:relative;text-decoration:none;text-align:center;display:inline-block;padding-top:0.75em;padding-right:1.5em;padding-bottom:0.8125em;padding-left:1.5em;font-size:1em;background-color:#2ba6cb;border-color:#2284a1;color:#fff}.button:hover,.button:focus{background-color:#2284a1}.button:hover,.button:focus{color:#fff}.button.secondary{background-color:#e9e9e9;border-color:#d0d0d0;color:#333}.button.secondary:hover,.button.secondary:focus{background-color:#d0d0d0}.button.secondary:hover,.button.secondary:focus{color:#333}.button.success{background-color:#5da423;border-color:#457a1a;color:#fff}.button.success:hover,.button.success:focus{background-color:#457a1a}.button.success:hover,.button.success:focus{color:#fff}.button.alert{background-color:#c60f13;border-color:#970b0e;color:#fff}.button.alert:hover,.button.alert:focus{background-color:#970b0e}.button.alert:hover,.button.alert:focus{color:#fff}.button.large{padding-top:1em;padding-right:2em;padding-bottom:1.0625em;padding-left:2em;font-size:1.25em}.button.small{padding-top:0.5625em;padding-right:1.125em;padding-bottom:0.625em;padding-left:1.125em;font-size:0.8125em}.button.tiny{padding-top:0.4375em;padding-right:0.875em;padding-bottom:0.5em;padding-left:0.875em;font-size:0.6875em}.button.expand{padding-top:0.75em;padding-right:1.5em;padding-bottom:0.8125em;padding-left:1.5em;font-size:1em;padding-top:0.75em;padding-right:0px;padding-bottom:0.8125em;padding-left:0px;width:100%}.button.left-align{text-align:left;text-indent:0.75em}.button.right-align{text-align:right;padding-right:0.75em}.button.disabled,.button[disabled]{background-color:#2ba6cb;border-color:#2284a1;color:#fff;cursor:default;opacity:0.6;-webkit-box-shadow:none;box-shadow:none}.button.disabled:hover,.button.disabled:focus,.button[disabled]:hover,.button[disabled]:focus{background-color:#2284a1}.button.disabled:hover,.button.disabled:focus,.button[disabled]:hover,.button[disabled]:focus{color:#fff}.button.disabled:hover,.button.disabled:focus,.button[disabled]:hover,.button[disabled]:focus{background-color:#2ba6cb}.button.disabled.secondary,.button[disabled].secondary{background-color:#e9e9e9;border-color:#d0d0d0;color:#333;cursor:default;opacity:0.6;-webkit-box-shadow:none;box-shadow:none}.button.disabled.secondary:hover,.button.disabled.secondary:focus,.button[disabled].secondary:hover,.button[disabled].secondary:focus{background-color:#d0d0d0}.button.disabled.secondary:hover,.button.disabled.secondary:focus,.button[disabled].secondary:hover,.button[disabled].secondary:focus{color:#333}.button.disabled.secondary:hover,.button.disabled.secondary:focus,.button[disabled].secondary:hover,.button[disabled].secondary:focus{background-color:#e9e9e9}.button.disabled.success,.button[disabled].success{background-color:#5da423;border-color:#457a1a;color:#fff;cursor:default;opacity:0.6;-webkit-box-shadow:none;box-shadow:none}.button.disabled.success:hover,.button.disabled.success:focus,.button[disabled].success:hover,.button[disabled].success:focus{background-color:#457a1a}.button.disabled.success:hover,.button.disabled.success:focus,.button[disabled].success:hover,.button[disabled].success:focus{color:#fff}.button.disabled.success:hover,.button.disabled.success:focus,.button[disabled].success:hover,.button[disabled].success:focus{background-color:#5da423}.button.disabled.alert,.button[disabled].alert{background-color:#c60f13;border-color:#970b0e;color:#fff;cursor:default;opacity:0.6;-webkit-box-shadow:none;box-shadow:none}.button.disabled.alert:hover,.button.disabled.alert:focus,.button[disabled].alert:hover,.button[disabled].alert:focus{background-color:#970b0e}.button.disabled.alert:hover,.button.disabled.alert:focus,.button[disabled].alert:hover,.button[disabled].alert:focus{color:#fff}.button.disabled.alert:hover,.button.disabled.alert:focus,.button[disabled].alert:hover,.button[disabled].alert:focus{background-color:#c60f13}input.button,button.button{padding-top:0.8125em;padding-bottom:0.75em}input.button.tiny,button.button.tiny{padding-top:0.5em;padding-bottom:0.4375em}input.button.small,button.button.small{padding-top:0.625em;padding-bottom:0.5625em}input.button.large,button.button.large{padding-top:1.03125em;padding-bottom:1.03125em}@media only screen{.button{-webkit-box-shadow:0 1px 0 rgba(255,255,255,0.5) inset;box-shadow:0 1px 0 rgba(255,255,255,0.5) inset;-webkit-transition:background-color 300ms ease-out;-moz-transition:background-color 300ms ease-out;transition:background-color 300ms ease-out}.button:active{-webkit-box-shadow:0 1px 0 rgba(0,0,0,0.2) inset;box-shadow:0 1px 0 rgba(0,0,0,0.2) inset}.button.radius{-webkit-border-radius:3px;border-radius:3px}.button.round{-webkit-border-radius:1000px;border-radius:1000px}}@media only screen and (min-width: 48em){.button{display:inline-block}}form{margin:0 0 1em}form .row .row{margin:-0.5em}form .row .row .column,form .row .row .columns{padding:0 0.5em}form .row .row.collapse{margin:0}form .row .row.collapse .column,form .row .row.collapse .columns{padding:0}form .row input.column,form .row input.columns{padding-left:0.5em}form .row .row{margin:0}label{font-size:0.875em;color:#4d4d4d;cursor:pointer;display:block;font-weight:500;margin-bottom:0.1875em}label.right{float:none;text-align:right}label.inline{margin:0 0 1em 0;padding:0.625em 0}.prefix,.postfix{display:block;position:relative;z-index:2;text-align:center;width:100%;padding-top:0;padding-bottom:0;border-style:solid;border-width:1px;overflow:hidden;font-size:0.875em;height:2.3125em;line-height:2.3125em}.postfix.button{padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;text-align:center;line-height:2.125em}.prefix.button{padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;text-align:center;line-height:2.125em}.prefix.button.radius{-webkit-border-radius:0;border-radius:0;-moz-border-radius-bottomleft:3px;-moz-border-radius-topleft:3px;-webkit-border-bottom-left-radius:3px;-webkit-border-top-left-radius:3px;border-bottom-left-radius:3px;border-top-left-radius:3px}.postfix.button.radius{-webkit-border-radius:0;border-radius:0;-moz-border-radius-topright:3px;-moz-border-radius-bottomright:3px;-webkit-border-top-right-radius:3px;-webkit-border-bottom-right-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px}.prefix.button.round{-webkit-border-radius:0;border-radius:0;-moz-border-radius-bottomleft:1000px;-moz-border-radius-topleft:1000px;-webkit-border-bottom-left-radius:1000px;-webkit-border-top-left-radius:1000px;border-bottom-left-radius:1000px;border-top-left-radius:1000px}.postfix.button.round{-webkit-border-radius:0;border-radius:0;-moz-border-radius-topright:1000px;-moz-border-radius-bottomright:1000px;-webkit-border-top-right-radius:1000px;-webkit-border-bottom-right-radius:1000px;border-top-right-radius:1000px;border-bottom-right-radius:1000px}span.prefix{background:#f2f2f2;border-color:#d9d9d9;border-right:none;color:#333}span.prefix.radius{-webkit-border-radius:0;border-radius:0;-moz-border-radius-bottomleft:3px;-moz-border-radius-topleft:3px;-webkit-border-bottom-left-radius:3px;-webkit-border-top-left-radius:3px;border-bottom-left-radius:3px;border-top-left-radius:3px}span.postfix{background:#f2f2f2;border-color:#ccc;border-left:none;color:#333}span.postfix.radius{-webkit-border-radius:0;border-radius:0;-moz-border-radius-topright:3px;-moz-border-radius-bottomright:3px;-webkit-border-top-right-radius:3px;-webkit-border-bottom-right-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px}.input-group.radius>*:first-child,.input-group.radius>*:first-child *{-webkit-border-radius:0;border-radius:0;-moz-border-radius-bottomleft:3px;-moz-border-radius-topleft:3px;-webkit-border-bottom-left-radius:3px;-webkit-border-top-left-radius:3px;border-bottom-left-radius:3px;border-top-left-radius:3px}.input-group.radius>*:last-child,.input-group.radius>*:last-child *{-webkit-border-radius:0;border-radius:0;-moz-border-radius-topright:3px;-moz-border-radius-bottomright:3px;-webkit-border-top-right-radius:3px;-webkit-border-bottom-right-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px}.input-group.round>*:first-child,.input-group.round>*:first-child *{-webkit-border-radius:0;border-radius:0;-moz-border-radius-bottomleft:1000px;-moz-border-radius-topleft:1000px;-webkit-border-bottom-left-radius:1000px;-webkit-border-top-left-radius:1000px;border-bottom-left-radius:1000px;border-top-left-radius:1000px}.input-group.round>*:last-child,.input-group.round>*:last-child *{-webkit-border-radius:0;border-radius:0;-moz-border-radius-topright:1000px;-moz-border-radius-bottomright:1000px;-webkit-border-top-right-radius:1000px;-webkit-border-bottom-right-radius:1000px;border-top-right-radius:1000px;border-bottom-right-radius:1000px}input[type="text"],input[type="password"],input[type="date"],input[type="datetime"],input[type="datetime-local"],input[type="month"],input[type="week"],input[type="email"],input[type="number"],input[type="search"],input[type="tel"],input[type="time"],input[type="url"],textarea{background-color:#fff;font-family:inherit;border:1px solid #ccc;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);color:rgba(0,0,0,0.75);display:block;font-size:0.875em;margin:0 0 1em 0;padding:0.5em;height:2.3125em;width:100%;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-transition:all 0.15s linear;-moz-transition:all 0.15s linear;transition:all 0.15s linear}input[type="text"]:focus,input[type="password"]:focus,input[type="date"]:focus,input[type="datetime"]:focus,input[type="datetime-local"]:focus,input[type="month"]:focus,input[type="week"]:focus,input[type="email"]:focus,input[type="number"]:focus,input[type="search"]:focus,input[type="tel"]:focus,input[type="time"]:focus,input[type="url"]:focus,textarea:focus{background:#fafafa;border-color:#999;outline:none}input[type="text"][disabled],input[type="password"][disabled],input[type="date"][disabled],input[type="datetime"][disabled],input[type="datetime-local"][disabled],input[type="month"][disabled],input[type="week"][disabled],input[type="email"][disabled],input[type="number"][disabled],input[type="search"][disabled],input[type="tel"][disabled],input[type="time"][disabled],input[type="url"][disabled],textarea[disabled]{background-color:#ddd}fieldset{border:solid 1px #ddd;padding:1.25em;margin:1.125em 0}fieldset legend{font-weight:bold;background:#fff;padding:0 0.1875em;margin:0;margin-left:-0.1875em}.error input,input.error,.error textarea,textarea.error{border-color:#c60f13;background-color:rgba(198,15,19,0.1)}.error input:focus,input.error:focus,.error textarea:focus,textarea.error:focus{background:#fafafa;border-color:#999}.error label,label.error{color:#c60f13}.error small,small.error{display:block;padding:0.375em 0.25em;margin-top:-1.3125em;margin-bottom:1em;font-size:0.75em;font-weight:bold;background:#c60f13;color:#fff}form.custom .custom{display:inline-block;width:16px;height:16px;position:relative;top:2px;border:solid 1px #ccc;background:#fff}form.custom .custom.radio{-webkit-border-radius:1000px;border-radius:1000px}form.custom .custom.checkbox:before{content:"";display:block;line-height:0.8;height:14px;width:14px;text-align:center;position:absolute;top:0;left:0;font-size:14px;color:#fff}form.custom .custom.radio.checked:before{content:"";display:block;width:8px;height:8px;-webkit-border-radius:1000px;border-radius:1000px;background:#222;position:relative;top:3px;left:3px}form.custom .custom.checkbox.checked:before{content:"\00d7";color:#222}form.custom .custom.dropdown{display:block;position:relative;top:0;height:2.3125em;margin-bottom:1.25em;margin-top:0px;padding:0px;width:100%;background:#fff;background:-moz-linear-gradient(top, #fff 0%, #f3f3f3 100%);background:-webkit-linear-gradient(top, #fff 0%, #f3f3f3 100%);background:linear-gradient(to bottom, #fff 0%, #f3f3f3 100%);-webkit-box-shadow:none;box-shadow:none;font-size:0.875em;vertical-align:top}form.custom .custom.dropdown ul{overflow-y:auto;max-height:200px}form.custom .custom.dropdown .current{cursor:default;white-space:nowrap;line-height:2.25em;color:rgba(0,0,0,0.75);text-decoration:none;overflow:hidden;display:block;margin-left:0.5em;margin-right:2.3125em}form.custom .custom.dropdown .selector{cursor:default;position:absolute;width:2.5em;height:2.3125em;display:block;right:0;top:0}form.custom .custom.dropdown .selector:after{content:"";display:block;content:"";display:block;width:0;height:0;border:solid 5px;border-color:#aaa transparent transparent transparent;position:absolute;left:0.9375em;top:50%;margin-top:-3px}form.custom .custom.dropdown:hover a.selector:after,form.custom .custom.dropdown.open a.selector:after{content:"";display:block;width:0;height:0;border:solid 5px;border-color:#222 transparent transparent transparent}form.custom .custom.dropdown .disabled{color:#888}form.custom .custom.dropdown .disabled:hover{background:transparent;color:#888}form.custom .custom.dropdown .disabled:hover:after{display:none}form.custom .custom.dropdown.open ul{display:block;z-index:10;min-width:100%;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}form.custom .custom.dropdown.small{max-width:134px}form.custom .custom.dropdown.medium{max-width:254px}form.custom .custom.dropdown.large{max-width:434px}form.custom .custom.dropdown.expand{width:100% !important}form.custom .custom.dropdown.open.small ul{min-width:134px;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}form.custom .custom.dropdown.open.medium ul{min-width:254px;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}form.custom .custom.dropdown.open.large ul{min-width:434px;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}form.custom .custom.dropdown ul{position:absolute;width:auto;display:none;margin:0;left:-1px;top:auto;-webkit-box-shadow:0 2px 2px 0px rgba(0,0,0,0.1);box-shadow:0 2px 2px 0px rgba(0,0,0,0.1);margin:0;padding:0;background:#fff;border:solid 1px #ccc;font-size:16px}form.custom .custom.dropdown ul li{color:#555;font-size:0.875em;cursor:default;padding-top:0.25em;padding-bottom:0.25em;padding-left:0.375em;padding-right:2.375em;min-height:1.5em;line-height:1.5em;margin:0;white-space:nowrap;list-style:none}form.custom .custom.dropdown ul li.selected{background:#eee;color:#000}form.custom .custom.dropdown ul li:hover{background-color:#e4e4e4;color:#000}form.custom .custom.dropdown ul li.selected:hover{background:#eee;cursor:default;color:#000}form.custom .custom.dropdown ul.show{display:block}form.custom .custom.disabled{background-color:#ddd}.button-group{list-style:none;margin:0;*zoom:1}.button-group:before,.button-group:after{content:" ";display:table}.button-group:after{clear:both}.button-group li{margin:0 0 0 -1px;float:left}.button-group li:first-child{margin-left:0}.button-group.radius li:first-child>a,.button-group.radius li:first-child>button{-webkit-border-radius:0;border-radius:0;-moz-border-radius-bottomleft:3px;-moz-border-radius-topleft:3px;-webkit-border-bottom-left-radius:3px;-webkit-border-top-left-radius:3px;border-bottom-left-radius:3px;border-top-left-radius:3px}.button-group.radius li:last-child>a,.button-group.radius li:last-child>button{-webkit-border-radius:0;border-radius:0;-moz-border-radius-topright:3px;-moz-border-radius-bottomright:3px;-webkit-border-top-right-radius:3px;-webkit-border-bottom-right-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px}.button-group.round li:first-child>a,.button-group.round li:first-child>button{-webkit-border-radius:0;border-radius:0;-moz-border-radius-bottomleft:1000px;-moz-border-radius-topleft:1000px;-webkit-border-bottom-left-radius:1000px;-webkit-border-top-left-radius:1000px;border-bottom-left-radius:1000px;border-top-left-radius:1000px}.button-group.round li:last-child>a,.button-group.round li:last-child>button{-webkit-border-radius:0;border-radius:0;-moz-border-radius-topright:1000px;-moz-border-radius-bottomright:1000px;-webkit-border-top-right-radius:1000px;-webkit-border-bottom-right-radius:1000px;border-top-right-radius:1000px;border-bottom-right-radius:1000px}.button-group.even-2 li{width:50%}.button-group.even-2 li .button{width:100%}.button-group.even-3 li{width:33.33333%}.button-group.even-3 li .button{width:100%}.button-group.even-4 li{width:25%}.button-group.even-4 li .button{width:100%}.button-group.even-5 li{width:20%}.button-group.even-5 li .button{width:100%}.button-group.even-6 li{width:16.66667%}.button-group.even-6 li .button{width:100%}.button-group.even-7 li{width:14.28571%}.button-group.even-7 li .button{width:100%}.button-group.even-8 li{width:12.5%}.button-group.even-8 li .button{width:100%}.button-bar{*zoom:1}.button-bar:before,.button-bar:after{content:" ";display:table}.button-bar:after{clear:both}.button-bar .button-group{float:left;margin-right:0.625em}.button-bar .button-group div{overflow:hidden}.dropdown.button{position:relative;padding-right:3.1875em}.dropdown.button:before{position:absolute;content:"";width:0;height:0;display:block;border-style:solid;border-color:#fff transparent transparent transparent;top:50%}.dropdown.button:before{border-width:0.5625em;right:1.5em;margin-top:-0.25em}.dropdown.button:before{border-color:#fff transparent transparent transparent}.dropdown.button.tiny{padding-right:2.1875em}.dropdown.button.tiny:before{border-width:0.4375em;right:0.875em;margin-top:-0.15625em}.dropdown.button.tiny:before{border-color:#fff transparent transparent transparent}.dropdown.button.small{padding-right:2.8125em}.dropdown.button.small:before{border-width:0.5625em;right:1.125em;margin-top:-0.21875em}.dropdown.button.small:before{border-color:#fff transparent transparent transparent}.dropdown.button.large{padding-right:4em}.dropdown.button.large:before{border-width:0.625em;right:1.75em;margin-top:-0.3125em}.dropdown.button.large:before{border-color:#fff transparent transparent transparent}.dropdown.button.secondary:before{border-color:#333 transparent transparent transparent}.split.button{position:relative;padding-right:4.8em}.split.button span{display:block;height:100%;position:absolute;right:0;top:0;border-left:solid 1px}.split.button span:before{position:absolute;content:"";width:0;height:0;display:block;border-style:solid;left:50%}.split.button span:active{background-color:rgba(0,0,0,0.1)}.split.button span{border-left-color:#1e728c}.split.button span{width:3em}.split.button span:before{border-width:0.5625em;top:1.125em;margin-left:-0.5625em}.split.button span:before{border-color:#fff transparent transparent transparent}.split.button.secondary span{border-left-color:#c3c3c3}.split.button.secondary span:before{border-color:#fff transparent transparent transparent}.split.button.alert span{border-left-color:#7f0a0c}.split.button.success span{border-left-color:#396516}.split.button.tiny{padding-right:3.9375em}.split.button.tiny span{width:2.84375em}.split.button.tiny span:before{border-width:0.4375em;top:0.875em;margin-left:-0.3125em}.split.button.small{padding-right:3.9375em}.split.button.small span{width:2.8125em}.split.button.small span:before{border-width:0.5625em;top:0.84375em;margin-left:-0.5625em}.split.button.large{padding-right:6em}.split.button.large span{width:3.75em}.split.button.large span:before{border-width:0.625em;top:1.3125em;margin-left:-0.5625em}.split.button.secondary span:before{border-color:#333 transparent transparent transparent}.split.button.radius span{-webkit-border-radius:0;border-radius:0;-moz-border-radius-topright:3px;-moz-border-radius-bottomright:3px;-webkit-border-top-right-radius:3px;-webkit-border-bottom-right-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px}.split.button.round span{-webkit-border-radius:0;border-radius:0;-moz-border-radius-topright:1000px;-moz-border-radius-bottomright:1000px;-webkit-border-top-right-radius:1000px;-webkit-border-bottom-right-radius:1000px;border-top-right-radius:1000px;border-bottom-right-radius:1000px}.flex-video{position:relative;padding-top:1.5625em;padding-bottom:67.5%;height:0;margin-bottom:1em;overflow:hidden}.flex-video.widescreen{padding-bottom:57.25%}.flex-video.vimeo{padding-top:0}.flex-video iframe,.flex-video object,.flex-video embed,.flex-video video{position:absolute;top:0;left:0;width:100%;height:100%}.section-container{width:100%;display:block;margin-bottom:1.25em;border:1px solid #ccc;border-top:none}.section-container section,.section-container .section{border-top:1px solid #ccc;position:relative}.section-container section .title,.section-container .section .title{top:0;cursor:pointer;width:100%;margin:0;background-color:#efefef}.section-container section .title a,.section-container .section .title a{padding:0.9375em;display:inline-block;color:#333;font-size:0.875em;white-space:nowrap;width:100%}.section-container section .title:hover,.section-container .section .title:hover{background-color:#e2e2e2}.section-container section .content,.section-container .section .content{display:none;padding:0.9375em;background-color:#fff}.section-container section .content>*:last-child,.section-container .section .content>*:last-child{margin-bottom:0}.section-container section .content>*:first-child,.section-container .section .content>*:first-child{padding-top:0}.section-container section .content>*:last-child,.section-container .section .content>*:last-child{padding-bottom:0}.section-container section.active .content,.section-container .section.active .content{display:block}.section-container section.active .title,.section-container .section.active .title{background:#d5d5d5}@media only screen and (min-width: 48em){.section-container.accordion .section{padding-top:0 !important}.section-container.vertical-nav{border:1px solid #ccc;border-top:none}.section-container.vertical-nav section,.section-container.vertical-nav .section{padding-top:0 !important}.section-container.vertical-nav section .title a,.section-container.vertical-nav .section .title a{display:block;width:100%}.section-container.vertical-nav section .content,.section-container.vertical-nav .section .content{display:none}.section-container.vertical-nav section.active .content,.section-container.vertical-nav .section.active .content{display:block;position:absolute;left:100%;top:-1px;z-index:999;min-width:12.5em;border:1px solid #ccc}.section-container.horizontal-nav{position:relative;background:#efefef;border:1px solid #ccc}.section-container.horizontal-nav section,.section-container.horizontal-nav .section{padding-top:0;border:0;position:static}.section-container.horizontal-nav section .title,.section-container.horizontal-nav .section .title{width:auto;border:1px solid #ccc;border-left:0;top:-1px;position:absolute;z-index:1}.section-container.horizontal-nav section .title a,.section-container.horizontal-nav .section .title a{width:100%}.section-container.horizontal-nav section .content,.section-container.horizontal-nav .section .content{display:none}.section-container.horizontal-nav section.active .content,.section-container.horizontal-nav .section.active .content{display:block;position:absolute;z-index:999;left:0;top:-2px;min-width:12.5em;border:1px solid #ccc}.section-container.tabs{border:0;position:relative}.section-container.tabs section,.section-container.tabs .section{padding-top:0;border:0;position:static}.section-container.tabs section .title,.section-container.tabs .section .title{width:auto;border:1px solid #ccc;border-right:0;border-bottom:0;position:absolute;z-index:1}.section-container.tabs section .title a,.section-container.tabs .section .title a{width:100%}.section-container.tabs section:last-child .title,.section-container.tabs .section:last-child .title{border-right:1px solid #ccc}.section-container.tabs section .content,.section-container.tabs .section .content{border:1px solid #ccc;position:absolute;z-index:10;top:-1px}.section-container.tabs section.active .title,.section-container.tabs .section.active .title{background-color:#fff;z-index:11;border-bottom:0}.section-container.tabs section.active .content,.section-container.tabs .section.active .content{position:relative}}.contain-to-grid{width:100%;background:#111}.fixed{width:100%;left:0;position:fixed;top:0;z-index:99}.top-bar{overflow:hidden;height:45px;line-height:45px;position:relative;background:#111}.top-bar ul{margin-bottom:0;list-style:none}.top-bar .row{max-width:none}.top-bar form,.top-bar input{margin-bottom:0}.top-bar input{height:2.45em}.top-bar .button{padding-top:.5em;padding-bottom:.5em;margin-bottom:0}.top-bar .title-area{position:relative}.top-bar .name{height:45px;margin:0;font-size:16px}.top-bar .name h1{line-height:45px;font-size:1.0625em;margin:0}.top-bar .name h1 a{font-weight:bold;color:#fff;width:50%;display:block;padding:0 15px}.top-bar .toggle-topbar{position:absolute;right:0;top:0}.top-bar .toggle-topbar a{color:#fff;text-transform:uppercase;font-size:0.8125em;font-weight:bold;position:relative;display:block;padding:0 15px;height:45px;line-height:45px}.top-bar .toggle-topbar.menu-icon{right:15px;top:50%;margin-top:-16px;padding-left:40px}.top-bar .toggle-topbar.menu-icon a{text-indent:-48px;width:34px;height:34px;line-height:33px;padding:0;color:#fff}.top-bar .toggle-topbar.menu-icon a span{position:absolute;right:0;display:block;width:16px;height:0;-webkit-box-shadow:0 10px 0 1px #fff,0 16px 0 1px #fff,0 22px 0 1px #fff;box-shadow:0 10px 0 1px #fff,0 16px 0 1px #fff,0 22px 0 1px #fff}.top-bar.expanded{height:auto;background:transparent}.top-bar.expanded .title-area{background:#111}.top-bar.expanded .toggle-topbar a{color:#888}.top-bar.expanded .toggle-topbar a span{-webkit-box-shadow:0 10px 0 1px #888,0 16px 0 1px #888,0 22px 0 1px #888;box-shadow:0 10px 0 1px #888,0 16px 0 1px #888,0 22px 0 1px #888}.top-bar-section{left:0;position:relative;width:auto;-webkit-transition:left 300ms ease-out;-moz-transition:left 300ms ease-out;transition:left 300ms ease-out}.top-bar-section ul{width:100%;height:auto;display:block;background:#333;font-size:16px;margin:0}.top-bar-section .divider{border-bottom:solid 1px #4d4d4d;border-top:solid 1px #1a1a1a;clear:both;height:1px;width:100%}.top-bar-section ul li>a{display:block;width:100%;color:#fff;padding:12px 0 12px 0;padding-left:15px;font-size:0.8125em;font-weight:bold;background:#333}.top-bar-section ul li>a:hover{background:#2b2b2b}.top-bar-section ul li>a.button{background:#2ba6cb;font-size:0.8125em}.top-bar-section ul li>a.button:hover{background:#2284a1}.top-bar-section ul li>a.button.secondary{background:#e9e9e9}.top-bar-section ul li>a.button.secondary:hover{background:#d0d0d0}.top-bar-section ul li>a.button.success{background:#5da423}.top-bar-section ul li>a.button.success:hover{background:#457a1a}.top-bar-section ul li>a.button.alert{background:#c60f13}.top-bar-section ul li>a.button.alert:hover{background:#970b0e}.top-bar-section ul li.active a{background:#2b2b2b}.top-bar-section .has-form{padding:15px}.top-bar-section .has-dropdown{position:relative}.top-bar-section .has-dropdown>a:after{content:"";display:block;width:0;height:0;border:solid 5px;border-color:transparent transparent transparent rgba(255,255,255,0.5);margin-right:15px;margin-top:-4.5px;position:absolute;top:50%;right:0}.top-bar-section .has-dropdown.moved{position:static}.top-bar-section .has-dropdown.moved>.dropdown{visibility:visible}.top-bar-section .dropdown{position:absolute;left:100%;top:0;visibility:hidden;z-index:99}.top-bar-section .dropdown li{width:100%}.top-bar-section .dropdown li a{font-weight:normal;padding:8px 15px}.top-bar-section .dropdown li.title h5{margin-bottom:0}.top-bar-section .dropdown li.title h5 a{color:#fff;line-height:22.5px;display:block}.top-bar-section .dropdown label{padding:8px 15px 2px;margin-bottom:0;text-transform:uppercase;color:#555;font-weight:bold;font-size:0.625em}.top-bar-js-breakpoint{width:58.75em !important;visibility:hidden}.js-generated{display:block}@media only screen and (min-width: 58.75em){.top-bar{background:#111;*zoom:1;overflow:visible}.top-bar:before,.top-bar:after{content:" ";display:table}.top-bar:after{clear:both}.top-bar .toggle-topbar{display:none}.top-bar .title-area{float:left}.top-bar .name h1 a{width:auto}.top-bar input,.top-bar .button{line-height:2em;font-size:0.875em;height:2em;padding:0 10px;position:relative;top:8px}.top-bar.expanded{background:#111}.contain-to-grid .top-bar{max-width:62.5em;margin:0 auto}.top-bar-section{-webkit-transition:none 0 0;-moz-transition:none 0 0;transition:none 0 0;left:0 !important}.top-bar-section ul{width:auto;height:auto !important;display:inline}.top-bar-section ul li{float:left}.top-bar-section ul li .js-generated{display:none}.top-bar-section li a:not(.button){padding:0 15px;line-height:45px;background:#111}.top-bar-section li a:not(.button):hover{background:#000}.top-bar-section .has-dropdown>a{padding-right:35px !important}.top-bar-section .has-dropdown>a:after{content:"";display:block;width:0;height:0;border:solid 5px;border-color:rgba(255,255,255,0.5) transparent transparent transparent;margin-top:-2.5px}.top-bar-section .has-dropdown.moved{position:relative}.top-bar-section .has-dropdown.moved>.dropdown{visibility:hidden}.top-bar-section .has-dropdown:hover>.dropdown,.top-bar-section .has-dropdown:active>.dropdown{visibility:visible}.top-bar-section .has-dropdown .dropdown li.has-dropdown>a:after{border:none;content:"\00bb";margin-top:-7px;right:5px}.top-bar-section .dropdown{left:0;top:auto;background:transparent}.top-bar-section .dropdown li a{line-height:1;white-space:nowrap;padding:7px 15px;background:#1e1e1e}.top-bar-section .dropdown li label{white-space:nowrap;background:#1e1e1e}.top-bar-section .dropdown li .dropdown{left:100%;top:0}.top-bar-section>ul>.divider{border-bottom:none;border-top:none;border-right:solid 1px #2b2b2b;border-left:solid 1px #000;clear:none;height:45px;width:0px}.top-bar-section .has-form{background:#111;padding:0 15px;height:45px}.top-bar-section ul.right li .dropdown{left:auto;right:0}.top-bar-section ul.right li .dropdown li .dropdown{right:100%}}.orbit-container{overflow:hidden;width:100%;position:relative;background:#f5f5f5}.orbit-container .orbit-slides-container{list-style:none;margin:0;padding:0;position:relative}.orbit-container .orbit-slides-container img{display:block}.orbit-container .orbit-slides-container>*{position:relative;float:left;height:100%}.orbit-container .orbit-slides-container>* .orbit-caption{position:absolute;bottom:0;background-color:#000;background-color:rgba(0,0,0,0.6);color:#fff;width:100%;padding:10px 14px;font-size:0.875em}.orbit-container .orbit-slides-container>* .orbit-caption *{color:#fff}.orbit-container .orbit-slide-number{position:absolute;top:10px;left:10px;font-size:12px}.orbit-container .orbit-slide-number span{font-weight:700}.orbit-container .orbit-timer{position:absolute;top:10px;right:10px;height:6px;width:100px}.orbit-container .orbit-timer .orbit-progress{height:100%;background-color:#000;background-color:rgba(0,0,0,0.6);display:block;width:0%}.orbit-container .orbit-timer>span{display:none;position:absolute;top:10px;right:0px;width:11px;height:14px;border:solid 4px #000;border-top:none;border-bottom:none}.orbit-container .orbit-timer.paused>span{right:-6px;top:9px;width:11px;height:14px;border:solid 8px;border-color:transparent transparent transparent #000}.orbit-container:hover .orbit-timer>span{display:block}.orbit-container .orbit-prev,.orbit-container .orbit-next{position:absolute;top:50%;margin-top:-25px;background-color:#000;background-color:rgba(0,0,0,0.6);width:50px;height:60px;line-height:50px;color:white;text-indent:-9999px !important}.orbit-container .orbit-prev>span,.orbit-container .orbit-next>span{position:absolute;top:50%;margin-top:-16px;display:block;width:0;height:0;border:solid 16px}.orbit-container .orbit-prev{left:0}.orbit-container .orbit-prev>span{border-color:transparent #fff transparent transparent}.orbit-container .orbit-prev:hover>span{border-color:transparent #ccc transparent transparent}.orbit-container .orbit-next{right:0}.orbit-container .orbit-next>span{border-color:transparent transparent transparent #fff;left:50%;margin-left:-8px}.orbit-container .orbit-next:hover>span{border-color:transparent transparent transparent #ccc}.orbit-bullets{margin:0 auto 30px auto;overflow:hidden;position:relative;top:10px}.orbit-bullets li{display:block;width:18px;height:18px;background:#fff;float:left;margin-right:6px;border:solid 2px #000;-webkit-border-radius:1000px;border-radius:1000px}.orbit-bullets li.active{background:#000}.orbit-bullets li:last-child{margin-right:0}.touch .orbit-container .orbit-prev,.touch .orbit-container .orbit-next{display:none}.touch .orbit-bullets{display:none}@media only screen and (min-width: 48em){.touch .orbit-container .orbit-prev,.touch .orbit-container .orbit-next{display:inherit}.touch .orbit-bullets{display:block}}.reveal-modal-bg{position:fixed;height:100%;width:100%;background:#000;background:rgba(0,0,0,0.45);z-index:98;display:none;top:0;left:0}.reveal-modal{visibility:hidden;display:none;position:absolute;left:50%;z-index:99;height:auto;background-color:#fff;margin-left:-40%;width:80%;background-color:#fff;padding:1.25em;border:solid 1px #666;-webkit-box-shadow:0 0 10px rgba(0,0,0,0.4);box-shadow:0 0 10px rgba(0,0,0,0.4);top:50px}.reveal-modal .column,.reveal-modal .columns{min-width:0}.reveal-modal>:first-child{margin-top:0}.reveal-modal>:last-child{margin-bottom:0}.reveal-modal .close-reveal-modal{font-size:1.375em;line-height:1;position:absolute;top:0.5em;right:0.6875em;color:#aaa;font-weight:bold;cursor:pointer}@media only screen and (min-width: 48em){.reveal-modal{padding:1.875em;top:6.25em}.reveal-modal.small{margin-left:-15%;width:30%}.reveal-modal.medium{margin-left:-20%;width:40%}.reveal-modal.large{margin-left:-30%;width:60%}.reveal-modal.xlarge{margin-left:-35%;width:70%}.reveal-modal.expand{margin-left:-47.5%;width:95%}}@media print{div:not(.reveal-modal){display:none}}.joyride-list{display:none}.joyride-tip-guide{display:none;position:absolute;background:#000;color:#fff;z-index:101;top:0;left:2.5%;font-family:inherit;font-weight:normal;width:95%}.lt-ie9 .joyride-tip-guide{max-width:800px;left:50%;margin-left:-400px}.joyride-content-wrapper{width:100%;padding:1.125em 1.25em 1.5em}.joyride-content-wrapper .button{margin-bottom:0 !important}.joyride-tip-guide .joyride-nub{display:block;position:absolute;left:22px;width:0;height:0;border:solid 14px}.joyride-tip-guide .joyride-nub.top{border-color:#000;border-top-color:transparent !important;border-left-color:transparent !important;border-right-color:transparent !important;top:-28px;bottom:none}.joyride-tip-guide .joyride-nub.bottom{border-color:#000 !important;border-bottom-color:transparent !important;border-left-color:transparent !important;border-right-color:transparent !important;bottom:-28px;bottom:none}.joyride-tip-guide .joyride-nub.right{right:-28px}.joyride-tip-guide .joyride-nub.left{left:-28px}.joyride-tip-guide h1,.joyride-tip-guide h2,.joyride-tip-guide h3,.joyride-tip-guide h4,.joyride-tip-guide h5,.joyride-tip-guide h6{line-height:1.25;margin:0;font-weight:bold;color:#fff}.joyride-tip-guide p{margin:0 0 1.125em 0;font-size:0.875em;line-height:1.3}.joyride-timer-indicator-wrap{width:50px;height:3px;border:solid 1px #555;position:absolute;right:1.0625em;bottom:1em}.joyride-timer-indicator{display:block;width:0;height:inherit;background:#666}.joyride-close-tip{position:absolute;right:12px;top:10px;color:#777 !important;text-decoration:none;font-size:30px;font-weight:normal;line-height:0.5 !important}.joyride-close-tip:hover,.joyride-close-tip:focus{color:#eee !important}.joyride-modal-bg{position:fixed;height:100%;width:100%;background:transparent;background:rgba(0,0,0,0.5);z-index:100;display:none;top:0;left:0;cursor:pointer}@media only screen and (min-width: 48em){.joyride-tip-guide{width:300px;left:0}.joyride-tip-guide .joyride-nub.bottom{border-color:#000 !important;border-bottom-color:transparent !important;border-left-color:transparent !important;border-right-color:transparent !important;bottom:-28px;bottom:none}.joyride-tip-guide .joyride-nub.right{border-color:#000 !important;border-top-color:transparent !important;border-right-color:transparent !important;border-bottom-color:transparent !important;top:22px;bottom:none;left:auto;right:-28px}.joyride-tip-guide .joyride-nub.left{border-color:#000 !important;border-top-color:transparent !important;border-left-color:transparent !important;border-bottom-color:transparent !important;top:22px;left:-28px;right:auto;bottom:none}}[data-clearing]{*zoom:1;margin-bottom:0}[data-clearing]:before,[data-clearing]:after{content:" ";display:table}[data-clearing]:after{clear:both}.clearing-blackout{background:#111;position:fixed;width:100%;height:100%;top:0;left:0;z-index:998}.clearing-blackout .clearing-close{display:block}.clearing-container{position:relative;z-index:998;height:100%;overflow:hidden;margin:0}.visible-img{height:95%;position:relative}.visible-img img{position:absolute;left:50%;top:50%;margin-left:-50%;max-height:100%;max-width:100%}.clearing-caption{color:#fff;line-height:1.3;margin-bottom:0;text-align:center;bottom:0;background:#111;width:100%;padding:10px 30px;position:absolute;left:0}.clearing-close{z-index:999;padding-left:20px;padding-top:10px;font-size:40px;line-height:1;color:#fff;display:none}.clearing-close:hover,.clearing-close:focus{color:#ccc}.clearing-assembled .clearing-container{height:100%}.clearing-assembled .clearing-container .carousel>ul{display:none}@media only screen and (min-width: 48em){.clearing-main-left,.clearing-main-right{position:absolute;height:100%;width:40px;top:0}.clearing-main-left>span,.clearing-main-right>span{position:absolute;top:50%;display:block;width:0;height:0;border:solid 16px}.clearing-main-left{left:0}.clearing-main-left>span{left:5px;border-color:transparent #fff transparent transparent}.clearing-main-right{right:0}.clearing-main-right>span{border-color:transparent transparent transparent #fff}.clearing-main-left.disabled,.clearing-main-right.disabled{opacity:0.5}.clearing-feature ~ li{display:none}.clearing-assembled .clearing-container .carousel{background:#111;height:150px;margin-top:5px}.clearing-assembled .clearing-container .carousel>ul{display:block;z-index:999;width:200%;height:100%;margin-left:0;position:relative;left:0}.clearing-assembled .clearing-container .carousel>ul li{display:block;width:175px;height:inherit;padding:0;float:left;overflow:hidden;margin-right:1px;position:relative;cursor:pointer;opacity:0.4}.clearing-assembled .clearing-container .carousel>ul li.fix-height img{min-height:100%;height:100%;max-width:none}.clearing-assembled .clearing-container .carousel>ul li a.th{border:none;-webkit-box-shadow:none;box-shadow:none;display:block}.clearing-assembled .clearing-container .carousel>ul li img{cursor:pointer !important;min-width:100% !important}.clearing-assembled .clearing-container .carousel>ul li.visible{opacity:1}.clearing-assembled .clearing-container .visible-img{background:#111;overflow:hidden;height:75%}.clearing-close{position:absolute;top:10px;right:20px;padding-left:0;padding-top:0}}.alert-box{border-style:solid;border-width:1px;display:block;font-weight:bold;margin-bottom:1.25em;position:relative;padding:0.6875em 1.3125em 0.75em 0.6875em;font-size:0.875em;background-color:#2ba6cb;border-color:#2284a1;color:#fff}.alert-box .close{font-size:1.375em;padding:5px 4px 4px;line-height:0;position:absolute;top:0.4375em;right:0.3125em;color:#333;opacity:0.3}.alert-box .close:hover,.alert-box .close:focus{opacity:0.5}.alert-box.radius{-webkit-border-radius:3px;border-radius:3px}.alert-box.round{-webkit-border-radius:1000px;border-radius:1000px}.alert-box.success{background-color:#5da423;border-color:#457a1a;color:#fff}.alert-box.alert{background-color:#c60f13;border-color:#970b0e;color:#fff}.alert-box.secondary{background-color:#e9e9e9;border-color:#d0d0d0;color:#505050}.breadcrumbs{display:block;padding:0.375em 0.875em 0.5625em;overflow:hidden;margin-left:0;list-style:none;border-style:solid;border-width:1px;background-color:#f6f6f6;border-color:#dcdcdc;-webkit-border-radius:3px;border-radius:3px}.breadcrumbs li{margin:0;padding:0 0.75em 0 0;float:left}.breadcrumbs li:hover a,.breadcrumbs li:focus a{text-decoration:underline}.breadcrumbs li a,.breadcrumbs li span{font-size:0.6875em;padding-left:0.75em;text-transform:uppercase;color:#2ba6cb}.breadcrumbs li.current a{cursor:default;color:#333}.breadcrumbs li.current:hover a,.breadcrumbs li.current:focus a{text-decoration:none}.breadcrumbs li.unavailable a{color:#999}.breadcrumbs li.unavailable:hover a,.breadcrumbs li.unavailable a:focus{text-decoration:none;color:#999;cursor:default}.breadcrumbs li:before{content:"/";color:#aaa;position:relative;top:1px}.breadcrumbs li:first-child a,.breadcrumbs li:first-child span{padding-left:0}.breadcrumbs li:first-child:before{content:""}.keystroke,kbd{background-color:#ededed;border-color:#dbdbdb;color:#222;border-style:solid;border-width:1px;margin:0;font-family:"Consolas","Menlo","Courier",monospace;font-size:0.9375em;padding:0.125em 0.25em 0em;-webkit-border-radius:3px;border-radius:3px}.label{font-weight:500;text-align:center;text-decoration:none;line-height:1;white-space:nowrap;display:inline;position:relative;padding:0.1875em 0.625em 0.25em;font-size:0.875em;background-color:#2ba6cb;color:#fff}.label.radius{-webkit-border-radius:3px;border-radius:3px}.label.round{-webkit-border-radius:1000px;border-radius:1000px}.label.alert{background-color:#c60f13;color:#fff}.label.success{background-color:#5da423;color:#fff}.label.secondary{background-color:#e9e9e9;color:#333}.inline-list{margin:0 0 1.0625em -1.375em;padding:0;list-style:none;overflow:hidden}.inline-list>li{list-style:none;float:left;margin-left:1.375em;display:block}.inline-list>li>*{display:block}.pagination{display:block;height:1.5em;margin-left:-0.3125em}.pagination li{display:block;float:left;height:1.5em;color:#222;font-size:0.875em;margin-left:0.3125em}.pagination li a{display:block;padding:0.0625em 0.4375em 0.0625em;color:#999}.pagination li:hover a,.pagination li a:focus{background:#e6e6e6}.pagination li.unavailable a{cursor:default;color:#999}.pagination li.unavailable:hover a,.pagination li.unavailable a:focus{background:transparent}.pagination li.current a{background:#2ba6cb;color:#fff;font-weight:bold;cursor:default}.pagination li.current a:hover,.pagination li.current a:focus{background:#2ba6cb}.pagination-centered{text-align:center}.pagination-centered ul>li{float:none;display:inline-block}.panel{border-style:solid;border-width:1px;border-color:#d9d9d9;margin-bottom:1.25em;padding:1.25em;background:#f2f2f2}.panel h1,.panel h2,.panel h3,.panel h4,.panel h5,.panel h6,.panel p{color:#333}.panel>:first-child{margin-top:0}.panel>:last-child{margin-bottom:0}.panel h1,.panel h2,.panel h3,.panel h4,.panel h5,.panel h6{line-height:1;margin-bottom:0.625em}.panel h1.subheader,.panel h2.subheader,.panel h3.subheader,.panel h4.subheader,.panel h5.subheader,.panel h6.subheader{line-height:1.4}.panel.callout{border-style:solid;border-width:1px;border-color:#2284a1;margin-bottom:1.25em;padding:1.25em;background:#2ba6cb;-webkit-box-shadow:0 1px 0 rgba(255,255,255,0.5) inset;box-shadow:0 1px 0 rgba(255,255,255,0.5) inset}.panel.callout h1,.panel.callout h2,.panel.callout h3,.panel.callout h4,.panel.callout h5,.panel.callout h6,.panel.callout p{color:#fff}.panel.callout>:first-child{margin-top:0}.panel.callout>:last-child{margin-bottom:0}.panel.callout h1,.panel.callout h2,.panel.callout h3,.panel.callout h4,.panel.callout h5,.panel.callout h6{line-height:1;margin-bottom:0.625em}.panel.callout h1.subheader,.panel.callout h2.subheader,.panel.callout h3.subheader,.panel.callout h4.subheader,.panel.callout h5.subheader,.panel.callout h6.subheader{line-height:1.4}.panel.radius{-webkit-border-radius:3px;border-radius:3px}.pricing-table{border:solid 1px #ddd;margin-left:0;margin-bottom:1.25em}.pricing-table *{list-style:none;line-height:1}.pricing-table .title{background-color:#ddd;padding:0.9375em 1.25em;text-align:center;color:#333;font-weight:bold;font-size:1em}.pricing-table .price{background-color:#eee;padding:0.9375em 1.25em;text-align:center;color:#333;font-weight:normal;font-size:1.25em}.pricing-table .description{background-color:#fff;padding:0.9375em;text-align:center;color:#777;font-size:0.75em;font-weight:normal;line-height:1.4;border-bottom:dotted 1px #ddd}.pricing-table .bullet-item{background-color:#fff;padding:0.9375em;text-align:center;color:#333;font-size:0.875em;font-weight:normal;border-bottom:dotted 1px #ddd}.pricing-table .cta-button{background-color:#f5f5f5;text-align:center;padding:1.25em 1.25em 0}.progress{background-color:transparent;height:1.5625em;border:1px solid #ccc;padding:0.125em;margin-bottom:0.625em}.progress .meter{background:#2ba6cb;height:100%;display:block}.progress.secondary .meter{background:#e9e9e9;height:100%;display:block}.progress.success .meter{background:#5da423;height:100%;display:block}.progress.alert .meter{background:#c60f13;height:100%;display:block}.progress.radius{-webkit-border-radius:3px;border-radius:3px}.progress.radius .meter{-webkit-border-radius:2px;border-radius:2px}.progress.round{-webkit-border-radius:1000px;border-radius:1000px}.progress.round .meter{-webkit-border-radius:999px;border-radius:999px}.side-nav{display:block;margin:0;padding:0.875em 0;list-style-type:none;list-style-position:inside}.side-nav li{margin:0 0 0.4375em 0;font-size:0.875em}.side-nav li a{display:block;color:#2ba6cb}.side-nav li.active a{color:#4d4d4d;font-weight:bold}.side-nav li.divider{border-top:1px solid;height:0;padding:0;list-style:none;border-top-color:#e6e6e6}.sub-nav{display:block;width:auto;overflow:hidden;margin:-0.25em 0 1.125em;padding-top:0.25em;margin-right:0;margin-left:-0.5625em}.sub-nav dt,.sub-nav dd{float:left;display:inline;margin-left:0.5625em;margin-bottom:0.625em;font-weight:normal;font-size:0.875em}.sub-nav dt a,.sub-nav dd a{color:#999;text-decoration:none}.sub-nav dt.active a,.sub-nav dd.active a{-webkit-border-radius:1000px;border-radius:1000px;font-weight:bold;background:#2ba6cb;padding:0.1875em 0.5625em;cursor:default;color:#fff}@media only screen{.switch{position:relative;width:100%;padding:0;display:block;overflow:hidden;border-style:solid;border-width:1px;margin-bottom:1.25em;-webkit-animation:webkitSiblingBugfix infinite 1s;height:36px;background:#fff;border-color:#ccc}.switch label{position:relative;left:0;z-index:2;float:left;width:50%;height:100%;margin:0;text-align:right;font-weight:bold;text-align:left;-webkit-transition:all 0.1s ease-out;-moz-transition:all 0.1s ease-out;transition:all 0.1s ease-out}.switch input{position:absolute;z-index:3;opacity:0;width:100%;height:100%}.switch input:hover,.switch input:focus{cursor:pointer}.switch>span{position:absolute;top:-1px;left:-1px;z-index:1;display:block;padding:0;border-width:1px;border-style:solid;-webkit-transition:all 0.1s ease-out;-moz-transition:all 0.1s ease-out;transition:all 0.1s ease-out}.switch input:not(:checked)+label{opacity:0}.switch input:checked{display:none !important}.switch input{left:0;display:block !important}.switch input:first-of-type+label,.switch input:first-of-type+span+label{left:-50%}.switch input:first-of-type:checked+label,.switch input:first-of-type:checked+span+label{left:0%}.switch input:last-of-type+label,.switch input:last-of-type+span+label{right:-50%;left:auto;text-align:right}.switch input:last-of-type:checked+label,.switch input:last-of-type:checked+span+label{right:0%;left:auto}.switch span.custom{display:none !important}.switch label{padding:0 0.375em;line-height:2.3em;font-size:0.875em}.switch input:first-of-type:checked ~ span{left:100%;margin-left:-2.1875em}.switch>span{width:2.25em;height:2.25em}.switch>span{border-color:#b3b3b3;background:#fff;background:-moz-linear-gradient(top, #fff 0%, #f2f2f2 100%);background:-webkit-linear-gradient(top, #fff 0%, #f2f2f2 100%);background:linear-gradient(to bottom, #fff 0%, #f2f2f2 100%);-webkit-box-shadow:2px 0 10px 0 rgba(0,0,0,0.07),1000px 0 0 1000px #e1f5d1,-2px 0 10px 0 rgba(0,0,0,0.07),-1000px 0 0 1000px #f5f5f5;box-shadow:2px 0 10px 0 rgba(0,0,0,0.07),1000px 0 0 980px #e1f5d1,-2px 0 10px 0 rgba(0,0,0,0.07),-1000px 0 0 1000px #f5f5f5}.switch:hover>span,.switch:focus>span{background:#fff;background:-moz-linear-gradient(top, #fff 0%, #e6e6e6 100%);background:-webkit-linear-gradient(top, #fff 0%, #e6e6e6 100%);background:linear-gradient(to bottom, #fff 0%, #e6e6e6 100%)}.switch:active{background:transparent}.switch.large{height:44px}.switch.large label{padding:0 0.375em;line-height:2.3em;font-size:1.0625em}.switch.large input:first-of-type:checked ~ span{left:100%;margin-left:-2.6875em}.switch.large>span{width:2.75em;height:2.75em}.switch.small{height:28px}.switch.small label{padding:0 0.375em;line-height:2.1em;font-size:0.75em}.switch.small input:first-of-type:checked ~ span{left:100%;margin-left:-1.6875em}.switch.small>span{width:1.75em;height:1.75em}.switch.tiny{height:22px}.switch.tiny label{padding:0 0.375em;line-height:1.9em;font-size:0.6875em}.switch.tiny input:first-of-type:checked ~ span{left:100%;margin-left:-1.3125em}.switch.tiny>span{width:1.375em;height:1.375em}.switch.radius{-webkit-border-radius:4px;border-radius:4px}.switch.radius>span{-webkit-border-radius:3px;border-radius:3px}.switch.round{-webkit-border-radius:1000px;border-radius:1000px}.switch.round>span{-webkit-border-radius:999px;border-radius:999px}.switch.round label{padding:0 0.5625em}@-webkit-keyframes webkitSiblingBugfix{from{position:relative}to{position:relative}}}[data-magellan-expedition]{background:#fff;z-index:997;min-width:100%;padding:10px}[data-magellan-expedition] .sub-nav{margin-bottom:0}[data-magellan-expedition] .sub-nav dd{margin-bottom:0}table{background:#fff;margin-bottom:1.25em;border:solid 1px #ddd}table thead,table tfoot{background:#f5f5f5;font-weight:bold}table thead tr th,table thead tr td,table tfoot tr th,table tfoot tr td{padding:0.5em 0.625em 0.625em;font-size:0.875em;color:#222;text-align:left}table tr th,table tr td{padding:0.5625em 0.625em;font-size:0.875em;color:#222}table tr.even,table tr.alt,table tr:nth-of-type(even){background:#f9f9f9}table thead tr th,table tfoot tr th,table tbody tr td,table tr td,table tfoot tr td{display:table-cell;line-height:1.125em}.th{display:inline-block;border:solid 4px #fff;-webkit-box-shadow:0 0 0 1px rgba(0,0,0,0.2);box-shadow:0 0 0 1px rgba(0,0,0,0.2);-webkit-transition:all 200ms ease-out;-moz-transition:all 200ms ease-out;transition:all 200ms ease-out}.th:hover,.th:focus{-webkit-box-shadow:0 0 6px 1px rgba(43,166,203,0.5);box-shadow:0 0 6px 1px rgba(43,166,203,0.5)}.th.radius{-webkit-border-radius:3px;border-radius:3px}.has-tip{border-bottom:dotted 1px #ccc;cursor:help;font-weight:bold;color:#333}.has-tip:hover,.has-tip:focus{border-bottom:dotted 1px #196177;color:#2ba6cb}.has-tip.tip-left,.has-tip.tip-right{float:none !important}.tooltip{display:none;position:absolute;z-index:999;font-weight:bold;font-size:0.9375em;line-height:1.3;padding:0.5em;max-width:85%;left:50%;width:100%;color:#fff;background:#000;-webkit-border-radius:3px;border-radius:3px}.tooltip>.nub{display:block;position:absolute;width:0;height:0;border:solid 5px;border-color:transparent transparent #000 transparent;top:-10px}.tooltip.opened{color:#2ba6cb !important;border-bottom:dotted 1px #196177 !important}.tap-to-close{display:block;font-size:0.625em;color:#888;font-weight:normal}@media only screen and (min-width: 48em){.tooltip>.nub{border-color:transparent transparent #000 transparent;top:-10px}.tooltip.tip-top>.nub{border-color:#000 transparent transparent transparent;top:auto;bottom:-10px}.tooltip.tip-left,.tooltip.tip-right{float:none !important}.tooltip.tip-left>.nub{border-color:transparent transparent transparent #000;right:-10px;left:auto;top:50%;margin-top:-5px}.tooltip.tip-right>.nub{border-color:transparent #000 transparent transparent;right:auto;left:-10px;top:50%;margin-top:-5px}}@media only screen and (max-width: 767px){.f-dropdown{max-width:100%;left:0}}.f-dropdown{position:absolute;left:-9999px;top:-9999px;list-style:none;width:100%;max-height:none;height:auto;background:#fff;border:solid 1px #ccc;font-size:16px;z-index:99;margin-top:2px;max-width:200px}.f-dropdown *:first-child{margin-top:0}.f-dropdown *:last-child{margin-bottom:0}.f-dropdown:before{content:"";display:block;width:0;height:0;border:solid 6px;border-color:transparent transparent #fff transparent;position:absolute;top:-12px;left:10px;z-index:99}.f-dropdown:after{content:"";display:block;width:0;height:0;border:solid 7px;border-color:transparent transparent #ccc transparent;position:absolute;top:-14px;left:9px;z-index:98}.f-dropdown li{font-size:0.875em;cursor:pointer;padding:0.3125em 0.625em;line-height:1.125em;margin:0}.f-dropdown li:hover,.f-dropdown li:focus{background:#eee}.f-dropdown li a{color:#555}.f-dropdown.content{position:absolute;left:-9999px;top:-9999px;list-style:none;padding:1.25em;width:100%;height:auto;max-height:none;background:#fff;border:solid 1px #ccc;font-size:16px;z-index:99;max-width:200px}.f-dropdown.content *:first-child{margin-top:0}.f-dropdown.content *:last-child{margin-bottom:0}.f-dropdown.tiny{max-width:200px}.f-dropdown.small{max-width:300px}.f-dropdown.medium{max-width:500px}.f-dropdown.large{max-width:800px} diff --git a/doc/foundation/static/css/general_enclosed_foundicons.css b/doc/foundation/static/css/general_enclosed_foundicons.css deleted file mode 100644 index a159957..0000000 --- a/doc/foundation/static/css/general_enclosed_foundicons.css +++ /dev/null @@ -1,216 +0,0 @@ -/* font-face */ -@font-face { - font-family: "GeneralEnclosedFoundicons"; - src: url("../fonts/general_enclosed_foundicons.eot"); - src: url("../fonts/general_enclosed_foundicons.eot?#iefix") format("embedded-opentype"), url("../fonts/general_enclosed_foundicons.woff") format("woff"), url("../fonts/general_enclosed_foundicons.ttf") format("truetype"), url("../fonts/general_enclosed_foundicons.svg#GeneralEnclosedFoundicons") format("svg"); - font-weight: normal; - font-style: normal; -} - -/* global foundicon styles */ -[class*="foundicon-"] { - display: inline; - width: auto; - height: auto; - line-height: inherit; - vertical-align: baseline; - background-image: none; - background-position: 0 0; - background-repeat: repeat; -} - -[class*="foundicon-"]:before { - font-family: "GeneralEnclosedFoundicons"; - font-weight: normal; - font-style: normal; - text-decoration: inherit; -} - -/* icons */ -.foundicon-settings:before { - content: "\f000"; -} - -.foundicon-heart:before { - content: "\f001"; -} - -.foundicon-star:before { - content: "\f002"; -} - -.foundicon-plus:before { - content: "\f003"; -} - -.foundicon-minus:before { - content: "\f004"; -} - -.foundicon-checkmark:before { - content: "\f005"; -} - -.foundicon-remove:before { - content: "\f006"; -} - -.foundicon-mail:before { - content: "\f007"; -} - -.foundicon-calendar:before { - content: "\f008"; -} - -.foundicon-page:before { - content: "\f009"; -} - -.foundicon-tools:before { - content: "\f00a"; -} - -.foundicon-globe:before { - content: "\f00b"; -} - -.foundicon-home:before { - content: "\f00c"; -} - -.foundicon-quote:before { - content: "\f00d"; -} - -.foundicon-people:before { - content: "\f00e"; -} - -.foundicon-monitor:before { - content: "\f00f"; -} - -.foundicon-laptop:before { - content: "\f010"; -} - -.foundicon-phone:before { - content: "\f011"; -} - -.foundicon-cloud:before { - content: "\f012"; -} - -.foundicon-error:before { - content: "\f013"; -} - -.foundicon-right-arrow:before { - content: "\f014"; -} - -.foundicon-left-arrow:before { - content: "\f015"; -} - -.foundicon-up-arrow:before { - content: "\f016"; -} - -.foundicon-down-arrow:before { - content: "\f017"; -} - -.foundicon-trash:before { - content: "\f018"; -} - -.foundicon-add-doc:before { - content: "\f019"; -} - -.foundicon-edit:before { - content: "\f01a"; -} - -.foundicon-lock:before { - content: "\f01b"; -} - -.foundicon-unlock:before { - content: "\f01c"; -} - -.foundicon-refresh:before { - content: "\f01d"; -} - -.foundicon-paper-clip:before { - content: "\f01e"; -} - -.foundicon-video:before { - content: "\f01f"; -} - -.foundicon-photo:before { - content: "\f020"; -} - -.foundicon-graph:before { - content: "\f021"; -} - -.foundicon-idea:before { - content: "\f022"; -} - -.foundicon-mic:before { - content: "\f023"; -} - -.foundicon-cart:before { - content: "\f024"; -} - -.foundicon-address-book:before { - content: "\f025"; -} - -.foundicon-compass:before { - content: "\f026"; -} - -.foundicon-flag:before { - content: "\f027"; -} - -.foundicon-location:before { - content: "\f028"; -} - -.foundicon-clock:before { - content: "\f029"; -} - -.foundicon-folder:before { - content: "\f02a"; -} - -.foundicon-inbox:before { - content: "\f02b"; -} - -.foundicon-website:before { - content: "\f02c"; -} - -.foundicon-smiley:before { - content: "\f02d"; -} - -.foundicon-search:before { - content: "\f02e"; -} diff --git a/doc/foundation/static/css/general_enclosed_foundicons_ie7.css b/doc/foundation/static/css/general_enclosed_foundicons_ie7.css deleted file mode 100644 index cc67f50..0000000 --- a/doc/foundation/static/css/general_enclosed_foundicons_ie7.css +++ /dev/null @@ -1,194 +0,0 @@ -/* general icons for IE7 */ -[class*="foundicon-"] { - font-family: "GeneralEnclosedFoundicons"; - font-weight: normal; - font-style: normal; -} - -.foundicon-settings { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-heart { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-star { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-plus { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-minus { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-checkmark { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-remove { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-mail { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-calendar { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-page { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-tools { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-globe { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-home { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-quote { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-people { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-monitor { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-laptop { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-phone { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-cloud { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-error { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-right-arrow { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-left-arrow { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-up-arrow { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-down-arrow { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-trash { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-add-doc { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-edit { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-lock { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-unlock { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-refresh { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-paper-clip { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-video { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-photo { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-graph { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-idea { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-mic { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-cart { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-address-book { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-compass { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-flag { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-location { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-clock { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-folder { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-inbox { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-website { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-smiley { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-search { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} diff --git a/doc/foundation/static/css/general_foundicons.css b/doc/foundation/static/css/general_foundicons.css deleted file mode 100644 index 3c308c8..0000000 --- a/doc/foundation/static/css/general_foundicons.css +++ /dev/null @@ -1,216 +0,0 @@ -/* font-face */ -@font-face { - font-family: "GeneralFoundicons"; - src: url("../fonts/general_foundicons.eot"); - src: url("../fonts/general_foundicons.eot?#iefix") format("embedded-opentype"), url("../fonts/general_foundicons.woff") format("woff"), url("../fonts/general_foundicons.ttf") format("truetype"), url("../fonts/general_foundicons.svg#GeneralFoundicons") format("svg"); - font-weight: normal; - font-style: normal; -} - -/* global foundicon styles */ -[class*="foundicon-"] { - display: inline; - width: auto; - height: auto; - line-height: inherit; - vertical-align: baseline; - background-image: none; - background-position: 0 0; - background-repeat: repeat; -} - -[class*="foundicon-"]:before { - font-family: "GeneralFoundicons"; - font-weight: normal; - font-style: normal; - text-decoration: inherit; -} - -/* icons */ -.foundicon-settings:before { - content: "\f000"; -} - -.foundicon-heart:before { - content: "\f001"; -} - -.foundicon-star:before { - content: "\f002"; -} - -.foundicon-plus:before { - content: "\f003"; -} - -.foundicon-minus:before { - content: "\f004"; -} - -.foundicon-checkmark:before { - content: "\f005"; -} - -.foundicon-remove:before { - content: "\f006"; -} - -.foundicon-mail:before { - content: "\f007"; -} - -.foundicon-calendar:before { - content: "\f008"; -} - -.foundicon-page:before { - content: "\f009"; -} - -.foundicon-tools:before { - content: "\f00a"; -} - -.foundicon-globe:before { - content: "\f00b"; -} - -.foundicon-home:before { - content: "\f00c"; -} - -.foundicon-quote:before { - content: "\f00d"; -} - -.foundicon-people:before { - content: "\f00e"; -} - -.foundicon-monitor:before { - content: "\f00f"; -} - -.foundicon-laptop:before { - content: "\f010"; -} - -.foundicon-phone:before { - content: "\f011"; -} - -.foundicon-cloud:before { - content: "\f012"; -} - -.foundicon-error:before { - content: "\f013"; -} - -.foundicon-right-arrow:before { - content: "\f014"; -} - -.foundicon-left-arrow:before { - content: "\f015"; -} - -.foundicon-up-arrow:before { - content: "\f016"; -} - -.foundicon-down-arrow:before { - content: "\f017"; -} - -.foundicon-trash:before { - content: "\f018"; -} - -.foundicon-add-doc:before { - content: "\f019"; -} - -.foundicon-edit:before { - content: "\f01a"; -} - -.foundicon-lock:before { - content: "\f01b"; -} - -.foundicon-unlock:before { - content: "\f01c"; -} - -.foundicon-refresh:before { - content: "\f01d"; -} - -.foundicon-paper-clip:before { - content: "\f01e"; -} - -.foundicon-video:before { - content: "\f01f"; -} - -.foundicon-photo:before { - content: "\f020"; -} - -.foundicon-graph:before { - content: "\f021"; -} - -.foundicon-idea:before { - content: "\f022"; -} - -.foundicon-mic:before { - content: "\f023"; -} - -.foundicon-cart:before { - content: "\f024"; -} - -.foundicon-address-book:before { - content: "\f025"; -} - -.foundicon-compass:before { - content: "\f026"; -} - -.foundicon-flag:before { - content: "\f027"; -} - -.foundicon-location:before { - content: "\f028"; -} - -.foundicon-clock:before { - content: "\f029"; -} - -.foundicon-folder:before { - content: "\f02a"; -} - -.foundicon-inbox:before { - content: "\f02b"; -} - -.foundicon-website:before { - content: "\f02c"; -} - -.foundicon-smiley:before { - content: "\f02d"; -} - -.foundicon-search:before { - content: "\f02e"; -} diff --git a/doc/foundation/static/css/general_foundicons_ie7.css b/doc/foundation/static/css/general_foundicons_ie7.css deleted file mode 100644 index d5b3776..0000000 --- a/doc/foundation/static/css/general_foundicons_ie7.css +++ /dev/null @@ -1,194 +0,0 @@ -/* general icons for IE7 */ -[class*="foundicon-"] { - font-family: "GeneralFoundicons"; - font-weight: normal; - font-style: normal; -} - -.foundicon-settings { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-heart { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-star { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-plus { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-minus { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-checkmark { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-remove { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-mail { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-calendar { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-page { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-tools { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-globe { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-home { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-quote { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-people { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-monitor { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-laptop { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-phone { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-cloud { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-error { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-right-arrow { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-left-arrow { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-up-arrow { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-down-arrow { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-trash { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-add-doc { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-edit { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-lock { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-unlock { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-refresh { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-paper-clip { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-video { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-photo { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-graph { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-idea { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-mic { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-cart { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-address-book { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-compass { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-flag { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-location { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-clock { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-folder { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-inbox { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-website { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-smiley { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-search { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} diff --git a/doc/foundation/static/css/social_foundicons.css b/doc/foundation/static/css/social_foundicons.css deleted file mode 100644 index 914f647..0000000 --- a/doc/foundation/static/css/social_foundicons.css +++ /dev/null @@ -1,148 +0,0 @@ -/* font-face */ -@font-face { - font-family: "SocialFoundicons"; - src: url("../fonts/social_foundicons.eot"); - src: url("../fonts/social_foundicons.eot?#iefix") format("embedded-opentype"), url("../fonts/social_foundicons.woff") format("woff"), url("../fonts/social_foundicons.ttf") format("truetype"), url("../fonts/social_foundicons.svg#SocialFoundicons") format("svg"); - font-weight: normal; - font-style: normal; -} - -/* global foundicon styles */ -[class*="foundicon-"] { - display: inline; - width: auto; - height: auto; - line-height: inherit; - vertical-align: baseline; - background-image: none; - background-position: 0 0; - background-repeat: repeat; -} - -[class*="foundicon-"]:before { - font-family: "SocialFoundicons"; - font-weight: normal; - font-style: normal; - text-decoration: inherit; -} - -/* icons */ -.foundicon-thumb-up:before { - content: "\f000"; -} - -.foundicon-thumb-down:before { - content: "\f001"; -} - -.foundicon-rss:before { - content: "\f002"; -} - -.foundicon-facebook:before { - content: "\f003"; -} - -.foundicon-twitter:before { - content: "\f004"; -} - -.foundicon-pinterest:before { - content: "\f005"; -} - -.foundicon-github:before { - content: "\f006"; -} - -.foundicon-path:before { - content: "\f007"; -} - -.foundicon-linkedin:before { - content: "\f008"; -} - -.foundicon-dribbble:before { - content: "\f009"; -} - -.foundicon-stumble-upon:before { - content: "\f00a"; -} - -.foundicon-behance:before { - content: "\f00b"; -} - -.foundicon-reddit:before { - content: "\f00c"; -} - -.foundicon-google-plus:before { - content: "\f00d"; -} - -.foundicon-youtube:before { - content: "\f00e"; -} - -.foundicon-vimeo:before { - content: "\f00f"; -} - -.foundicon-flickr:before { - content: "\f010"; -} - -.foundicon-slideshare:before { - content: "\f011"; -} - -.foundicon-picassa:before { - content: "\f012"; -} - -.foundicon-skype:before { - content: "\f013"; -} - -.foundicon-steam:before { - content: "\f014"; -} - -.foundicon-instagram:before { - content: "\f015"; -} - -.foundicon-foursquare:before { - content: "\f016"; -} - -.foundicon-delicious:before { - content: "\f017"; -} - -.foundicon-chat:before { - content: "\f018"; -} - -.foundicon-torso:before { - content: "\f019"; -} - -.foundicon-tumblr:before { - content: "\f01a"; -} - -.foundicon-video-chat:before { - content: "\f01b"; -} - -.foundicon-digg:before { - content: "\f01c"; -} - -.foundicon-wordpress:before { - content: "\f01d"; -} diff --git a/doc/foundation/static/css/social_foundicons_ie7.css b/doc/foundation/static/css/social_foundicons_ie7.css deleted file mode 100644 index 6a3c9c0..0000000 --- a/doc/foundation/static/css/social_foundicons_ie7.css +++ /dev/null @@ -1,126 +0,0 @@ -/* general icons for IE7 */ -[class*="foundicon-"] { - font-family: "SocialFoundicons"; - font-weight: normal; - font-style: normal; -} - -.foundicon-thumb-up { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-thumb-down { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-rss { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-facebook { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-twitter { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-pinterest { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-github { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-path { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-linkedin { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-dribbble { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-stumble-upon { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-behance { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-reddit { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-google-plus { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-youtube { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-vimeo { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-flickr { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-slideshare { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-picassa { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-skype { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-steam { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-instagram { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-foursquare { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-delicious { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-chat { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-torso { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-tumblr { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-video-chat { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-digg { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} - -.foundicon-wordpress { - *zoom: expression(this.runtimeStyle['zoom'] = "1", this.innerHTML = ""); -} diff --git a/doc/foundation/static/fonts/accessibility_foundicons.eot b/doc/foundation/static/fonts/accessibility_foundicons.eot deleted file mode 100644 index 237a0ca97e568531dc58bf7c81202028af1e881c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15316 zcmdUWdwg6+eeXQZbI&q>m*c8GoP}1_b7|P{cKD~v@g-!X9R(jB3+~tV;2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ibility_foundicons.svg b/doc/foundation/static/fonts/accessibility_foundicons.svg deleted file mode 100644 index 49c0d07..0000000 --- a/doc/foundation/static/fonts/accessibility_foundicons.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - diff --git a/doc/foundation/static/fonts/accessibility_foundicons.ttf b/doc/foundation/static/fonts/accessibility_foundicons.ttf deleted file mode 100644 index 46a67f8d0223b881ca74ccafb44b64664552b937..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15056 zcmdUWd3;<~eeYTBerN8T{c1*EnZy_dR!J7&wA3pzvPZo zsjEDbZb_2-f>>^WcoQKQjS>2!i*x=y`UH_t@+o!(C2y@j`d6fgURVE6cRJOwqjw!U zj`bivjV{kY)VOb;Pw*6Qk!oWIh$Lo;lt6kGX**I9sg3`T_5pqy=?v02q&U)Qq&-Mq zL0VbO4*+%{Z9|$z`aY6qmqHR_iF)y#0lbk{5>u*_X+Q~PNIyjs`T^8|$kiG*<38vz zeQR{STz55Ap{97p|F1vs|3@dziA2URH;ZUk4F#AN-1MfOg4Fzl_dKP7YukNsNOoXntlABOI)b0O%IwFQJj#aeeA6&u-bZb=TR`qxENp zMD1WSSGVjs`|4d({TX~mHNQw+y{3SYYYT>}1)v1R042s2>FF&P3?P%P7X_JgCXIPcj^f>V z$MxHHjbWzg$xZ^Ax07>_QHij2dJc+85y)qN+(-74Eo22&m=LY~GpJZ3Pmz;k2Q*iu zL?x?8H_4JHv8yE-=^?G)q{}5b>Aa@IAQ2KEK4KEp?L|I=*AHGZ5F?Xh176;`{CZAG z*9;^%=TOG1pEqhjbUxV@S^+ zy@d1%(rZZHMEViZ|3UKY8Bwnqgx|hMI`OhJUM60Y_hj#KAJA9D5S#HUs>T) zp}#vtO)mLO_M(Hek+339^4ItX@sK_ca|ij;MY1!$NLrD|1>hh?8Ze!I1?;C^9MJ(3 zEV=@&Q_x2t(jF|(7?7PvY!CXPkBL65AgK?1DkXJd6x0j=4&={a1qX=FA6QW-U5V0_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$JxQ+G{#g776c_ zt_;~%xUj7BX%m`kt|9!IA?-KfHj%D6N&9%nk|~*P9=ZMM#^WL@sLTVLL;g+1X_#;= z-Al`}jY_IH=Did$PE=%RDxJM|qI2jL#`ybU1^TNhalLlDBO7CQ&L9c|_3pf7YNu(H ze)~tjF?L1u?R{KkUtJLe=fYp@2>}|c*-Fr3LbM5;63C|tPq!*IIq!NBtrBfFzU}L@ zh|aj*epC{UdiB8s*%i2q*L3%l|x*4*11Pr@r410K1yIEF| zLLVQFzHlPV1iMJ_k`NgcA0|Ha2w7UX=R?fxs9Q~3@^Cpny9(Nl4G9(&{v>VHBovWp zzc6pzo>6lf;3VJ>l&emxb*08;_Se$LO-@nTiJ3XdbJpO{k{fp`v~_5{mJGkGPwkg6 z9nY~yDmnn^DKIPeCNGgSR`ezIYr=|^(UTl7?fK5Jiz}0dZl+B diff --git a/doc/foundation/static/fonts/general_enclosed_foundicons.eot b/doc/foundation/static/fonts/general_enclosed_foundicons.eot deleted file mode 100644 index 2abc02e00dbdbb9e036bb757b756ef683f1db4ad..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 18912 zcmdUXd3c;hnP*jfcOPHh-8x!Fw~p3*w4`p^lI25|9LGoGE68zhkR{ntVyhKdPMl;& z%uEu9H(>$`c^Hy;W`ThXGXrC?Wa3zXkPKlU@a%Z95RS>hJ~K-eNMJKyvcuu_{@&_t zNtU}I%<{*q?CS6R>Z_`+>aF*FtNVX!W9-5;jBzH|m4BQ)%&BI_sJt-dEj-WPvuD5e zu4f8$%hwd!%BI*X$~+rq$5<^J#@z&<3_F3^Nz{x0K8e~%HiIV_KqoMO&Gz8=Q9L<@ zp7W@Qv+LzJC(w>s)v|8Z!MgCTmL>7ojZcQr{%vopz3P1!jH9^OX{NBz>-Kgg@0~ks zp>hnh@0d6~KKIh2-#o>bcn`|x#BB?;BCV7&W|(*$J~DUoxPIWVG-K+w(C5U_V|N@G zeC36+cwWm`|9hsV#wUN7J@{j^eFY^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Thu!Q3@!qXdvs3fq$7+XXCyr%K zOik8~WKPab&P-%xPwbgGdh*!#e0N7zS64s%K1F}NaiQ&U({{A|4I|a&hq``h{=`gX zww8vhO?GuBf8&5R?BBC_Bs05EyNza3dn7ZTo80&U#+Y7Mm|NG`dHe0Rciee${&2@c z=J-$slbks^y-?dU(JY6rr6JmCi?r?hH~yH)l|S85_?eb2h?F^;lby#8y!5XcdG*i2 z6#G$__WVz@{CrpM32KTe`u8BIEt9bV{!&zUg}c|j+=nZu>4avwK)5n zn?)OH-`cpOE2Qtu*ySf-!WH|&S3tQyD|{t@;|l`#x`4q=ZgB^9au*V&B)z@d$NfCO zgFM8;Ji^O(Ij`WA_?AtTl;X8K#^bz>*YgJ6$P>JYH}e*lyluQ4QHo9^RK|I?x@-TA z9ojWhI oUfVW%ICIK)+tlF`Gg#=}<1@#m?$GxFc@xv--l>HJ4141L0*z%61^@s6 diff --git a/doc/foundation/static/fonts/general_enclosed_foundicons.svg b/doc/foundation/static/fonts/general_enclosed_foundicons.svg deleted file mode 100644 index 6cb60b7..0000000 --- a/doc/foundation/static/fonts/general_enclosed_foundicons.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - diff --git a/doc/foundation/static/fonts/general_enclosed_foundicons.ttf b/doc/foundation/static/fonts/general_enclosed_foundicons.ttf deleted file mode 100644 index 3b2eee9b93c7b8e4e483d14db95aeb4e804dd942..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 18640 zcmdUXd3c;hnP*jfcOPHh-8x!Qck5`~M@#CqEm=Nf$#HzdXOQE>L6#ItiLDm0oH)sl zn3*IHZ^8r?@-QU(%m4!$W(LM&$;7dMkPKlU@a%Z95RS>h^UN$+Ac4(*$qt9x`+KXq zC0Xu<@XY)%E2;W>zxt}`t9t9b>uoX47<04JOkumP+t-!4Z|=0k7#~CJ+b52X&%N~6 zw@xu8-h;Ax;`W7@$S9SJ877{GZ<#xKTtE1DhB5Wq=yT%eu{&=WdgX<)cphV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sX7#B zz2!vDOFtiA7x^UrlBg2*DUWJvv?uh#=Aikg6?J^WdD!`?>vq@c?rYp1wV8dr{b^5w z=Ysb=K9}!N|K5NIJP`O<@Drhz!Y@W{uV}Bhr_!waaOF>{Zm7Cg{Y3PJ=r^L@sQHq7 zPY@Z0`TrO|Upbcl5dxnA0;#%CuYiYe1T9;uAP)#532O*D9529>#CcBvHsQ5CR)8%e zNB(I6c0yU;%jdGM8+zw!AXBc=_mk7?Ukk8cHt#IJ_&*(dumG!Uls{B}HJ0En6=0pM z;};9C$&dh4fGw61=>qIzO=7wLyV(umy<4Ydr{>3x#YSc)j%80wO~yvECub*TCbF|9 z_D&r=d2D>Xr?b1edw~8w#XzBPvF&ox4z&F(BgG0sT|YH{VkSEqqakCd?w-_d9q@(& zdpD0}XBT4IXg0B1vh(@LjW1w~>4k;4bzNO|+;Ku zIed(UXpfa>+aBe2^-!Q`)5Qg0gQ;}9N%N8*Dwk6!ekkgw54pw4r9BuORmq-p3crrX~V~|CnvR$`T6X;V=wW?CV+QXJEm^Q zL&kx*e9e~Z9kUYB_Ro)>n09WOoZOO~IC*?(c0nDPoLNwJWG8OZ56t2}_S|Odow{Xy z>cq6Qdwgzce)!nToOb=pLcY_{_1X TJN11)-o&)IZ)#xy!=CtmYNhJ< diff --git a/doc/foundation/static/fonts/general_enclosed_foundicons.woff b/doc/foundation/static/fonts/general_enclosed_foundicons.woff deleted file mode 100644 index a254e565703a5eae35639cafea817eb6dc7dcbc4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 9536 zcmZvBQ*>rcwCxw$ww-ir+crD4ZFFpRY}@`~+wRzQ(&^~tzvtYyTVu?svF6&d=Gs-Y zUv_yYN=N`e0N;&52!Qb4C^h$A|Nm=>s*EfE07&t7PV^gwA&!ACCU!=S001cXcWnPX zDlKHKdYZVq5(5BWkKY{Te*onK!!dWXu=~!te(OQM;R30h&1qrlWexyWsQ>_P zgutKSdP_4S)9*afx9-~u!13=>_sa5{{N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$wN=BsdzC!G(b>eP86{?8_FdnP%_QY+q147g08m>dC$~WR~R^}Qv z2PW5A$@VbdFZ05UaB&5dp{x>4>G3Obb4v%g=B!qbBo~J`NlqP_@rVJn|+d?pxlqu7+nYO(Ys$KcFQA%IwY28a7V!s$UyHe#4r+>zRQ!C$Ml zt|WQ&8mvAT#2tjZ`w%qXi~MKu*Pd=te%fP_z(3>!sYIhd5{>#OcD;V}>I2+b6EIFk zv^GaP4@ayQMTT-O)zzPW*M4|@kHF&lODx}Qa^1$Uc*Th1D*HAloft!3+EY|%VnRwj_IS@knDXQ6rVZmw}T%)iXc W*I*f529{*P{R@D4?!*55RsJ7g#_U7@ diff --git a/doc/foundation/static/fonts/general_foundicons.eot b/doc/foundation/static/fonts/general_foundicons.eot deleted file mode 100644 index 20733a0388ef77572cbc55cbf76cc46babf0a15d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15724 zcmdUWd3an`mFKQ(%KXl&lI=L@ z4*h-e$BgXz?s@l}d*8k1p8dWWU(DFiMT~JKvA6zlb|7v&K)pZFF>{iQDWb6Kvg88(TZxKY7$Z<5slp+`WHf^7;Gz z+s%wgA4FNV`=;rn^px}0g)I(#0E?={A?11C~Gsw?&9qekW7V^0;&YEhkGge+e7*r%Q(d%rCGJZYFP;I*9#X zueFrt;Lf=;1AeDS0)@)_7*wMGw;Dx9NtBBh^>&mL$_G#$L>WY>Kv|8FM4@-|q1Y(Y zFMvYrghS;d%AF`Tp^Tw?2xW7*5dIRBC`ti^`d*9jEfhZry}t^Dp50f59ik{;qG>Hk z9)<3sScNDRNi9>m3N4^3f1IiOGkAuLD?f2>+{;A~y6{wg3F9D3w6aPXUNx)Ywi=eXx@{^8AEz4=YKS;L&wMm*O`qio!IdN6*PZ98#-#@x6ylRAC$#EJL`tfPEC!=AjX zfwRjS2Fneg1jYa*R?P6D>o6FqOe#(dnN%i)d2U;dcN@*CH*Q^lnWnZaV4!&uI|~_A znbgG3G7Z}a;F|!_tdf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*~OAa|pWNMNSw_S`5hd%Nl{&3>T^;ablH8qLERqNee z{3&|SvmhS`RXt4DZnsl~BS#Lm6?%Hyc}DT8nCDn(D99bqnoWTO0M<@>Wz`zYJBw zXE*bxeDAzvny+8DbkHCW)k}v|(Ga|RK>go9qs_nYcQt#FSMWvrR{pefjd(%sm7i2U zqy9u2)YJNhjes#_oHDcK)#g$2tLCq*9_yE$hwXrUhy9v!v-4ALrT4487yL&9k-$%b zHw4dyHi!N(TowL{h%fThsEU85-S>pp8&FjAhci$2N-$*#0_AoAd5)D~I#66(h84s? z_`-tFA*(TDCrU77vyPQv%9kB4!xnhtQ)SqOb$k>$4PU#Vr53+nE5Q=O0Y@1YYzRLW zE49n43%}GW!3sp>4h_axJ^Y+fk@{`S@QwPT;4kT%mWJguADe9om@pPPhLMURhrAlH2UwGo}TP&Z9RPWaLcWSrgpXLp4h)^0&^PM zyKg#Kzq`R5I!Qw`C*J|L_0Rf&hr~3d+g9g1wI<_L)M*mvyE0{y*u?rB5vLD|{Pn792hR?XEPZE*UZg`Rxf2x|q zx6-9qG^6#;8@ILOBQf^oV=#{I^aqy~@&O6Km+tue2Un4H*SWz>ZgCH{p-sKq$NfCO zgZMTy%p*Js4HDy(JkF~S%u;F~$&tq88D7ilcoqr#dfvbrp@p0I0;t_q-o{3FyL{!Q zHEWci(UGZXdE@lRl)P^I&_QMG*a2LZ?Hk>FqjL4w{?UW-+L5twec8zP=z%?iG_rS8 z-7+(i{!wN9p^52Hb=~O1m&Q)YQb3xq&!+3Bbd~n$hb^khW>E)Utfy@BtT6uAUk>xX)U$XV3D9-G}y% z9+;L_>=~Pu*G%lbQQdR^zp%Yg+c0|l)ab!|#=4Qo(WzzQW0T6}u|1;`^v>xC<%+41 z$$j#wJ)B$&rHx<(1 - - - - - - - - diff --git a/doc/foundation/static/fonts/general_foundicons.ttf b/doc/foundation/static/fonts/general_foundicons.ttf deleted file mode 100644 index 90a5ccead2d84d036bd8ed66926af93b21621df5..0000000000000000000000000000000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(vRJhq3;jzm7P9VhE#B`BoM6`Cc1TMh6>cVw%XOdQs#sVra&LlY)rT(8P%BGPgLcDpoc-iL8jyhv$SoAysw3XE=#$S(3O`k3dM z^EH2S$$@cLafe^gTQrTv6itz3Wp)TQsJx`)OgGG2{;8h}^(`~?)}O=U8At~J diff --git a/doc/foundation/static/fonts/social_foundicons.eot b/doc/foundation/static/fonts/social_foundicons.eot deleted file mode 100644 index a9341f49f12c10aaa5db2bc74ed3889245ce9a3a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 17112 zcmdUXX>?r2b!OFDdwt!n_Z{8nz0p7e=mr`D2!J2~Qs5>K-~#RfNst5y5)=qZlq^}R zWrcAxl1Fi3$FZ46iDJ#jrsX3KMA)%?lE`von@nOlb}TE2$MJD8IT=qzi8CG%n(w~u z1{XOe`QbTdhGg}8Tj0wX?V~6iqi1Y99|Hzo~W0Z%Eo;h|(+5Pb;BR~7WK2VaqiPU`@8K#d)Db)4gId%Nh!ubaj`6WCr;`u|fbBCwCv+r*{%-HHL z!h!uya&(m(^IFWJO9M@2xI*w#>B_Z%$;5M+28(XCu3_qggR4a=BLk` z-uwOp#)oqDmN7TX?~PaZ`wu!+{}VHdG;a3Bf0{AY?CTppy+F_6Rq;Cj=9Q(!J4Vgd z@f%4j030CXoDaU>h42oL25$Ugp@`aMEZ3k%F7}( z*YN;gvW`<3r34c7N%b0e1XD;Qq=WVRGT>l6QNJ`_v6cj-PN@iTFk=1%rtpg>1JUax z#)I*5gSBpFu^V-2SdF^W$N#T?69115Tx1g4h_PwRgsrOpvtxI?|0mde@4jn{x$(^L z%-{W|cmM0V&q3rFt6QHFy+vZ`7uFJlL2=U}GmlMvmh-1}FYA3Zz9op)r7DB1{>{L^6SK z?jA zUi%V;+7RtQ$bTyQ$@{@H!*EXX^}M}b(NMtDhY(7 zUP8bM28Fsnp+P3S-QMBuj7eUPLNutfNe1Xfp0JW9)bl(Vur{HqG9Z*u{^|qUti$ggx)ZIzP%+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X2oOa4+}4 z4Gi!g58>uk1g<3fe>TPA5+vSc^Y-KCP8}MayZ5v>J~3fhKXrKe(A?Zfb^ENp!J~@44^t5Sse&*1jL$lM?i3Kz>JH6w~+-Y^~ z^zo_Fho_bC=_5yG7Aza)=8nxykIkMttL~mVxBc9qX?f?&sp&ao{p`%)lk=8|*_k8L z6UV3Kr`55U!&7I^PRSD|?>jRsPb^GNoidM}KD#h=Y#tc6Z~pFcsAnFY#;Y@P=gvy& xj!!KpW8k&9)5>-l!n}DWnwz71X?W(?G4rmu`6Ku*5zd}98B;yG;|yr}e*gq>2LJ#7 diff --git a/doc/foundation/static/fonts/social_foundicons.svg b/doc/foundation/static/fonts/social_foundicons.svg deleted file mode 100644 index eb4189c..0000000 --- a/doc/foundation/static/fonts/social_foundicons.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - diff --git a/doc/foundation/static/fonts/social_foundicons.ttf b/doc/foundation/static/fonts/social_foundicons.ttf deleted file mode 100644 index 01158c66b13b6f90e7b7d1cdb5c4e7369c6434ae..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16880 zcmdUX325?PLHlZj2ohpZ%C$K_;G*=$ycvtAL}?|(A@ z4>?u4Ro<#yl0E5PYU0eF zAODLQW5N*9=;3?j;{1pF-!rEC4CSGtXO5jxc7LqSnDi{(IeTpSzN7a)c=UC~REe>! zFCL$qIP!}h?^}bqZyGp$ zD|o)+)WrES!dmHTDDS~@{Pe`B$;zMk9$~EC#F+T_nVGY5zxdmq?qqD$2T*6?%twA-efd3q}M;s-+R!p@}HSmq<*v4|HG7%;5RmWdXAuYRs0@+nF;iSKX}Ke z`5Jx$EFfMrT56Ovev?K{l20+OkwKIgvw%xX+;8Bb_y_!HCL`yI!Ug1fpaJ=hScUz< zsBzpSf@LEarp#V|2L>RANxzPm6Kjl$P2ch=jWPklK)1kTxQvkp_`|3yJcw zNUcpg0GMpzR7NR*L^P@1QXat+QW@!BGrtNr*i1y1#w#|GpfouZ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xo1E{o=)`srreYA5Qo5OxJ2Z{9&z!_Ns%d4xRD)M%=OlSNCrA82=*O99AIJw5V_q z$B0<0{*~PR{S`DqTTBHV^dVvAE3-5ZxBAkQ;mo#?FCDL!k=8jII8rarlY+@NZ z*2G9By@CxYT_&1YE+!kQ;O$muI zMak*e~(@Uu37D=|$8#X?G9s54wAVmA{PH?2CoOcvx%uevU&CLiznxkeL(bG%zb%!|>wddXs_osxg>Ti5?i%*-pRC_tCehazg zO|gl-{te+(`9sP|<)NZYijS<3L;z&Dw1H*t}z z$JT);LUpI5^ z^pUB==IdSbS-)X~w=M_(fMHLBdG(cY}`u2CW#2Lhpr*QXk8ot9iJe@`+=raAz;15km$lJ;TPru$|K(KUx4p3wy&zgsMz7+_{fOfpQU{(Y|HpmU zgYTBM;fqb`?`de^I6^;5V~!&%GXr`z_l<7HHmDy5HiyyoLh#FovD4oYZbO{I8;5{V zE2nTnb*9OoDe#Zpi6g>t7=fl6eU9UPccT|Y5T$jE8a(CpNqLx-j(tz&a&W_ohRnVHk-n#to6rw>mm+a`}3nVPe#pP4x}Jvlmk z?yS0d=G^vkhbHBnQ>P|ply%cnhfmI0#-^u^OpYC&n4MHdrw&h?Jv$+foxJbNq&zk^ zIdRH7a{BDt#IadmkiOZw&!L`qXcDhZ&73HsSC5_ooH@`@};4v aW5>+9W@eAzzeG5D)?^Iz?2a?w>Hh*iiRnxL diff --git a/doc/foundation/static/fonts/social_foundicons.woff b/doc/foundation/static/fonts/social_foundicons.woff deleted file mode 100644 index bd1f1e58a692b73205fce579faee81801d3157aa..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 10644 zcmaKSWpG_FljVD6jG37^X7;mVW@cuLF=l4AV~&}bnK9;=nVFd}rggrVA6r{HqpQ=c zK2mq}l~i@>s^ls!CI$ckJ_}7E0P&v|y!t2qe??xIkp%z%7JT*zf5ITh-gn2?#?T%B z0Au>JZ9lcbjKw0Gv5ONi002S%$>IJ3a21$fW^Zou*`M?25B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doc/foundation/static/humans.txt b/doc/foundation/static/humans.txt deleted file mode 100644 index 426b35b..0000000 --- a/doc/foundation/static/humans.txt +++ /dev/null @@ -1,8 +0,0 @@ -/* Foundation was made by ZURB, an interaction design and design strategy firm in Campbell, CA */ -/* zurb.com */ -/* humanstxt.org */ - -/* SITE */ - Standards: HTML5, CSS3 - Components: jQuery, Orbit, Reveal - Software: Coda, Textmate, Git diff --git a/doc/foundation/static/img/.gitkeep b/doc/foundation/static/img/.gitkeep deleted file mode 100644 index 8b13789..0000000 --- a/doc/foundation/static/img/.gitkeep +++ /dev/null @@ -1 +0,0 @@ - diff --git a/doc/foundation/static/img/subtle_carbon.png b/doc/foundation/static/img/subtle_carbon.png deleted file mode 100644 index f2bb16d0cea474d13472d19cc2e1cbd1753e1b76..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 112 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh1SBVD?P>#3=AJH&AsQ2t6C9Y7l$3Vt$Oy7% zxxn&K!r_3;nzY9uj^0;qF#fbVtkiLz;ZWbf=PEvTuY|RG^E0p*a1<(}JbDH+g2B_( K&t;ucLK6UBXCk`* diff --git a/doc/foundation/static/index.html b/doc/foundation/static/index.html deleted file mode 100644 index 3aead3f..0000000 --- a/doc/foundation/static/index.html +++ /dev/null @@ -1,143 +0,0 @@ - - - - - - - - Foundation 4 - - - - - - - - - - - -

    -
    -

    Welcome to Foundation

    -

    This is version 4.0.5.

    -
    -
    -
    - -
    - - -
    -

    Getting Started

    -

    We're stoked you want to try Foundation! To get going, this file (index.html) includes some basic styles you can modify, play around with, or totally destroy to get going.

    - -

    Other Resources

    -

    Once you've exhausted the fun in this document, you should check out:

    -
      -
    • Foundation Documentation
      Everything you need to know about using the framework.
    • -
    • Foundation on Github
      Latest code, issue reports, feature requests and more.
    • -
    • @foundationzurb
      Ping us on Twitter if you have questions. If you build something with this we'd love to see it (and send you a totally boss sticker).
    • -
    -
    -
    - - - - - - - - - diff --git a/doc/foundation/static/js/foundation.min.js b/doc/foundation/static/js/foundation.min.js deleted file mode 100644 index be3fdf6..0000000 --- a/doc/foundation/static/js/foundation.min.js +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Foundation Responsive Library - * http://foundation.zurb.com - * Copyright 2013, ZURB - * Free to use under the MIT license. - * http://www.opensource.org/licenses/mit-license.php -*/ -/*jslint unparam: true, browser: true, indent: 2 */ -(function(){Array.prototype.filter||(Array.prototype.filter=function(e){"use strict";if(this==null)throw new TypeError;var t=Object(this),n=t.length>>>0;if(typeof e!="function")try{throw new TypeError}catch(r){return}var i=[],s=arguments[1];for(var o=0;o0)for(var f=o.length-1;f>=0;f--)a.push(this.init_lib(o[f],u))}else for(var l in this.libs)a.push(this.init_lib(l,u));return typeof t=="function"&&u.unshift(t),this.response_obj(a,u)},response_obj:function(e,t){for(var n in t)if(typeof t[n]=="function")return t[n]({errors:e.filter(function(e){if(typeof e=="string")return e})});return e},init_lib:function(e,t){return this.trap(function(){if(this.libs.hasOwnProperty(e))return this.patch(this.libs[e]),this.libs[e].init.apply(this.libs[e],t)}.bind(this),e)},trap:function(e,t){if(!this.nc)try{return e()}catch(n){return this.error({name:t,message:"could not be initialized",more:n.name+" "+n.message})}return e()},patch:function(e){this.fix_outer(e)},inherit:function(e,t){var n=t.split(" ");for(var r=n.length-1;r>=0;r--)this.lib_methods.hasOwnProperty(n[r])&&(this.libs[e.name][n[r]]=this.lib_methods[n[r]])},libs:{},lib_methods:{set_data:function(e,t){var n=this.name+ +(new Date);Foundation.cache[n]=t,e.attr("data-"+this.name+"-id",n)},get_data:function(e){return Foundation.cache[e.attr("data-"+this.name+"-id")]},remove_data:function(e){e?(delete Foundation.cache[e.attr("data-"+this.name+"-id")],e.attr("data-"+this.name+"-id","")):$("[data-"+this.name+"-id]").each(function(){delete Foundation.cache[$(this).attr("data-"+this.name+"-id")],$(this).attr("data-"+this.name+"-id","")})},throttle:function(e,t){var n=null;return function(){var r=this,i=arguments;clearTimeout(n),n=setTimeout(function(){e.apply(r,i)},t)}},data_options:function(e){function o(e){return typeof e=="string"?$.trim(e):e}var t={},n,r,i=(e.attr("data-options")||":").split(";"),s=i.length;for(n=s-1;n>=0;n--)r=i[n].split(":"),/true/i.test(r[1])&&(r[1]=!0),/false/i.test(r[1])&&(r[1]=!1),r.length===2&&(t[o(r[0])]=o(r[1]));return t},delay:function(e,t){return setTimeout(e,t)},scrollTo:function(t,n,r){if(r<0)return;var i=n-$(e).scrollTop(),s=i/r*10;this.scrollToTimerCache=setTimeout(function(){isNaN(parseInt(s,10))||(e.scrollTo(0,$(e).scrollTop()+s),this.scrollTo(t,n,r-10))}.bind(this),10)},scrollLeft:function(e){if(!e.length)return;return"scrollLeft"in e[0]?e[0].scrollLeft:e[0].pageXOffset},empty:function(e){if(e.length&&e.length>0)return!1;if(e.length&&e.length===0)return!0;for(var t in e)if(hasOwnProperty.call(e,t))return!1;return!0}},fix_outer:function(e){e.outerHeight=function(e,t){return typeof Zepto=="function"?e.height():typeof t!="undefined"?e.outerHeight(t):e.outerHeight()},e.outerWidth=function(e){return typeof Zepto=="function"?e.width():typeof bool!="undefined"?e.outerWidth(bool):e.outerWidth()}},error:function(e){return e.name+" "+e.message+"; "+e.more},off:function(){return $(this.scope).off(".fndtn"),$(e).off(".fndtn"),!0},zj:function(){try{return Zepto}catch(e){return jQuery}}()},$.fn.foundation=function(){var e=Array.prototype.slice.call(arguments,0);return this.each(function(){return Foundation.init.apply(Foundation,[this].concat(e)),this})}}(this,this.document),function(e,t,n,r){"use strict";Foundation.libs.dropdown={name:"dropdown",version:"4.0.0",settings:{activeClass:"open"},init:function(t,n,r){return this.scope=t||this.scope,Foundation.inherit(this,"throttle"),typeof n=="object"&&e.extend(!0,this.settings,n),typeof n!="string"?(this.settings.init||this.events(),this.settings.init):this[n].call(this,r)},events:function(){var n=this;e(this.scope).on("click.fndtn.dropdown","[data-dropdown]",function(t){t.preventDefault(),t.stopPropagation(),n.toggle(e(this))}),e("*, html, body").on("click.fndtn.dropdown",function(t){e(t.target).data("dropdown")||e("[data-dropdown-content]").css("left","-99999px").removeClass(n.settings.activeClass)}),e("[data-dropdown-content]").on("click.fndtn.dropdown",function(e){e.stopPropagation()}),e(t).on("resize.fndtn.dropdown",n.throttle(function(){n.resize.call(n)},50)).trigger("resize"),this.settings.init=!0},toggle:function(t,n){var r=e("#"+t.data("dropdown"));e("[data-dropdown-content]").not(r).css("left","-99999px"),r.hasClass(this.settings.activeClass)?r.css("left","-99999px").removeClass(this.settings.activeClass):this.css(r.addClass(this.settings.activeClass),t)},resize:function(){var t=e("[data-dropdown-content].open"),n=e("[data-dropdown='"+t.attr("id")+"']");t.length&&n.length&&this.css(t,n)},css:function(e,t){var n=t.offset();return this.small()?e.css({position:"absolute",width:"95%",left:"2.5%","max-width":"none",top:n.top+this.outerHeight(t)}):e.attr("style","").css({position:"absolute",top:n.top+this.outerHeight(t),left:n.left}),e},small:function(){return e(t).width()<768||e("html").hasClass("lt-ie9")},off:function(){e(this.scope).off(".fndtn.dropdown"),e("html, body").off(".fndtn.dropdown"),e(t).off(".fndtn.dropdown"),e("[data-dropdown-content]").off(".fndtn.dropdown"),this.settings.init=!1}}}(Foundation.zj,this,this.document),function(e,t,n,r){"use strict";Foundation.libs.alerts={name:"alerts",version:"4.0.0",settings:{speed:300,callback:function(){}},init:function(t,n,r){return this.scope=t||this.scope,typeof n=="object"&&e.extend(!0,this.settings,n),typeof n!="string"?(this.settings.init||this.events(),this.settings.init):this[n].call(this,r)},events:function(){var t=this;e(this.scope).on("click.fndtn.alerts","[data-alert] a.close",function(n){n.preventDefault(),e(this).closest("[data-alert]").fadeOut(t.speed,function(){e(this).remove(),t.settings.callback()})}),this.settings.init=!0},off:function(){e(this.scope).off(".fndtn.alerts")}}}(Foundation.zj,this,this.document),function(e,t,n,r){"use strict";Foundation.libs.clearing={name:"clearing",version:"4.0.0",settings:{templates:{viewing:'×'},close_selectors:".clearing-close",init:!1,locked:!1},init:function(t,n,r){return this.scope=this.scope||t,Foundation.inherit(this,"set_data get_data remove_data throttle"),typeof n=="object"&&(r=e.extend(!0,this.settings,n)),typeof n!="string"?(e(this.scope).find("ul[data-clearing]").each(function(){var t=Foundation.libs.clearing,n=e(this),r=r||{},i=t.get_data(n);i||(r.$parent=n.parent(),t.set_data(n,e.extend(!0,t.settings,r)),t.assemble(n.find("li")),t.settings.init||t.events().swipe_events())}),this.settings.init):this[n].call(this,r)},events:function(){var n=this;return e(this.scope).on("click.fndtn.clearing","ul[data-clearing] li",function(t,r,i){var r=r||e(this),i=i||r,s=n.get_data(r.parent());t.preventDefault(),s||n.init(),n.open(e(t.target),r,i),n.update_paddles(i)}).on("click.fndtn.clearing",".clearing-main-right",function(e){this.nav(e,"next")}.bind(this)).on("click.fndtn.clearing",".clearing-main-left",function(e){this.nav(e,"prev")}.bind(this)).on("click.fndtn.clearing",this.settings.close_selectors,function(e){Foundation.libs.clearing.close(e,this)}).on("keydown.fndtn.clearing",function(e){this.keydown(e)}.bind(this)),e(t).on("resize.fndtn.clearing",function(e){this.resize()}.bind(this)),this.settings.init=!0,this},swipe_events:function(){var t=this;e(this.scope).on("touchstart.fndtn.clearing",".visible-img",function(t){var n={start_page_x:t.touches[0].pageX,start_page_y:t.touches[0].pageY,start_time:(new Date).getTime(),delta_x:0,is_scrolling:r};e(this).data("swipe-transition",n),t.stopPropagation()}).on("touchmove.fndtn.clearing",".visible-img",function(n){if(n.touches.length>1||n.scale&&n.scale!==1)return;var r=e(this).data("swipe-transition");typeof r=="undefined"&&(r={}),r.delta_x=n.touches[0].pageX-r.start_page_x,typeof r.is_scrolling=="undefined"&&(r.is_scrolling=!!(r.is_scrolling||Math.abs(r.delta_x)'+this.outerHTML(r[0])+"",viewing:n.templates.viewing},s='
    '+i.viewing+i.grid+"
    ";return n.$parent.append(s)},open:function(e,t,n){var r=n.closest(".clearing-assembled"),i=r.find("div").first(),s=i.find(".visible-img"),o=s.find("img").not(e);this.locked()||(o.attr("src",this.load(e)),this.loaded(o,function(){r.addClass("clearing-blackout"),i.addClass("clearing-container"),s.show(),this.fix_height(n).caption(s.find(".clearing-caption"),e).center(o).shift(t,n,function(){n.siblings().removeClass("visible"),n.addClass("visible")})}.bind(this)))},close:function(t,n){t.preventDefault();var r=function(e){return/blackout/.test(e.selector)?e:e.closest(".clearing-blackout")}(e(n)),i,s;return n===t.target&&r&&(i=r.find("div").first(),s=i.find(".visible-img"),this.settings.prev_index=0,r.find("ul[data-clearing]").attr("style","").closest(".clearing-blackout").removeClass("clearing-blackout"),i.removeClass("clearing-container"),s.hide()),!1},keydown:function(t){var n=e(".clearing-blackout").find("ul[data-clearing]");t.which===39&&this.go(n,"next"),t.which===37&&this.go(n,"prev"),t.which===27&&e("a.clearing-close").trigger("click")},nav:function(t,n){var r=e(".clearing-blackout").find("ul[data-clearing]");t.preventDefault(),this.go(r,n)},resize:function(){var t=e(".clearing-blackout .visible-img").find("img");t.length&&this.center(t)},fix_height:function(t){var n=t.parent().children(),r=this;return n.each(function(){var t=e(this),n=t.find("img");t.height()>r.outerHeight(n)&&t.addClass("fix-height")}).closest("ul").width(n.length*100+"%"),this},update_paddles:function(e){var t=e.closest(".carousel").siblings(".visible-img");e.next().length?t.find(".clearing-main-right").removeClass("disabled"):t.find(".clearing-main-right").addClass("disabled"),e.prev().length?t.find(".clearing-main-left").removeClass("disabled"):t.find(".clearing-main-left").addClass("disabled")},center:function(e){return e.css({marginLeft:-(this.outerWidth(e)/2),marginTop:-(this.outerHeight(e)/2)}),this},load:function(e){var t=e.parent().attr("href");return this.preload(e),t?t:e.attr("src")},preload:function(e){this.img(e.closest("li").next()).img(e.closest("li").prev())},loaded:function(e,t){function n(){t()}function r(){this.one("load",n);if(/MSIE (\d+\.\d+);/.test(navigator.userAgent)){var e=this.attr("src"),t=e.match(/\?/)?"&":"?";t+="random="+(new Date).getTime(),this.attr("src",e+t)}}if(!e.attr("src")){n();return}this.complete||this.readyState===4?n():r.call(e)},img:function(e){if(e.length){var t=new Image,n=e.find("a");n.length?t.src=n.attr("href"):t.src=e.find("img").attr("src")}return this},caption:function(e,t){var n=t.data("caption");return n?e.text(n).show():e.text("").hide(),this},go:function(e,t){var n=e.find(".visible"),r=n[t]();r.length&&r.find("img").trigger("click",[n,r])},shift:function(e,t,n){var r=t.parent(),i=this.settings.prev_index||t.index(),s=this.direction(r,e,t),o=parseInt(r.css("left"),10),u=this.outerWidth(t),a;t.index()!==i&&!/skip/.test(s)?/left/.test(s)?(this.lock(),r.animate({left:o+u},300,this.unlock())):/right/.test(s)&&(this.lock(),r.animate({left:o-u},300,this.unlock())):/skip/.test(s)&&(a=t.index()-this.settings.up_count,this.lock(),a>0?r.animate({left:-(a*u)},300,this.unlock()):r.animate({left:0},300,this.unlock())),n()},direction:function(t,n,r){var i=t.find("li"),s=this.outerWidth(i)+this.outerWidth(i)/4,o=Math.floor(this.outerWidth(e(".clearing-container"))/s)-1,u=i.index(r),a;return this.settings.up_count=o,this.adjacent(this.settings.prev_index,u)?u>o&&u>this.settings.prev_index?a="right":u>o-1&&u<=this.settings.prev_index?a="left":a=!1:a="skip",this.settings.prev_index=u,a},adjacent:function(e,t){for(var n=t+1;n>=t-1;n--)if(n===e)return!0;return!1},lock:function(){this.settings.locked=!0},unlock:function(){this.settings.locked=!1},locked:function(){return this.settings.locked},outerHTML:function(e){return e.outerHTML||(new XMLSerializer).serializeToString(e)},off:function(){e(this.scope).off(".fndtn.clearing"),e(t).off(".fndtn.clearing"),this.remove_data(),this.settings.init=!1}}}(Foundation.zj,this,this.document),function(e,t,n){function f(e){var t={},r=/^jQuery\d+$/;return n.each(e.attributes,function(e,n){n.specified&&!r.test(n.name)&&(t[n.name]=n.value)}),t}function l(e,r){var i=this,s=n(i);if(i.value==s.attr("placeholder")&&s.hasClass("placeholder"))if(s.data("placeholder-password")){s=s.hide().next().show().attr("id",s.removeAttr("id").data("placeholder-id"));if(e===!0)return s[0].value=r;s.focus()}else i.value="",s.removeClass("placeholder"),i==t.activeElement&&i.select()}function c(){var e,t=this,r=n(t),i=r,s=this.id;if(t.value==""){if(t.type=="password"){if(!r.data("placeholder-textinput")){try{e=r.clone().attr({type:"text"})}catch(o){e=n("").attr(n.extend(f(this),{type:"text"}))}e.removeAttr("name").data({"placeholder-password":!0,"placeholder-id":s}).bind("focus.placeholder",l),r.data({"placeholder-textinput":e,"placeholder-id":s}).before(e)}r=r.removeAttr("id").hide().prev().attr("id",s).show()}r.addClass("placeholder"),r[0].value=r.attr("placeholder")}else r.removeClass("placeholder")}var r="placeholder"in t.createElement("input"),i="placeholder"in t.createElement("textarea"),s=n.fn,o=n.valHooks,u,a;r&&i?(a=s.placeholder=function(){return this},a.input=a.textarea=!0):(a=s.placeholder=function(){var e=this;return e.filter((r?"textarea":":input")+"[placeholder]").not(".placeholder").bind({"focus.placeholder":l,"blur.placeholder":c}).data("placeholder-enabled",!0).trigger("blur.placeholder"),e},a.input=r,a.textarea=i,u={get:function(e){var t=n(e);return t.data("placeholder-enabled")&&t.hasClass("placeholder")?"":e.value},set:function(e,r){var i=n(e);return i.data("placeholder-enabled")?(r==""?(e.value=r,e!=t.activeElement&&c.call(e)):i.hasClass("placeholder")?l.call(e,!0,r)||(e.value=r):e.value=r,i):e.value=r}},r||(o.input=u),i||(o.textarea=u),n(function(){n(t).delegate("form","submit.placeholder",function(){var e=n(".placeholder",this).each(l);setTimeout(function(){e.each(c)},10)})}),n(e).bind("beforeunload.placeholder",function(){n(".placeholder").each(function(){this.value=""})}))}(this,document,Foundation.zj),function(e,t,n,r){"use strict";Foundation.libs.forms={name:"forms",version:"4.0.4",settings:{disable_class:"no-custom"},init:function(t,n,r){return this.scope=t||this.scope,typeof n=="object"&&e.extend(!0,this.settings,n),typeof n!="string"?(this.settings.init||this.events(),this.assemble(),this.settings.init):this[n].call(this,r)},assemble:function(){e('form.custom input[type="radio"]',e(this.scope)).not('[data-customforms="disabled"]').each(this.append_custom_markup),e('form.custom input[type="checkbox"]',e(this.scope)).not('[data-customforms="disabled"]').each(this.append_custom_markup),e("form.custom select",e(this.scope)).not('[data-customforms="disabled"]').each(this.append_custom_select)},events:function(){var t=this;e(this.scope).on("change.fndtn.forms",'form.custom select:not([data-customforms="disabled"])',function(n){t.refresh_custom_select(e(this))}).on("click.fndtn.forms","form.custom label",function(n){var r=e("#"+t.escape(e(this).attr("for"))+':not([data-customforms="disabled"])'),i,s;r.length!==0&&(r.attr("type")==="checkbox"?(n.preventDefault(),i=e(this).find("span.custom.checkbox"),i.length==0&&(i=e(this).next("span.custom.checkbox")),i.length==0&&(i=e(this).prev("span.custom.checkbox")),t.toggle_checkbox(i)):r.attr("type")==="radio"&&(n.preventDefault(),s=e(this).find("span.custom.radio"),s.length==0&&(s=e(this).next("span.custom.radio")),s.length==0&&(s=e(this).prev("span.custom.radio")),t.toggle_radio(s)))}).on("click.fndtn.forms","form.custom div.custom.dropdown a.current, form.custom div.custom.dropdown a.selector",function(n){var r=e(this),i=r.closest("div.custom.dropdown"),s=i.prev();i.hasClass("open")||e(t.scope).trigger("click"),n.preventDefault();if(!1===s.is(":disabled"))return i.toggleClass("open"),i.hasClass("open")?e(t.scope).on("click.fndtn.forms.customdropdown",function(){i.removeClass("open"),e(t.scope).off(".fndtn.forms.customdropdown")}):e(t.scope).on(".fndtn.forms.customdropdown"),!1}).on("click.fndtn.forms touchend.fndtn.forms","form.custom div.custom.dropdown li",function(t){var n=e(this),r=n.closest("div.custom.dropdown"),i=r.prev(),s=0;t.preventDefault(),t.stopPropagation();if(!e(this).hasClass("disabled")){e("div.dropdown").not(r).removeClass("open");var o=n.closest("ul").find("li.selected");o.removeClass("selected"),n.addClass("selected"),r.removeClass("open").find("a.current").html(n.html()),n.closest("ul").find("li").each(function(e){n[0]==this&&(s=e)}),i[0].selectedIndex=s,i.data("prevalue",o.html()),i.trigger("change")}}),this.settings.init=!0},append_custom_markup:function(t,n){var r=e(n).hide(),i=r.attr("type"),s=r.next("span.custom."+i);s.length===0&&(s=e('').insertAfter(r)),s.toggleClass("checked",r.is(":checked")),s.toggleClass("disabled",r.is(":disabled"))},append_custom_select:function(t,n){var r=Foundation.libs.forms,i=e(n),s=i.next("div.custom.dropdown"),o=s.find("ul"),u=s.find(".current"),a=s.find(".selector"),f=i.find("option"),l=f.filter(":selected"),c=i.attr("class")?i.attr("class").split(" "):[],h=0,p="",d,v=!1;if(i.hasClass(r.settings.disable_class))return;if(s.length===0){var m=i.hasClass("small")?"small":i.hasClass("medium")?"medium":i.hasClass("large")?"large":i.hasClass("expand")?"expand":"";s=e('
      '),a=s.find(".selector"),o=s.find("ul"),p=f.map(function(){return"
    • "+e(this).html()+"
    • "}).get().join(""),o.append(p),v=s.prepend(''+l.html()+"").find(".current"),i.after(s).hide()}else p=f.map(function(){return"
    • "+e(this).html()+"
    • "}).get().join(""),o.html("").append(p);s.toggleClass("disabled",i.is(":disabled")),d=o.find("li"),f.each(function(t){this.selected&&(d.eq(t).addClass("selected"),v&&v.html(e(this).html())),e(this).is(":disabled")&&d.eq(t).addClass("disabled")});if(!s.is(".small, .medium, .large, .expand")){s.addClass("open");var r=Foundation.libs.forms;r.hidden_fix.adjust(o),h=r.outerWidth(d)>h?r.outerWidth(d):h,Foundation.libs.forms.hidden_fix.reset(),s.removeClass("open")}},refresh_custom_select:function(t){var n=this,r=0,i=t.next(),s=t.find("option");i.find("ul").html(""),s.each(function(){var t=e("
    • "+e(this).html()+"
    • ");i.find("ul").append(t)}),s.each(function(t){this.selected&&(i.find("li").eq(t).addClass("selected"),i.find(".current").html(e(this).html())),e(this).is(":disabled")&&i.find("li").eq(t).addClass("disabled")}),i.removeAttr("style").find("ul").removeAttr("style"),i.find("li").each(function(){i.addClass("open"),n.outerWidth(e(this))>r&&(r=n.outerWidth(e(this))),i.removeClass("open")})},toggle_checkbox:function(e){var t=e.prev(),n=t[0];!1===t.is(":disabled")&&(n.checked=n.checked?!1:!0,e.toggleClass("checked"),t.trigger("change"))},toggle_radio:function(e){var t=e.prev(),n=t.closest("form.custom"),r=t[0];!1===t.is(":disabled")&&(n.find('input[type="radio"][name="'+this.escape(t.attr("name"))+'"]').next().not(e).removeClass("checked"),e.hasClass("checked")||e.toggleClass("checked"),r.checked=e.hasClass("checked"),t.trigger("change"))},escape:function(e){return e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")},hidden_fix:{tmp:[],hidden:null,adjust:function(t){var n=this;n.hidden=t.parents().andSelf().filter(":hidden"),n.hidden.each(function(){var t=e(this);n.tmp.push(t.attr("style")),t.css({visibility:"hidden",display:"block"})})},reset:function(){var t=this;t.hidden.each(function(n){var i=e(this),s=t.tmp[n];s===r?i.removeAttr("style"):i.attr("style",s)}),t.tmp=[],t.hidden=null}},off:function(){e(this.scope).off(".fndtn.forms")}}}(Foundation.zj,this,this.document),function(e,t,n){function i(e){return e}function s(e){return decodeURIComponent(e.replace(r," "))}var r=/\+/g,o=e.cookie=function(r,u,a){if(u!==n){a=e.extend({},o.defaults,a),u===null&&(a.expires=-1);if(typeof a.expires=="number"){var f=a.expires,l=a.expires=new Date;l.setDate(l.getDate()+f)}return u=o.json?JSON.stringify(u):String(u),t.cookie=[encodeURIComponent(r),"=",o.raw?u:encodeURIComponent(u),a.expires?"; expires="+a.expires.toUTCString():"",a.path?"; path="+a.path:"",a.domain?"; domain="+a.domain:"",a.secure?"; secure":""].join("")}var c=o.raw?i:s,h=t.cookie.split("; ");for(var p=0,d=h.length;p×',timer:'
      ',tip:'
      ',wrapper:'
      ',button:''}},settings:{},init:function(t,n,r){return this.scope=t||this.scope,Foundation.inherit(this,"throttle data_options scrollTo scrollLeft delay"),typeof n=="object"?e.extend(!0,this.settings,this.defaults,n):e.extend(!0,this.settings,this.defaults,r),typeof n!="string"?(this.settings.init||this.events(),this.settings.init):this[n].call(this,r)},events:function(){var n=this;e(this.scope).on("click.joyride",".joyride-next-tip, .joyride-modal-bg",function(e){e.preventDefault(),this.settings.$li.next().length<1?this.end():this.settings.timer>0?(clearTimeout(this.settings.automate),this.hide(),this.show(),this.startTimer()):(this.hide(),this.show())}.bind(this)).on("click.joyride",".joyride-close-tip",function(e){e.preventDefault(),this.end()}.bind(this)),e(t).on("resize.fndtn.joyride",n.throttle(function(){e("[data-joyride]").length>0&&n.settings.$next_tip&&(n.is_phone()?n.pos_phone():n.pos_default())},100)),this.settings.init=!0},start:function(){var t=this,n=e(this.scope).find("[data-joyride]"),r=["timer","scrollSpeed","startOffset","tipAnimationFadeSpeed","cookieExpires"],i=r.length;this.settings.init||this.init(),e.extend(!0,this.settings,this.data_options(n)),this.settings.$content_el=n,this.settings.body_offset=e(this.settings.tipContainer).position(),this.settings.$tip_content=this.settings.$content_el.find("> li"),this.settings.paused=!1,this.settings.attempts=0;for(var s=i-1;s>=0;s--)this.settings[r[s]]=parseInt(this.settings[r[s]],10);this.settings.tipLocationPatterns={top:["bottom"],bottom:[],left:["right","top","bottom"],right:["left","top","bottom"]},typeof e.cookie!="function"&&(this.settings.cookieMonster=!1);if(!this.settings.cookieMonster||this.settings.cookieMonster&&e.cookie(this.settings.cookieName)===null)this.settings.$tip_content.each(function(n){t.create({$li:e(this),index:n})}),!this.settings.startTimerOnClick&&this.settings.timer>0?(this.show("init"),this.startTimer()):this.show("init")},resume:function(){this.set_li(),this.show()},tip_template:function(t){var n,r;return t.tip_class=t.tip_class||"",n=e(this.settings.template.tip).addClass(t.tip_class),r=e.trim(e(t.li).html())+this.button_text(t.button_text)+this.settings.template.link+this.timer_instance(t.index),n.append(e(this.settings.template.wrapper)),n.first().attr("data-index",t.index),e(".joyride-content-wrapper",n).append(r),n[0]},timer_instance:function(t){var n;return t===0&&this.settings.startTimerOnClick&&this.settings.timer>0||this.settings.timer===0?n="":n=this.outerHTML(e(this.settings.template.timer)[0]),n},button_text:function(t){return this.settings.nextButton?(t=e.trim(t)||"Next",t=this.outerHTML(e(this.settings.template.button).append(t)[0])):t="",t},create:function(t){var n=t.$li.attr("data-button")||t.$li.attr("data-text"),r=t.$li.attr("class"),i=e(this.tip_template({tip_class:r,index:t.index,button_text:n,li:t.$li}));e(this.settings.tipContainer).append(i)},show:function(t){var n=null;this.settings.$li===r||e.inArray(this.settings.$li.index(),this.settings.pauseAfter)===-1?(this.settings.paused?this.settings.paused=!1:this.set_li(t),this.settings.attempts=0,this.settings.$li.length&&this.settings.$target.length>0?(this.settings.tipSettings=e.extend(!0,this.settings,this.data_options(this.settings.$li)),this.settings.timer=parseInt(this.settings.timer,10),this.settings.tipSettings.tipLocationPattern=this.settings.tipLocationPatterns[this.settings.tipSettings.tipLocation],/body/i.test(this.settings.$target.selector)||this.scroll_to(),this.is_phone()?this.pos_phone(!0):this.pos_default(!0),n=this.settings.$next_tip.find(".joyride-timer-indicator"),/pop/i.test(this.settings.tipAnimation)?(n.width(0),thsi.settings.timer>0?(this.settings.$next_tip.show(),this.delay(function(){n.animate({width:n.parent().width()},this.settings.timer,"linear")}.bind(this),this.settings.tipAnimationFadeSpeed)):this.settings.$next_tip.show()):/fade/i.test(this.settings.tipAnimation)&&(n.width(0),this.settings.timer>0?(this.settings.$next_tip.fadeIn(this.settings.tipAnimationFadeSpeed).show(),this.delay(function(){n.animate({width:n.parent().width()},this.settings.timer,"linear")}.bind(this),this.settings.tipAnimationFadeSpeed)):this.settings.$next_tip.fadeIn(this.settings.tipAnimationFadeSpeed)),this.settings.$current_tip=this.settings.$next_tip):this.settings.$li&&this.settings.$target.length<1?this.show():this.end()):this.settings.paused=!0},is_phone:function(){return Modernizr?Modernizr.mq("only screen and (max-width: 767px)")||e(".lt-ie9").length>0:this.settings.$window.width()<767?!0:!1},hide:function(){this.settings.postStepCallback(this.settings.$li.index(),this.settings.$current_tip),e(".joyride-modal-bg").hide(),this.settings.$current_tip.hide()},set_li:function(e){e?(this.settings.$li=this.settings.$tip_content.eq(this.settings.startOffset),this.set_next_tip(),this.settings.$current_tip=this.settings.$next_tip):(this.settings.$li=this.settings.$li.next(),this.set_next_tip()),this.set_target()},set_next_tip:function(){this.settings.$next_tip=e(".joyride-tip-guide[data-index='"+this.settings.$li.index()+"']"),this.settings.$next_tip.data("closed","")},set_target:function(){var t=this.settings.$li.attr("data-class"),r=this.settings.$li.attr("data-id"),i=function(){return r?e(n.getElementById(r)):t?e("."+t).first():e("body")};this.settings.$target=i()},scroll_to:function(){var n,r;n=e(t).height()/2,r=Math.ceil(this.settings.$target.offset().top-n+this.outerHeight(this.settings.$next_tip)),r>0&&this.scrollTo(e("html, body"),r,this.settings.scrollSpeed)},paused:function(){return e.inArray(this.settings.$li.index()+1,this.settings.pauseAfter)===-1?!0:!1},restart:function(){this.hide(),this.settings.$li=r,this.show("init")},pos_default:function(n){var r=Math.ceil(e(t).height()/2),i=this.settings.$next_tip.offset(),s=this.settings.$next_tip.find(".joyride-nub"),o=Math.ceil(this.outerHeight(s)/2),u=n||!1;u&&(this.settings.$next_tip.css("visibility","hidden"),this.settings.$next_tip.show()),/body/i.test(this.settings.$target.selector)?this.settings.$li.length&&this.pos_modal(s):(this.bottom()?(this.settings.$next_tip.css({top:this.settings.$target.offset().top+o+this.outerHeight(this.settings.$target),left:this.settings.$target.offset().left}),this.nub_position(s,this.settings.tipSettings.nubPosition,"top")):this.top()?(this.settings.$next_tip.css({top:this.settings.$target.offset().top-this.outerHeight(this.settings.$next_tip)-o,left:this.settings.$target.offset().left}),this.nub_position(s,this.settings.tipSettings.nubPosition,"bottom")):this.right()?(this.settings.$next_tip.css({top:this.settings.$target.offset().top,left:this.outerWidth(this.settings.$target)+this.settings.$target.offset().left}),this.nub_position(s,this.settings.tipSettings.nubPosition,"left")):this.left()&&(this.settings.$next_tip.css({top:this.settings.$target.offset().top,left:this.settings.$target.offset().left-this.outerWidth(this.settings.$next_tip)-o}),this.nub_position(s,this.settings.tipSettings.nubPosition,"right")),!this.visible(this.corners(this.settings.$next_tip))&&this.settings.attempts').show(),/pop/i.test(this.settings.tipAnimation)?e(".joyride-modal-bg").show():e(".joyride-modal-bg").fadeIn(this.settings.tipAnimationFadeSpeed))},center:function(){var n=e(t);return this.settings.$next_tip.css({top:(n.height()-this.outerHeight(this.settings.$next_tip))/2+n.scrollTop(),left:(n.width()-this.outerWidth(this.settings.$next_tip))/2+this.scrollLeft(n)}),!0},bottom:function(){return/bottom/i.test(this.settings.tipSettings.tipLocation)},top:function(){return/top/i.test(this.settings.tipSettings.tipLocation)},right:function(){return/right/i.test(this.settings.tipSettings.tipLocation)},left:function(){return/left/i.test(this.settings.tipSettings.tipLocation)},corners:function(n){var r=e(t),i=r.width()+this.scrollLeft(r),s=r.width()+r.scrollTop();return[n.offset().top<=r.scrollTop(),i<=n.offset().left+this.outerWidth(n),s<=n.offset().top+this.outerHeight(n),this.scrollLeft(r)>=n.offset().left]},visible:function(e){var t=e.length;while(t--)if(e[t])return!1;return!0},nub_position:function(e,t,n){t==="auto"?e.addClass(n):e.addClass(t)},startTimer:function(){this.settings.$li.length?this.settings.automate=setTimeout(function(){this.hide(),this.show(),this.startTimer()}.bind(this),this.settings.timer):clearTimeout(this.settings.automate)},end:function(){this.settings.cookieMonster&&e.cookie(this.settings.cookieName,"ridden",{expires:this.settings.cookieExpires,domain:this.settings.cookieDomain}),this.settings.timer>0&&clearTimeout(this.settings.automate),this.settings -.$next_tip.data("closed",!0),e(".joyride-modal-bg").hide(),this.settings.$current_tip.hide(),this.settings.postStepCallback(this.settings.$li.index(),this.settings.$current_tip),this.settings.postRideCallback(this.settings.$li.index(),this.settings.$current_tip)},outerHTML:function(e){return e.outerHTML||(new XMLSerializer).serializeToString(e)},off:function(){e(this.scope).off(".joyride"),e(t).off(".joyride"),e(".joyride-close-tip, .joyride-next-tip, .joyride-modal-bg").off(".joyride"),e(".joyride-tip-guide, .joyride-modal-bg").remove(),clearTimeout(this.settings.automate),this.settings={}}}}(Foundation.zj,this,this.document),function(e,t,n,r){"use strict";Foundation.libs.magellan={name:"magellan",version:"4.0.0",settings:{activeClass:"active"},init:function(t,n,r){return this.scope=t||this.scope,Foundation.inherit(this,"data_options"),typeof n=="object"&&e.extend(!0,this.settings,n),typeof n!="string"?(this.settings.init||(this.fixed_magellan=e("[data-magellan-expedition]"),this.set_threshold(),this.last_destination=e("[data-magellan-destination]").last(),this.events()),this.settings.init):this[n].call(this,r)},events:function(){var n=this;e(this.scope).on("arrival.fndtn.magellan","[data-magellan-arrival]",function(t){var r=e(this),i=r.closest("[data-magellan-expedition]"),s=i.attr("data-magellan-active-class")||n.settings.activeClass;r.closest("[data-magellan-expedition]").find("[data-magellan-arrival]").not(r).removeClass(s),r.addClass(s)}),this.fixed_magellan.on("update-position.fndtn.magellan",function(){var t=e(this)}).trigger("update-position"),e(t).on("resize.fndtn.magellan",function(){this.fixed_magellan.trigger("update-position")}.bind(this)).on("scroll.fndtn.magellan",function(){var r=e(t).scrollTop();n.fixed_magellan.each(function(){var t=e(this);typeof t.data("magellan-top-offset")=="undefined"&&t.data("magellan-top-offset",t.offset().top),typeof t.data("magellan-fixed-position")=="undefined"&&t.data("magellan-fixed-position",!1);var i=r+n.settings.threshold>t.data("magellan-top-offset"),s=t.attr("data-magellan-top-offset");t.data("magellan-fixed-position")!=i&&(t.data("magellan-fixed-position",i),i?t.css({position:"fixed",top:0}):t.css({position:"",top:""}),i&&typeof s!="undefined"&&s!=0&&t.css({position:"fixed",top:s+"px"}))})}),this.last_destination.length>0&&e(t).on("scroll.fndtn.magellan",function(r){var i=e(t).scrollTop(),s=i+e(t).height(),o=Math.ceil(n.last_destination.offset().top);e("[data-magellan-destination]").each(function(){var t=e(this),r=t.attr("data-magellan-destination"),u=t.offset().top-i;u<=n.settings.threshold&&e("[data-magellan-arrival='"+r+"']").trigger("arrival"),s>=e(n.scope).height()&&o>i&&o0?this.outerHeight(this.fixed_magellan,!0):0)},off:function(){e(this.scope).off(".fndtn.magellan")}}}(Foundation.zj,this,this.document),function(e,t,n,r){"use strict";Foundation.libs=Foundation.libs||{},Foundation.libs.orbit={version:"4.0.0",settings:{timer_speed:1e4,animation_speed:500,bullets:!0,stack_on_small:!0,container_class:"orbit-container",stack_on_small_class:"orbit-stack-on-small",next_class:"orbit-next",prev_class:"orbit-prev",timer_container_class:"orbit-timer",timer_paused_class:"paused",timer_progress_class:"orbit-progress",slides_container_class:"orbit-slides-container",bullets_container_class:"orbit-bullets",bullets_active_class:"active",slide_number_class:"orbit-slide-number",caption_class:"orbit-caption",active_slide_class:"active",orbit_transition_class:"orbit-transitioning"},init:function(t,n,r){var i=this;typeof n=="object"&&e.extend(!0,i.settings,n),e("[data-orbit]",t).each(e.proxy(i._init,i))},_container_html:function(){var e=this;return'
      '},_bullets_container_html:function(t){var n=this,r=e('
        ');return t.each(function(t,i){var s=e('
      1. ');t===0&&s.addClass(n.settings.bullets_active_class),r.append(s)}),r},_slide_number_html:function(t,n){var r=this,i=e('
        ');return i.append(""+t+" of "+n+""),i},_timer_html:function(){var e=this;return typeof e.settings.timer_speed=="number"&&e.settings.timer_speed>0?'
        ':""},_next_html:function(){var e=this;return'Next '},_prev_html:function(){var e=this;return'Prev '},_init:function(t,n){var r=this,i=e(n),s=i.wrap(r._container_html()).parent(),o=i.children();s.append(r._prev_html()),s.append(r._next_html()),i.addClass(r.settings.slides_container_class),r.settings.stack_on_small&&s.addClass(r.settings.stack_on_small_class),s.append(r._slide_number_html(1,o.length)),s.append(r._timer_html()),r.settings.bullets&&s.after(r._bullets_container_html(o)),i.append(o.first().clone().attr("data-orbit-slide","")),i.prepend(o.last().clone().attr("data-orbit-slide","")),i.css("marginLeft","-100%"),o.first().addClass(r.settings.active_slide_class),r._init_events(i),r._init_dimensions(i),r._start_timer(i)},_init_events:function(i){var s=this,o=i.parent();e(t).on("load.fndtn.orbit",function(){i.height(""),i.height(i.height(o.height())),i.trigger("orbit:ready")}).on("resize.fndtn.orbit",function(){i.height(""),i.height(i.height(o.height()))}),e(n).on("click.fndtn.orbit","[data-orbit-link]",function(t){t.preventDefault();var n=e(t.currentTarget).attr("data-orbit-link"),r=i.find("[data-orbit-slide="+n+"]").first();r.length===1&&(s._reset_timer(i,!0),s.goto(i,r.index(),function(){}))}),o.siblings("."+s.settings.bullets_container_class).on("click.fndtn.orbit","[data-orbit-slide-number]",function(t){t.preventDefault(),s._reset_timer(i,!0),s.goto(i,e(t.currentTarget).data("orbit-slide-number"),function(){})}),o.on("orbit:after-slide-change.fndtn.orbit",function(e,t){var n=o.find("."+s.settings.slide_number_class);n.length===1&&n.replaceWith(s._slide_number_html(t.slide_number,t.total_slides))}).on("orbit:next-slide.fndtn.orbit click.fndtn.orbit","."+s.settings.next_class,function(e){e.preventDefault(),s._reset_timer(i,!0),s.goto(i,"next",function(){})}).on("orbit:prev-slide.fndtn.orbit click.fndtn.orbit","."+s.settings.prev_class,function(e){e.preventDefault(),s._reset_timer(i,!0),s.goto(i,"prev",function(){})}).on("orbit:toggle-play-pause.fndtn.orbit click.fndtn.orbit touchstart.fndtn.orbit","."+s.settings.timer_container_class,function(t){t.preventDefault();var n=e(t.currentTarget).toggleClass(s.settings.timer_paused_class),r=n.closest("."+s.settings.container_class).find("."+s.settings.slides_container_class);n.hasClass(s.settings.timer_paused_class)?s._stop_timer(r):s._start_timer(r)}).on("touchstart.fndtn.orbit",function(e){e.touches||(e=e.originalEvent);var t={start_page_x:e.touches[0].pageX,start_page_y:e.touches[0].pageY,start_time:(new Date).getTime(),delta_x:0,is_scrolling:r};o.data("swipe-transition",t),e.stopPropagation()}).on("touchmove.fndtn.orbit",function(e){e.touches||(e=e.originalEvent);if(e.touches.length>1||e.scale&&e.scale!==1)return;var t=o.data("swipe-transition");typeof t=="undefined"&&(t={}),t.delta_x=e.touches[0].pageX-t.start_page_x,typeof t.is_scrolling=="undefined"&&(t.is_scrolling=!!(t.is_scrolling||Math.abs(t.delta_x)0&&this.hide(e,this.settings.css.close),t.filter(":visible").length>0?this.hide(t,this.settings.css.close):this.show(t,this.settings.css.open)},toggle_bg:function(t){this.settings.bg.length===0&&(this.settings.bg=e("
        ",{"class":this.settings.bgClass}).insertAfter(t)),this.settings.bg.filter(":visible").length>0?this.hide(this.settings.bg):this.show(this.settings.bg)},show:function(n,r){if(r){if(/pop/i.test(this.settings.animation)){r.top=e(t).scrollTop()-n.data("offset")+"px";var i={top:e(t).scrollTop()+n.data("css-top")+"px",opacity:1};return this.delay(function(){return n.css(r).animate(i,this.settings.animationSpeed,"linear",function(){this.locked=!1,n.trigger("opened")}.bind(this)).addClass("open")}.bind(this),this.settings.animationSpeed/2)}if(/fade/i.test(this.settings.animation)){var i={opacity:1};return this.delay(function(){return n.css(r).animate(i,this.settings.animationSpeed,"linear",function(){this.locked=!1,n.trigger("opened")}.bind(this)).addClass("open")}.bind(this),this.settings.animationSpeed/2)}return n.css(r).show().css({opacity:1}).addClass("open").trigger("opened")}return/fade/i.test(this.settings.animation)?n.fadeIn(this.settings.animationSpeed/2):n.show()},hide:function(n,r){if(r){if(/pop/i.test(this.settings.animation)){var i={top:-e(t).scrollTop()-n.data("offset")+"px",opacity:0};return this.delay(function(){return n.animate(i,this.settings.animationSpeed,"linear",function(){this.locked=!1,n.css(r).trigger("closed")}.bind(this)).removeClass("open")}.bind(this),this.settings.animationSpeed/2)}if(/fade/i.test(this.settings.animation)){var i={opacity:0};return this.delay(function(){return n.animate(i,this.settings.animationSpeed,"linear",function(){this.locked=!1,n.css(r).trigger("closed")}.bind(this)).removeClass("open")}.bind(this),this.settings.animationSpeed/2)}return n.hide().css(r).removeClass("open").trigger("closed")}return/fade/i.test(this.settings.animation)?n.fadeOut(this.settings.animationSpeed/2):n.hide()},close_video:function(t){var n=e(this).find(".flex-video"),r=n.find("iframe");r.length>0&&(r.attr("data-src",r[0].src),r.attr("src","about:blank"),n.fadeOut(100).hide())},open_video:function(t){var n=e(this).find(".flex-video"),r=n.find("iframe");if(r.length>0){var i=r.attr("data-src");typeof i=="string"&&(r[0].src=r.attr("data-src")),n.show().fadeIn(100)}},cache_offset:function(e){var t=e.show().height()+parseInt(e.css("top"),10);return e.hide(),t},off:function(){e(this.scope).off(".fndtn.reveal")}}}(Foundation.zj,this,this.document),function(e,t,n,r){"use strict";Foundation.libs.section={name:"section",version:"4.0.5",settings:{deep_linking:!1,one_up:!0,callback:function(){}},init:function(t,n,r){return this.scope=t||this.scope,Foundation.inherit(this,"throttle data_options"),typeof n=="object"&&e.extend(!0,this.settings,n),typeof n!="string"?(this.set_active_from_hash(),this.settings.init||this.events(),this.settings.init):this[n].call(this,r)},events:function(){var n=this;e(this.scope).on("click.fndtn.section","[data-section] .title",function(t){e.extend(!0,n.settings,n.data_options(e(this).closest("[data-section]"))),n.toggle_active.call(this,t,n)}),e(t).on("resize.fndtn.section",n.throttle(function(){n.resize.call(this)},30)).trigger("resize"),e("[data-section] .content").on("click.fndtn.section",function(e){e.stopPropagation()}),e("*, html, body").on("click.fndtn.section",function(t){e(t.target).closest(".title").length<1&&e("[data-section].vertical-nav, [data-section].horizontal-nav").find("section, .section").removeClass("active").attr("style","")}),this.settings.init=!0},toggle_active:function(t,n){var r=e(this),i=r.closest("section, .section"),s=i.find(".content"),o=i.closest("[data-section]"),n=Foundation.libs.section;!n.settings.deep_linking&&s.length>0&&t.preventDefault();if(i.hasClass("active"))(n.small(o)||n.is_vertical(o)||n.is_horizontal(o)||n.is_accordion(o))&&i.removeClass("active").attr("style","");else{if(n.small(o)||n.settings.one_up)r.closest("[data-section]").find("section, .section").removeClass("active").attr("style",""),i.css("padding-top",n.outerHeight(i.find(".title")));e("[data-section].vertical-nav, [data-section].horizontal-nav").find("section, .section").removeClass("active").attr("style",""),n.small(o)&&i.attr("style",""),i.addClass("active")}n.settings.callback()},resize:function(){var t=e("[data-section]"),n=Foundation.libs.section;t.each(function(){var t=e(this),r=t.find("section.active, .section.active");if(r.length>1)r.not(":first").removeClass("active").attr("style","");else if(r.length<1&&!n.is_vertical(t)&&!n.is_horizontal(t)&&!n.is_accordion(t)){var i=t.find("section, .section").first();i.addClass("active"),n.small(t)?i.attr("style",""):i.css("padding-top",n.outerHeight(i.find(".title")))}n.small(t)?r.attr("style",""):r.css("padding-top",n.outerHeight(r.find(".title"))),n.position_titles(t),n.is_horizontal(t)&&!n.small(t)?n.position_content(t):n.position_content(t,!1)})},is_vertical:function(e){return e.hasClass("vertical-nav")},is_horizontal:function(e){return e.hasClass("horizontal-nav")},is_accordion:function(e){return e.hasClass("accordion")},set_active_from_hash:function(){var n=t.location.hash.substring(1),r=e("[data-section]"),i=this;r.each(function(){var t=e(this);e.extend(!0,i.settings,i.data_options(t)),n.length>0&&i.settings.deep_linking&&t.find('.content[data-slug="'+n+'"]').closest("section, .section").addClass("active")})},position_titles:function(t,n){var r=t.find(".title"),i=0,s=this;typeof n=="boolean"?r.attr("style",""):r.each(function(){e(this).css("left",i),i+=s.outerWidth(e(this))})},position_content:function(t,n){var r=t.find(".title"),i=t.find(".content"),s=this;typeof n=="boolean"?(i.attr("style",""),t.attr("style","")):(t.find("section, .section").each(function(){var t=e(this).find(".title"),n=e(this).find(".content");n.css({left:t.position().left-1,top:s.outerHeight(t)-2})}),typeof Zepto=="function"?t.height(this.outerHeight(r.first())):t.height(this.outerHeight(r.first())-2))},small:function(t){return t&&this.is_accordion(t)?!0:e("html").hasClass("lt-ie9")?!0:e("html").hasClass("ie8compat")?!0:e(this.scope).width()<768},off:function(){e(this.scope).off(".fndtn.section"),e(t).off(".fndtn.section"),this.settings.init=!1}}}(Foundation.zj,this,this.document),function(e,t,n,r){"use strict";Foundation.libs.tooltips={name:"tooltips",version:"4.0.2",settings:{selector:".has-tip",additionalInheritableClasses:[],tooltipClass:".tooltip",tipTemplate:function(e,t){return''+t+''}},cache:{},init:function(t,n,r){var i=this;this.scope=t||this.scope,typeof n=="object"&&e.extend(!0,this.settings,n);if(typeof n=="string")return this[n].call(this,r);Modernizr.touch?e(this.scope).on("click.fndtn.tooltip touchstart.fndtn.tooltip touchend.fndtn.tooltip","[data-tooltip]",function(t){t.preventDefault(),e(i.settings.tooltipClass).hide(),i.showOrCreateTip(e(this))}).on("click.fndtn.tooltip touchstart.fndtn.tooltip touchend.fndtn.tooltip",this.settings.tooltipClass,function(t){t.preventDefault(),e(this).fadeOut(150)}):e(this.scope).on("mouseenter.fndtn.tooltip mouseleave.fndtn.tooltip","[data-tooltip]",function(t){var n=e(this);t.type==="mouseover"||t.type==="mouseenter"?i.showOrCreateTip(n):(t.type==="mouseout"||t.type==="mouseleave")&&i.hide(n)})},showOrCreateTip:function(e){var t=this.getTip(e);return t&&t.length>0?this.show(e):this.create(e)},getTip:function(t){var n=this.selector(t),r=null;return n&&(r=e("span[data-selector="+n+"]"+this.settings.tooltipClass)),typeof r=="object"?r:!1},selector:function(e){var t=e.attr("id"),n=e.attr("data-tooltip")||e.attr("data-selector");return(t&&t.length<1||!t)&&typeof n!="string"&&(n="tooltip"+Math.random().toString(36).substring(7),e.attr("data-selector",n)),t&&t.length>0?t:n},create:function(t){var n=e(this.settings.tipTemplate(this.selector(t),e("
        ").html(t.attr("title")).html())),r=this.inheritable_classes(t);n.addClass(r).appendTo("body"),Modernizr.touch&&n.append('tap to close '),t.removeAttr("title").attr("title",""),this.show(t)},reposition:function(n,r,i){var s,o,u,a,f,l;r.css("visibility","hidden").show(),s=n.data("width"),o=r.children(".nub"),u=this.outerHeight(o),a=this.outerHeight(o),l=function(e,t,n,r,i,s){return e.css({top:t?t:"auto",bottom:r?r:"auto",left:i?i:"auto",right:n?n:"auto",width:s?s:"auto"}).end()},l(r,n.offset().top+this.outerHeight(n)+10,"auto","auto",n.offset().left,s),e(t).width()<767?(l(r,n.offset().top+this.outerHeight(n)+10,"auto","auto",12.5,e(this.scope).width()),r.addClass("tip-override"),l(o,-u,"auto","auto",n.offset().left)):(l(r,n.offset().top+this.outerHeight(n)+10,"auto","auto",n.offset().left,s),r.removeClass("tip-override"),i&&i.indexOf("tip-top")>-1?l(r,n.offset().top-this.outerHeight(r),"auto","auto",n.offset().left,s).removeClass("tip-override"):i&&i.indexOf("tip-left")>-1?l(r,n.offset().top+this.outerHeight(n)/2-u*2.5,"auto","auto",n.offset().left-this.outerWidth(r)-u,s).removeClass("tip-override"):i&&i.indexOf("tip-right")>-1&&l(r,n.offset().top+this.outerHeight(n)/2-u*2.5,"auto","auto",n.offset().left+this.outerWidth(n)+u,s).removeClass("tip-override")),r.css("visibility","visible").hide()},inheritable_classes:function(t){var n=["tip-top","tip-left","tip-bottom","tip-right","noradius"].concat(this.settings.additionalInheritableClasses),r=t.attr("class"),i=r?e.map(r.split(" "),function(t,r){if(e.inArray(t,n)!==-1)return t}).join(" "):"";return e.trim(i)},show:function(e){var t=this.getTip(e);this.reposition(e,t,e.attr("class")),t.fadeIn(150)},hide:function(e){var t=this.getTip(e);t.fadeOut(150)},reload:function(){var t=e(this);return t.data("fndtn-tooltips")?t.foundationTooltips("destroy").foundationTooltips("init"):t.foundationTooltips("init")},off:function(){e(this.scope).off(".fndtn.tooltip"),e(this.settings.tooltipClass).each(function(t){e("[data-tooltip]").get(t).attr("title",e(this).text())}).remove()}}}(Foundation.zj,this,this.document),function(e,t,n,r){"use strict";Foundation.libs.topbar={name:"topbar",version:"4.0.0",settings:{index:0,stickyClass:"sticky",custom_back_text:!0,back_text:"Back",init:!1},init:function(n,r,i){var s=this;return this.scope=n||this.scope,typeof r=="object"&&e.extend(!0,this.settings,r),typeof r!="string"?(e("nav.top-bar").each(function(){s.settings.$w=e(t),s.settings.$topbar=e(this),s.settings.$section=s.settings.$topbar.find("section"),s.settings.$titlebar=s.settings.$topbar.children("ul").first(),s.settings.$topbar.data("index",0);var n=e("
        ").insertAfter(s.settings.$topbar);s.settings.breakPoint=n.width(),n.remove(),s.assemble(),s.settings.$topbar.parent().hasClass("fixed")&&e("body").css("padding-top",s.outerHeight(s.settings.$topbar))}),s.settings.init||this.events(),this.settings.init):this[r].call(this,i)},events:function(){var n=this;e(this.scope).on("click.fndtn.topbar",".top-bar .toggle-topbar",function(t){var r=e(this).closest(".top-bar"),i=r.find("section, .section"),s=r.children("ul").first();n.settings.$topbar.data("height")||n.largestUL(),t.preventDefault(),n.breakpoint()&&r.toggleClass("expanded").css("min-height",""),r.hasClass("expanded")||(i.css({left:"0%"}),i.find(">.name").css({left:"100%"}),i.find("li.moved").removeClass("moved"),r.data("index",0))}).on("click.fndtn.topbar",".top-bar .has-dropdown>a",function(t){var r=e(this).closest(".top-bar"),i=r.find("section, .section"),s=r.children("ul").first();(Modernizr.touch||n.breakpoint())&&t.preventDefault();if(n.breakpoint()){var o=e(this),u=o.closest("li");r.data("index",r.data("index")+1),u.addClass("moved"),i.css({left:-(100*r.data("index"))+"%"}),i.find(">.name").css({left:100*r.data("index")+"%"}),o.siblings("ul").height(r.data("height")+n.outerHeight(s,!0)),r.css("min-height",r.data("height")+n.outerHeight(s,!0)*2)}}),e(t).on("resize.fndtn.topbar",function(){this.breakpoint()||e(".top-bar").css("min-height","")}.bind(this)),e(this.scope).on("click.fndtn",".top-bar .has-dropdown .back",function(t){t.preventDefault();var n=e(this),r=n.closest(".top-bar"),i=r.find("section, .section"),s=n.closest("li.moved"),o=s.parent();r.data("index",r.data("index")-1),i.css({left:-(100*r.data("index"))+"%"}),i.find(">.name").css({left:100*r.data("index")+"%"}),r.data("index")===0&&r.css("min-height",0),setTimeout(function(){s.removeClass("moved")},300)})},breakpoint:function(){return e(t).width()<=this.settings.breakPoint||e("html").hasClass("lt-ie9")},assemble:function(){var t=this;this.settings.$section.detach(),this.settings.$section.find(".has-dropdown>a").each(function(){var n=e(this),r=n.siblings(".dropdown"),i=e('
      2. ');t.settings.custom_back_text==1?i.find("h5>a").html("« "+t.settings.back_text):i.find("h5>a").html("« "+n.html()),r.prepend(i)}),this.settings.$section.appendTo(this.settings.$topbar),this.sticky()},largestUL:function(){var t=this.settings.$topbar.find("section ul ul"),n=t.first(),r=0,i=this;t.each(function(){e(this).children("li").length>n.children("li").length&&(n=e(this))}),n.children("li").each(function(){r+=i.outerHeight(e(this),!0)}),this.settings.$topbar.data("height",r)},sticky:function(){var n="."+this.settings.stickyClass;if(e(n).length>0){var r=e(n).length?e(n).offset().top:0,i=e(t),s=this.outerHeight(e("nav.top-bar"))+20;i.scroll(function(){i.scrollTop()>=r?(e(n).addClass("fixed"),e("body").css("padding-top",s)):i.scrollTop()×' + - '' - }, - - // comma delimited list of selectors that, on click, will close clearing, - // add 'div.clearing-blackout, div.visible-img' to close on background click - close_selectors : '.clearing-close', - - // event initializers and locks - init : false, - locked : false - }, - - init : function (scope, method, options) { - this.scope = this.scope || scope; - Foundation.inherit(this, 'set_data get_data remove_data throttle'); - - if (typeof method === 'object') { - options = $.extend(true, this.settings, method); - } - - if (typeof method != 'string') { - $(this.scope).find('ul[data-clearing]').each(function () { - var self = Foundation.libs.clearing, - $el = $(this), - options = options || {}, - settings = self.get_data($el); - - if (!settings) { - options.$parent = $el.parent(); - - self.set_data($el, $.extend(true, self.settings, options)); - - self.assemble($el.find('li')); - - if (!self.settings.init) { - self.events().swipe_events(); - } - } - }); - - return this.settings.init; - } else { - // fire method - return this[method].call(this, options); - } - }, - - // event binding and initial setup - - events : function () { - var self = this; - - $(this.scope) - .on('click.fndtn.clearing', 'ul[data-clearing] li', - function (e, current, target) { - var current = current || $(this), - target = target || current, - settings = self.get_data(current.parent()); - - e.preventDefault(); - if (!settings) self.init(); - - // set current and target to the clicked li if not otherwise defined. - self.open($(e.target), current, target); - self.update_paddles(target); - }) - - .on('click.fndtn.clearing', '.clearing-main-right', - function (e) { this.nav(e, 'next') }.bind(this)) - .on('click.fndtn.clearing', '.clearing-main-left', - function (e) { this.nav(e, 'prev') }.bind(this)) - .on('click.fndtn.clearing', this.settings.close_selectors, - function (e) { Foundation.libs.clearing.close(e, this) }) - .on('keydown.fndtn.clearing', - function (e) { this.keydown(e) }.bind(this)); - - $(window).on('resize.fndtn.clearing', - function (e) { this.resize() }.bind(this)); - - this.settings.init = true; - return this; - }, - - swipe_events : function () { - var self = this; - - $(this.scope) - .on('touchstart.fndtn.clearing', '.visible-img', function(e) { - var data = { - start_page_x: e.touches[0].pageX, - start_page_y: e.touches[0].pageY, - start_time: (new Date()).getTime(), - delta_x: 0, - is_scrolling: undefined - }; - - $(this).data('swipe-transition', data); - e.stopPropagation(); - }) - .on('touchmove.fndtn.clearing', '.visible-img', function(e) { - // Ignore pinch/zoom events - if(e.touches.length > 1 || e.scale && e.scale !== 1) return; - - var data = $(this).data('swipe-transition'); - - if (typeof data === 'undefined') { - data = {}; - } - - data.delta_x = e.touches[0].pageX - data.start_page_x; - - if ( typeof data.is_scrolling === 'undefined') { - data.is_scrolling = !!( data.is_scrolling || Math.abs(data.delta_x) < Math.abs(e.touches[0].pageY - data.start_page_y) ); - } - - if (!data.is_scrolling && !data.active) { - e.preventDefault(); - var direction = (data.delta_x < 0) ? 'next' : 'prev'; - data.active = true; - self.nav(e, direction); - } - }) - .on('touchend.fndtn.clearing', '.visible-img', function(e) { - $(this).data('swipe-transition', {}); - e.stopPropagation(); - }); - }, - - assemble : function ($li) { - var $el = $li.parent(), - settings = this.get_data($el), - grid = $el.detach(), - data = { - grid: '', - viewing: settings.templates.viewing - }, - wrapper = '
        ' + data.viewing + - data.grid + '
        '; - - return settings.$parent.append(wrapper); - }, - - // event callbacks - - open : function ($image, current, target) { - var root = target.closest('.clearing-assembled'), - container = root.find('div').first(), - visible_image = container.find('.visible-img'), - image = visible_image.find('img').not($image); - - if (!this.locked()) { - // set the image to the selected thumbnail - image.attr('src', this.load($image)); - - this.loaded(image, function () { - // toggle the gallery - root.addClass('clearing-blackout'); - container.addClass('clearing-container'); - visible_image.show(); - this.fix_height(target) - .caption(visible_image.find('.clearing-caption'), $image) - .center(image) - .shift(current, target, function () { - target.siblings().removeClass('visible'); - target.addClass('visible'); - }); - }.bind(this)); - } - }, - - close : function (e, el) { - e.preventDefault(); - - var root = (function (target) { - if (/blackout/.test(target.selector)) { - return target; - } else { - return target.closest('.clearing-blackout'); - } - }($(el))), container, visible_image; - - if (el === e.target && root) { - container = root.find('div').first(), - visible_image = container.find('.visible-img'); - this.settings.prev_index = 0; - root.find('ul[data-clearing]') - .attr('style', '').closest('.clearing-blackout') - .removeClass('clearing-blackout'); - container.removeClass('clearing-container'); - visible_image.hide(); - } - - return false; - }, - - keydown : function (e) { - var clearing = $('.clearing-blackout').find('ul[data-clearing]'); - - if (e.which === 39) this.go(clearing, 'next'); - if (e.which === 37) this.go(clearing, 'prev'); - if (e.which === 27) $('a.clearing-close').trigger('click'); - }, - - nav : function (e, direction) { - var clearing = $('.clearing-blackout').find('ul[data-clearing]'); - - e.preventDefault(); - this.go(clearing, direction); - }, - - resize : function () { - var image = $('.clearing-blackout .visible-img').find('img'); - - if (image.length) { - this.center(image); - } - }, - - // visual adjustments - fix_height : function (target) { - var lis = target.parent().children(), - self = this; - - lis.each(function () { - var li = $(this), - image = li.find('img'); - - if (li.height() > self.outerHeight(image)) { - li.addClass('fix-height'); - } - }) - .closest('ul') - .width(lis.length * 100 + '%'); - - return this; - }, - - update_paddles : function (target) { - var visible_image = target - .closest('.carousel') - .siblings('.visible-img'); - - if (target.next().length) { - visible_image - .find('.clearing-main-right') - .removeClass('disabled'); - } else { - visible_image - .find('.clearing-main-right') - .addClass('disabled'); - } - - if (target.prev().length) { - visible_image - .find('.clearing-main-left') - .removeClass('disabled'); - } else { - visible_image - .find('.clearing-main-left') - .addClass('disabled'); - } - }, - - center : function (target) { - target.css({ - marginLeft : -(this.outerWidth(target) / 2), - marginTop : -(this.outerHeight(target) / 2) - }); - return this; - }, - - // image loading and preloading - - load : function ($image) { - var href = $image.parent().attr('href'); - - this.preload($image); - - if (href) return href; - return $image.attr('src'); - }, - - preload : function ($image) { - this - .img($image.closest('li').next()) - .img($image.closest('li').prev()); - }, - - loaded : function (image, callback) { - // based on jquery.imageready.js - // @weblinc, @jsantell, (c) 2012 - - function loaded () { - callback(); - } - - function bindLoad () { - this.one('load', loaded); - - if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) { - var src = this.attr( 'src' ), - param = src.match( /\?/ ) ? '&' : '?'; - - param += 'random=' + (new Date()).getTime(); - this.attr('src', src + param); - } - } - - if (!image.attr('src')) { - loaded(); - return; - } - - if (this.complete || this.readyState === 4) { - loaded(); - } else { - bindLoad.call(image); - } - }, - - img : function (img) { - if (img.length) { - var new_img = new Image(), - new_a = img.find('a'); - - if (new_a.length) { - new_img.src = new_a.attr('href'); - } else { - new_img.src = img.find('img').attr('src'); - } - } - return this; - }, - - // image caption - - caption : function (container, $image) { - var caption = $image.data('caption'); - - if (caption) { - container - .text(caption) - .show(); - } else { - container - .text('') - .hide(); - } - return this; - }, - - // directional methods - - go : function ($ul, direction) { - var current = $ul.find('.visible'), - target = current[direction](); - - if (target.length) { - target - .find('img') - .trigger('click', [current, target]); - } - }, - - shift : function (current, target, callback) { - var clearing = target.parent(), - old_index = this.settings.prev_index || target.index(), - direction = this.direction(clearing, current, target), - left = parseInt(clearing.css('left'), 10), - width = this.outerWidth(target), - skip_shift; - - // we use jQuery animate instead of CSS transitions because we - // need a callback to unlock the next animation - if (target.index() !== old_index && !/skip/.test(direction)){ - if (/left/.test(direction)) { - this.lock(); - clearing.animate({left : left + width}, 300, this.unlock()); - } else if (/right/.test(direction)) { - this.lock(); - clearing.animate({left : left - width}, 300, this.unlock()); - } - } else if (/skip/.test(direction)) { - // the target image is not adjacent to the current image, so - // do we scroll right or not - skip_shift = target.index() - this.settings.up_count; - this.lock(); - - if (skip_shift > 0) { - clearing.animate({left : -(skip_shift * width)}, 300, this.unlock()); - } else { - clearing.animate({left : 0}, 300, this.unlock()); - } - } - - callback(); - }, - - direction : function ($el, current, target) { - var lis = $el.find('li'), - li_width = this.outerWidth(lis) + (this.outerWidth(lis) / 4), - up_count = Math.floor(this.outerWidth($('.clearing-container')) / li_width) - 1, - target_index = lis.index(target), - response; - - this.settings.up_count = up_count; - - if (this.adjacent(this.settings.prev_index, target_index)) { - if ((target_index > up_count) - && target_index > this.settings.prev_index) { - response = 'right'; - } else if ((target_index > up_count - 1) - && target_index <= this.settings.prev_index) { - response = 'left'; - } else { - response = false; - } - } else { - response = 'skip'; - } - - this.settings.prev_index = target_index; - - return response; - }, - - adjacent : function (current_index, target_index) { - for (var i = target_index + 1; i >= target_index - 1; i--) { - if (i === current_index) return true; - } - return false; - }, - - // lock management - - lock : function () { - this.settings.locked = true; - }, - - unlock : function () { - this.settings.locked = false; - }, - - locked : function () { - return this.settings.locked; - }, - - // plugin management/browser quirks - - outerHTML : function (el) { - // support FireFox < 11 - return el.outerHTML || new XMLSerializer().serializeToString(el); - }, - - off : function () { - $(this.scope).off('.fndtn.clearing'); - $(window).off('.fndtn.clearing'); - this.remove_data(); // empty settings cache - this.settings.init = false; - } - }; - -}(Foundation.zj, this, this.document)); diff --git a/doc/foundation/static/js/foundation/foundation.cookie.js b/doc/foundation/static/js/foundation/foundation.cookie.js deleted file mode 100644 index 862027c..0000000 --- a/doc/foundation/static/js/foundation/foundation.cookie.js +++ /dev/null @@ -1,74 +0,0 @@ -/*! - * jQuery Cookie Plugin v1.3 - * https://github.com/carhartl/jquery-cookie - * - * Copyright 2011, Klaus Hartl - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://www.opensource.org/licenses/mit-license.php - * http://www.opensource.org/licenses/GPL-2.0 - * - * Modified to work with Zepto.js by ZURB - */ -(function ($, document, undefined) { - - var pluses = /\+/g; - - function raw(s) { - return s; - } - - function decoded(s) { - return decodeURIComponent(s.replace(pluses, ' ')); - } - - var config = $.cookie = function (key, value, options) { - - // write - if (value !== undefined) { - options = $.extend({}, config.defaults, options); - - if (value === null) { - options.expires = -1; - } - - if (typeof options.expires === 'number') { - var days = options.expires, t = options.expires = new Date(); - t.setDate(t.getDate() + days); - } - - value = config.json ? JSON.stringify(value) : String(value); - - return (document.cookie = [ - encodeURIComponent(key), '=', config.raw ? value : encodeURIComponent(value), - options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE - options.path ? '; path=' + options.path : '', - options.domain ? '; domain=' + options.domain : '', - options.secure ? '; secure' : '' - ].join('')); - } - - // read - var decode = config.raw ? raw : decoded; - var cookies = document.cookie.split('; '); - for (var i = 0, l = cookies.length; i < l; i++) { - var parts = cookies[i].split('='); - if (decode(parts.shift()) === key) { - var cookie = decode(parts.join('=')); - return config.json ? JSON.parse(cookie) : cookie; - } - } - - return null; - }; - - config.defaults = {}; - - $.removeCookie = function (key, options) { - if ($.cookie(key) !== null) { - $.cookie(key, null, options); - return true; - } - return false; - }; - -})(Foundation.zj, document); diff --git a/doc/foundation/static/js/foundation/foundation.dropdown.js b/doc/foundation/static/js/foundation/foundation.dropdown.js deleted file mode 100644 index 24b35e1..0000000 --- a/doc/foundation/static/js/foundation/foundation.dropdown.js +++ /dev/null @@ -1,122 +0,0 @@ -/*jslint unparam: true, browser: true, indent: 2 */ - -;(function ($, window, document, undefined) { - 'use strict'; - - Foundation.libs.dropdown = { - name : 'dropdown', - - version : '4.0.0', - - settings : { - activeClass: 'open' - }, - - init : function (scope, method, options) { - this.scope = scope || this.scope; - Foundation.inherit(this, 'throttle'); - - if (typeof method === 'object') { - $.extend(true, this.settings, method); - } - - if (typeof method != 'string') { - - if (!this.settings.init) { - this.events(); - } - - return this.settings.init; - } else { - return this[method].call(this, options); - } - }, - - events : function () { - var self = this; - - $(this.scope).on('click.fndtn.dropdown', '[data-dropdown]', function (e) { - e.preventDefault(); - e.stopPropagation(); - self.toggle($(this)); - }); - - $('*, html, body').on('click.fndtn.dropdown', function (e) { - if (!$(e.target).data('dropdown')) { - $('[data-dropdown-content]') - .css('left', '-99999px') - .removeClass(self.settings.activeClass); - } - }); - - $('[data-dropdown-content]').on('click.fndtn.dropdown', function (e) { - e.stopPropagation(); - }); - - $(window).on('resize.fndtn.dropdown', self.throttle(function () { - self.resize.call(self); - }, 50)).trigger('resize'); - - this.settings.init = true; - }, - - toggle : function (target, resize) { - var dropdown = $('#' + target.data('dropdown')); - - $('[data-dropdown-content]').not(dropdown).css('left', '-99999px'); - - if (dropdown.hasClass(this.settings.activeClass)) { - dropdown - .css('left', '-99999px') - .removeClass(this.settings.activeClass); - } else { - this - .css(dropdown - .addClass(this.settings.activeClass), target); - } - }, - - resize : function () { - var dropdown = $('[data-dropdown-content].open'), - target = $("[data-dropdown='" + dropdown.attr('id') + "']"); - - if (dropdown.length && target.length) { - this.css(dropdown, target); - } - }, - - css : function (dropdown, target) { - var offset = target.offset(); - - if (this.small()) { - dropdown.css({ - position : 'absolute', - width: '95%', - left: '2.5%', - 'max-width': 'none', - top: offset.top + this.outerHeight(target) - }); - } else { - dropdown.attr('style', '').css({ - position : 'absolute', - top: offset.top + this.outerHeight(target), - left: offset.left - }); - } - - return dropdown; - }, - - small : function () { - return $(window).width() < 768 || $('html').hasClass('lt-ie9'); - }, - - off: function () { - $(this.scope).off('.fndtn.dropdown'); - $('html, body').off('.fndtn.dropdown'); - $(window).off('.fndtn.dropdown'); - $('[data-dropdown-content]').off('.fndtn.dropdown'); - this.settings.init = false; - } - }; -}(Foundation.zj, this, this.document)); diff --git a/doc/foundation/static/js/foundation/foundation.forms.js b/doc/foundation/static/js/foundation/foundation.forms.js deleted file mode 100644 index f5734ce..0000000 --- a/doc/foundation/static/js/foundation/foundation.forms.js +++ /dev/null @@ -1,395 +0,0 @@ -/*jslint unparam: true, browser: true, indent: 2 */ - -;(function ($, window, document, undefined) { - 'use strict'; - - Foundation.libs.forms = { - name : 'forms', - - version : '4.0.4', - - settings : { - disable_class: 'no-custom' - }, - - init : function (scope, method, options) { - this.scope = scope || this.scope; - - if (typeof method === 'object') { - $.extend(true, this.settings, method); - } - - if (typeof method != 'string') { - if (!this.settings.init) { - this.events(); - } - - this.assemble(); - - return this.settings.init; - } else { - return this[method].call(this, options); - } - }, - - assemble : function () { - $('form.custom input[type="radio"]', $(this.scope)).not('[data-customforms="disabled"]') - .each(this.append_custom_markup); - $('form.custom input[type="checkbox"]', $(this.scope)).not('[data-customforms="disabled"]') - .each(this.append_custom_markup); - $('form.custom select', $(this.scope)).not('[data-customforms="disabled"]') - .each(this.append_custom_select); - }, - - events : function () { - var self = this; - - $(this.scope) - .on('change.fndtn.forms', 'form.custom select:not([data-customforms="disabled"])', function (e) { - self.refresh_custom_select($(this)); - }) - .on('click.fndtn.forms', 'form.custom label', function (e) { - var $associatedElement = $('#' + self.escape($(this).attr('for')) + ':not([data-customforms="disabled"])'), - $customCheckbox, - $customRadio; - if ($associatedElement.length !== 0) { - if ($associatedElement.attr('type') === 'checkbox') { - e.preventDefault(); - $customCheckbox = $(this).find('span.custom.checkbox'); - - //the checkbox might be outside after the label - if ($customCheckbox.length == 0) { - $customCheckbox = $(this).next('span.custom.checkbox'); - } - //the checkbox might be outside before the label - if ($customCheckbox.length == 0) { - $customCheckbox = $(this).prev('span.custom.checkbox'); - } - self.toggle_checkbox($customCheckbox); - } else if ($associatedElement.attr('type') === 'radio') { - e.preventDefault(); - $customRadio = $(this).find('span.custom.radio'); - //the radio might be outside after the label - if ($customRadio.length == 0) { - $customRadio = $(this).next('span.custom.radio'); - } - //the radio might be outside before the label - if ($customRadio.length == 0) { - $customRadio = $(this).prev('span.custom.radio'); - } - self.toggle_radio($customRadio); - } - } - }) - .on('click.fndtn.forms', 'form.custom div.custom.dropdown a.current, form.custom div.custom.dropdown a.selector', function (e) { - var $this = $(this), - $dropdown = $this.closest('div.custom.dropdown'), - $select = $dropdown.prev(); - - // make sure other dropdowns close - if(!$dropdown.hasClass('open')) - $(self.scope).trigger('click'); - - e.preventDefault(); - if (false === $select.is(':disabled')) { - $dropdown.toggleClass('open'); - - if ($dropdown.hasClass('open')) { - $(self.scope).on('click.fndtn.forms.customdropdown', function () { - $dropdown.removeClass('open'); - $(self.scope).off('.fndtn.forms.customdropdown'); - }); - } else { - $(self.scope).on('.fndtn.forms.customdropdown'); - } - return false; - } - }) - .on('click.fndtn.forms touchend.fndtn.forms', 'form.custom div.custom.dropdown li', function (e) { - var $this = $(this), - $customDropdown = $this.closest('div.custom.dropdown'), - $select = $customDropdown.prev(), - selectedIndex = 0; - - e.preventDefault(); - e.stopPropagation(); - - if ( ! $(this).hasClass('disabled')) { - $('div.dropdown').not($customDropdown).removeClass('open'); - - var $oldThis= $this - .closest('ul') - .find('li.selected'); - $oldThis.removeClass('selected'); - - $this.addClass('selected'); - - $customDropdown - .removeClass('open') - .find('a.current') - .html($this.html()); - - $this.closest('ul').find('li').each(function (index) { - if ($this[0] == this) { - selectedIndex = index; - } - - }); - $select[0].selectedIndex = selectedIndex; - - //store the old value in data - $select.data('prevalue', $oldThis.html()); - $select.trigger('change'); - } - }); - - this.settings.init = true; - }, - - append_custom_markup : function (idx, sel) { - var $this = $(sel).hide(), - type = $this.attr('type'), - $span = $this.next('span.custom.' + type); - - if ($span.length === 0) { - $span = $('').insertAfter($this); - } - - $span.toggleClass('checked', $this.is(':checked')); - $span.toggleClass('disabled', $this.is(':disabled')); - }, - - append_custom_select : function (idx, sel) { - var self = Foundation.libs.forms, - $this = $( sel ), - $customSelect = $this.next( 'div.custom.dropdown' ), - $customList = $customSelect.find( 'ul' ), - $selectCurrent = $customSelect.find( ".current" ), - $selector = $customSelect.find( ".selector" ), - $options = $this.find( 'option' ), - $selectedOption = $options.filter( ':selected' ), - copyClasses = $this.attr('class') ? $this.attr('class').split(' ') : [], - maxWidth = 0, - liHtml = '', - $listItems, - $currentSelect = false; - - if ($this.hasClass(self.settings.disable_class)) return; - - if ($customSelect.length === 0) { - var customSelectSize = $this.hasClass( 'small' ) ? 'small' : - $this.hasClass( 'medium' ) ? 'medium' : - $this.hasClass( 'large' ) ? 'large' : - $this.hasClass( 'expand' ) ? 'expand' : ''; - - $customSelect = $('
          '); - $selector = $customSelect.find(".selector"); - $customList = $customSelect.find("ul"); - liHtml = $options.map(function() { return "
        • " + $( this ).html() + "
        • "; } ).get().join( '' ); - $customList.append(liHtml); - $currentSelect = $customSelect.prepend('' + $selectedOption.html() + '' ).find( ".current" ); - $this - .after( $customSelect ) - .hide(); - - } else { - liHtml = $options.map(function() { - return "
        • " + $( this ).html() + "
        • "; - }) - .get().join(''); - $customList - .html('') - .append(liHtml); - - } // endif $customSelect.length === 0 - $customSelect.toggleClass('disabled', $this.is( ':disabled' ) ); - $listItems = $customList.find( 'li' ); - - $options.each( function ( index ) { - if ( this.selected ) { - $listItems.eq( index ).addClass( 'selected' ); - - if ($currentSelect) { - $currentSelect.html( $( this ).html() ); - } - - } - if ($(this).is(':disabled')) { - $listItems.eq( index ).addClass( 'disabled' ); - } - }); - - // - // If we're not specifying a predetermined form size. - // - if (!$customSelect.is('.small, .medium, .large, .expand')) { - - // ------------------------------------------------------------------------------------ - // This is a work-around for when elements are contained within hidden parents. - // For example, when custom-form elements are inside of a hidden reveal modal. - // - // We need to display the current custom list element as well as hidden parent elements - // in order to properly calculate the list item element's width property. - // ------------------------------------------------------------------------------------- - - $customSelect.addClass( 'open' ); - // - // Quickly, display all parent elements. - // This should help us calcualate the width of the list item's within the drop down. - // - var self = Foundation.libs.forms; - self.hidden_fix.adjust( $customList ); - - maxWidth = ( self.outerWidth($listItems) > maxWidth ) ? self.outerWidth($listItems) : maxWidth; - - Foundation.libs.forms.hidden_fix.reset(); - - $customSelect.removeClass( 'open' ); - - } // endif - - }, - - refresh_custom_select : function ($select) { - var self = this; - var maxWidth = 0, - $customSelect = $select.next(), - $options = $select.find('option'); - - $customSelect.find('ul').html(''); - - $options.each(function () { - var $li = $('
        • ' + $(this).html() + '
        • '); - $customSelect.find('ul').append($li); - }); - - // re-populate - $options.each(function (index) { - if (this.selected) { - $customSelect.find('li').eq(index).addClass('selected'); - $customSelect.find('.current').html($(this).html()); - } - if ($(this).is(':disabled')) { - $customSelect.find('li').eq(index).addClass('disabled'); - } - }); - - // fix width - $customSelect.removeAttr('style') - .find('ul').removeAttr('style'); - $customSelect.find('li').each(function () { - $customSelect.addClass('open'); - if (self.outerWidth($(this)) > maxWidth) { - maxWidth = self.outerWidth($(this)); - } - $customSelect.removeClass('open'); - }); - }, - - toggle_checkbox : function ($element) { - var $input = $element.prev(), - input = $input[0]; - - if (false === $input.is(':disabled')) { - input.checked = ((input.checked) ? false : true); - $element.toggleClass('checked'); - - $input.trigger('change'); - } - }, - - toggle_radio : function ($element) { - var $input = $element.prev(), - $form = $input.closest('form.custom'), - input = $input[0]; - - if (false === $input.is(':disabled')) { - $form.find('input[type="radio"][name="' + this.escape($input.attr('name')) + '"]').next().not($element).removeClass('checked'); - if ( !$element.hasClass('checked') ) { - $element.toggleClass('checked'); - } - input.checked = $element.hasClass('checked'); - - $input.trigger('change'); - } - }, - - escape : function (text) { - return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); - }, - - hidden_fix : { - /** - * Sets all hidden parent elements and self to visibile. - * - * @method adjust - * @param {jQuery Object} $child - */ - - // We'll use this to temporarily store style properties. - tmp : [], - - // We'll use this to set hidden parent elements. - hidden : null, - - adjust : function( $child ) { - // Internal reference. - var _self = this; - - // Set all hidden parent elements, including this element. - _self.hidden = $child.parents().andSelf().filter( ":hidden" ); - - // Loop through all hidden elements. - _self.hidden.each( function() { - - // Cache the element. - var $elem = $( this ); - - // Store the style attribute. - // Undefined if element doesn't have a style attribute. - _self.tmp.push( $elem.attr( 'style' ) ); - - // Set the element's display property to block, - // but ensure it's visibility is hidden. - $elem.css( { 'visibility' : 'hidden', 'display' : 'block' } ); - }); - - }, // end adjust - - /** - * Resets the elements previous state. - * - * @method reset - */ - reset : function() { - // Internal reference. - var _self = this; - // Loop through our hidden element collection. - _self.hidden.each( function( i ) { - // Cache this element. - var $elem = $( this ), - _tmp = _self.tmp[ i ]; // Get the stored 'style' value for this element. - - // If the stored value is undefined. - if( _tmp === undefined ) - // Remove the style attribute. - $elem.removeAttr( 'style' ); - else - // Otherwise, reset the element style attribute. - $elem.attr( 'style', _tmp ); - - }); - // Reset the tmp array. - _self.tmp = []; - // Reset the hidden elements variable. - _self.hidden = null; - - } // end reset - - }, - - off : function () { - $(this.scope).off('.fndtn.forms'); - } - }; -}(Foundation.zj, this, this.document)); diff --git a/doc/foundation/static/js/foundation/foundation.joyride.js b/doc/foundation/static/js/foundation/foundation.joyride.js deleted file mode 100644 index 779d8e3..0000000 --- a/doc/foundation/static/js/foundation/foundation.joyride.js +++ /dev/null @@ -1,615 +0,0 @@ -/*jslint unparam: true, browser: true, indent: 2 */ - -;(function ($, window, document, undefined) { - 'use strict'; - - Foundation.libs.joyride = { - name: 'joyride', - - version : '4.0.0', - - defaults : { - tipLocation : 'bottom', // 'top' or 'bottom' in relation to parent - nubPosition : 'auto', // override on a per tooltip bases - scrollSpeed : 300, // Page scrolling speed in milliseconds - timer : 0, // 0 = no timer , all other numbers = timer in milliseconds - startTimerOnClick : true, // true or false - true requires clicking the first button start the timer - startOffset : 0, // the index of the tooltip you want to start on (index of the li) - nextButton : true, // true or false to control whether a next button is used - tipAnimation : 'fade', // 'pop' or 'fade' in each tip - pauseAfter : [], // array of indexes where to pause the tour after - tipAnimationFadeSpeed: 300, // when tipAnimation = 'fade' this is speed in milliseconds for the transition - cookieMonster : false, // true or false to control whether cookies are used - cookieName : 'joyride', // Name the cookie you'll use - cookieDomain : false, // Will this cookie be attached to a domain, ie. '.notableapp.com' - cookieExpires : 365, // set when you would like the cookie to expire. - tipContainer : 'body', // Where will the tip be attached - postRideCallback : function (){}, // A method to call once the tour closes (canceled or complete) - postStepCallback : function (){}, // A method to call after each step - template : { // HTML segments for tip layout - link : '×', - timer : '
          ', - tip : '
          ', - wrapper : '
          ', - button : '' - } - }, - - settings : {}, - - init : function (scope, method, options) { - this.scope = scope || this.scope; - Foundation.inherit(this, 'throttle data_options scrollTo scrollLeft delay'); - - if (typeof method === 'object') { - $.extend(true, this.settings, this.defaults, method); - } else { - $.extend(true, this.settings, this.defaults, options); - } - - if (typeof method != 'string') { - if (!this.settings.init) this.events(); - - return this.settings.init; - } else { - return this[method].call(this, options); - } - }, - - events : function () { - var self = this; - - $(this.scope) - .on('click.joyride', '.joyride-next-tip, .joyride-modal-bg', function (e) { - e.preventDefault(); - - if (this.settings.$li.next().length < 1) { - this.end(); - } else if (this.settings.timer > 0) { - clearTimeout(this.settings.automate); - this.hide(); - this.show(); - this.startTimer(); - } else { - this.hide(); - this.show(); - } - - }.bind(this)) - - .on('click.joyride', '.joyride-close-tip', function (e) { - e.preventDefault(); - this.end(); - }.bind(this)); - - $(window).on('resize.fndtn.joyride', self.throttle(function () { - if ($('[data-joyride]').length > 0 && self.settings.$next_tip) { - if (self.is_phone()) { - self.pos_phone(); - } else { - self.pos_default(); - } - } - }, 100)); - - this.settings.init = true; - }, - - start : function () { - var self = this, - $this = $(this.scope).find('[data-joyride]'), - integer_settings = ['timer', 'scrollSpeed', 'startOffset', 'tipAnimationFadeSpeed', 'cookieExpires'], - int_settings_count = integer_settings.length; - - if (!this.settings.init) this.init(); - $.extend(true, this.settings, this.data_options($this)); - - // non configureable settings - this.settings.$content_el = $this; - this.settings.body_offset = $(this.settings.tipContainer).position(); - this.settings.$tip_content = this.settings.$content_el.find('> li'); - this.settings.paused = false; - this.settings.attempts = 0; - - // Make sure that settings parsed from data_options are integers where necessary - for (var i = int_settings_count - 1; i >= 0; i--) { - this.settings[integer_settings[i]] = parseInt(this.settings[integer_settings[i]], 10); - } - - this.settings.tipLocationPatterns = { - top: ['bottom'], - bottom: [], // bottom should not need to be repositioned - left: ['right', 'top', 'bottom'], - right: ['left', 'top', 'bottom'] - }; - - // can we create cookies? - if (typeof $.cookie !== 'function') { - this.settings.cookieMonster = false; - } - - // generate the tips and insert into dom. - if (!this.settings.cookieMonster || this.settings.cookieMonster && $.cookie(this.settings.cookieName) === null) { - - this.settings.$tip_content.each(function (index) { - self.create({$li : $(this), index : index}); - }); - - // show first tip - if (!this.settings.startTimerOnClick && this.settings.timer > 0) { - this.show('init'); - this.startTimer(); - } else { - this.show('init'); - } - - } - }, - - resume : function () { - this.set_li(); - this.show(); - }, - - tip_template : function (opts) { - var $blank, content; - - opts.tip_class = opts.tip_class || ''; - - $blank = $(this.settings.template.tip).addClass(opts.tip_class); - content = $.trim($(opts.li).html()) + - this.button_text(opts.button_text) + - this.settings.template.link + - this.timer_instance(opts.index); - - $blank.append($(this.settings.template.wrapper)); - $blank.first().attr('data-index', opts.index); - $('.joyride-content-wrapper', $blank).append(content); - - return $blank[0]; - }, - - timer_instance : function (index) { - var txt; - - if ((index === 0 && this.settings.startTimerOnClick && this.settings.timer > 0) || this.settings.timer === 0) { - txt = ''; - } else { - txt = this.outerHTML($(this.settings.template.timer)[0]); - } - return txt; - }, - - button_text : function (txt) { - if (this.settings.nextButton) { - txt = $.trim(txt) || 'Next'; - txt = this.outerHTML($(this.settings.template.button).append(txt)[0]); - } else { - txt = ''; - } - return txt; - }, - - create : function (opts) { - // backwards compatability with data-text attribute - var buttonText = opts.$li.attr('data-button') || opts.$li.attr('data-text'), - tipClass = opts.$li.attr('class'), - $tip_content = $(this.tip_template({ - tip_class : tipClass, - index : opts.index, - button_text : buttonText, - li : opts.$li - })); - - $(this.settings.tipContainer).append($tip_content); - }, - - show : function (init) { - var $timer = null; - - // are we paused? - if (this.settings.$li === undefined - || ($.inArray(this.settings.$li.index(), this.settings.pauseAfter) === -1)) { - - // don't go to the next li if the tour was paused - if (this.settings.paused) { - this.settings.paused = false; - } else { - this.set_li(init); - } - - this.settings.attempts = 0; - - if (this.settings.$li.length && this.settings.$target.length > 0) { - - this.settings.tipSettings = $.extend(true, - this.settings, this.data_options(this.settings.$li)); - - this.settings.timer = parseInt(this.settings.timer, 10); - - this.settings.tipSettings.tipLocationPattern = this.settings.tipLocationPatterns[this.settings.tipSettings.tipLocation]; - - // scroll if not modal - if (!/body/i.test(this.settings.$target.selector)) { - this.scroll_to(); - } - - if (this.is_phone()) { - this.pos_phone(true); - } else { - this.pos_default(true); - } - - $timer = this.settings.$next_tip.find('.joyride-timer-indicator'); - - if (/pop/i.test(this.settings.tipAnimation)) { - - $timer.width(0); - - if (thsi.settings.timer > 0) { - - this.settings.$next_tip.show(); - - this.delay(function () { - $timer.animate({ - width: $timer.parent().width() - }, this.settings.timer, 'linear'); - }.bind(this), this.settings.tipAnimationFadeSpeed); - - } else { - this.settings.$next_tip.show(); - - } - - - } else if (/fade/i.test(this.settings.tipAnimation)) { - - $timer.width(0); - - if (this.settings.timer > 0) { - - this.settings.$next_tip - .fadeIn(this.settings.tipAnimationFadeSpeed) - .show(); - - this.delay(function () { - $timer.animate({ - width: $timer.parent().width() - }, this.settings.timer, 'linear'); - }.bind(this), this.settings.tipAnimationFadeSpeed); - - } else { - this.settings.$next_tip.fadeIn(this.settings.tipAnimationFadeSpeed); - - } - } - - this.settings.$current_tip = this.settings.$next_tip; - - // skip non-existant targets - } else if (this.settings.$li && this.settings.$target.length < 1) { - - this.show(); - - } else { - - this.end(); - - } - } else { - - this.settings.paused = true; - - } - - }, - - is_phone : function () { - if (Modernizr) { - return Modernizr.mq('only screen and (max-width: 767px)') || $('.lt-ie9').length > 0; - } - - return (this.settings.$window.width() < 767) ? true : false; - }, - - hide : function () { - this.settings.postStepCallback(this.settings.$li.index(), - this.settings.$current_tip); - $('.joyride-modal-bg').hide(); - this.settings.$current_tip.hide(); - }, - - set_li : function (init) { - if (init) { - this.settings.$li = this.settings.$tip_content.eq(this.settings.startOffset); - this.set_next_tip(); - this.settings.$current_tip = this.settings.$next_tip; - } else { - this.settings.$li = this.settings.$li.next(); - this.set_next_tip(); - } - - this.set_target(); - }, - - set_next_tip : function () { - this.settings.$next_tip = $(".joyride-tip-guide[data-index='" + this.settings.$li.index() + "']"); - this.settings.$next_tip.data('closed', ''); - }, - - set_target : function () { - var cl = this.settings.$li.attr('data-class'), - id = this.settings.$li.attr('data-id'), - $sel = function () { - if (id) { - return $(document.getElementById(id)); - } else if (cl) { - return $('.' + cl).first(); - } else { - return $('body'); - } - }; - - this.settings.$target = $sel(); - }, - - scroll_to : function () { - var window_half, tipOffset; - - window_half = $(window).height() / 2; - tipOffset = Math.ceil(this.settings.$target.offset().top - window_half + this.outerHeight(this.settings.$next_tip)); - if (tipOffset > 0) { - this.scrollTo($('html, body'), tipOffset, this.settings.scrollSpeed); - } - }, - - paused : function () { - if (($.inArray((this.settings.$li.index() + 1), this.settings.pauseAfter) === -1)) { - return true; - } - - return false; - }, - - restart : function () { - this.hide(); - this.settings.$li = undefined; - this.show('init'); - }, - - pos_default : function (init) { - var half_fold = Math.ceil($(window).height() / 2), - tip_position = this.settings.$next_tip.offset(), - $nub = this.settings.$next_tip.find('.joyride-nub'), - nub_height = Math.ceil(this.outerHeight($nub) / 2), - toggle = init || false; - - // tip must not be "display: none" to calculate position - if (toggle) { - this.settings.$next_tip.css('visibility', 'hidden'); - this.settings.$next_tip.show(); - } - - if (!/body/i.test(this.settings.$target.selector)) { - - if (this.bottom()) { - this.settings.$next_tip.css({ - top: (this.settings.$target.offset().top + nub_height + this.outerHeight(this.settings.$target)), - left: this.settings.$target.offset().left}); - - this.nub_position($nub, this.settings.tipSettings.nubPosition, 'top'); - - } else if (this.top()) { - - this.settings.$next_tip.css({ - top: (this.settings.$target.offset().top - this.outerHeight(this.settings.$next_tip) - nub_height), - left: this.settings.$target.offset().left}); - - this.nub_position($nub, this.settings.tipSettings.nubPosition, 'bottom'); - - } else if (this.right()) { - - this.settings.$next_tip.css({ - top: this.settings.$target.offset().top, - left: (this.outerWidth(this.settings.$target) + this.settings.$target.offset().left)}); - - this.nub_position($nub, this.settings.tipSettings.nubPosition, 'left'); - - } else if (this.left()) { - - this.settings.$next_tip.css({ - top: this.settings.$target.offset().top, - left: (this.settings.$target.offset().left - this.outerWidth(this.settings.$next_tip) - nub_height)}); - - this.nub_position($nub, this.settings.tipSettings.nubPosition, 'right'); - - } - - if (!this.visible(this.corners(this.settings.$next_tip)) && this.settings.attempts < this.settings.tipSettings.tipLocationPattern.length) { - - $nub.removeClass('bottom') - .removeClass('top') - .removeClass('right') - .removeClass('left'); - - this.settings.tipSettings.tipLocation = this.settings.tipSettings.tipLocationPattern[this.settings.attempts]; - - this.settings.attempts++; - - this.pos_default(true); - - } - - } else if (this.settings.$li.length) { - - this.pos_modal($nub); - - } - - if (toggle) { - this.settings.$next_tip.hide(); - this.settings.$next_tip.css('visibility', 'visible'); - } - - }, - - pos_phone : function (init) { - var tip_height = this.outerHeight(this.settings.$next_tip), - tip_offset = this.settings.$next_tip.offset(), - target_height = this.outerHeight(this.settings.$target), - $nub = $('.joyride-nub', this.settings.$next_tip), - nub_height = Math.ceil(this.outerHeight($nub) / 2), - toggle = init || false; - - $nub.removeClass('bottom') - .removeClass('top') - .removeClass('right') - .removeClass('left'); - - if (toggle) { - this.settings.$next_tip.css('visibility', 'hidden'); - this.settings.$next_tip.show(); - } - - if (!/body/i.test(this.settings.$target.selector)) { - - if (this.top()) { - - this.settings.$next_tip.offset({top: this.settings.$target.offset().top - tip_height - nub_height}); - $nub.addClass('bottom'); - - } else { - - this.settings.$next_tip.offset({top: this.settings.$target.offset().top + target_height + nub_height}); - $nub.addClass('top'); - - } - - } else if (this.settings.$li.length) { - this.pos_modal($nub); - } - - if (toggle) { - this.settings.$next_tip.hide(); - this.settings.$next_tip.css('visibility', 'visible'); - } - }, - - pos_modal : function ($nub) { - this.center(); - $nub.hide(); - if (!this.settings.$next_tip.data('closed')) { - if ($('.joyride-modal-bg').length < 1) { - $('body').append('
          ').show(); - } - - if (/pop/i.test(this.settings.tipAnimation)) { - $('.joyride-modal-bg').show(); - } else { - $('.joyride-modal-bg').fadeIn(this.settings.tipAnimationFadeSpeed); - } - } - }, - - center : function () { - var $w = $(window); - - this.settings.$next_tip.css({ - top : ((($w.height() - this.outerHeight(this.settings.$next_tip)) / 2) + $w.scrollTop()), - left : ((($w.width() - this.outerWidth(this.settings.$next_tip)) / 2) + this.scrollLeft($w)) - }); - - return true; - }, - - bottom : function () { - return /bottom/i.test(this.settings.tipSettings.tipLocation); - }, - - top : function () { - return /top/i.test(this.settings.tipSettings.tipLocation); - }, - - right : function () { - return /right/i.test(this.settings.tipSettings.tipLocation); - }, - - left : function () { - return /left/i.test(this.settings.tipSettings.tipLocation); - }, - - corners : function (el) { - var w = $(window), - right = w.width() + this.scrollLeft(w), - bottom = w.width() + w.scrollTop(); - - return [ - el.offset().top <= w.scrollTop(), - right <= el.offset().left + this.outerWidth(el), - bottom <= el.offset().top + this.outerHeight(el), - this.scrollLeft(w) >= el.offset().left - ]; - }, - - visible : function (hidden_corners) { - var i = hidden_corners.length; - - while (i--) { - if (hidden_corners[i]) return false; - } - - return true; - }, - - nub_position : function (nub, pos, def) { - if (pos === 'auto') { - nub.addClass(def); - } else { - nub.addClass(pos); - } - }, - - startTimer : function () { - if (this.settings.$li.length) { - this.settings.automate = setTimeout(function () { - this.hide(); - this.show(); - this.startTimer(); - }.bind(this), this.settings.timer); - } else { - clearTimeout(this.settings.automate); - } - }, - - end : function () { - if (this.settings.cookieMonster) { - $.cookie(this.settings.cookieName, 'ridden', { expires: this.settings.cookieExpires, domain: this.settings.cookieDomain }); - } - - if (this.settings.timer > 0) { - clearTimeout(this.settings.automate); - } - - this.settings.$next_tip.data('closed', true); - - $('.joyride-modal-bg').hide(); - this.settings.$current_tip.hide(); - this.settings.postStepCallback(this.settings.$li.index(), this.settings.$current_tip); - this.settings.postRideCallback(this.settings.$li.index(), this.settings.$current_tip); - }, - - outerHTML : function (el) { - // support FireFox < 11 - return el.outerHTML || new XMLSerializer().serializeToString(el); - }, - - off : function () { - $(this.scope).off('.joyride'); - $(window).off('.joyride'); - $('.joyride-close-tip, .joyride-next-tip, .joyride-modal-bg').off('.joyride'); - $('.joyride-tip-guide, .joyride-modal-bg').remove(); - clearTimeout(this.settings.automate); - this.settings = {}; - } - }; -}(Foundation.zj, this, this.document)); diff --git a/doc/foundation/static/js/foundation/foundation.js b/doc/foundation/static/js/foundation/foundation.js deleted file mode 100644 index d7157fb..0000000 --- a/doc/foundation/static/js/foundation/foundation.js +++ /dev/null @@ -1,331 +0,0 @@ -/* - * Foundation Responsive Library - * http://foundation.zurb.com - * Copyright 2013, ZURB - * Free to use under the MIT license. - * http://www.opensource.org/licenses/mit-license.php -*/ - -/*jslint unparam: true, browser: true, indent: 2 */ - -(function () { - // add dusty browser stuff - if (!Array.prototype.filter) { - Array.prototype.filter = function(fun /*, thisp */) { - "use strict"; - - if (this == null) { - throw new TypeError(); - } - - var t = Object(this), - len = t.length >>> 0; - if (typeof fun != "function") { - try { - throw new TypeError(); - } catch (e) { - return; - } - } - - var res = [], - thisp = arguments[1]; - for (var i = 0; i < len; i++) { - if (i in t) { - var val = t[i]; // in case fun mutates this - if (fun && fun.call(thisp, val, i, t)) { - res.push(val); - } - } - } - - return res; - }; - - if (!Function.prototype.bind) { - Function.prototype.bind = function (oThis) { - if (typeof this !== "function") { - // closest thing possible to the ECMAScript 5 internal IsCallable function - throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable"); - } - - var aArgs = Array.prototype.slice.call(arguments, 1), - fToBind = this, - fNOP = function () {}, - fBound = function () { - return fToBind.apply(this instanceof fNOP && oThis - ? this - : oThis, - aArgs.concat(Array.prototype.slice.call(arguments))); - }; - - fNOP.prototype = this.prototype; - fBound.prototype = new fNOP(); - - return fBound; - }; - } - } - - // fake stop() for zepto. - $.fn.stop = $.fn.stop || function() { - return this; - }; -}()); - -;(function (window, document, undefined) { - 'use strict'; - - window.Foundation = { - name : 'Foundation', - - version : '4.0.0', - - // global Foundation cache object - cache : {}, - - init : function (scope, libraries, method, options, response, /* internal */ nc) { - var library_arr, - args = [scope, method, options, response], - responses = [], - nc = nc || false; - - // disable library error catching, - // used for development only - if (nc) this.nc = nc; - - // set foundation global scope - this.scope = scope || this.scope; - - if (libraries && typeof libraries === 'string') { - if (/off/i.test(libraries)) return this.off(); - - library_arr = libraries.split(' '); - - if (library_arr.length > 0) { - for (var i = library_arr.length - 1; i >= 0; i--) { - responses.push(this.init_lib(library_arr[i], args)); - } - } - } else { - for (var lib in this.libs) { - responses.push(this.init_lib(lib, args)); - } - } - - // if first argument is callback, add to args - if (typeof libraries === 'function') { - args.unshift(libraries); - } - - return this.response_obj(responses, args); - }, - - response_obj : function (response_arr, args) { - for (var callback in args) { - if (typeof args[callback] === 'function') { - return args[callback]({ - errors: response_arr.filter(function (s) { - if (typeof s === 'string') return s; - }) - }); - } - } - - return response_arr; - }, - - init_lib : function (lib, args) { - return this.trap(function () { - if (this.libs.hasOwnProperty(lib)) { - this.patch(this.libs[lib]); - return this.libs[lib].init.apply(this.libs[lib], args); - } - }.bind(this), lib); - }, - - trap : function (fun, lib) { - if (!this.nc) { - try { - return fun(); - } catch (e) { - return this.error({name: lib, message: 'could not be initialized', more: e.name + ' ' + e.message}); - } - } - - return fun(); - }, - - patch : function (lib) { - this.fix_outer(lib); - }, - - inherit : function (scope, methods) { - var methods_arr = methods.split(' '); - - for (var i = methods_arr.length - 1; i >= 0; i--) { - if (this.lib_methods.hasOwnProperty(methods_arr[i])) { - this.libs[scope.name][methods_arr[i]] = this.lib_methods[methods_arr[i]]; - } - } - }, - - libs : {}, - - // methods that can be inherited in libraries - lib_methods : { - set_data : function (node, data) { - // this.name references the name of the library calling this method - var id = this.name + (+new Date()); - - Foundation.cache[id] = data; - node.attr('data-' + this.name + '-id', id); - }, - - get_data : function (node) { - return Foundation.cache[node.attr('data-' + this.name + '-id')]; - }, - - remove_data : function (node) { - if (node) { - delete Foundation.cache[node.attr('data-' + this.name + '-id')]; - node.attr('data-' + this.name + '-id', ''); - } else { - $('[data-' + this.name + '-id]').each(function () { - delete Foundation.cache[$(this).attr('data-' + this.name + '-id')]; - $(this).attr('data-' + this.name + '-id', ''); - }); - } - }, - - throttle : function(fun, delay) { - var timer = null; - return function () { - var context = this, args = arguments; - clearTimeout(timer); - timer = setTimeout(function () { - fun.apply(context, args); - }, delay); - }; - }, - - // parses dat-options attribute on page nodes and turns - // them into an object - data_options : function (el) { - var opts = {}, ii, p, - opts_arr = (el.attr('data-options') || ':').split(';'), - opts_len = opts_arr.length; - - function trim(str) { - if (typeof str === 'string') return $.trim(str); - return str; - } - - // parse options - for (ii = opts_len - 1; ii >= 0; ii--) { - p = opts_arr[ii].split(':'); - - if (/true/i.test(p[1])) p[1] = true; - if (/false/i.test(p[1])) p[1] = false; - - if (p.length === 2) { - opts[trim(p[0])] = trim(p[1]); - } - } - - return opts; - }, - - delay : function (fun, delay) { - return setTimeout(fun, delay); - }, - - // animated scrolling - scrollTo : function (el, to, duration) { - if (duration < 0) return; - var difference = to - $(window).scrollTop(); - var perTick = difference / duration * 10; - - this.scrollToTimerCache = setTimeout(function() { - if (!isNaN(parseInt(perTick, 10))) { - window.scrollTo(0, $(window).scrollTop() + perTick); - this.scrollTo(el, to, duration - 10); - } - }.bind(this), 10); - }, - - // not supported in core Zepto - scrollLeft : function (el) { - if (!el.length) return; - return ('scrollLeft' in el[0]) ? el[0].scrollLeft : el[0].pageXOffset; - }, - - // test for empty object or array - empty : function (obj) { - if (obj.length && obj.length > 0) return false; - if (obj.length && obj.length === 0) return true; - - for (var key in obj) { - if (hasOwnProperty.call(obj, key)) return false; - } - - return true; - } - }, - - fix_outer : function (lib) { - lib.outerHeight = function (el, bool) { - if (typeof Zepto === 'function') { - return el.height(); - } - - if (typeof bool !== 'undefined') { - return el.outerHeight(bool); - } - - return el.outerHeight(); - }; - - lib.outerWidth = function (el) { - if (typeof Zepto === 'function') { - return el.width(); - } - - if (typeof bool !== 'undefined') { - return el.outerWidth(bool); - } - - return el.outerWidth(); - }; - }, - - error : function (error) { - return error.name + ' ' + error.message + '; ' + error.more; - }, - - // remove all foundation events. - off: function () { - $(this.scope).off('.fndtn'); - $(window).off('.fndtn'); - return true; - }, - - zj : function () { - try { - return Zepto; - } catch (e) { - return jQuery; - } - }() - }, - - $.fn.foundation = function () { - var args = Array.prototype.slice.call(arguments, 0); - - return this.each(function () { - Foundation.init.apply(Foundation, [this].concat(args)); - return this; - }); - }; - -}(this, this.document)); diff --git a/doc/foundation/static/js/foundation/foundation.magellan.js b/doc/foundation/static/js/foundation/foundation.magellan.js deleted file mode 100644 index 3cdef5b..0000000 --- a/doc/foundation/static/js/foundation/foundation.magellan.js +++ /dev/null @@ -1,130 +0,0 @@ -/*jslint unparam: true, browser: true, indent: 2 */ - -;(function ($, window, document, undefined) { - 'use strict'; - - Foundation.libs.magellan = { - name : 'magellan', - - version : '4.0.0', - - settings : { - activeClass: 'active' - }, - - init : function (scope, method, options) { - this.scope = scope || this.scope; - Foundation.inherit(this, 'data_options'); - - if (typeof method === 'object') { - $.extend(true, this.settings, method); - } - - if (typeof method != 'string') { - if (!this.settings.init) { - this.fixed_magellan = $("[data-magellan-expedition]"); - this.set_threshold(); - this.last_destination = $('[data-magellan-destination]').last(); - this.events(); - } - - return this.settings.init; - } else { - return this[method].call(this, options); - } - }, - - events : function () { - var self = this; - $(this.scope).on('arrival.fndtn.magellan', '[data-magellan-arrival]', function (e) { - var $destination = $(this), - $expedition = $destination.closest('[data-magellan-expedition]'), - activeClass = $expedition.attr('data-magellan-active-class') - || self.settings.activeClass; - - $destination - .closest('[data-magellan-expedition]') - .find('[data-magellan-arrival]') - .not($destination) - .removeClass(activeClass); - $destination.addClass(activeClass); - }); - - this.fixed_magellan - .on('update-position.fndtn.magellan', function(){ - var $el = $(this); - // $el.data("magellan-fixed-position",""); - //$el.data("magellan-top-offset", ""); - }) - .trigger('update-position'); - - $(window) - .on('resize.fndtn.magellan', function() { - this.fixed_magellan.trigger('update-position'); - }.bind(this)) - - .on('scroll.fndtn.magellan', function() { - var windowScrollTop = $(window).scrollTop(); - self.fixed_magellan.each(function() { - var $expedition = $(this); - if (typeof $expedition.data('magellan-top-offset') === 'undefined') { - $expedition.data('magellan-top-offset', $expedition.offset().top); - } - if (typeof $expedition.data('magellan-fixed-position') === 'undefined') { - $expedition.data('magellan-fixed-position', false) - } - var fixed_position = (windowScrollTop + self.settings.threshold) > $expedition.data("magellan-top-offset"); - var attr = $expedition.attr('data-magellan-top-offset'); - - if ($expedition.data("magellan-fixed-position") != fixed_position) { - $expedition.data("magellan-fixed-position", fixed_position); - if (fixed_position) { - $expedition.css({position:"fixed", top:0}); - } else { - $expedition.css({position:"", top:""}); - } - if (fixed_position && typeof attr != 'undefined' && attr != false) { - $expedition.css({position:"fixed", top:attr + "px"}); - } - } - }); - }); - - - if (this.last_destination.length > 0) { - $(window).on('scroll.fndtn.magellan', function (e) { - var windowScrollTop = $(window).scrollTop(), - scrolltopPlusHeight = windowScrollTop + $(window).height(), - lastDestinationTop = Math.ceil(self.last_destination.offset().top); - - $('[data-magellan-destination]').each(function () { - var $destination = $(this), - destination_name = $destination.attr('data-magellan-destination'), - topOffset = $destination.offset().top - windowScrollTop; - - if (topOffset <= self.settings.threshold) { - $("[data-magellan-arrival='" + destination_name + "']").trigger('arrival'); - } - // In large screens we may hit the bottom of the page and dont reach the top of the last magellan-destination, so lets force it - if (scrolltopPlusHeight >= $(self.scope).height() && lastDestinationTop > windowScrollTop && lastDestinationTop < scrolltopPlusHeight) { - $('[data-magellan-arrival]').last().trigger('arrival'); - } - }); - }); - } - - this.settings.init = true; - }, - - set_threshold : function () { - if (!this.settings.threshold) { - this.settings.threshold = (this.fixed_magellan.length > 0) ? - this.outerHeight(this.fixed_magellan, true) : 0; - } - }, - - off : function () { - $(this.scope).off('.fndtn.magellan'); - } - }; -}(Foundation.zj, this, this.document)); diff --git a/doc/foundation/static/js/foundation/foundation.orbit.js b/doc/foundation/static/js/foundation/foundation.orbit.js deleted file mode 100644 index df5f7c6..0000000 --- a/doc/foundation/static/js/foundation/foundation.orbit.js +++ /dev/null @@ -1,357 +0,0 @@ -;(function ($, window, document, undefined) { - 'use strict'; - - Foundation.libs = Foundation.libs || {}; - - Foundation.libs.orbit = { - version: '4.0.0', - - settings: { - timer_speed: 10000, - animation_speed: 500, - bullets: true, - stack_on_small: true, - container_class: 'orbit-container', - stack_on_small_class: 'orbit-stack-on-small', - next_class: 'orbit-next', - prev_class: 'orbit-prev', - timer_container_class: 'orbit-timer', - timer_paused_class: 'paused', - timer_progress_class: 'orbit-progress', - slides_container_class: 'orbit-slides-container', - bullets_container_class: 'orbit-bullets', - bullets_active_class: 'active', - slide_number_class: 'orbit-slide-number', - caption_class: 'orbit-caption', - active_slide_class: 'active', - orbit_transition_class: 'orbit-transitioning' - }, - - init: function (scope, method, options) { - var self = this; - - if (typeof method === 'object') { - $.extend(true, self.settings, method); - } - - $('[data-orbit]', scope).each($.proxy(self._init, self)); - }, - - _container_html: function() { - var self = this; - return '
          '; - }, - - _bullets_container_html: function($slides) { - var self = this, - $list = $('
            '); - $slides.each(function(idx, slide) { - var $item = $('
          1. '); - if (idx === 0) { - $item.addClass(self.settings.bullets_active_class); - } - $list.append($item); - }); - return $list; - }, - - _slide_number_html: function(slide_number, total_slides) { - var self = this, - $container = $('
            '); - $container.append('' + slide_number + ' of ' + total_slides + ''); - return $container; - }, - - _timer_html: function() { - var self = this; - if (typeof self.settings.timer_speed === 'number' && self.settings.timer_speed > 0) { - return '
            '; - } else { - return ''; - } - }, - - _next_html: function() { - var self = this; - return 'Next '; - }, - - _prev_html: function() { - var self = this; - return 'Prev '; - }, - - _init: function (idx, slider) { - var self = this, - $slides_container = $(slider), - $container = $slides_container.wrap(self._container_html()).parent(), - $slides = $slides_container.children(); - - $container.append(self._prev_html()); - $container.append(self._next_html()); - $slides_container.addClass(self.settings.slides_container_class); - if (self.settings.stack_on_small) { - $container.addClass(self.settings.stack_on_small_class); - } - $container.append(self._slide_number_html(1, $slides.length)); - $container.append(self._timer_html()); - if (self.settings.bullets) { - $container.after(self._bullets_container_html($slides)); - } - // To better support the "sliding" effect it's easier - // if we just clone the first and last slides - $slides_container.append($slides.first().clone().attr('data-orbit-slide','')); - $slides_container.prepend($slides.last().clone().attr('data-orbit-slide','')); - // Make the first "real" slide active - $slides_container.css('marginLeft', '-100%'); - $slides.first().addClass(self.settings.active_slide_class); - - self._init_events($slides_container); - self._init_dimensions($slides_container); - self._start_timer($slides_container); - }, - - _init_events: function ($slides_container) { - var self = this, - $container = $slides_container.parent(); - - $(window) - .on('load.fndtn.orbit', function() { - $slides_container.height(''); - $slides_container.height($slides_container.height($container.height())); - $slides_container.trigger('orbit:ready'); - }) - .on('resize.fndtn.orbit', function() { - $slides_container.height(''); - $slides_container.height($slides_container.height($container.height())); - }); - - $(document).on('click.fndtn.orbit', '[data-orbit-link]', function(e) { - e.preventDefault(); - var id = $(e.currentTarget).attr('data-orbit-link'), - $slide = $slides_container.find('[data-orbit-slide=' + id + ']').first(); - - if ($slide.length === 1) { - self._reset_timer($slides_container, true); - self.goto($slides_container, $slide.index(), function() {}); - } - }); - - $container.siblings('.' + self.settings.bullets_container_class) - .on('click.fndtn.orbit', '[data-orbit-slide-number]', function(e) { - e.preventDefault(); - self._reset_timer($slides_container, true); - self.goto($slides_container, $(e.currentTarget).data('orbit-slide-number'),function() {}); - }); - - $container - .on('orbit:after-slide-change.fndtn.orbit', function(e, orbit) { - var $slide_number = $container.find('.' + self.settings.slide_number_class); - - if ($slide_number.length === 1) { - $slide_number.replaceWith(self._slide_number_html(orbit.slide_number, orbit.total_slides)); - } - }) - .on('orbit:next-slide.fndtn.orbit click.fndtn.orbit', '.' + self.settings.next_class, function(e) { - e.preventDefault(); - self._reset_timer($slides_container, true); - self.goto($slides_container, 'next', function() {}); - }) - .on('orbit:prev-slide.fndtn.orbit click.fndtn.orbit', '.' + self.settings.prev_class, function(e) { - e.preventDefault(); - self._reset_timer($slides_container, true); - self.goto($slides_container, 'prev', function() {}); - }) - .on('orbit:toggle-play-pause.fndtn.orbit click.fndtn.orbit touchstart.fndtn.orbit', '.' + self.settings.timer_container_class, function(e) { - e.preventDefault(); - var $timer = $(e.currentTarget).toggleClass(self.settings.timer_paused_class), - $slides_container = $timer.closest('.' + self.settings.container_class) - .find('.' + self.settings.slides_container_class); - - if ($timer.hasClass(self.settings.timer_paused_class)) { - self._stop_timer($slides_container); - } else { - self._start_timer($slides_container); - } - }) - .on('touchstart.fndtn.orbit', function(e) { - if (!e.touches) { e = e.originalEvent; } - var data = { - start_page_x: e.touches[0].pageX, - start_page_y: e.touches[0].pageY, - start_time: (new Date()).getTime(), - delta_x: 0, - is_scrolling: undefined - }; - $container.data('swipe-transition', data); - e.stopPropagation(); - }) - .on('touchmove.fndtn.orbit', function(e) { - if (!e.touches) { e = e.originalEvent; } - // Ignore pinch/zoom events - if(e.touches.length > 1 || e.scale && e.scale !== 1) return; - - var data = $container.data('swipe-transition'); - if (typeof data === 'undefined') { - data = {}; - } - - data.delta_x = e.touches[0].pageX - data.start_page_x; - - if ( typeof data.is_scrolling === 'undefined') { - data.is_scrolling = !!( data.is_scrolling || Math.abs(data.delta_x) < Math.abs(e.touches[0].pageY - data.start_page_y) ); - } - - if (!data.is_scrolling && !data.active) { - e.preventDefault(); - self._stop_timer($slides_container); - var direction = (data.delta_x < 0) ? 'next' : 'prev'; - data.active = true; - self.goto($slides_container, direction, function() {}); - } - }) - .on('touchend.fndtn.orbit', function(e) { - $container.data('swipe-transition', {}); - e.stopPropagation(); - }); - }, - - _init_dimensions: function ($slides_container) { - var $container = $slides_container.parent(), - $slides = $slides_container.children(); - - $slides_container.css('width', $slides.length * 100 + '%'); - $slides.css('width', 100 / $slides.length + '%'); - $slides_container.height($container.height()); - $slides_container.css('width', $slides.length * 100 + '%'); - }, - - _start_timer: function ($slides_container) { - var self = this, - $container = $slides_container.parent(); - - var callback = function() { - self._reset_timer($slides_container, false); - self.goto($slides_container, 'next', function() { - self._start_timer($slides_container); - }); - }; - - var $timer = $container.find('.' + self.settings.timer_container_class), - $progress = $timer.find('.' + self.settings.timer_progress_class), - progress_pct = ($progress.width() / $timer.width()), - delay = self.settings.timer_speed - (progress_pct * self.settings.timer_speed); - - $progress.animate({'width': '100%'}, delay, 'linear', callback).data('is-original', 'beans?'); - $slides_container.trigger('orbit:timer-started'); - }, - - _stop_timer: function ($slides_container) { - var self = this, - $container = $slides_container.parent(), - $timer = $container.find('.' + self.settings.timer_container_class), - $progress = $timer.find('.' + self.settings.timer_progress_class), - progress_pct = $progress.width() / $timer.width() - self._rebuild_timer($container, progress_pct * 100 + '%'); - // $progress.stop(); - $slides_container.trigger('orbit:timer-stopped'); - $timer = $container.find('.' + self.settings.timer_container_class); - $timer.addClass(self.settings.timer_paused_class); - }, - - _reset_timer: function($slides_container, is_paused) { - var self = this, - $container = $slides_container.parent(); - self._rebuild_timer($container, '0%'); - if (typeof is_paused === 'boolean' && is_paused) { - var $timer = $container.find('.' + self.settings.timer_container_class); - $timer.addClass(self.settings.timer_paused_class); - } - }, - - _rebuild_timer: function ($container, width_pct) { - // Zepto is unable to stop animations since they - // are css-based. This is a workaround for that - // limitation, which rebuilds the dom element - // thus stopping the animation - var self = this, - $timer = $container.find('.' + self.settings.timer_container_class), - $new_timer = $(self._timer_html()), - $new_timer_progress = $new_timer.find('.' + self.settings.timer_progress_class); - - if (typeof Zepto === 'function') { - $timer.remove(); - $container.append($new_timer); - $new_timer_progress.css('width', width_pct); - } else if (typeof jQuery === 'function') { - var $progress = $timer.find('.' + self.settings.timer_progress_class); - $progress.css('width', width_pct); - $progress.stop(); - } - }, - - goto: function($slides_container, index_or_direction, callback) { - var self = this, - $container = $slides_container.parent(), - $slides = $slides_container.children(), - $active_slide = $slides_container.find('.' + self.settings.active_slide_class), - active_index = $active_slide.index(); - - if ($container.hasClass(self.settings.orbit_transition_class)) { - return false; - } - - if (index_or_direction === 'prev') { - if (active_index === 0) { - active_index = $slides.length - 1; - } - else { - active_index--; - } - } - else if (index_or_direction === 'next') { - active_index = (active_index+1) % $slides.length; - } - else if (typeof index_or_direction === 'number') { - active_index = (index_or_direction % $slides.length); - } - if (active_index === ($slides.length - 1) && index_or_direction === 'next') { - $slides_container.css('marginLeft', '0%'); - active_index = 1; - } - else if (active_index === 0 && index_or_direction === 'prev') { - $slides_container.css('marginLeft', '-' + ($slides.length - 1) * 100 + '%'); - active_index = $slides.length - 2; - } - // Start transition, make next slide active - $container.addClass(self.settings.orbit_transition_class); - $active_slide.removeClass(self.settings.active_slide_class); - $($slides[active_index]).addClass(self.settings.active_slide_class); - // Make next bullet active - var $bullets = $container.siblings('.' + self.settings.bullets_container_class); - if ($bullets.length === 1) { - $bullets.children().removeClass(self.settings.bullets_active_class); - $($bullets.children()[active_index-1]).addClass(self.settings.bullets_active_class); - } - var new_margin_left = '-' + (active_index * 100) + '%'; - // Check to see if animation will occur, otherwise perform - // callbacks manually - $slides_container.trigger('orbit:before-slide-change'); - if ($slides_container.css('marginLeft') === new_margin_left) { - $container.removeClass(self.settings.orbit_transition_class); - $slides_container.trigger('orbit:after-slide-change', [{slide_number: active_index, total_slides: $slides_container.children().length - 2}]); - callback(); - } else { - $slides_container.animate({ - 'marginLeft' : new_margin_left - }, self.settings.animation_speed, 'linear', function() { - $container.removeClass(self.settings.orbit_transition_class); - $slides_container.trigger('orbit:after-slide-change', [{slide_number: active_index, total_slides: $slides_container.children().length - 2}]); - callback(); - }); - } - } - }; -}(Foundation.zj, this, this.document)); diff --git a/doc/foundation/static/js/foundation/foundation.placeholder.js b/doc/foundation/static/js/foundation/foundation.placeholder.js deleted file mode 100644 index 65c18fc..0000000 --- a/doc/foundation/static/js/foundation/foundation.placeholder.js +++ /dev/null @@ -1,159 +0,0 @@ -/*! http://mths.be/placeholder v2.0.7 by @mathias - Modified to work with Zepto.js by ZURB -*/ -;(function(window, document, $) { - - var isInputSupported = 'placeholder' in document.createElement('input'), - isTextareaSupported = 'placeholder' in document.createElement('textarea'), - prototype = $.fn, - valHooks = $.valHooks, - hooks, - placeholder; - - if (isInputSupported && isTextareaSupported) { - - placeholder = prototype.placeholder = function() { - return this; - }; - - placeholder.input = placeholder.textarea = true; - - } else { - - placeholder = prototype.placeholder = function() { - var $this = this; - $this - .filter((isInputSupported ? 'textarea' : ':input') + '[placeholder]') - .not('.placeholder') - .bind({ - 'focus.placeholder': clearPlaceholder, - 'blur.placeholder': setPlaceholder - }) - .data('placeholder-enabled', true) - .trigger('blur.placeholder'); - return $this; - }; - - placeholder.input = isInputSupported; - placeholder.textarea = isTextareaSupported; - - hooks = { - 'get': function(element) { - var $element = $(element); - return $element.data('placeholder-enabled') && $element.hasClass('placeholder') ? '' : element.value; - }, - 'set': function(element, value) { - var $element = $(element); - if (!$element.data('placeholder-enabled')) { - return element.value = value; - } - if (value == '') { - element.value = value; - // Issue #56: Setting the placeholder causes problems if the element continues to have focus. - if (element != document.activeElement) { - // We can't use `triggerHandler` here because of dummy text/password inputs :( - setPlaceholder.call(element); - } - } else if ($element.hasClass('placeholder')) { - clearPlaceholder.call(element, true, value) || (element.value = value); - } else { - element.value = value; - } - // `set` can not return `undefined`; see http://jsapi.info/jquery/1.7.1/val#L2363 - return $element; - } - }; - - isInputSupported || (valHooks.input = hooks); - isTextareaSupported || (valHooks.textarea = hooks); - - $(function() { - // Look for forms - $(document).delegate('form', 'submit.placeholder', function() { - // Clear the placeholder values so they don't get submitted - var $inputs = $('.placeholder', this).each(clearPlaceholder); - setTimeout(function() { - $inputs.each(setPlaceholder); - }, 10); - }); - }); - - // Clear placeholder values upon page reload - $(window).bind('beforeunload.placeholder', function() { - $('.placeholder').each(function() { - this.value = ''; - }); - }); - - } - - function args(elem) { - // Return an object of element attributes - var newAttrs = {}, - rinlinejQuery = /^jQuery\d+$/; - $.each(elem.attributes, function(i, attr) { - if (attr.specified && !rinlinejQuery.test(attr.name)) { - newAttrs[attr.name] = attr.value; - } - }); - return newAttrs; - } - - function clearPlaceholder(event, value) { - var input = this, - $input = $(input); - if (input.value == $input.attr('placeholder') && $input.hasClass('placeholder')) { - if ($input.data('placeholder-password')) { - $input = $input.hide().next().show().attr('id', $input.removeAttr('id').data('placeholder-id')); - // If `clearPlaceholder` was called from `$.valHooks.input.set` - if (event === true) { - return $input[0].value = value; - } - $input.focus(); - } else { - input.value = ''; - $input.removeClass('placeholder'); - input == document.activeElement && input.select(); - } - } - } - - function setPlaceholder() { - var $replacement, - input = this, - $input = $(input), - $origInput = $input, - id = this.id; - if (input.value == '') { - if (input.type == 'password') { - if (!$input.data('placeholder-textinput')) { - try { - $replacement = $input.clone().attr({ 'type': 'text' }); - } catch(e) { - $replacement = $('').attr($.extend(args(this), { 'type': 'text' })); - } - $replacement - .removeAttr('name') - .data({ - 'placeholder-password': true, - 'placeholder-id': id - }) - .bind('focus.placeholder', clearPlaceholder); - $input - .data({ - 'placeholder-textinput': $replacement, - 'placeholder-id': id - }) - .before($replacement); - } - $input = $input.removeAttr('id').hide().prev().attr('id', id).show(); - // Note: `$input[0] != input` now! - } - $input.addClass('placeholder'); - $input[0].value = $input.attr('placeholder'); - } else { - $input.removeClass('placeholder'); - } - } - -}(this, document, Foundation.zj)); diff --git a/doc/foundation/static/js/foundation/foundation.reveal.js b/doc/foundation/static/js/foundation/foundation.reveal.js deleted file mode 100644 index b4e1b52..0000000 --- a/doc/foundation/static/js/foundation/foundation.reveal.js +++ /dev/null @@ -1,272 +0,0 @@ -/*jslint unparam: true, browser: true, indent: 2 */ - -;(function ($, window, document, undefined) { - 'use strict'; - - Foundation.libs.reveal = { - name: 'reveal', - - version : '4.0.4', - - locked : false, - - settings : { - animation: 'fadeAndPop', - animationSpeed: 250, - closeOnBackgroundClick: true, - dismissModalClass: 'close-reveal-modal', - bgClass: 'reveal-modal-bg', - open: function(){}, - opened: function(){}, - close: function(){}, - closed: function(){}, - bg : $('.reveal-modal-bg'), - css : { - open : { - 'opacity': 0, - 'visibility': 'visible', - 'display' : 'block' - }, - close : { - 'opacity': 1, - 'visibility': 'hidden', - 'display': 'none' - } - } - }, - - init : function (scope, method, options) { - this.scope = scope || this.scope; - Foundation.inherit(this, 'data_options delay'); - - if (typeof method === 'object') { - $.extend(true, this.settings, method); - } - - if (typeof method != 'string') { - if (!this.settings.init) this.events(); - - return this.settings.init; - } else { - return this[method].call(this, options); - } - }, - - events : function () { - var self = this; - - $(this.scope) - .on('click.fndtn.reveal', '[data-reveal-id]', function (e) { - e.preventDefault(); - if (!self.locked) { - self.locked = true; - self.open.call(self, $(this)); - } - }) - .on('click.fndtn.reveal touchend.click.fndtn.reveal', this.close_targets(), function (e) { - if (!self.locked) { - self.locked = true; - self.close.call(self, $(this).closest('.reveal-modal')); - } - }) - .on('open.fndtn.reveal', '.reveal-modal', this.settings.open) - .on('opened.fndtn.reveal', '.reveal-modal', this.settings.opened) - .on('opened.fndtn.reveal', '.reveal-modal', this.open_video) - .on('close.fndtn.reveal', '.reveal-modal', this.settings.close) - .on('closed.fndtn.reveal', '.reveal-modal', this.settings.closed) - .on('closed.fndtn.reveal', '.reveal-modal', this.close_video); - }, - - open : function (target) { - if (target) { - var modal = $('#' + target.data('reveal-id')); - } else { - var modal = $(this.scope); - } - - var open_modal = $('.reveal-modal.open'); - - if (!modal.data('css-top')) { - modal.data('css-top', parseInt(modal.css('top'), 10)) - .data('offset', this.cache_offset(modal)); - } - - modal.trigger('open'); - - if (open_modal.length < 1) { - this.toggle_bg(modal); - } - - this.toggle_modals(open_modal, modal); - }, - - close : function (modal) { - var modal = modal || $(this.scope); - this.locked = true; - var open_modal = $('.reveal-modal.open').not(modal); - modal.trigger('close'); - this.toggle_bg(modal); - this.toggle_modals(open_modal, modal); - }, - - close_targets : function () { - var base = '.' + this.settings.dismissModalClass; - - if (this.settings.closeOnBackgroundClick) { - return base + ', .' + this.settings.bgClass; - } - - return base; - }, - - toggle_modals : function (open_modal, modal) { - if (open_modal.length > 0) { - this.hide(open_modal, this.settings.css.close); - } - - if (modal.filter(':visible').length > 0) { - this.hide(modal, this.settings.css.close); - } else { - this.show(modal, this.settings.css.open); - } - }, - - toggle_bg : function (modal) { - if (this.settings.bg.length === 0) { - this.settings.bg = $('
            ', {'class': this.settings.bgClass}) - .insertAfter(modal); - } - - if (this.settings.bg.filter(':visible').length > 0) { - this.hide(this.settings.bg); - } else { - this.show(this.settings.bg); - } - }, - - show : function (el, css) { - // is modal - if (css) { - if (/pop/i.test(this.settings.animation)) { - css.top = $(window).scrollTop() - el.data('offset') + 'px'; - var end_css = { - top: $(window).scrollTop() + el.data('css-top') + 'px', - opacity: 1 - } - - return this.delay(function () { - return el - .css(css) - .animate(end_css, this.settings.animationSpeed, 'linear', function () { - this.locked = false; - el.trigger('opened'); - }.bind(this)) - .addClass('open'); - }.bind(this), this.settings.animationSpeed / 2); - } - - if (/fade/i.test(this.settings.animation)) { - var end_css = {opacity: 1}; - - return this.delay(function () { - return el - .css(css) - .animate(end_css, this.settings.animationSpeed, 'linear', function () { - this.locked = false; - el.trigger('opened'); - }.bind(this)) - .addClass('open'); - }.bind(this), this.settings.animationSpeed / 2); - } - - return el.css(css).show().css({opacity: 1}).addClass('open').trigger('opened'); - } - - // should we animate the background? - if (/fade/i.test(this.settings.animation)) { - return el.fadeIn(this.settings.animationSpeed / 2); - } - - return el.show(); - }, - - hide : function (el, css) { - // is modal - if (css) { - if (/pop/i.test(this.settings.animation)) { - var end_css = { - top: - $(window).scrollTop() - el.data('offset') + 'px', - opacity: 0 - }; - - return this.delay(function () { - return el - .animate(end_css, this.settings.animationSpeed, 'linear', function () { - this.locked = false; - el.css(css).trigger('closed'); - }.bind(this)) - .removeClass('open'); - }.bind(this), this.settings.animationSpeed / 2); - } - - if (/fade/i.test(this.settings.animation)) { - var end_css = {opacity: 0}; - - return this.delay(function () { - return el - .animate(end_css, this.settings.animationSpeed, 'linear', function () { - this.locked = false; - el.css(css).trigger('closed'); - }.bind(this)) - .removeClass('open'); - }.bind(this), this.settings.animationSpeed / 2); - } - - return el.hide().css(css).removeClass('open').trigger('closed'); - } - - // should we animate the background? - if (/fade/i.test(this.settings.animation)) { - return el.fadeOut(this.settings.animationSpeed / 2); - } - - return el.hide(); - }, - - close_video : function (e) { - var video = $(this).find('.flex-video'), - iframe = video.find('iframe'); - - if (iframe.length > 0) { - iframe.attr('data-src', iframe[0].src); - iframe.attr('src', 'about:blank'); - video.fadeOut(100).hide(); - } - }, - - open_video : function (e) { - var video = $(this).find('.flex-video'), - iframe = video.find('iframe'); - - if (iframe.length > 0) { - var data_src = iframe.attr('data-src'); - if (typeof data_src === 'string') { - iframe[0].src = iframe.attr('data-src'); - } - video.show().fadeIn(100); - } - }, - - cache_offset : function (modal) { - var offset = modal.show().height() + parseInt(modal.css('top'), 10); - - modal.hide(); - - return offset; - }, - - off : function () { - $(this.scope).off('.fndtn.reveal'); - } - }; -}(Foundation.zj, this, this.document)); diff --git a/doc/foundation/static/js/foundation/foundation.section.js b/doc/foundation/static/js/foundation/foundation.section.js deleted file mode 100644 index ccf1ac8..0000000 --- a/doc/foundation/static/js/foundation/foundation.section.js +++ /dev/null @@ -1,240 +0,0 @@ -/*jslint unparam: true, browser: true, indent: 2 */ - -;(function ($, window, document, undefined) { - 'use strict'; - - Foundation.libs.section = { - name: 'section', - - version : '4.0.5', - - settings : { - deep_linking: false, - one_up: true, - callback: function (){} - }, - - init : function (scope, method, options) { - this.scope = scope || this.scope; - Foundation.inherit(this, 'throttle data_options'); - - if (typeof method === 'object') { - $.extend(true, this.settings, method); - } - - if (typeof method != 'string') { - this.set_active_from_hash(); - if (!this.settings.init) this.events(); - - return this.settings.init; - } else { - return this[method].call(this, options); - } - }, - - events : function () { - var self = this; - $(this.scope).on('click.fndtn.section', '[data-section] .title', function (e) { - $.extend(true, self.settings, self.data_options($(this).closest('[data-section]'))); - self.toggle_active.call(this, e, self); - }); - - $(window).on('resize.fndtn.section', self.throttle(function () { - self.resize.call(this); - }, 30)).trigger('resize'); - - $('[data-section] .content').on('click.fndtn.section', function (e) { - e.stopPropagation(); - }); - - $('*, html, body').on('click.fndtn.section', function (e) { - if ($(e.target).closest('.title').length < 1) { - $('[data-section].vertical-nav, [data-section].horizontal-nav') - .find('section, .section') - .removeClass('active') - .attr('style', ''); - } - }); - - this.settings.init = true; - }, - - toggle_active : function (e, self) { - var $this = $(this), - section = $this.closest('section, .section'), - content = section.find('.content'), - parent = section.closest('[data-section]'), - self = Foundation.libs.section; - - if (!self.settings.deep_linking && content.length > 0) { - e.preventDefault(); - } - - if (section.hasClass('active')) { - if (self.small(parent) - || self.is_vertical(parent) - || self.is_horizontal(parent) - || self.is_accordion(parent)) { - section - .removeClass('active') - .attr('style', ''); - } - } else { - if (self.small(parent) || self.settings.one_up) { - $this - .closest('[data-section]') - .find('section, .section') - .removeClass('active') - .attr('style', ''); - - section.css('padding-top', self.outerHeight(section.find('.title'))); - } - - $('[data-section].vertical-nav, [data-section].horizontal-nav') - .find('section, .section') - .removeClass('active') - .attr('style', ''); - - if (self.small(parent)) { - section.attr('style', ''); - } - - section.addClass('active'); - } - - self.settings.callback(); - }, - - resize : function () { - var sections = $('[data-section]'), - self = Foundation.libs.section; - - sections.each(function() { - var $this = $(this), - active_section = $this.find('section.active, .section.active'); - if (active_section.length > 1) { - active_section - .not(':first') - .removeClass('active') - .attr('style', ''); - } else if (active_section.length < 1 - && !self.is_vertical($this) - && !self.is_horizontal($this) - && !self.is_accordion($this)) { - var first = $this.find('section, .section').first(); - first.addClass('active'); - - if (self.small($this)) { - first.attr('style', ''); - } else { - first.css('padding-top', self.outerHeight(first.find('.title'))); - } - } - - if (self.small($this)) { - active_section.attr('style', ''); - } else { - active_section.css('padding-top', self.outerHeight(active_section.find('.title'))); - } - self.position_titles($this); - - if (self.is_horizontal($this) && !self.small($this)) { - self.position_content($this); - } else { - self.position_content($this, false); - } - }); - }, - - is_vertical : function (el) { - return el.hasClass('vertical-nav'); - }, - - is_horizontal : function (el) { - return el.hasClass('horizontal-nav'); - }, - - is_accordion : function (el) { - return el.hasClass('accordion'); - }, - - set_active_from_hash : function () { - var hash = window.location.hash.substring(1), - sections = $('[data-section]'), - self = this; - - sections.each(function () { - var section = $(this); - $.extend(true, self.settings, self.data_options(section)); - - if (hash.length > 0 && self.settings.deep_linking) { - section - .find('.content[data-slug="' + hash + '"]') - .closest('section, .section') - .addClass('active'); - } - }); - }, - - position_titles : function (section, off) { - var titles = section.find('.title'), - previous_width = 0, - self = this; - - if (typeof off === 'boolean') { - titles.attr('style', ''); - - } else { - titles.each(function () { - $(this).css('left', previous_width); - previous_width += self.outerWidth($(this)); - }); - } - }, - - position_content : function (section, off) { - var titles = section.find('.title'), - content = section.find('.content'), - self = this; - - if (typeof off === 'boolean') { - content.attr('style', ''); - section.attr('style', ''); - } else { - section.find('section, .section').each(function () { - var title = $(this).find('.title'), - content = $(this).find('.content'); - - content.css({left: title.position().left - 1, top: self.outerHeight(title) - 2}); - }); - - // temporary work around for Zepto outerheight calculation issues. - if (typeof Zepto === 'function') { - section.height(this.outerHeight(titles.first())); - } else { - section.height(this.outerHeight(titles.first()) - 2); - } - } - - }, - - small : function (el) { - if (el && this.is_accordion(el)) { - return true; - } - if ($('html').hasClass('lt-ie9')) { - return true; - } - if ($('html').hasClass('ie8compat')) { - return true; - } - return $(this.scope).width() < 768; - }, - - off : function () { - $(this.scope).off('.fndtn.section'); - $(window).off('.fndtn.section'); - this.settings.init = false; - } - }; -}(Foundation.zj, this, this.document)); diff --git a/doc/foundation/static/js/foundation/foundation.tooltips.js b/doc/foundation/static/js/foundation/foundation.tooltips.js deleted file mode 100644 index 1696e2a..0000000 --- a/doc/foundation/static/js/foundation/foundation.tooltips.js +++ /dev/null @@ -1,195 +0,0 @@ -/*jslint unparam: true, browser: true, indent: 2 */ - -;(function ($, window, document, undefined) { - 'use strict'; - - Foundation.libs.tooltips = { - name: 'tooltips', - - version : '4.0.2', - - settings : { - selector : '.has-tip', - additionalInheritableClasses : [], - tooltipClass : '.tooltip', - tipTemplate : function (selector, content) { - return '' + content + ''; - } - }, - - cache : {}, - - init : function (scope, method, options) { - var self = this; - this.scope = scope || this.scope; - - if (typeof method === 'object') { - $.extend(true, this.settings, method); - } - - if (typeof method != 'string') { - if (Modernizr.touch) { - $(this.scope) - .on('click.fndtn.tooltip touchstart.fndtn.tooltip touchend.fndtn.tooltip', - '[data-tooltip]', function (e) { - e.preventDefault(); - $(self.settings.tooltipClass).hide(); - self.showOrCreateTip($(this)); - }) - .on('click.fndtn.tooltip touchstart.fndtn.tooltip touchend.fndtn.tooltip', - this.settings.tooltipClass, function (e) { - e.preventDefault(); - $(this).fadeOut(150); - }); - } else { - $(this.scope) - .on('mouseenter.fndtn.tooltip mouseleave.fndtn.tooltip', - '[data-tooltip]', function (e) { - var $this = $(this); - - if (e.type === 'mouseover' || e.type === 'mouseenter') { - self.showOrCreateTip($this); - } else if (e.type === 'mouseout' || e.type === 'mouseleave') { - self.hide($this); - } - }); - } - - // $(this.scope).data('fndtn-tooltips', true); - } else { - return this[method].call(this, options); - } - - }, - - showOrCreateTip : function ($target) { - var $tip = this.getTip($target); - - if ($tip && $tip.length > 0) { - return this.show($target); - } - - return this.create($target); - }, - - getTip : function ($target) { - var selector = this.selector($target), - tip = null; - - if (selector) { - tip = $('span[data-selector=' + selector + ']' + this.settings.tooltipClass); - } - - return (typeof tip === 'object') ? tip : false; - }, - - selector : function ($target) { - var id = $target.attr('id'), - dataSelector = $target.attr('data-tooltip') || $target.attr('data-selector'); - - if ((id && id.length < 1 || !id) && typeof dataSelector != 'string') { - dataSelector = 'tooltip' + Math.random().toString(36).substring(7); - $target.attr('data-selector', dataSelector); - } - - return (id && id.length > 0) ? id : dataSelector; - }, - - create : function ($target) { - var $tip = $(this.settings.tipTemplate(this.selector($target), $('
            ').html($target.attr('title')).html())), - classes = this.inheritable_classes($target); - - $tip.addClass(classes).appendTo('body'); - if (Modernizr.touch) { - $tip.append('tap to close '); - } - $target.removeAttr('title').attr('title',''); - this.show($target); - }, - - reposition : function (target, tip, classes) { - var width, nub, nubHeight, nubWidth, column, objPos; - - tip.css('visibility', 'hidden').show(); - - width = target.data('width'); - nub = tip.children('.nub'); - nubHeight = this.outerHeight(nub); - nubWidth = this.outerHeight(nub); - - objPos = function (obj, top, right, bottom, left, width) { - return obj.css({ - 'top' : (top) ? top : 'auto', - 'bottom' : (bottom) ? bottom : 'auto', - 'left' : (left) ? left : 'auto', - 'right' : (right) ? right : 'auto', - 'width' : (width) ? width : 'auto' - }).end(); - }; - - objPos(tip, (target.offset().top + this.outerHeight(target) + 10), 'auto', 'auto', target.offset().left, width); - - if ($(window).width() < 767) { - objPos(tip, (target.offset().top + this.outerHeight(target) + 10), 'auto', 'auto', 12.5, $(this.scope).width()); - tip.addClass('tip-override'); - objPos(nub, -nubHeight, 'auto', 'auto', target.offset().left); - } else { - objPos(tip, (target.offset().top + this.outerHeight(target) + 10), 'auto', 'auto', target.offset().left, width); - tip.removeClass('tip-override'); - if (classes && classes.indexOf('tip-top') > -1) { - objPos(tip, (target.offset().top - this.outerHeight(tip)), 'auto', 'auto', target.offset().left, width) - .removeClass('tip-override'); - } else if (classes && classes.indexOf('tip-left') > -1) { - objPos(tip, (target.offset().top + (this.outerHeight(target) / 2) - nubHeight*2.5), 'auto', 'auto', (target.offset().left - this.outerWidth(tip) - nubHeight), width) - .removeClass('tip-override'); - } else if (classes && classes.indexOf('tip-right') > -1) { - objPos(tip, (target.offset().top + (this.outerHeight(target) / 2) - nubHeight*2.5), 'auto', 'auto', (target.offset().left + this.outerWidth(target) + nubHeight), width) - .removeClass('tip-override'); - } - } - - tip.css('visibility', 'visible').hide(); - }, - - inheritable_classes : function (target) { - var inheritables = ['tip-top', 'tip-left', 'tip-bottom', 'tip-right', 'noradius'].concat(this.settings.additionalInheritableClasses), - classes = target.attr('class'), - filtered = classes ? $.map(classes.split(' '), function (el, i) { - if ($.inArray(el, inheritables) !== -1) { - return el; - } - }).join(' ') : ''; - - return $.trim(filtered); - }, - - show : function ($target) { - var $tip = this.getTip($target); - - this.reposition($target, $tip, $target.attr('class')); - $tip.fadeIn(150); - }, - - hide : function ($target) { - var $tip = this.getTip($target); - - $tip.fadeOut(150); - }, - - // deprecate reload - reload : function () { - var $self = $(this); - - return ($self.data('fndtn-tooltips')) ? $self.foundationTooltips('destroy').foundationTooltips('init') : $self.foundationTooltips('init'); - }, - - off : function () { - $(this.scope).off('.fndtn.tooltip'); - $(this.settings.tooltipClass).each(function (i) { - $('[data-tooltip]').get(i).attr('title', $(this).text()); - }).remove(); - } - }; -}(Foundation.zj, this, this.document)); diff --git a/doc/foundation/static/js/foundation/foundation.topbar.js b/doc/foundation/static/js/foundation/foundation.topbar.js deleted file mode 100644 index 50f239a..0000000 --- a/doc/foundation/static/js/foundation/foundation.topbar.js +++ /dev/null @@ -1,215 +0,0 @@ -/*jslint unparam: true, browser: true, indent: 2 */ - -;(function ($, window, document, undefined) { - 'use strict'; - - Foundation.libs.topbar = { - name : 'topbar', - - version : '4.0.0', - - settings : { - index : 0, - stickyClass : 'sticky', - custom_back_text: true, - back_text: 'Back', - init : false - }, - - init : function (scope, method, options) { - var self = this; - this.scope = scope || this.scope; - - if (typeof method === 'object') { - $.extend(true, this.settings, method); - } - - if (typeof method != 'string') { - - $('nav.top-bar').each(function () { - self.settings.$w = $(window); - self.settings.$topbar = $(this); - self.settings.$section = self.settings.$topbar.find('section'); - self.settings.$titlebar = self.settings.$topbar.children('ul').first(); - - - self.settings.$topbar.data('index', 0); - - var breakpoint = $("
            ").insertAfter(self.settings.$topbar); - self.settings.breakPoint = breakpoint.width(); - breakpoint.remove(); - - self.assemble(); - - if (self.settings.$topbar.parent().hasClass('fixed')) { - $('body').css('padding-top', self.outerHeight(self.settings.$topbar)); - } - }); - - if (!self.settings.init) { - this.events(); - } - - return this.settings.init; - } else { - // fire method - return this[method].call(this, options); - } - }, - - events : function () { - var self = this; - - $(this.scope) - .on('click.fndtn.topbar', '.top-bar .toggle-topbar', function (e) { - var topbar = $(this).closest('.top-bar'), - section = topbar.find('section, .section'), - titlebar = topbar.children('ul').first(); - - if (!self.settings.$topbar.data('height')) self.largestUL(); - - e.preventDefault(); - - if (self.breakpoint()) { - topbar - .toggleClass('expanded') - .css('min-height', ''); - } - - if (!topbar.hasClass('expanded')) { - section.css({left: '0%'}); - section.find('>.name').css({left: '100%'}); - section.find('li.moved').removeClass('moved'); - topbar.data('index', 0); - } - }) - - .on('click.fndtn.topbar', '.top-bar .has-dropdown>a', function (e) { - var topbar = $(this).closest('.top-bar'), - section = topbar.find('section, .section'), - titlebar = topbar.children('ul').first(); - - if (Modernizr.touch || self.breakpoint()) { - e.preventDefault(); - } - - if (self.breakpoint()) { - var $this = $(this), - $selectedLi = $this.closest('li'); - - topbar.data('index', topbar.data('index') + 1); - $selectedLi.addClass('moved'); - section.css({left: -(100 * topbar.data('index')) + '%'}); - section.find('>.name').css({left: 100 * topbar.data('index') + '%'}); - - $this.siblings('ul') - .height(topbar.data('height') + self.outerHeight(titlebar, true)); - topbar - .css('min-height', topbar.data('height') + self.outerHeight(titlebar, true) * 2) - } - }); - - $(window).on('resize.fndtn.topbar', function () { - if (!this.breakpoint()) { - $('.top-bar').css('min-height', ''); - } - }.bind(this)); - - // Go up a level on Click - $(this.scope).on('click.fndtn', '.top-bar .has-dropdown .back', function (e) { - e.preventDefault(); - - var $this = $(this), - topbar = $this.closest('.top-bar'), - section = topbar.find('section, .section'), - $movedLi = $this.closest('li.moved'), - $previousLevelUl = $movedLi.parent(); - - topbar.data('index', topbar.data('index') - 1); - section.css({left: -(100 * topbar.data('index')) + '%'}); - section.find('>.name').css({'left': 100 * topbar.data('index') + '%'}); - - if (topbar.data('index') === 0) { - topbar.css('min-height', 0); - } - - setTimeout(function () { - $movedLi.removeClass('moved'); - }, 300); - }); - }, - - breakpoint : function () { - return $(window).width() <= this.settings.breakPoint || $('html').hasClass('lt-ie9'); - }, - - assemble : function () { - var self = this; - // Pull element out of the DOM for manipulation - this.settings.$section.detach(); - - this.settings.$section.find('.has-dropdown>a').each(function () { - var $link = $(this), - $dropdown = $link.siblings('.dropdown'), - $titleLi = $('
          2. '); - - // Copy link to subnav - if (self.settings.custom_back_text == true) { - $titleLi.find('h5>a').html('« ' + self.settings.back_text); - } else { - $titleLi.find('h5>a').html('« ' + $link.html()); - } - $dropdown.prepend($titleLi); - }); - - // Put element back in the DOM - this.settings.$section.appendTo(this.settings.$topbar); - - // check for sticky - this.sticky(); - }, - - largestUL : function () { - var uls = this.settings.$topbar.find('section ul ul'), - largest = uls.first(), - total = 0, - self = this; - - uls.each(function () { - if ($(this).children('li').length > largest.children('li').length) { - largest = $(this); - } - }); - - largest.children('li').each(function () { total += self.outerHeight($(this), true); }); - - this.settings.$topbar.data('height', total); - }, - - sticky : function () { - var klass = '.' + this.settings.stickyClass; - if ($(klass).length > 0) { - var distance = $(klass).length ? $(klass).offset().top: 0, - $window = $(window); - var offst = this.outerHeight($('nav.top-bar'))+20; - - $window.scroll(function() { - if ($window.scrollTop() >= (distance)) { - $(klass).addClass("fixed"); - $('body').css('padding-top',offst); - } - - else if ($window.scrollTop() < distance) { - $(klass).removeClass("fixed"); - $('body').css('padding-top','0'); - } - }); - } - }, - - off : function () { - $(this.scope).off('.fndtn.topbar'); - $(window).off('.fndtn.topbar'); - } - }; -}(Foundation.zj, this, this.document)); diff --git a/doc/foundation/static/js/vendor/custom.modernizr.js b/doc/foundation/static/js/vendor/custom.modernizr.js deleted file mode 100644 index e5afa6c..0000000 --- a/doc/foundation/static/js/vendor/custom.modernizr.js +++ /dev/null @@ -1,4 +0,0 @@ -/* Modernizr 2.6.2 (Custom Build) | MIT & BSD - * Build: http://modernizr.com/download/#-inlinesvg-svg-svgclippaths-touch-shiv-mq-cssclasses-teststyles-prefixes-ie8compat-load - */ -;window.Modernizr=function(a,b,c){function y(a){j.cssText=a}function z(a,b){return y(m.join(a+";")+(b||""))}function A(a,b){return typeof a===b}function B(a,b){return!!~(""+a).indexOf(b)}function C(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:A(f,"function")?f.bind(d||b):f}return!1}var d="2.6.2",e={},f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k,l={}.toString,m=" -webkit- -moz- -o- -ms- ".split(" "),n={svg:"http://www.w3.org/2000/svg"},o={},p={},q={},r=[],s=r.slice,t,u=function(a,c,d,e){var f,i,j,k,l=b.createElement("div"),m=b.body,n=m||b.createElement("body");if(parseInt(d,10))while(d--)j=b.createElement("div"),j.id=e?e[d]:h+(d+1),l.appendChild(j);return f=["­",'"].join(""),l.id=h,(m?l:n).innerHTML+=f,n.appendChild(l),m||(n.style.background="",n.style.overflow="hidden",k=g.style.overflow,g.style.overflow="hidden",g.appendChild(n)),i=c(l,a),m?l.parentNode.removeChild(l):(n.parentNode.removeChild(n),g.style.overflow=k),!!i},v=function(b){var c=a.matchMedia||a.msMatchMedia;if(c)return c(b).matches;var d;return u("@media "+b+" { #"+h+" { position: absolute; } }",function(b){d=(a.getComputedStyle?getComputedStyle(b,null):b.currentStyle)["position"]=="absolute"}),d},w={}.hasOwnProperty,x;!A(w,"undefined")&&!A(w.call,"undefined")?x=function(a,b){return w.call(a,b)}:x=function(a,b){return b in a&&A(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=s.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(s.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(s.call(arguments)))};return e}),o.touch=function(){var c;return"ontouchstart"in a||a.DocumentTouch&&b instanceof DocumentTouch?c=!0:u(["@media (",m.join("touch-enabled),("),h,")","{#modernizr{top:9px;position:absolute}}"].join(""),function(a){c=a.offsetTop===9}),c},o.svg=function(){return!!b.createElementNS&&!!b.createElementNS(n.svg,"svg").createSVGRect},o.inlinesvg=function(){var a=b.createElement("div");return a.innerHTML="",(a.firstChild&&a.firstChild.namespaceURI)==n.svg},o.svgclippaths=function(){return!!b.createElementNS&&/SVGClipPath/.test(l.call(b.createElementNS(n.svg,"clipPath")))};for(var D in o)x(o,D)&&(t=D.toLowerCase(),e[t]=o[D](),r.push((e[t]?"":"no-")+t));return e.addTest=function(a,b){if(typeof a=="object")for(var d in a)x(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof f!="undefined"&&f&&(g.className+=" "+(b?"":"no-")+a),e[a]=b}return e},y(""),i=k=null,function(a,b){function k(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x",d.insertBefore(c.lastChild,d.firstChild)}function l(){var a=r.elements;return typeof a=="string"?a.split(" "):a}function m(a){var b=i[a[g]];return b||(b={},h++,a[g]=h,i[h]=b),b}function n(a,c,f){c||(c=b);if(j)return c.createElement(a);f||(f=m(c));var g;return f.cache[a]?g=f.cache[a].cloneNode():e.test(a)?g=(f.cache[a]=f.createElem(a)).cloneNode():g=f.createElem(a),g.canHaveChildren&&!d.test(a)?f.frag.appendChild(g):g}function o(a,c){a||(a=b);if(j)return a.createDocumentFragment();c=c||m(a);var d=c.frag.cloneNode(),e=0,f=l(),g=f.length;for(;e",f="hidden"in a,j=a.childNodes.length==1||function(){b.createElement("a");var a=b.createDocumentFragment();return typeof a.cloneNode=="undefined"||typeof a.createDocumentFragment=="undefined"||typeof a.createElement=="undefined"}()}catch(c){f=!0,j=!0}})();var r={elements:c.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:c.shivCSS!==!1,supportsUnknownElements:j,shivMethods:c.shivMethods!==!1,type:"default",shivDocument:q,createElement:n,createDocumentFragment:o};a.html5=r,q(b)}(this,b),e._version=d,e._prefixes=m,e.mq=v,e.testStyles=u,g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+r.join(" "):""),e}(this,this.document),function(a,b,c){function d(a){return"[object Function]"==o.call(a)}function e(a){return"string"==typeof a}function f(){}function g(a){return!a||"loaded"==a||"complete"==a||"uninitialized"==a}function h(){var a=p.shift();q=1,a?a.t?m(function(){("c"==a.t?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l=b.createElement(a),o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};1===y[c]&&(r=1,y[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),"img"!=a&&(r||2===y[c]?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i("c"==b?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),1==p.length&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&"[object Opera]"==o.call(a.opera),l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return"[object Array]"==o.call(a)},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;f type pairs - class2type = {}, - - // List of deleted data cache ids, so we can reuse them - core_deletedIds = [], - - core_version = "1.9.1", - - // Save a reference to some core methods - core_concat = core_deletedIds.concat, - core_push = core_deletedIds.push, - core_slice = core_deletedIds.slice, - core_indexOf = core_deletedIds.indexOf, - core_toString = class2type.toString, - core_hasOwn = class2type.hasOwnProperty, - core_trim = core_version.trim, - - // Define a local copy of jQuery - jQuery = function( selector, context ) { - // The jQuery object is actually just the init constructor 'enhanced' - return new jQuery.fn.init( selector, context, rootjQuery ); - }, - - // Used for matching numbers - core_pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source, - - // Used for splitting on whitespace - core_rnotwhite = /\S+/g, - - // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE) - rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, - - // A simple way to check for HTML strings - // Prioritize #id over to avoid XSS via location.hash (#9521) - // Strict HTML recognition (#11290: must start with <) - rquickExpr = /^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/, - - // Match a standalone tag - rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, - - // JSON RegExp - rvalidchars = /^[\],:{}\s]*$/, - rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, - rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g, - rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g, - - // Matches dashed string for camelizing - rmsPrefix = /^-ms-/, - rdashAlpha = /-([\da-z])/gi, - - // Used by jQuery.camelCase as callback to replace() - fcamelCase = function( all, letter ) { - return letter.toUpperCase(); - }, - - // The ready event handler - completed = function( event ) { - - // readyState === "complete" is good enough for us to call the dom ready in oldIE - if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) { - detach(); - jQuery.ready(); - } - }, - // Clean-up method for dom ready events - detach = function() { - if ( document.addEventListener ) { - document.removeEventListener( "DOMContentLoaded", completed, false ); - window.removeEventListener( "load", completed, false ); - - } else { - document.detachEvent( "onreadystatechange", completed ); - window.detachEvent( "onload", completed ); - } - }; - -jQuery.fn = jQuery.prototype = { - // The current version of jQuery being used - jquery: core_version, - - constructor: jQuery, - init: function( selector, context, rootjQuery ) { - var match, elem; - - // HANDLE: $(""), $(null), $(undefined), $(false) - if ( !selector ) { - return this; - } - - // Handle HTML strings - if ( typeof selector === "string" ) { - if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { - // Assume that strings that start and end with <> are HTML and skip the regex check - match = [ null, selector, null ]; - - } else { - match = rquickExpr.exec( selector ); - } - - // Match html or make sure no context is specified for #id - if ( match && (match[1] || !context) ) { - - // HANDLE: $(html) -> $(array) - if ( match[1] ) { - context = context instanceof jQuery ? context[0] : context; - - // scripts is true for back-compat - jQuery.merge( this, jQuery.parseHTML( - match[1], - context && context.nodeType ? context.ownerDocument || context : document, - true - ) ); - - // HANDLE: $(html, props) - if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { - for ( match in context ) { - // Properties of context are called as methods if possible - if ( jQuery.isFunction( this[ match ] ) ) { - this[ match ]( context[ match ] ); - - // ...and otherwise set as attributes - } else { - this.attr( match, context[ match ] ); - } - } - } - - return this; - - // HANDLE: $(#id) - } else { - elem = document.getElementById( match[2] ); - - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE and Opera return items - // by name instead of ID - if ( elem.id !== match[2] ) { - return rootjQuery.find( selector ); - } - - // Otherwise, we inject the element directly into the jQuery object - this.length = 1; - this[0] = elem; - } - - this.context = document; - this.selector = selector; - return this; - } - - // HANDLE: $(expr, $(...)) - } else if ( !context || context.jquery ) { - return ( context || rootjQuery ).find( selector ); - - // HANDLE: $(expr, context) - // (which is just equivalent to: $(context).find(expr) - } else { - return this.constructor( context ).find( selector ); - } - - // HANDLE: $(DOMElement) - } else if ( selector.nodeType ) { - this.context = this[0] = selector; - this.length = 1; - return this; - - // HANDLE: $(function) - // Shortcut for document ready - } else if ( jQuery.isFunction( selector ) ) { - return rootjQuery.ready( selector ); - } - - if ( selector.selector !== undefined ) { - this.selector = selector.selector; - this.context = selector.context; - } - - return jQuery.makeArray( selector, this ); - }, - - // Start with an empty selector - selector: "", - - // The default length of a jQuery object is 0 - length: 0, - - // The number of elements contained in the matched element set - size: function() { - return this.length; - }, - - toArray: function() { - return core_slice.call( this ); - }, - - // Get the Nth element in the matched element set OR - // Get the whole matched element set as a clean array - get: function( num ) { - return num == null ? - - // Return a 'clean' array - this.toArray() : - - // Return just the object - ( num < 0 ? this[ this.length + num ] : this[ num ] ); - }, - - // Take an array of elements and push it onto the stack - // (returning the new matched element set) - pushStack: function( elems ) { - - // Build a new jQuery matched element set - var ret = jQuery.merge( this.constructor(), elems ); - - // Add the old object onto the stack (as a reference) - ret.prevObject = this; - ret.context = this.context; - - // Return the newly-formed element set - return ret; - }, - - // Execute a callback for every element in the matched set. - // (You can seed the arguments with an array of args, but this is - // only used internally.) - each: function( callback, args ) { - return jQuery.each( this, callback, args ); - }, - - ready: function( fn ) { - // Add the callback - jQuery.ready.promise().done( fn ); - - return this; - }, - - slice: function() { - return this.pushStack( core_slice.apply( this, arguments ) ); - }, - - first: function() { - return this.eq( 0 ); - }, - - last: function() { - return this.eq( -1 ); - }, - - eq: function( i ) { - var len = this.length, - j = +i + ( i < 0 ? len : 0 ); - return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] ); - }, - - map: function( callback ) { - return this.pushStack( jQuery.map(this, function( elem, i ) { - return callback.call( elem, i, elem ); - })); - }, - - end: function() { - return this.prevObject || this.constructor(null); - }, - - // For internal use only. - // Behaves like an Array's method, not like a jQuery method. - push: core_push, - sort: [].sort, - splice: [].splice -}; - -// Give the init function the jQuery prototype for later instantiation -jQuery.fn.init.prototype = jQuery.fn; - -jQuery.extend = jQuery.fn.extend = function() { - var src, copyIsArray, copy, name, options, clone, - target = arguments[0] || {}, - i = 1, - length = arguments.length, - deep = false; - - // Handle a deep copy situation - if ( typeof target === "boolean" ) { - deep = target; - target = arguments[1] || {}; - // skip the boolean and the target - i = 2; - } - - // Handle case when target is a string or something (possible in deep copy) - if ( typeof target !== "object" && !jQuery.isFunction(target) ) { - target = {}; - } - - // extend jQuery itself if only one argument is passed - if ( length === i ) { - target = this; - --i; - } - - for ( ; i < length; i++ ) { - // Only deal with non-null/undefined values - if ( (options = arguments[ i ]) != null ) { - // Extend the base object - for ( name in options ) { - src = target[ name ]; - copy = options[ name ]; - - // Prevent never-ending loop - if ( target === copy ) { - continue; - } - - // Recurse if we're merging plain objects or arrays - if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { - if ( copyIsArray ) { - copyIsArray = false; - clone = src && jQuery.isArray(src) ? src : []; - - } else { - clone = src && jQuery.isPlainObject(src) ? src : {}; - } - - // Never move original objects, clone them - target[ name ] = jQuery.extend( deep, clone, copy ); - - // Don't bring in undefined values - } else if ( copy !== undefined ) { - target[ name ] = copy; - } - } - } - } - - // Return the modified object - return target; -}; - -jQuery.extend({ - noConflict: function( deep ) { - if ( window.$ === jQuery ) { - window.$ = _$; - } - - if ( deep && window.jQuery === jQuery ) { - window.jQuery = _jQuery; - } - - return jQuery; - }, - - // Is the DOM ready to be used? Set to true once it occurs. - isReady: false, - - // A counter to track how many items to wait for before - // the ready event fires. See #6781 - readyWait: 1, - - // Hold (or release) the ready event - holdReady: function( hold ) { - if ( hold ) { - jQuery.readyWait++; - } else { - jQuery.ready( true ); - } - }, - - // Handle when the DOM is ready - ready: function( wait ) { - - // Abort if there are pending holds or we're already ready - if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { - return; - } - - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). - if ( !document.body ) { - return setTimeout( jQuery.ready ); - } - - // Remember that the DOM is ready - jQuery.isReady = true; - - // If a normal DOM Ready event fired, decrement, and wait if need be - if ( wait !== true && --jQuery.readyWait > 0 ) { - return; - } - - // If there are functions bound, to execute - readyList.resolveWith( document, [ jQuery ] ); - - // Trigger any bound ready events - if ( jQuery.fn.trigger ) { - jQuery( document ).trigger("ready").off("ready"); - } - }, - - // See test/unit/core.js for details concerning isFunction. - // Since version 1.3, DOM methods and functions like alert - // aren't supported. They return false on IE (#2968). - isFunction: function( obj ) { - return jQuery.type(obj) === "function"; - }, - - isArray: Array.isArray || function( obj ) { - return jQuery.type(obj) === "array"; - }, - - isWindow: function( obj ) { - return obj != null && obj == obj.window; - }, - - isNumeric: function( obj ) { - return !isNaN( parseFloat(obj) ) && isFinite( obj ); - }, - - type: function( obj ) { - if ( obj == null ) { - return String( obj ); - } - return typeof obj === "object" || typeof obj === "function" ? - class2type[ core_toString.call(obj) ] || "object" : - typeof obj; - }, - - isPlainObject: function( obj ) { - // Must be an Object. - // Because of IE, we also have to check the presence of the constructor property. - // Make sure that DOM nodes and window objects don't pass through, as well - if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { - return false; - } - - try { - // Not own constructor property must be Object - if ( obj.constructor && - !core_hasOwn.call(obj, "constructor") && - !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { - return false; - } - } catch ( e ) { - // IE8,9 Will throw exceptions on certain host objects #9897 - return false; - } - - // Own properties are enumerated firstly, so to speed up, - // if last one is own, then all properties are own. - - var key; - for ( key in obj ) {} - - return key === undefined || core_hasOwn.call( obj, key ); - }, - - isEmptyObject: function( obj ) { - var name; - for ( name in obj ) { - return false; - } - return true; - }, - - error: function( msg ) { - throw new Error( msg ); - }, - - // data: string of html - // context (optional): If specified, the fragment will be created in this context, defaults to document - // keepScripts (optional): If true, will include scripts passed in the html string - parseHTML: function( data, context, keepScripts ) { - if ( !data || typeof data !== "string" ) { - return null; - } - if ( typeof context === "boolean" ) { - keepScripts = context; - context = false; - } - context = context || document; - - var parsed = rsingleTag.exec( data ), - scripts = !keepScripts && []; - - // Single tag - if ( parsed ) { - return [ context.createElement( parsed[1] ) ]; - } - - parsed = jQuery.buildFragment( [ data ], context, scripts ); - if ( scripts ) { - jQuery( scripts ).remove(); - } - return jQuery.merge( [], parsed.childNodes ); - }, - - parseJSON: function( data ) { - // Attempt to parse using the native JSON parser first - if ( window.JSON && window.JSON.parse ) { - return window.JSON.parse( data ); - } - - if ( data === null ) { - return data; - } - - if ( typeof data === "string" ) { - - // Make sure leading/trailing whitespace is removed (IE can't handle it) - data = jQuery.trim( data ); - - if ( data ) { - // Make sure the incoming data is actual JSON - // Logic borrowed from http://json.org/json2.js - if ( rvalidchars.test( data.replace( rvalidescape, "@" ) - .replace( rvalidtokens, "]" ) - .replace( rvalidbraces, "")) ) { - - return ( new Function( "return " + data ) )(); - } - } - } - - jQuery.error( "Invalid JSON: " + data ); - }, - - // Cross-browser xml parsing - parseXML: function( data ) { - var xml, tmp; - if ( !data || typeof data !== "string" ) { - return null; - } - try { - if ( window.DOMParser ) { // Standard - tmp = new DOMParser(); - xml = tmp.parseFromString( data , "text/xml" ); - } else { // IE - xml = new ActiveXObject( "Microsoft.XMLDOM" ); - xml.async = "false"; - xml.loadXML( data ); - } - } catch( e ) { - xml = undefined; - } - if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { - jQuery.error( "Invalid XML: " + data ); - } - return xml; - }, - - noop: function() {}, - - // Evaluates a script in a global context - // Workarounds based on findings by Jim Driscoll - // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context - globalEval: function( data ) { - if ( data && jQuery.trim( data ) ) { - // We use execScript on Internet Explorer - // We use an anonymous function so that context is window - // rather than jQuery in Firefox - ( window.execScript || function( data ) { - window[ "eval" ].call( window, data ); - } )( data ); - } - }, - - // Convert dashed to camelCase; used by the css and data modules - // Microsoft forgot to hump their vendor prefix (#9572) - camelCase: function( string ) { - return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); - }, - - nodeName: function( elem, name ) { - return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); - }, - - // args is for internal usage only - each: function( obj, callback, args ) { - var value, - i = 0, - length = obj.length, - isArray = isArraylike( obj ); - - if ( args ) { - if ( isArray ) { - for ( ; i < length; i++ ) { - value = callback.apply( obj[ i ], args ); - - if ( value === false ) { - break; - } - } - } else { - for ( i in obj ) { - value = callback.apply( obj[ i ], args ); - - if ( value === false ) { - break; - } - } - } - - // A special, fast, case for the most common use of each - } else { - if ( isArray ) { - for ( ; i < length; i++ ) { - value = callback.call( obj[ i ], i, obj[ i ] ); - - if ( value === false ) { - break; - } - } - } else { - for ( i in obj ) { - value = callback.call( obj[ i ], i, obj[ i ] ); - - if ( value === false ) { - break; - } - } - } - } - - return obj; - }, - - // Use native String.trim function wherever possible - trim: core_trim && !core_trim.call("\uFEFF\xA0") ? - function( text ) { - return text == null ? - "" : - core_trim.call( text ); - } : - - // Otherwise use our own trimming functionality - function( text ) { - return text == null ? - "" : - ( text + "" ).replace( rtrim, "" ); - }, - - // results is for internal usage only - makeArray: function( arr, results ) { - var ret = results || []; - - if ( arr != null ) { - if ( isArraylike( Object(arr) ) ) { - jQuery.merge( ret, - typeof arr === "string" ? - [ arr ] : arr - ); - } else { - core_push.call( ret, arr ); - } - } - - return ret; - }, - - inArray: function( elem, arr, i ) { - var len; - - if ( arr ) { - if ( core_indexOf ) { - return core_indexOf.call( arr, elem, i ); - } - - len = arr.length; - i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; - - for ( ; i < len; i++ ) { - // Skip accessing in sparse arrays - if ( i in arr && arr[ i ] === elem ) { - return i; - } - } - } - - return -1; - }, - - merge: function( first, second ) { - var l = second.length, - i = first.length, - j = 0; - - if ( typeof l === "number" ) { - for ( ; j < l; j++ ) { - first[ i++ ] = second[ j ]; - } - } else { - while ( second[j] !== undefined ) { - first[ i++ ] = second[ j++ ]; - } - } - - first.length = i; - - return first; - }, - - grep: function( elems, callback, inv ) { - var retVal, - ret = [], - i = 0, - length = elems.length; - inv = !!inv; - - // Go through the array, only saving the items - // that pass the validator function - for ( ; i < length; i++ ) { - retVal = !!callback( elems[ i ], i ); - if ( inv !== retVal ) { - ret.push( elems[ i ] ); - } - } - - return ret; - }, - - // arg is for internal usage only - map: function( elems, callback, arg ) { - var value, - i = 0, - length = elems.length, - isArray = isArraylike( elems ), - ret = []; - - // Go through the array, translating each of the items to their - if ( isArray ) { - for ( ; i < length; i++ ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - - // Go through every key on the object, - } else { - for ( i in elems ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - } - - // Flatten any nested arrays - return core_concat.apply( [], ret ); - }, - - // A global GUID counter for objects - guid: 1, - - // Bind a function to a context, optionally partially applying any - // arguments. - proxy: function( fn, context ) { - var args, proxy, tmp; - - if ( typeof context === "string" ) { - tmp = fn[ context ]; - context = fn; - fn = tmp; - } - - // Quick check to determine if target is callable, in the spec - // this throws a TypeError, but we will just return undefined. - if ( !jQuery.isFunction( fn ) ) { - return undefined; - } - - // Simulated bind - args = core_slice.call( arguments, 2 ); - proxy = function() { - return fn.apply( context || this, args.concat( core_slice.call( arguments ) ) ); - }; - - // Set the guid of unique handler to the same of original handler, so it can be removed - proxy.guid = fn.guid = fn.guid || jQuery.guid++; - - return proxy; - }, - - // Multifunctional method to get and set values of a collection - // The value/s can optionally be executed if it's a function - access: function( elems, fn, key, value, chainable, emptyGet, raw ) { - var i = 0, - length = elems.length, - bulk = key == null; - - // Sets many values - if ( jQuery.type( key ) === "object" ) { - chainable = true; - for ( i in key ) { - jQuery.access( elems, fn, i, key[i], true, emptyGet, raw ); - } - - // Sets one value - } else if ( value !== undefined ) { - chainable = true; - - if ( !jQuery.isFunction( value ) ) { - raw = true; - } - - if ( bulk ) { - // Bulk operations run against the entire set - if ( raw ) { - fn.call( elems, value ); - fn = null; - - // ...except when executing function values - } else { - bulk = fn; - fn = function( elem, key, value ) { - return bulk.call( jQuery( elem ), value ); - }; - } - } - - if ( fn ) { - for ( ; i < length; i++ ) { - fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) ); - } - } - } - - return chainable ? - elems : - - // Gets - bulk ? - fn.call( elems ) : - length ? fn( elems[0], key ) : emptyGet; - }, - - now: function() { - return ( new Date() ).getTime(); - } -}); - -jQuery.ready.promise = function( obj ) { - if ( !readyList ) { - - readyList = jQuery.Deferred(); - - // Catch cases where $(document).ready() is called after the browser event has already occurred. - // we once tried to use readyState "interactive" here, but it caused issues like the one - // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 - if ( document.readyState === "complete" ) { - // Handle it asynchronously to allow scripts the opportunity to delay ready - setTimeout( jQuery.ready ); - - // Standards-based browsers support DOMContentLoaded - } else if ( document.addEventListener ) { - // Use the handy event callback - document.addEventListener( "DOMContentLoaded", completed, false ); - - // A fallback to window.onload, that will always work - window.addEventListener( "load", completed, false ); - - // If IE event model is used - } else { - // Ensure firing before onload, maybe late but safe also for iframes - document.attachEvent( "onreadystatechange", completed ); - - // A fallback to window.onload, that will always work - window.attachEvent( "onload", completed ); - - // If IE and not a frame - // continually check to see if the document is ready - var top = false; - - try { - top = window.frameElement == null && document.documentElement; - } catch(e) {} - - if ( top && top.doScroll ) { - (function doScrollCheck() { - if ( !jQuery.isReady ) { - - try { - // Use the trick by Diego Perini - // http://javascript.nwbox.com/IEContentLoaded/ - top.doScroll("left"); - } catch(e) { - return setTimeout( doScrollCheck, 50 ); - } - - // detach all dom ready events - detach(); - - // and execute any waiting functions - jQuery.ready(); - } - })(); - } - } - } - return readyList.promise( obj ); -}; - -// Populate the class2type map -jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) { - class2type[ "[object " + name + "]" ] = name.toLowerCase(); -}); - -function isArraylike( obj ) { - var length = obj.length, - type = jQuery.type( obj ); - - if ( jQuery.isWindow( obj ) ) { - return false; - } - - if ( obj.nodeType === 1 && length ) { - return true; - } - - return type === "array" || type !== "function" && - ( length === 0 || - typeof length === "number" && length > 0 && ( length - 1 ) in obj ); -} - -// All jQuery objects should point back to these -rootjQuery = jQuery(document); -// String to Object options format cache -var optionsCache = {}; - -// Convert String-formatted options into Object-formatted ones and store in cache -function createOptions( options ) { - var object = optionsCache[ options ] = {}; - jQuery.each( options.match( core_rnotwhite ) || [], function( _, flag ) { - object[ flag ] = true; - }); - return object; -} - -/* - * Create a callback list using the following parameters: - * - * options: an optional list of space-separated options that will change how - * the callback list behaves or a more traditional option object - * - * By default a callback list will act like an event callback list and can be - * "fired" multiple times. - * - * Possible options: - * - * once: will ensure the callback list can only be fired once (like a Deferred) - * - * memory: will keep track of previous values and will call any callback added - * after the list has been fired right away with the latest "memorized" - * values (like a Deferred) - * - * unique: will ensure a callback can only be added once (no duplicate in the list) - * - * stopOnFalse: interrupt callings when a callback returns false - * - */ -jQuery.Callbacks = function( options ) { - - // Convert options from String-formatted to Object-formatted if needed - // (we check in cache first) - options = typeof options === "string" ? - ( optionsCache[ options ] || createOptions( options ) ) : - jQuery.extend( {}, options ); - - var // Flag to know if list is currently firing - firing, - // Last fire value (for non-forgettable lists) - memory, - // Flag to know if list was already fired - fired, - // End of the loop when firing - firingLength, - // Index of currently firing callback (modified by remove if needed) - firingIndex, - // First callback to fire (used internally by add and fireWith) - firingStart, - // Actual callback list - list = [], - // Stack of fire calls for repeatable lists - stack = !options.once && [], - // Fire callbacks - fire = function( data ) { - memory = options.memory && data; - fired = true; - firingIndex = firingStart || 0; - firingStart = 0; - firingLength = list.length; - firing = true; - for ( ; list && firingIndex < firingLength; firingIndex++ ) { - if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) { - memory = false; // To prevent further calls using add - break; - } - } - firing = false; - if ( list ) { - if ( stack ) { - if ( stack.length ) { - fire( stack.shift() ); - } - } else if ( memory ) { - list = []; - } else { - self.disable(); - } - } - }, - // Actual Callbacks object - self = { - // Add a callback or a collection of callbacks to the list - add: function() { - if ( list ) { - // First, we save the current length - var start = list.length; - (function add( args ) { - jQuery.each( args, function( _, arg ) { - var type = jQuery.type( arg ); - if ( type === "function" ) { - if ( !options.unique || !self.has( arg ) ) { - list.push( arg ); - } - } else if ( arg && arg.length && type !== "string" ) { - // Inspect recursively - add( arg ); - } - }); - })( arguments ); - // Do we need to add the callbacks to the - // current firing batch? - if ( firing ) { - firingLength = list.length; - // With memory, if we're not firing then - // we should call right away - } else if ( memory ) { - firingStart = start; - fire( memory ); - } - } - return this; - }, - // Remove a callback from the list - remove: function() { - if ( list ) { - jQuery.each( arguments, function( _, arg ) { - var index; - while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { - list.splice( index, 1 ); - // Handle firing indexes - if ( firing ) { - if ( index <= firingLength ) { - firingLength--; - } - if ( index <= firingIndex ) { - firingIndex--; - } - } - } - }); - } - return this; - }, - // Check if a given callback is in the list. - // If no argument is given, return whether or not list has callbacks attached. - has: function( fn ) { - return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length ); - }, - // Remove all callbacks from the list - empty: function() { - list = []; - return this; - }, - // Have the list do nothing anymore - disable: function() { - list = stack = memory = undefined; - return this; - }, - // Is it disabled? - disabled: function() { - return !list; - }, - // Lock the list in its current state - lock: function() { - stack = undefined; - if ( !memory ) { - self.disable(); - } - return this; - }, - // Is it locked? - locked: function() { - return !stack; - }, - // Call all callbacks with the given context and arguments - fireWith: function( context, args ) { - args = args || []; - args = [ context, args.slice ? args.slice() : args ]; - if ( list && ( !fired || stack ) ) { - if ( firing ) { - stack.push( args ); - } else { - fire( args ); - } - } - return this; - }, - // Call all the callbacks with the given arguments - fire: function() { - self.fireWith( this, arguments ); - return this; - }, - // To know if the callbacks have already been called at least once - fired: function() { - return !!fired; - } - }; - - return self; -}; -jQuery.extend({ - - Deferred: function( func ) { - var tuples = [ - // action, add listener, listener list, final state - [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ], - [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ], - [ "notify", "progress", jQuery.Callbacks("memory") ] - ], - state = "pending", - promise = { - state: function() { - return state; - }, - always: function() { - deferred.done( arguments ).fail( arguments ); - return this; - }, - then: function( /* fnDone, fnFail, fnProgress */ ) { - var fns = arguments; - return jQuery.Deferred(function( newDefer ) { - jQuery.each( tuples, function( i, tuple ) { - var action = tuple[ 0 ], - fn = jQuery.isFunction( fns[ i ] ) && fns[ i ]; - // deferred[ done | fail | progress ] for forwarding actions to newDefer - deferred[ tuple[1] ](function() { - var returned = fn && fn.apply( this, arguments ); - if ( returned && jQuery.isFunction( returned.promise ) ) { - returned.promise() - .done( newDefer.resolve ) - .fail( newDefer.reject ) - .progress( newDefer.notify ); - } else { - newDefer[ action + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments ); - } - }); - }); - fns = null; - }).promise(); - }, - // Get a promise for this deferred - // If obj is provided, the promise aspect is added to the object - promise: function( obj ) { - return obj != null ? jQuery.extend( obj, promise ) : promise; - } - }, - deferred = {}; - - // Keep pipe for back-compat - promise.pipe = promise.then; - - // Add list-specific methods - jQuery.each( tuples, function( i, tuple ) { - var list = tuple[ 2 ], - stateString = tuple[ 3 ]; - - // promise[ done | fail | progress ] = list.add - promise[ tuple[1] ] = list.add; - - // Handle state - if ( stateString ) { - list.add(function() { - // state = [ resolved | rejected ] - state = stateString; - - // [ reject_list | resolve_list ].disable; progress_list.lock - }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); - } - - // deferred[ resolve | reject | notify ] - deferred[ tuple[0] ] = function() { - deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments ); - return this; - }; - deferred[ tuple[0] + "With" ] = list.fireWith; - }); - - // Make the deferred a promise - promise.promise( deferred ); - - // Call given func if any - if ( func ) { - func.call( deferred, deferred ); - } - - // All done! - return deferred; - }, - - // Deferred helper - when: function( subordinate /* , ..., subordinateN */ ) { - var i = 0, - resolveValues = core_slice.call( arguments ), - length = resolveValues.length, - - // the count of uncompleted subordinates - remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, - - // the master Deferred. If resolveValues consist of only a single Deferred, just use that. - deferred = remaining === 1 ? subordinate : jQuery.Deferred(), - - // Update function for both resolve and progress values - updateFunc = function( i, contexts, values ) { - return function( value ) { - contexts[ i ] = this; - values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value; - if( values === progressValues ) { - deferred.notifyWith( contexts, values ); - } else if ( !( --remaining ) ) { - deferred.resolveWith( contexts, values ); - } - }; - }, - - progressValues, progressContexts, resolveContexts; - - // add listeners to Deferred subordinates; treat others as resolved - if ( length > 1 ) { - progressValues = new Array( length ); - progressContexts = new Array( length ); - resolveContexts = new Array( length ); - for ( ; i < length; i++ ) { - if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { - resolveValues[ i ].promise() - .done( updateFunc( i, resolveContexts, resolveValues ) ) - .fail( deferred.reject ) - .progress( updateFunc( i, progressContexts, progressValues ) ); - } else { - --remaining; - } - } - } - - // if we're not waiting on anything, resolve the master - if ( !remaining ) { - deferred.resolveWith( resolveContexts, resolveValues ); - } - - return deferred.promise(); - } -}); -jQuery.support = (function() { - - var support, all, a, - input, select, fragment, - opt, eventName, isSupported, i, - div = document.createElement("div"); - - // Setup - div.setAttribute( "className", "t" ); - div.innerHTML = "
            a"; - - // Support tests won't run in some limited or non-browser environments - all = div.getElementsByTagName("*"); - a = div.getElementsByTagName("a")[ 0 ]; - if ( !all || !a || !all.length ) { - return {}; - } - - // First batch of tests - select = document.createElement("select"); - opt = select.appendChild( document.createElement("option") ); - input = div.getElementsByTagName("input")[ 0 ]; - - a.style.cssText = "top:1px;float:left;opacity:.5"; - support = { - // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) - getSetAttribute: div.className !== "t", - - // IE strips leading whitespace when .innerHTML is used - leadingWhitespace: div.firstChild.nodeType === 3, - - // Make sure that tbody elements aren't automatically inserted - // IE will insert them into empty tables - tbody: !div.getElementsByTagName("tbody").length, - - // Make sure that link elements get serialized correctly by innerHTML - // This requires a wrapper element in IE - htmlSerialize: !!div.getElementsByTagName("link").length, - - // Get the style information from getAttribute - // (IE uses .cssText instead) - style: /top/.test( a.getAttribute("style") ), - - // Make sure that URLs aren't manipulated - // (IE normalizes it by default) - hrefNormalized: a.getAttribute("href") === "/a", - - // Make sure that element opacity exists - // (IE uses filter instead) - // Use a regex to work around a WebKit issue. See #5145 - opacity: /^0.5/.test( a.style.opacity ), - - // Verify style float existence - // (IE uses styleFloat instead of cssFloat) - cssFloat: !!a.style.cssFloat, - - // Check the default checkbox/radio value ("" on WebKit; "on" elsewhere) - checkOn: !!input.value, - - // Make sure that a selected-by-default option has a working selected property. - // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) - optSelected: opt.selected, - - // Tests for enctype support on a form (#6743) - enctype: !!document.createElement("form").enctype, - - // Makes sure cloning an html5 element does not cause problems - // Where outerHTML is undefined, this still works - html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav>", - - // jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode - boxModel: document.compatMode === "CSS1Compat", - - // Will be defined later - deleteExpando: true, - noCloneEvent: true, - inlineBlockNeedsLayout: false, - shrinkWrapBlocks: false, - reliableMarginRight: true, - boxSizingReliable: true, - pixelPosition: false - }; - - // Make sure checked status is properly cloned - input.checked = true; - support.noCloneChecked = input.cloneNode( true ).checked; - - // Make sure that the options inside disabled selects aren't marked as disabled - // (WebKit marks them as disabled) - select.disabled = true; - support.optDisabled = !opt.disabled; - - // Support: IE<9 - try { - delete div.test; - } catch( e ) { - support.deleteExpando = false; - } - - // Check if we can trust getAttribute("value") - input = document.createElement("input"); - input.setAttribute( "value", "" ); - support.input = input.getAttribute( "value" ) === ""; - - // Check if an input maintains its value after becoming a radio - input.value = "t"; - input.setAttribute( "type", "radio" ); - support.radioValue = input.value === "t"; - - // #11217 - WebKit loses check when the name is after the checked attribute - input.setAttribute( "checked", "t" ); - input.setAttribute( "name", "t" ); - - fragment = document.createDocumentFragment(); - fragment.appendChild( input ); - - // Check if a disconnected checkbox will retain its checked - // value of true after appended to the DOM (IE6/7) - support.appendChecked = input.checked; - - // WebKit doesn't clone checked state correctly in fragments - support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; - - // Support: IE<9 - // Opera does not clone events (and typeof div.attachEvent === undefined). - // IE9-10 clones events bound via attachEvent, but they don't trigger with .click() - if ( div.attachEvent ) { - div.attachEvent( "onclick", function() { - support.noCloneEvent = false; - }); - - div.cloneNode( true ).click(); - } - - // Support: IE<9 (lack submit/change bubble), Firefox 17+ (lack focusin event) - // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP), test/csp.php - for ( i in { submit: true, change: true, focusin: true }) { - div.setAttribute( eventName = "on" + i, "t" ); - - support[ i + "Bubbles" ] = eventName in window || div.attributes[ eventName ].expando === false; - } - - div.style.backgroundClip = "content-box"; - div.cloneNode( true ).style.backgroundClip = ""; - support.clearCloneStyle = div.style.backgroundClip === "content-box"; - - // Run tests that need a body at doc ready - jQuery(function() { - var container, marginDiv, tds, - divReset = "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;", - body = document.getElementsByTagName("body")[0]; - - if ( !body ) { - // Return for frameset docs that don't have a body - return; - } - - container = document.createElement("div"); - container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px"; - - body.appendChild( container ).appendChild( div ); - - // Support: IE8 - // Check if table cells still have offsetWidth/Height when they are set - // to display:none and there are still other visible table cells in a - // table row; if so, offsetWidth/Height are not reliable for use when - // determining if an element has been hidden directly using - // display:none (it is still safe to use offsets if a parent element is - // hidden; don safety goggles and see bug #4512 for more information). - div.innerHTML = "
            t
            "; - tds = div.getElementsByTagName("td"); - tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none"; - isSupported = ( tds[ 0 ].offsetHeight === 0 ); - - tds[ 0 ].style.display = ""; - tds[ 1 ].style.display = "none"; - - // Support: IE8 - // Check if empty table cells still have offsetWidth/Height - support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); - - // Check box-sizing and margin behavior - div.innerHTML = ""; - div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;"; - support.boxSizing = ( div.offsetWidth === 4 ); - support.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== 1 ); - - // Use window.getComputedStyle because jsdom on node.js will break without it. - if ( window.getComputedStyle ) { - support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%"; - support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px"; - - // Check if div with explicit width and no margin-right incorrectly - // gets computed margin-right based on width of container. (#3333) - // Fails in WebKit before Feb 2011 nightlies - // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right - marginDiv = div.appendChild( document.createElement("div") ); - marginDiv.style.cssText = div.style.cssText = divReset; - marginDiv.style.marginRight = marginDiv.style.width = "0"; - div.style.width = "1px"; - - support.reliableMarginRight = - !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight ); - } - - if ( typeof div.style.zoom !== core_strundefined ) { - // Support: IE<8 - // Check if natively block-level elements act like inline-block - // elements when setting their display to 'inline' and giving - // them layout - div.innerHTML = ""; - div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1"; - support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 ); - - // Support: IE6 - // Check if elements with layout shrink-wrap their children - div.style.display = "block"; - div.innerHTML = "
            "; - div.firstChild.style.width = "5px"; - support.shrinkWrapBlocks = ( div.offsetWidth !== 3 ); - - if ( support.inlineBlockNeedsLayout ) { - // Prevent IE 6 from affecting layout for positioned elements #11048 - // Prevent IE from shrinking the body in IE 7 mode #12869 - // Support: IE<8 - body.style.zoom = 1; - } - } - - body.removeChild( container ); - - // Null elements to avoid leaks in IE - container = div = tds = marginDiv = null; - }); - - // Null elements to avoid leaks in IE - all = select = fragment = opt = a = input = null; - - return support; -})(); - -var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/, - rmultiDash = /([A-Z])/g; - -function internalData( elem, name, data, pvt /* Internal Use Only */ ){ - if ( !jQuery.acceptData( elem ) ) { - return; - } - - var thisCache, ret, - internalKey = jQuery.expando, - getByName = typeof name === "string", - - // We have to handle DOM nodes and JS objects differently because IE6-7 - // can't GC object references properly across the DOM-JS boundary - isNode = elem.nodeType, - - // Only DOM nodes need the global jQuery cache; JS object data is - // attached directly to the object so GC can occur automatically - cache = isNode ? jQuery.cache : elem, - - // Only defining an ID for JS objects if its cache already exists allows - // the code to shortcut on the same path as a DOM node with no cache - id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey; - - // Avoid doing any more work than we need to when trying to get data on an - // object that has no data at all - if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined ) { - return; - } - - if ( !id ) { - // Only DOM nodes need a new unique ID for each element since their data - // ends up in the global cache - if ( isNode ) { - elem[ internalKey ] = id = core_deletedIds.pop() || jQuery.guid++; - } else { - id = internalKey; - } - } - - if ( !cache[ id ] ) { - cache[ id ] = {}; - - // Avoids exposing jQuery metadata on plain JS objects when the object - // is serialized using JSON.stringify - if ( !isNode ) { - cache[ id ].toJSON = jQuery.noop; - } - } - - // An object can be passed to jQuery.data instead of a key/value pair; this gets - // shallow copied over onto the existing cache - if ( typeof name === "object" || typeof name === "function" ) { - if ( pvt ) { - cache[ id ] = jQuery.extend( cache[ id ], name ); - } else { - cache[ id ].data = jQuery.extend( cache[ id ].data, name ); - } - } - - thisCache = cache[ id ]; - - // jQuery data() is stored in a separate object inside the object's internal data - // cache in order to avoid key collisions between internal data and user-defined - // data. - if ( !pvt ) { - if ( !thisCache.data ) { - thisCache.data = {}; - } - - thisCache = thisCache.data; - } - - if ( data !== undefined ) { - thisCache[ jQuery.camelCase( name ) ] = data; - } - - // Check for both converted-to-camel and non-converted data property names - // If a data property was specified - if ( getByName ) { - - // First Try to find as-is property data - ret = thisCache[ name ]; - - // Test for null|undefined property data - if ( ret == null ) { - - // Try to find the camelCased property - ret = thisCache[ jQuery.camelCase( name ) ]; - } - } else { - ret = thisCache; - } - - return ret; -} - -function internalRemoveData( elem, name, pvt ) { - if ( !jQuery.acceptData( elem ) ) { - return; - } - - var i, l, thisCache, - isNode = elem.nodeType, - - // See jQuery.data for more information - cache = isNode ? jQuery.cache : elem, - id = isNode ? elem[ jQuery.expando ] : jQuery.expando; - - // If there is already no cache entry for this object, there is no - // purpose in continuing - if ( !cache[ id ] ) { - return; - } - - if ( name ) { - - thisCache = pvt ? cache[ id ] : cache[ id ].data; - - if ( thisCache ) { - - // Support array or space separated string names for data keys - if ( !jQuery.isArray( name ) ) { - - // try the string as a key before any manipulation - if ( name in thisCache ) { - name = [ name ]; - } else { - - // split the camel cased version by spaces unless a key with the spaces exists - name = jQuery.camelCase( name ); - if ( name in thisCache ) { - name = [ name ]; - } else { - name = name.split(" "); - } - } - } else { - // If "name" is an array of keys... - // When data is initially created, via ("key", "val") signature, - // keys will be converted to camelCase. - // Since there is no way to tell _how_ a key was added, remove - // both plain key and camelCase key. #12786 - // This will only penalize the array argument path. - name = name.concat( jQuery.map( name, jQuery.camelCase ) ); - } - - for ( i = 0, l = name.length; i < l; i++ ) { - delete thisCache[ name[i] ]; - } - - // If there is no data left in the cache, we want to continue - // and let the cache object itself get destroyed - if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) { - return; - } - } - } - - // See jQuery.data for more information - if ( !pvt ) { - delete cache[ id ].data; - - // Don't destroy the parent cache unless the internal data object - // had been the only thing left in it - if ( !isEmptyDataObject( cache[ id ] ) ) { - return; - } - } - - // Destroy the cache - if ( isNode ) { - jQuery.cleanData( [ elem ], true ); - - // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080) - } else if ( jQuery.support.deleteExpando || cache != cache.window ) { - delete cache[ id ]; - - // When all else fails, null - } else { - cache[ id ] = null; - } -} - -jQuery.extend({ - cache: {}, - - // Unique for each copy of jQuery on the page - // Non-digits removed to match rinlinejQuery - expando: "jQuery" + ( core_version + Math.random() ).replace( /\D/g, "" ), - - // The following elements throw uncatchable exceptions if you - // attempt to add expando properties to them. - noData: { - "embed": true, - // Ban all objects except for Flash (which handle expandos) - "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", - "applet": true - }, - - hasData: function( elem ) { - elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; - return !!elem && !isEmptyDataObject( elem ); - }, - - data: function( elem, name, data ) { - return internalData( elem, name, data ); - }, - - removeData: function( elem, name ) { - return internalRemoveData( elem, name ); - }, - - // For internal use only. - _data: function( elem, name, data ) { - return internalData( elem, name, data, true ); - }, - - _removeData: function( elem, name ) { - return internalRemoveData( elem, name, true ); - }, - - // A method for determining if a DOM node can handle the data expando - acceptData: function( elem ) { - // Do not set data on non-element because it will not be cleared (#8335). - if ( elem.nodeType && elem.nodeType !== 1 && elem.nodeType !== 9 ) { - return false; - } - - var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ]; - - // nodes accept data unless otherwise specified; rejection can be conditional - return !noData || noData !== true && elem.getAttribute("classid") === noData; - } -}); - -jQuery.fn.extend({ - data: function( key, value ) { - var attrs, name, - elem = this[0], - i = 0, - data = null; - - // Gets all values - if ( key === undefined ) { - if ( this.length ) { - data = jQuery.data( elem ); - - if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { - attrs = elem.attributes; - for ( ; i < attrs.length; i++ ) { - name = attrs[i].name; - - if ( !name.indexOf( "data-" ) ) { - name = jQuery.camelCase( name.slice(5) ); - - dataAttr( elem, name, data[ name ] ); - } - } - jQuery._data( elem, "parsedAttrs", true ); - } - } - - return data; - } - - // Sets multiple values - if ( typeof key === "object" ) { - return this.each(function() { - jQuery.data( this, key ); - }); - } - - return jQuery.access( this, function( value ) { - - if ( value === undefined ) { - // Try to fetch any internally stored data first - return elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : null; - } - - this.each(function() { - jQuery.data( this, key, value ); - }); - }, null, value, arguments.length > 1, null, true ); - }, - - removeData: function( key ) { - return this.each(function() { - jQuery.removeData( this, key ); - }); - } -}); - -function dataAttr( elem, key, data ) { - // If nothing was found internally, try to fetch any - // data from the HTML5 data-* attribute - if ( data === undefined && elem.nodeType === 1 ) { - - var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); - - data = elem.getAttribute( name ); - - if ( typeof data === "string" ) { - try { - data = data === "true" ? true : - data === "false" ? false : - data === "null" ? null : - // Only convert to a number if it doesn't change the string - +data + "" === data ? +data : - rbrace.test( data ) ? jQuery.parseJSON( data ) : - data; - } catch( e ) {} - - // Make sure we set the data so it isn't changed later - jQuery.data( elem, key, data ); - - } else { - data = undefined; - } - } - - return data; -} - -// checks a cache object for emptiness -function isEmptyDataObject( obj ) { - var name; - for ( name in obj ) { - - // if the public data object is empty, the private is still empty - if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { - continue; - } - if ( name !== "toJSON" ) { - return false; - } - } - - return true; -} -jQuery.extend({ - queue: function( elem, type, data ) { - var queue; - - if ( elem ) { - type = ( type || "fx" ) + "queue"; - queue = jQuery._data( elem, type ); - - // Speed up dequeue by getting out quickly if this is just a lookup - if ( data ) { - if ( !queue || jQuery.isArray(data) ) { - queue = jQuery._data( elem, type, jQuery.makeArray(data) ); - } else { - queue.push( data ); - } - } - return queue || []; - } - }, - - dequeue: function( elem, type ) { - type = type || "fx"; - - var queue = jQuery.queue( elem, type ), - startLength = queue.length, - fn = queue.shift(), - hooks = jQuery._queueHooks( elem, type ), - next = function() { - jQuery.dequeue( elem, type ); - }; - - // If the fx queue is dequeued, always remove the progress sentinel - if ( fn === "inprogress" ) { - fn = queue.shift(); - startLength--; - } - - hooks.cur = fn; - if ( fn ) { - - // Add a progress sentinel to prevent the fx queue from being - // automatically dequeued - if ( type === "fx" ) { - queue.unshift( "inprogress" ); - } - - // clear up the last queue stop function - delete hooks.stop; - fn.call( elem, next, hooks ); - } - - if ( !startLength && hooks ) { - hooks.empty.fire(); - } - }, - - // not intended for public consumption - generates a queueHooks object, or returns the current one - _queueHooks: function( elem, type ) { - var key = type + "queueHooks"; - return jQuery._data( elem, key ) || jQuery._data( elem, key, { - empty: jQuery.Callbacks("once memory").add(function() { - jQuery._removeData( elem, type + "queue" ); - jQuery._removeData( elem, key ); - }) - }); - } -}); - -jQuery.fn.extend({ - queue: function( type, data ) { - var setter = 2; - - if ( typeof type !== "string" ) { - data = type; - type = "fx"; - setter--; - } - - if ( arguments.length < setter ) { - return jQuery.queue( this[0], type ); - } - - return data === undefined ? - this : - this.each(function() { - var queue = jQuery.queue( this, type, data ); - - // ensure a hooks for this queue - jQuery._queueHooks( this, type ); - - if ( type === "fx" && queue[0] !== "inprogress" ) { - jQuery.dequeue( this, type ); - } - }); - }, - dequeue: function( type ) { - return this.each(function() { - jQuery.dequeue( this, type ); - }); - }, - // Based off of the plugin by Clint Helfers, with permission. - // http://blindsignals.com/index.php/2009/07/jquery-delay/ - delay: function( time, type ) { - time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; - type = type || "fx"; - - return this.queue( type, function( next, hooks ) { - var timeout = setTimeout( next, time ); - hooks.stop = function() { - clearTimeout( timeout ); - }; - }); - }, - clearQueue: function( type ) { - return this.queue( type || "fx", [] ); - }, - // Get a promise resolved when queues of a certain type - // are emptied (fx is the type by default) - promise: function( type, obj ) { - var tmp, - count = 1, - defer = jQuery.Deferred(), - elements = this, - i = this.length, - resolve = function() { - if ( !( --count ) ) { - defer.resolveWith( elements, [ elements ] ); - } - }; - - if ( typeof type !== "string" ) { - obj = type; - type = undefined; - } - type = type || "fx"; - - while( i-- ) { - tmp = jQuery._data( elements[ i ], type + "queueHooks" ); - if ( tmp && tmp.empty ) { - count++; - tmp.empty.add( resolve ); - } - } - resolve(); - return defer.promise( obj ); - } -}); -var nodeHook, boolHook, - rclass = /[\t\r\n]/g, - rreturn = /\r/g, - rfocusable = /^(?:input|select|textarea|button|object)$/i, - rclickable = /^(?:a|area)$/i, - rboolean = /^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i, - ruseDefault = /^(?:checked|selected)$/i, - getSetAttribute = jQuery.support.getSetAttribute, - getSetInput = jQuery.support.input; - -jQuery.fn.extend({ - attr: function( name, value ) { - return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 ); - }, - - removeAttr: function( name ) { - return this.each(function() { - jQuery.removeAttr( this, name ); - }); - }, - - prop: function( name, value ) { - return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 ); - }, - - removeProp: function( name ) { - name = jQuery.propFix[ name ] || name; - return this.each(function() { - // try/catch handles cases where IE balks (such as removing a property on window) - try { - this[ name ] = undefined; - delete this[ name ]; - } catch( e ) {} - }); - }, - - addClass: function( value ) { - var classes, elem, cur, clazz, j, - i = 0, - len = this.length, - proceed = typeof value === "string" && value; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).addClass( value.call( this, j, this.className ) ); - }); - } - - if ( proceed ) { - // The disjunction here is for better compressibility (see removeClass) - classes = ( value || "" ).match( core_rnotwhite ) || []; - - for ( ; i < len; i++ ) { - elem = this[ i ]; - cur = elem.nodeType === 1 && ( elem.className ? - ( " " + elem.className + " " ).replace( rclass, " " ) : - " " - ); - - if ( cur ) { - j = 0; - while ( (clazz = classes[j++]) ) { - if ( cur.indexOf( " " + clazz + " " ) < 0 ) { - cur += clazz + " "; - } - } - elem.className = jQuery.trim( cur ); - - } - } - } - - return this; - }, - - removeClass: function( value ) { - var classes, elem, cur, clazz, j, - i = 0, - len = this.length, - proceed = arguments.length === 0 || typeof value === "string" && value; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).removeClass( value.call( this, j, this.className ) ); - }); - } - if ( proceed ) { - classes = ( value || "" ).match( core_rnotwhite ) || []; - - for ( ; i < len; i++ ) { - elem = this[ i ]; - // This expression is here for better compressibility (see addClass) - cur = elem.nodeType === 1 && ( elem.className ? - ( " " + elem.className + " " ).replace( rclass, " " ) : - "" - ); - - if ( cur ) { - j = 0; - while ( (clazz = classes[j++]) ) { - // Remove *all* instances - while ( cur.indexOf( " " + clazz + " " ) >= 0 ) { - cur = cur.replace( " " + clazz + " ", " " ); - } - } - elem.className = value ? jQuery.trim( cur ) : ""; - } - } - } - - return this; - }, - - toggleClass: function( value, stateVal ) { - var type = typeof value, - isBool = typeof stateVal === "boolean"; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( i ) { - jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); - }); - } - - return this.each(function() { - if ( type === "string" ) { - // toggle individual class names - var className, - i = 0, - self = jQuery( this ), - state = stateVal, - classNames = value.match( core_rnotwhite ) || []; - - while ( (className = classNames[ i++ ]) ) { - // check each className given, space separated list - state = isBool ? state : !self.hasClass( className ); - self[ state ? "addClass" : "removeClass" ]( className ); - } - - // Toggle whole class name - } else if ( type === core_strundefined || type === "boolean" ) { - if ( this.className ) { - // store className if set - jQuery._data( this, "__className__", this.className ); - } - - // If the element has a class name or if we're passed "false", - // then remove the whole classname (if there was one, the above saved it). - // Otherwise bring back whatever was previously saved (if anything), - // falling back to the empty string if nothing was stored. - this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; - } - }); - }, - - hasClass: function( selector ) { - var className = " " + selector + " ", - i = 0, - l = this.length; - for ( ; i < l; i++ ) { - if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) { - return true; - } - } - - return false; - }, - - val: function( value ) { - var ret, hooks, isFunction, - elem = this[0]; - - if ( !arguments.length ) { - if ( elem ) { - hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; - - if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { - return ret; - } - - ret = elem.value; - - return typeof ret === "string" ? - // handle most common string cases - ret.replace(rreturn, "") : - // handle cases where value is null/undef or number - ret == null ? "" : ret; - } - - return; - } - - isFunction = jQuery.isFunction( value ); - - return this.each(function( i ) { - var val, - self = jQuery(this); - - if ( this.nodeType !== 1 ) { - return; - } - - if ( isFunction ) { - val = value.call( this, i, self.val() ); - } else { - val = value; - } - - // Treat null/undefined as ""; convert numbers to string - if ( val == null ) { - val = ""; - } else if ( typeof val === "number" ) { - val += ""; - } else if ( jQuery.isArray( val ) ) { - val = jQuery.map(val, function ( value ) { - return value == null ? "" : value + ""; - }); - } - - hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; - - // If set returns undefined, fall back to normal setting - if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { - this.value = val; - } - }); - } -}); - -jQuery.extend({ - valHooks: { - option: { - get: function( elem ) { - // attributes.value is undefined in Blackberry 4.7 but - // uses .value. See #6932 - var val = elem.attributes.value; - return !val || val.specified ? elem.value : elem.text; - } - }, - select: { - get: function( elem ) { - var value, option, - options = elem.options, - index = elem.selectedIndex, - one = elem.type === "select-one" || index < 0, - values = one ? null : [], - max = one ? index + 1 : options.length, - i = index < 0 ? - max : - one ? index : 0; - - // Loop through all the selected options - for ( ; i < max; i++ ) { - option = options[ i ]; - - // oldIE doesn't update selected after form reset (#2551) - if ( ( option.selected || i === index ) && - // Don't return options that are disabled or in a disabled optgroup - ( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) && - ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { - - // Get the specific value for the option - value = jQuery( option ).val(); - - // We don't need an array for one selects - if ( one ) { - return value; - } - - // Multi-Selects return an array - values.push( value ); - } - } - - return values; - }, - - set: function( elem, value ) { - var values = jQuery.makeArray( value ); - - jQuery(elem).find("option").each(function() { - this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; - }); - - if ( !values.length ) { - elem.selectedIndex = -1; - } - return values; - } - } - }, - - attr: function( elem, name, value ) { - var hooks, notxml, ret, - nType = elem.nodeType; - - // don't get/set attributes on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - // Fallback to prop when attributes are not supported - if ( typeof elem.getAttribute === core_strundefined ) { - return jQuery.prop( elem, name, value ); - } - - notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - - // All attributes are lowercase - // Grab necessary hook if one is defined - if ( notxml ) { - name = name.toLowerCase(); - hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook ); - } - - if ( value !== undefined ) { - - if ( value === null ) { - jQuery.removeAttr( elem, name ); - - } else if ( hooks && notxml && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { - return ret; - - } else { - elem.setAttribute( name, value + "" ); - return value; - } - - } else if ( hooks && notxml && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { - return ret; - - } else { - - // In IE9+, Flash objects don't have .getAttribute (#12945) - // Support: IE9+ - if ( typeof elem.getAttribute !== core_strundefined ) { - ret = elem.getAttribute( name ); - } - - // Non-existent attributes return null, we normalize to undefined - return ret == null ? - undefined : - ret; - } - }, - - removeAttr: function( elem, value ) { - var name, propName, - i = 0, - attrNames = value && value.match( core_rnotwhite ); - - if ( attrNames && elem.nodeType === 1 ) { - while ( (name = attrNames[i++]) ) { - propName = jQuery.propFix[ name ] || name; - - // Boolean attributes get special treatment (#10870) - if ( rboolean.test( name ) ) { - // Set corresponding property to false for boolean attributes - // Also clear defaultChecked/defaultSelected (if appropriate) for IE<8 - if ( !getSetAttribute && ruseDefault.test( name ) ) { - elem[ jQuery.camelCase( "default-" + name ) ] = - elem[ propName ] = false; - } else { - elem[ propName ] = false; - } - - // See #9699 for explanation of this approach (setting first, then removal) - } else { - jQuery.attr( elem, name, "" ); - } - - elem.removeAttribute( getSetAttribute ? name : propName ); - } - } - }, - - attrHooks: { - type: { - set: function( elem, value ) { - if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { - // Setting the type on a radio button after the value resets the value in IE6-9 - // Reset value to default in case type is set after value during creation - var val = elem.value; - elem.setAttribute( "type", value ); - if ( val ) { - elem.value = val; - } - return value; - } - } - } - }, - - propFix: { - tabindex: "tabIndex", - readonly: "readOnly", - "for": "htmlFor", - "class": "className", - maxlength: "maxLength", - cellspacing: "cellSpacing", - cellpadding: "cellPadding", - rowspan: "rowSpan", - colspan: "colSpan", - usemap: "useMap", - frameborder: "frameBorder", - contenteditable: "contentEditable" - }, - - prop: function( elem, name, value ) { - var ret, hooks, notxml, - nType = elem.nodeType; - - // don't get/set properties on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - - if ( notxml ) { - // Fix name and attach hooks - name = jQuery.propFix[ name ] || name; - hooks = jQuery.propHooks[ name ]; - } - - if ( value !== undefined ) { - if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { - return ret; - - } else { - return ( elem[ name ] = value ); - } - - } else { - if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { - return ret; - - } else { - return elem[ name ]; - } - } - }, - - propHooks: { - tabIndex: { - get: function( elem ) { - // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set - // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ - var attributeNode = elem.getAttributeNode("tabindex"); - - return attributeNode && attributeNode.specified ? - parseInt( attributeNode.value, 10 ) : - rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? - 0 : - undefined; - } - } - } -}); - -// Hook for boolean attributes -boolHook = { - get: function( elem, name ) { - var - // Use .prop to determine if this attribute is understood as boolean - prop = jQuery.prop( elem, name ), - - // Fetch it accordingly - attr = typeof prop === "boolean" && elem.getAttribute( name ), - detail = typeof prop === "boolean" ? - - getSetInput && getSetAttribute ? - attr != null : - // oldIE fabricates an empty string for missing boolean attributes - // and conflates checked/selected into attroperties - ruseDefault.test( name ) ? - elem[ jQuery.camelCase( "default-" + name ) ] : - !!attr : - - // fetch an attribute node for properties not recognized as boolean - elem.getAttributeNode( name ); - - return detail && detail.value !== false ? - name.toLowerCase() : - undefined; - }, - set: function( elem, value, name ) { - if ( value === false ) { - // Remove boolean attributes when set to false - jQuery.removeAttr( elem, name ); - } else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) { - // IE<8 needs the *property* name - elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name ); - - // Use defaultChecked and defaultSelected for oldIE - } else { - elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true; - } - - return name; - } -}; - -// fix oldIE value attroperty -if ( !getSetInput || !getSetAttribute ) { - jQuery.attrHooks.value = { - get: function( elem, name ) { - var ret = elem.getAttributeNode( name ); - return jQuery.nodeName( elem, "input" ) ? - - // Ignore the value *property* by using defaultValue - elem.defaultValue : - - ret && ret.specified ? ret.value : undefined; - }, - set: function( elem, value, name ) { - if ( jQuery.nodeName( elem, "input" ) ) { - // Does not return so that setAttribute is also used - elem.defaultValue = value; - } else { - // Use nodeHook if defined (#1954); otherwise setAttribute is fine - return nodeHook && nodeHook.set( elem, value, name ); - } - } - }; -} - -// IE6/7 do not support getting/setting some attributes with get/setAttribute -if ( !getSetAttribute ) { - - // Use this for any attribute in IE6/7 - // This fixes almost every IE6/7 issue - nodeHook = jQuery.valHooks.button = { - get: function( elem, name ) { - var ret = elem.getAttributeNode( name ); - return ret && ( name === "id" || name === "name" || name === "coords" ? ret.value !== "" : ret.specified ) ? - ret.value : - undefined; - }, - set: function( elem, value, name ) { - // Set the existing or create a new attribute node - var ret = elem.getAttributeNode( name ); - if ( !ret ) { - elem.setAttributeNode( - (ret = elem.ownerDocument.createAttribute( name )) - ); - } - - ret.value = value += ""; - - // Break association with cloned elements by also using setAttribute (#9646) - return name === "value" || value === elem.getAttribute( name ) ? - value : - undefined; - } - }; - - // Set contenteditable to false on removals(#10429) - // Setting to empty string throws an error as an invalid value - jQuery.attrHooks.contenteditable = { - get: nodeHook.get, - set: function( elem, value, name ) { - nodeHook.set( elem, value === "" ? false : value, name ); - } - }; - - // Set width and height to auto instead of 0 on empty string( Bug #8150 ) - // This is for removals - jQuery.each([ "width", "height" ], function( i, name ) { - jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { - set: function( elem, value ) { - if ( value === "" ) { - elem.setAttribute( name, "auto" ); - return value; - } - } - }); - }); -} - - -// Some attributes require a special call on IE -// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx -if ( !jQuery.support.hrefNormalized ) { - jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { - jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { - get: function( elem ) { - var ret = elem.getAttribute( name, 2 ); - return ret == null ? undefined : ret; - } - }); - }); - - // href/src property should get the full normalized URL (#10299/#12915) - jQuery.each([ "href", "src" ], function( i, name ) { - jQuery.propHooks[ name ] = { - get: function( elem ) { - return elem.getAttribute( name, 4 ); - } - }; - }); -} - -if ( !jQuery.support.style ) { - jQuery.attrHooks.style = { - get: function( elem ) { - // Return undefined in the case of empty string - // Note: IE uppercases css property names, but if we were to .toLowerCase() - // .cssText, that would destroy case senstitivity in URL's, like in "background" - return elem.style.cssText || undefined; - }, - set: function( elem, value ) { - return ( elem.style.cssText = value + "" ); - } - }; -} - -// Safari mis-reports the default selected property of an option -// Accessing the parent's selectedIndex property fixes it -if ( !jQuery.support.optSelected ) { - jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, { - get: function( elem ) { - var parent = elem.parentNode; - - if ( parent ) { - parent.selectedIndex; - - // Make sure that it also works with optgroups, see #5701 - if ( parent.parentNode ) { - parent.parentNode.selectedIndex; - } - } - return null; - } - }); -} - -// IE6/7 call enctype encoding -if ( !jQuery.support.enctype ) { - jQuery.propFix.enctype = "encoding"; -} - -// Radios and checkboxes getter/setter -if ( !jQuery.support.checkOn ) { - jQuery.each([ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = { - get: function( elem ) { - // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified - return elem.getAttribute("value") === null ? "on" : elem.value; - } - }; - }); -} -jQuery.each([ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], { - set: function( elem, value ) { - if ( jQuery.isArray( value ) ) { - return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); - } - } - }); -}); -var rformElems = /^(?:input|select|textarea)$/i, - rkeyEvent = /^key/, - rmouseEvent = /^(?:mouse|contextmenu)|click/, - rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, - rtypenamespace = /^([^.]*)(?:\.(.+)|)$/; - -function returnTrue() { - return true; -} - -function returnFalse() { - return false; -} - -/* - * Helper functions for managing events -- not part of the public interface. - * Props to Dean Edwards' addEvent library for many of the ideas. - */ -jQuery.event = { - - global: {}, - - add: function( elem, types, handler, data, selector ) { - var tmp, events, t, handleObjIn, - special, eventHandle, handleObj, - handlers, type, namespaces, origType, - elemData = jQuery._data( elem ); - - // Don't attach events to noData or text/comment nodes (but allow plain objects) - if ( !elemData ) { - return; - } - - // Caller can pass in an object of custom data in lieu of the handler - if ( handler.handler ) { - handleObjIn = handler; - handler = handleObjIn.handler; - selector = handleObjIn.selector; - } - - // Make sure that the handler has a unique ID, used to find/remove it later - if ( !handler.guid ) { - handler.guid = jQuery.guid++; - } - - // Init the element's event structure and main handler, if this is the first - if ( !(events = elemData.events) ) { - events = elemData.events = {}; - } - if ( !(eventHandle = elemData.handle) ) { - eventHandle = elemData.handle = function( e ) { - // Discard the second event of a jQuery.event.trigger() and - // when an event is called after a page has unloaded - return typeof jQuery !== core_strundefined && (!e || jQuery.event.triggered !== e.type) ? - jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : - undefined; - }; - // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events - eventHandle.elem = elem; - } - - // Handle multiple events separated by a space - // jQuery(...).bind("mouseover mouseout", fn); - types = ( types || "" ).match( core_rnotwhite ) || [""]; - t = types.length; - while ( t-- ) { - tmp = rtypenamespace.exec( types[t] ) || []; - type = origType = tmp[1]; - namespaces = ( tmp[2] || "" ).split( "." ).sort(); - - // If event changes its type, use the special event handlers for the changed type - special = jQuery.event.special[ type ] || {}; - - // If selector defined, determine special event api type, otherwise given type - type = ( selector ? special.delegateType : special.bindType ) || type; - - // Update special based on newly reset type - special = jQuery.event.special[ type ] || {}; - - // handleObj is passed to all event handlers - handleObj = jQuery.extend({ - type: type, - origType: origType, - data: data, - handler: handler, - guid: handler.guid, - selector: selector, - needsContext: selector && jQuery.expr.match.needsContext.test( selector ), - namespace: namespaces.join(".") - }, handleObjIn ); - - // Init the event handler queue if we're the first - if ( !(handlers = events[ type ]) ) { - handlers = events[ type ] = []; - handlers.delegateCount = 0; - - // Only use addEventListener/attachEvent if the special events handler returns false - if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { - // Bind the global event handler to the element - if ( elem.addEventListener ) { - elem.addEventListener( type, eventHandle, false ); - - } else if ( elem.attachEvent ) { - elem.attachEvent( "on" + type, eventHandle ); - } - } - } - - if ( special.add ) { - special.add.call( elem, handleObj ); - - if ( !handleObj.handler.guid ) { - handleObj.handler.guid = handler.guid; - } - } - - // Add to the element's handler list, delegates in front - if ( selector ) { - handlers.splice( handlers.delegateCount++, 0, handleObj ); - } else { - handlers.push( handleObj ); - } - - // Keep track of which events have ever been used, for event optimization - jQuery.event.global[ type ] = true; - } - - // Nullify elem to prevent memory leaks in IE - elem = null; - }, - - // Detach an event or set of events from an element - remove: function( elem, types, handler, selector, mappedTypes ) { - var j, handleObj, tmp, - origCount, t, events, - special, handlers, type, - namespaces, origType, - elemData = jQuery.hasData( elem ) && jQuery._data( elem ); - - if ( !elemData || !(events = elemData.events) ) { - return; - } - - // Once for each type.namespace in types; type may be omitted - types = ( types || "" ).match( core_rnotwhite ) || [""]; - t = types.length; - while ( t-- ) { - tmp = rtypenamespace.exec( types[t] ) || []; - type = origType = tmp[1]; - namespaces = ( tmp[2] || "" ).split( "." ).sort(); - - // Unbind all events (on this namespace, if provided) for the element - if ( !type ) { - for ( type in events ) { - jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); - } - continue; - } - - special = jQuery.event.special[ type ] || {}; - type = ( selector ? special.delegateType : special.bindType ) || type; - handlers = events[ type ] || []; - tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ); - - // Remove matching events - origCount = j = handlers.length; - while ( j-- ) { - handleObj = handlers[ j ]; - - if ( ( mappedTypes || origType === handleObj.origType ) && - ( !handler || handler.guid === handleObj.guid ) && - ( !tmp || tmp.test( handleObj.namespace ) ) && - ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { - handlers.splice( j, 1 ); - - if ( handleObj.selector ) { - handlers.delegateCount--; - } - if ( special.remove ) { - special.remove.call( elem, handleObj ); - } - } - } - - // Remove generic event handler if we removed something and no more handlers exist - // (avoids potential for endless recursion during removal of special event handlers) - if ( origCount && !handlers.length ) { - if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { - jQuery.removeEvent( elem, type, elemData.handle ); - } - - delete events[ type ]; - } - } - - // Remove the expando if it's no longer used - if ( jQuery.isEmptyObject( events ) ) { - delete elemData.handle; - - // removeData also checks for emptiness and clears the expando if empty - // so use it instead of delete - jQuery._removeData( elem, "events" ); - } - }, - - trigger: function( event, data, elem, onlyHandlers ) { - var handle, ontype, cur, - bubbleType, special, tmp, i, - eventPath = [ elem || document ], - type = core_hasOwn.call( event, "type" ) ? event.type : event, - namespaces = core_hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : []; - - cur = tmp = elem = elem || document; - - // Don't do events on text and comment nodes - if ( elem.nodeType === 3 || elem.nodeType === 8 ) { - return; - } - - // focus/blur morphs to focusin/out; ensure we're not firing them right now - if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { - return; - } - - if ( type.indexOf(".") >= 0 ) { - // Namespaced trigger; create a regexp to match event type in handle() - namespaces = type.split("."); - type = namespaces.shift(); - namespaces.sort(); - } - ontype = type.indexOf(":") < 0 && "on" + type; - - // Caller can pass in a jQuery.Event object, Object, or just an event type string - event = event[ jQuery.expando ] ? - event : - new jQuery.Event( type, typeof event === "object" && event ); - - event.isTrigger = true; - event.namespace = namespaces.join("."); - event.namespace_re = event.namespace ? - new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) : - null; - - // Clean up the event in case it is being reused - event.result = undefined; - if ( !event.target ) { - event.target = elem; - } - - // Clone any incoming data and prepend the event, creating the handler arg list - data = data == null ? - [ event ] : - jQuery.makeArray( data, [ event ] ); - - // Allow special events to draw outside the lines - special = jQuery.event.special[ type ] || {}; - if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { - return; - } - - // Determine event propagation path in advance, per W3C events spec (#9951) - // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) - if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { - - bubbleType = special.delegateType || type; - if ( !rfocusMorph.test( bubbleType + type ) ) { - cur = cur.parentNode; - } - for ( ; cur; cur = cur.parentNode ) { - eventPath.push( cur ); - tmp = cur; - } - - // Only add window if we got to document (e.g., not plain obj or detached DOM) - if ( tmp === (elem.ownerDocument || document) ) { - eventPath.push( tmp.defaultView || tmp.parentWindow || window ); - } - } - - // Fire handlers on the event path - i = 0; - while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) { - - event.type = i > 1 ? - bubbleType : - special.bindType || type; - - // jQuery handler - handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); - if ( handle ) { - handle.apply( cur, data ); - } - - // Native handler - handle = ontype && cur[ ontype ]; - if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) { - event.preventDefault(); - } - } - event.type = type; - - // If nobody prevented the default action, do it now - if ( !onlyHandlers && !event.isDefaultPrevented() ) { - - if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) && - !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) { - - // Call a native DOM method on the target with the same name name as the event. - // Can't use an .isFunction() check here because IE6/7 fails that test. - // Don't do default actions on window, that's where global variables be (#6170) - if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) { - - // Don't re-trigger an onFOO event when we call its FOO() method - tmp = elem[ ontype ]; - - if ( tmp ) { - elem[ ontype ] = null; - } - - // Prevent re-triggering of the same event, since we already bubbled it above - jQuery.event.triggered = type; - try { - elem[ type ](); - } catch ( e ) { - // IE<9 dies on focus/blur to hidden element (#1486,#12518) - // only reproducible on winXP IE8 native, not IE9 in IE8 mode - } - jQuery.event.triggered = undefined; - - if ( tmp ) { - elem[ ontype ] = tmp; - } - } - } - } - - return event.result; - }, - - dispatch: function( event ) { - - // Make a writable jQuery.Event from the native event object - event = jQuery.event.fix( event ); - - var i, ret, handleObj, matched, j, - handlerQueue = [], - args = core_slice.call( arguments ), - handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [], - special = jQuery.event.special[ event.type ] || {}; - - // Use the fix-ed jQuery.Event rather than the (read-only) native event - args[0] = event; - event.delegateTarget = this; - - // Call the preDispatch hook for the mapped type, and let it bail if desired - if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { - return; - } - - // Determine handlers - handlerQueue = jQuery.event.handlers.call( this, event, handlers ); - - // Run delegates first; they may want to stop propagation beneath us - i = 0; - while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) { - event.currentTarget = matched.elem; - - j = 0; - while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) { - - // Triggered event must either 1) have no namespace, or - // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). - if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) { - - event.handleObj = handleObj; - event.data = handleObj.data; - - ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) - .apply( matched.elem, args ); - - if ( ret !== undefined ) { - if ( (event.result = ret) === false ) { - event.preventDefault(); - event.stopPropagation(); - } - } - } - } - } - - // Call the postDispatch hook for the mapped type - if ( special.postDispatch ) { - special.postDispatch.call( this, event ); - } - - return event.result; - }, - - handlers: function( event, handlers ) { - var sel, handleObj, matches, i, - handlerQueue = [], - delegateCount = handlers.delegateCount, - cur = event.target; - - // Find delegate handlers - // Black-hole SVG instance trees (#13180) - // Avoid non-left-click bubbling in Firefox (#3861) - if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) { - - for ( ; cur != this; cur = cur.parentNode || this ) { - - // Don't check non-elements (#13208) - // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) - if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) { - matches = []; - for ( i = 0; i < delegateCount; i++ ) { - handleObj = handlers[ i ]; - - // Don't conflict with Object.prototype properties (#13203) - sel = handleObj.selector + " "; - - if ( matches[ sel ] === undefined ) { - matches[ sel ] = handleObj.needsContext ? - jQuery( sel, this ).index( cur ) >= 0 : - jQuery.find( sel, this, null, [ cur ] ).length; - } - if ( matches[ sel ] ) { - matches.push( handleObj ); - } - } - if ( matches.length ) { - handlerQueue.push({ elem: cur, handlers: matches }); - } - } - } - } - - // Add the remaining (directly-bound) handlers - if ( delegateCount < handlers.length ) { - handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) }); - } - - return handlerQueue; - }, - - fix: function( event ) { - if ( event[ jQuery.expando ] ) { - return event; - } - - // Create a writable copy of the event object and normalize some properties - var i, prop, copy, - type = event.type, - originalEvent = event, - fixHook = this.fixHooks[ type ]; - - if ( !fixHook ) { - this.fixHooks[ type ] = fixHook = - rmouseEvent.test( type ) ? this.mouseHooks : - rkeyEvent.test( type ) ? this.keyHooks : - {}; - } - copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; - - event = new jQuery.Event( originalEvent ); - - i = copy.length; - while ( i-- ) { - prop = copy[ i ]; - event[ prop ] = originalEvent[ prop ]; - } - - // Support: IE<9 - // Fix target property (#1925) - if ( !event.target ) { - event.target = originalEvent.srcElement || document; - } - - // Support: Chrome 23+, Safari? - // Target should not be a text node (#504, #13143) - if ( event.target.nodeType === 3 ) { - event.target = event.target.parentNode; - } - - // Support: IE<9 - // For mouse/key events, metaKey==false if it's undefined (#3368, #11328) - event.metaKey = !!event.metaKey; - - return fixHook.filter ? fixHook.filter( event, originalEvent ) : event; - }, - - // Includes some event props shared by KeyEvent and MouseEvent - props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), - - fixHooks: {}, - - keyHooks: { - props: "char charCode key keyCode".split(" "), - filter: function( event, original ) { - - // Add which for key events - if ( event.which == null ) { - event.which = original.charCode != null ? original.charCode : original.keyCode; - } - - return event; - } - }, - - mouseHooks: { - props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), - filter: function( event, original ) { - var body, eventDoc, doc, - button = original.button, - fromElement = original.fromElement; - - // Calculate pageX/Y if missing and clientX/Y available - if ( event.pageX == null && original.clientX != null ) { - eventDoc = event.target.ownerDocument || document; - doc = eventDoc.documentElement; - body = eventDoc.body; - - event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); - event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); - } - - // Add relatedTarget, if necessary - if ( !event.relatedTarget && fromElement ) { - event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; - } - - // Add which for click: 1 === left; 2 === middle; 3 === right - // Note: button is not normalized, so don't use it - if ( !event.which && button !== undefined ) { - event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); - } - - return event; - } - }, - - special: { - load: { - // Prevent triggered image.load events from bubbling to window.load - noBubble: true - }, - click: { - // For checkbox, fire native event so checked state will be right - trigger: function() { - if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) { - this.click(); - return false; - } - } - }, - focus: { - // Fire native event if possible so blur/focus sequence is correct - trigger: function() { - if ( this !== document.activeElement && this.focus ) { - try { - this.focus(); - return false; - } catch ( e ) { - // Support: IE<9 - // If we error on focus to hidden element (#1486, #12518), - // let .trigger() run the handlers - } - } - }, - delegateType: "focusin" - }, - blur: { - trigger: function() { - if ( this === document.activeElement && this.blur ) { - this.blur(); - return false; - } - }, - delegateType: "focusout" - }, - - beforeunload: { - postDispatch: function( event ) { - - // Even when returnValue equals to undefined Firefox will still show alert - if ( event.result !== undefined ) { - event.originalEvent.returnValue = event.result; - } - } - } - }, - - simulate: function( type, elem, event, bubble ) { - // Piggyback on a donor event to simulate a different one. - // Fake originalEvent to avoid donor's stopPropagation, but if the - // simulated event prevents default then we do the same on the donor. - var e = jQuery.extend( - new jQuery.Event(), - event, - { type: type, - isSimulated: true, - originalEvent: {} - } - ); - if ( bubble ) { - jQuery.event.trigger( e, null, elem ); - } else { - jQuery.event.dispatch.call( elem, e ); - } - if ( e.isDefaultPrevented() ) { - event.preventDefault(); - } - } -}; - -jQuery.removeEvent = document.removeEventListener ? - function( elem, type, handle ) { - if ( elem.removeEventListener ) { - elem.removeEventListener( type, handle, false ); - } - } : - function( elem, type, handle ) { - var name = "on" + type; - - if ( elem.detachEvent ) { - - // #8545, #7054, preventing memory leaks for custom events in IE6-8 - // detachEvent needed property on element, by name of that event, to properly expose it to GC - if ( typeof elem[ name ] === core_strundefined ) { - elem[ name ] = null; - } - - elem.detachEvent( name, handle ); - } - }; - -jQuery.Event = function( src, props ) { - // Allow instantiation without the 'new' keyword - if ( !(this instanceof jQuery.Event) ) { - return new jQuery.Event( src, props ); - } - - // Event object - if ( src && src.type ) { - this.originalEvent = src; - this.type = src.type; - - // Events bubbling up the document may have been marked as prevented - // by a handler lower down the tree; reflect the correct value. - this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || - src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; - - // Event type - } else { - this.type = src; - } - - // Put explicitly provided properties onto the event object - if ( props ) { - jQuery.extend( this, props ); - } - - // Create a timestamp if incoming event doesn't have one - this.timeStamp = src && src.timeStamp || jQuery.now(); - - // Mark it as fixed - this[ jQuery.expando ] = true; -}; - -// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding -// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html -jQuery.Event.prototype = { - isDefaultPrevented: returnFalse, - isPropagationStopped: returnFalse, - isImmediatePropagationStopped: returnFalse, - - preventDefault: function() { - var e = this.originalEvent; - - this.isDefaultPrevented = returnTrue; - if ( !e ) { - return; - } - - // If preventDefault exists, run it on the original event - if ( e.preventDefault ) { - e.preventDefault(); - - // Support: IE - // Otherwise set the returnValue property of the original event to false - } else { - e.returnValue = false; - } - }, - stopPropagation: function() { - var e = this.originalEvent; - - this.isPropagationStopped = returnTrue; - if ( !e ) { - return; - } - // If stopPropagation exists, run it on the original event - if ( e.stopPropagation ) { - e.stopPropagation(); - } - - // Support: IE - // Set the cancelBubble property of the original event to true - e.cancelBubble = true; - }, - stopImmediatePropagation: function() { - this.isImmediatePropagationStopped = returnTrue; - this.stopPropagation(); - } -}; - -// Create mouseenter/leave events using mouseover/out and event-time checks -jQuery.each({ - mouseenter: "mouseover", - mouseleave: "mouseout" -}, function( orig, fix ) { - jQuery.event.special[ orig ] = { - delegateType: fix, - bindType: fix, - - handle: function( event ) { - var ret, - target = this, - related = event.relatedTarget, - handleObj = event.handleObj; - - // For mousenter/leave call the handler if related is outside the target. - // NB: No relatedTarget if the mouse left/entered the browser window - if ( !related || (related !== target && !jQuery.contains( target, related )) ) { - event.type = handleObj.origType; - ret = handleObj.handler.apply( this, arguments ); - event.type = fix; - } - return ret; - } - }; -}); - -// IE submit delegation -if ( !jQuery.support.submitBubbles ) { - - jQuery.event.special.submit = { - setup: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } - - // Lazy-add a submit handler when a descendant form may potentially be submitted - jQuery.event.add( this, "click._submit keypress._submit", function( e ) { - // Node name check avoids a VML-related crash in IE (#9807) - var elem = e.target, - form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; - if ( form && !jQuery._data( form, "submitBubbles" ) ) { - jQuery.event.add( form, "submit._submit", function( event ) { - event._submit_bubble = true; - }); - jQuery._data( form, "submitBubbles", true ); - } - }); - // return undefined since we don't need an event listener - }, - - postDispatch: function( event ) { - // If form was submitted by the user, bubble the event up the tree - if ( event._submit_bubble ) { - delete event._submit_bubble; - if ( this.parentNode && !event.isTrigger ) { - jQuery.event.simulate( "submit", this.parentNode, event, true ); - } - } - }, - - teardown: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } - - // Remove delegated handlers; cleanData eventually reaps submit handlers attached above - jQuery.event.remove( this, "._submit" ); - } - }; -} - -// IE change delegation and checkbox/radio fix -if ( !jQuery.support.changeBubbles ) { - - jQuery.event.special.change = { - - setup: function() { - - if ( rformElems.test( this.nodeName ) ) { - // IE doesn't fire change on a check/radio until blur; trigger it on click - // after a propertychange. Eat the blur-change in special.change.handle. - // This still fires onchange a second time for check/radio after blur. - if ( this.type === "checkbox" || this.type === "radio" ) { - jQuery.event.add( this, "propertychange._change", function( event ) { - if ( event.originalEvent.propertyName === "checked" ) { - this._just_changed = true; - } - }); - jQuery.event.add( this, "click._change", function( event ) { - if ( this._just_changed && !event.isTrigger ) { - this._just_changed = false; - } - // Allow triggered, simulated change events (#11500) - jQuery.event.simulate( "change", this, event, true ); - }); - } - return false; - } - // Delegated event; lazy-add a change handler on descendant inputs - jQuery.event.add( this, "beforeactivate._change", function( e ) { - var elem = e.target; - - if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "changeBubbles" ) ) { - jQuery.event.add( elem, "change._change", function( event ) { - if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { - jQuery.event.simulate( "change", this.parentNode, event, true ); - } - }); - jQuery._data( elem, "changeBubbles", true ); - } - }); - }, - - handle: function( event ) { - var elem = event.target; - - // Swallow native change events from checkbox/radio, we already triggered them above - if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { - return event.handleObj.handler.apply( this, arguments ); - } - }, - - teardown: function() { - jQuery.event.remove( this, "._change" ); - - return !rformElems.test( this.nodeName ); - } - }; -} - -// Create "bubbling" focus and blur events -if ( !jQuery.support.focusinBubbles ) { - jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { - - // Attach a single capturing handler while someone wants focusin/focusout - var attaches = 0, - handler = function( event ) { - jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); - }; - - jQuery.event.special[ fix ] = { - setup: function() { - if ( attaches++ === 0 ) { - document.addEventListener( orig, handler, true ); - } - }, - teardown: function() { - if ( --attaches === 0 ) { - document.removeEventListener( orig, handler, true ); - } - } - }; - }); -} - -jQuery.fn.extend({ - - on: function( types, selector, data, fn, /*INTERNAL*/ one ) { - var type, origFn; - - // Types can be a map of types/handlers - if ( typeof types === "object" ) { - // ( types-Object, selector, data ) - if ( typeof selector !== "string" ) { - // ( types-Object, data ) - data = data || selector; - selector = undefined; - } - for ( type in types ) { - this.on( type, selector, data, types[ type ], one ); - } - return this; - } - - if ( data == null && fn == null ) { - // ( types, fn ) - fn = selector; - data = selector = undefined; - } else if ( fn == null ) { - if ( typeof selector === "string" ) { - // ( types, selector, fn ) - fn = data; - data = undefined; - } else { - // ( types, data, fn ) - fn = data; - data = selector; - selector = undefined; - } - } - if ( fn === false ) { - fn = returnFalse; - } else if ( !fn ) { - return this; - } - - if ( one === 1 ) { - origFn = fn; - fn = function( event ) { - // Can use an empty set, since event contains the info - jQuery().off( event ); - return origFn.apply( this, arguments ); - }; - // Use same guid so caller can remove using origFn - fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); - } - return this.each( function() { - jQuery.event.add( this, types, fn, data, selector ); - }); - }, - one: function( types, selector, data, fn ) { - return this.on( types, selector, data, fn, 1 ); - }, - off: function( types, selector, fn ) { - var handleObj, type; - if ( types && types.preventDefault && types.handleObj ) { - // ( event ) dispatched jQuery.Event - handleObj = types.handleObj; - jQuery( types.delegateTarget ).off( - handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, - handleObj.selector, - handleObj.handler - ); - return this; - } - if ( typeof types === "object" ) { - // ( types-object [, selector] ) - for ( type in types ) { - this.off( type, selector, types[ type ] ); - } - return this; - } - if ( selector === false || typeof selector === "function" ) { - // ( types [, fn] ) - fn = selector; - selector = undefined; - } - if ( fn === false ) { - fn = returnFalse; - } - return this.each(function() { - jQuery.event.remove( this, types, fn, selector ); - }); - }, - - bind: function( types, data, fn ) { - return this.on( types, null, data, fn ); - }, - unbind: function( types, fn ) { - return this.off( types, null, fn ); - }, - - delegate: function( selector, types, data, fn ) { - return this.on( types, selector, data, fn ); - }, - undelegate: function( selector, types, fn ) { - // ( namespace ) or ( selector, types [, fn] ) - return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn ); - }, - - trigger: function( type, data ) { - return this.each(function() { - jQuery.event.trigger( type, data, this ); - }); - }, - triggerHandler: function( type, data ) { - var elem = this[0]; - if ( elem ) { - return jQuery.event.trigger( type, data, elem, true ); - } - } -}); -/*! - * Sizzle CSS Selector Engine - * Copyright 2012 jQuery Foundation and other contributors - * Released under the MIT license - * http://sizzlejs.com/ - */ -(function( window, undefined ) { - -var i, - cachedruns, - Expr, - getText, - isXML, - compile, - hasDuplicate, - outermostContext, - - // Local document vars - setDocument, - document, - docElem, - documentIsXML, - rbuggyQSA, - rbuggyMatches, - matches, - contains, - sortOrder, - - // Instance-specific data - expando = "sizzle" + -(new Date()), - preferredDoc = window.document, - support = {}, - dirruns = 0, - done = 0, - classCache = createCache(), - tokenCache = createCache(), - compilerCache = createCache(), - - // General-purpose constants - strundefined = typeof undefined, - MAX_NEGATIVE = 1 << 31, - - // Array methods - arr = [], - pop = arr.pop, - push = arr.push, - slice = arr.slice, - // Use a stripped-down indexOf if we can't use a native one - indexOf = arr.indexOf || function( elem ) { - var i = 0, - len = this.length; - for ( ; i < len; i++ ) { - if ( this[i] === elem ) { - return i; - } - } - return -1; - }, - - - // Regular expressions - - // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace - whitespace = "[\\x20\\t\\r\\n\\f]", - // http://www.w3.org/TR/css3-syntax/#characters - characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", - - // Loosely modeled on CSS identifier characters - // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors - // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier - identifier = characterEncoding.replace( "w", "w#" ), - - // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors - operators = "([*^$|!~]?=)", - attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace + - "*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]", - - // Prefer arguments quoted, - // then not containing pseudos/brackets, - // then attribute selectors/non-parenthetical expressions, - // then anything else - // These preferences are here to reduce the number of selectors - // needing tokenize in the PSEUDO preFilter - pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)", - - // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter - rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), - - rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), - rcombinators = new RegExp( "^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*" ), - rpseudo = new RegExp( pseudos ), - ridentifier = new RegExp( "^" + identifier + "$" ), - - matchExpr = { - "ID": new RegExp( "^#(" + characterEncoding + ")" ), - "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), - "NAME": new RegExp( "^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]" ), - "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), - "ATTR": new RegExp( "^" + attributes ), - "PSEUDO": new RegExp( "^" + pseudos ), - "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + - "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + - "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), - // For use in libraries implementing .is() - // We use this for POS matching in `select` - "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + - whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) - }, - - rsibling = /[\x20\t\r\n\f]*[+~]/, - - rnative = /^[^{]+\{\s*\[native code/, - - // Easily-parseable/retrievable ID or TAG or CLASS selectors - rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, - - rinputs = /^(?:input|select|textarea|button)$/i, - rheader = /^h\d$/i, - - rescape = /'|\\/g, - rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g, - - // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters - runescape = /\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g, - funescape = function( _, escaped ) { - var high = "0x" + escaped - 0x10000; - // NaN means non-codepoint - return high !== high ? - escaped : - // BMP codepoint - high < 0 ? - String.fromCharCode( high + 0x10000 ) : - // Supplemental Plane codepoint (surrogate pair) - String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); - }; - -// Use a stripped-down slice if we can't use a native one -try { - slice.call( preferredDoc.documentElement.childNodes, 0 )[0].nodeType; -} catch ( e ) { - slice = function( i ) { - var elem, - results = []; - while ( (elem = this[i++]) ) { - results.push( elem ); - } - return results; - }; -} - -/** - * For feature detection - * @param {Function} fn The function to test for native support - */ -function isNative( fn ) { - return rnative.test( fn + "" ); -} - -/** - * Create key-value caches of limited size - * @returns {Function(string, Object)} Returns the Object data after storing it on itself with - * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) - * deleting the oldest entry - */ -function createCache() { - var cache, - keys = []; - - return (cache = function( key, value ) { - // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) - if ( keys.push( key += " " ) > Expr.cacheLength ) { - // Only keep the most recent entries - delete cache[ keys.shift() ]; - } - return (cache[ key ] = value); - }); -} - -/** - * Mark a function for special use by Sizzle - * @param {Function} fn The function to mark - */ -function markFunction( fn ) { - fn[ expando ] = true; - return fn; -} - -/** - * Support testing using an element - * @param {Function} fn Passed the created div and expects a boolean result - */ -function assert( fn ) { - var div = document.createElement("div"); - - try { - return fn( div ); - } catch (e) { - return false; - } finally { - // release memory in IE - div = null; - } -} - -function Sizzle( selector, context, results, seed ) { - var match, elem, m, nodeType, - // QSA vars - i, groups, old, nid, newContext, newSelector; - - if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { - setDocument( context ); - } - - context = context || document; - results = results || []; - - if ( !selector || typeof selector !== "string" ) { - return results; - } - - if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) { - return []; - } - - if ( !documentIsXML && !seed ) { - - // Shortcuts - if ( (match = rquickExpr.exec( selector )) ) { - // Speed-up: Sizzle("#ID") - if ( (m = match[1]) ) { - if ( nodeType === 9 ) { - elem = context.getElementById( m ); - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE, Opera, and Webkit return items - // by name instead of ID - if ( elem.id === m ) { - results.push( elem ); - return results; - } - } else { - return results; - } - } else { - // Context is not a document - if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && - contains( context, elem ) && elem.id === m ) { - results.push( elem ); - return results; - } - } - - // Speed-up: Sizzle("TAG") - } else if ( match[2] ) { - push.apply( results, slice.call(context.getElementsByTagName( selector ), 0) ); - return results; - - // Speed-up: Sizzle(".CLASS") - } else if ( (m = match[3]) && support.getByClassName && context.getElementsByClassName ) { - push.apply( results, slice.call(context.getElementsByClassName( m ), 0) ); - return results; - } - } - - // QSA path - if ( support.qsa && !rbuggyQSA.test(selector) ) { - old = true; - nid = expando; - newContext = context; - newSelector = nodeType === 9 && selector; - - // qSA works strangely on Element-rooted queries - // We can work around this by specifying an extra ID on the root - // and working up from there (Thanks to Andrew Dupont for the technique) - // IE 8 doesn't work on object elements - if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { - groups = tokenize( selector ); - - if ( (old = context.getAttribute("id")) ) { - nid = old.replace( rescape, "\\$&" ); - } else { - context.setAttribute( "id", nid ); - } - nid = "[id='" + nid + "'] "; - - i = groups.length; - while ( i-- ) { - groups[i] = nid + toSelector( groups[i] ); - } - newContext = rsibling.test( selector ) && context.parentNode || context; - newSelector = groups.join(","); - } - - if ( newSelector ) { - try { - push.apply( results, slice.call( newContext.querySelectorAll( - newSelector - ), 0 ) ); - return results; - } catch(qsaError) { - } finally { - if ( !old ) { - context.removeAttribute("id"); - } - } - } - } - } - - // All others - return select( selector.replace( rtrim, "$1" ), context, results, seed ); -} - -/** - * Detect xml - * @param {Element|Object} elem An element or a document - */ -isXML = Sizzle.isXML = function( elem ) { - // documentElement is verified for cases where it doesn't yet exist - // (such as loading iframes in IE - #4833) - var documentElement = elem && (elem.ownerDocument || elem).documentElement; - return documentElement ? documentElement.nodeName !== "HTML" : false; -}; - -/** - * Sets document-related variables once based on the current document - * @param {Element|Object} [doc] An element or document object to use to set the document - * @returns {Object} Returns the current document - */ -setDocument = Sizzle.setDocument = function( node ) { - var doc = node ? node.ownerDocument || node : preferredDoc; - - // If no document and documentElement is available, return - if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { - return document; - } - - // Set our document - document = doc; - docElem = doc.documentElement; - - // Support tests - documentIsXML = isXML( doc ); - - // Check if getElementsByTagName("*") returns only elements - support.tagNameNoComments = assert(function( div ) { - div.appendChild( doc.createComment("") ); - return !div.getElementsByTagName("*").length; - }); - - // Check if attributes should be retrieved by attribute nodes - support.attributes = assert(function( div ) { - div.innerHTML = ""; - var type = typeof div.lastChild.getAttribute("multiple"); - // IE8 returns a string for some attributes even when not present - return type !== "boolean" && type !== "string"; - }); - - // Check if getElementsByClassName can be trusted - support.getByClassName = assert(function( div ) { - // Opera can't find a second classname (in 9.6) - div.innerHTML = ""; - if ( !div.getElementsByClassName || !div.getElementsByClassName("e").length ) { - return false; - } - - // Safari 3.2 caches class attributes and doesn't catch changes - div.lastChild.className = "e"; - return div.getElementsByClassName("e").length === 2; - }); - - // Check if getElementById returns elements by name - // Check if getElementsByName privileges form controls or returns elements by ID - support.getByName = assert(function( div ) { - // Inject content - div.id = expando + 0; - div.innerHTML = "
            "; - docElem.insertBefore( div, docElem.firstChild ); - - // Test - var pass = doc.getElementsByName && - // buggy browsers will return fewer than the correct 2 - doc.getElementsByName( expando ).length === 2 + - // buggy browsers will return more than the correct 0 - doc.getElementsByName( expando + 0 ).length; - support.getIdNotName = !doc.getElementById( expando ); - - // Cleanup - docElem.removeChild( div ); - - return pass; - }); - - // IE6/7 return modified attributes - Expr.attrHandle = assert(function( div ) { - div.innerHTML = ""; - return div.firstChild && typeof div.firstChild.getAttribute !== strundefined && - div.firstChild.getAttribute("href") === "#"; - }) ? - {} : - { - "href": function( elem ) { - return elem.getAttribute( "href", 2 ); - }, - "type": function( elem ) { - return elem.getAttribute("type"); - } - }; - - // ID find and filter - if ( support.getIdNotName ) { - Expr.find["ID"] = function( id, context ) { - if ( typeof context.getElementById !== strundefined && !documentIsXML ) { - var m = context.getElementById( id ); - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - return m && m.parentNode ? [m] : []; - } - }; - Expr.filter["ID"] = function( id ) { - var attrId = id.replace( runescape, funescape ); - return function( elem ) { - return elem.getAttribute("id") === attrId; - }; - }; - } else { - Expr.find["ID"] = function( id, context ) { - if ( typeof context.getElementById !== strundefined && !documentIsXML ) { - var m = context.getElementById( id ); - - return m ? - m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ? - [m] : - undefined : - []; - } - }; - Expr.filter["ID"] = function( id ) { - var attrId = id.replace( runescape, funescape ); - return function( elem ) { - var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id"); - return node && node.value === attrId; - }; - }; - } - - // Tag - Expr.find["TAG"] = support.tagNameNoComments ? - function( tag, context ) { - if ( typeof context.getElementsByTagName !== strundefined ) { - return context.getElementsByTagName( tag ); - } - } : - function( tag, context ) { - var elem, - tmp = [], - i = 0, - results = context.getElementsByTagName( tag ); - - // Filter out possible comments - if ( tag === "*" ) { - while ( (elem = results[i++]) ) { - if ( elem.nodeType === 1 ) { - tmp.push( elem ); - } - } - - return tmp; - } - return results; - }; - - // Name - Expr.find["NAME"] = support.getByName && function( tag, context ) { - if ( typeof context.getElementsByName !== strundefined ) { - return context.getElementsByName( name ); - } - }; - - // Class - Expr.find["CLASS"] = support.getByClassName && function( className, context ) { - if ( typeof context.getElementsByClassName !== strundefined && !documentIsXML ) { - return context.getElementsByClassName( className ); - } - }; - - // QSA and matchesSelector support - - // matchesSelector(:active) reports false when true (IE9/Opera 11.5) - rbuggyMatches = []; - - // qSa(:focus) reports false when true (Chrome 21), - // no need to also add to buggyMatches since matches checks buggyQSA - // A support test would require too much code (would include document ready) - rbuggyQSA = [ ":focus" ]; - - if ( (support.qsa = isNative(doc.querySelectorAll)) ) { - // Build QSA regex - // Regex strategy adopted from Diego Perini - assert(function( div ) { - // Select is set to empty string on purpose - // This is to test IE's treatment of not explictly - // setting a boolean content attribute, - // since its presence should be enough - // http://bugs.jquery.com/ticket/12359 - div.innerHTML = ""; - - // IE8 - Some boolean attributes are not treated correctly - if ( !div.querySelectorAll("[selected]").length ) { - rbuggyQSA.push( "\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)" ); - } - - // Webkit/Opera - :checked should return selected option elements - // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked - // IE8 throws error here and will not see later tests - if ( !div.querySelectorAll(":checked").length ) { - rbuggyQSA.push(":checked"); - } - }); - - assert(function( div ) { - - // Opera 10-12/IE8 - ^= $= *= and empty values - // Should not select anything - div.innerHTML = ""; - if ( div.querySelectorAll("[i^='']").length ) { - rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:\"\"|'')" ); - } - - // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) - // IE8 throws error here and will not see later tests - if ( !div.querySelectorAll(":enabled").length ) { - rbuggyQSA.push( ":enabled", ":disabled" ); - } - - // Opera 10-11 does not throw on post-comma invalid pseudos - div.querySelectorAll("*,:x"); - rbuggyQSA.push(",.*:"); - }); - } - - if ( (support.matchesSelector = isNative( (matches = docElem.matchesSelector || - docElem.mozMatchesSelector || - docElem.webkitMatchesSelector || - docElem.oMatchesSelector || - docElem.msMatchesSelector) )) ) { - - assert(function( div ) { - // Check to see if it's possible to do matchesSelector - // on a disconnected node (IE 9) - support.disconnectedMatch = matches.call( div, "div" ); - - // This should fail with an exception - // Gecko does not error, returns false instead - matches.call( div, "[s!='']:x" ); - rbuggyMatches.push( "!=", pseudos ); - }); - } - - rbuggyQSA = new RegExp( rbuggyQSA.join("|") ); - rbuggyMatches = new RegExp( rbuggyMatches.join("|") ); - - // Element contains another - // Purposefully does not implement inclusive descendent - // As in, an element does not contain itself - contains = isNative(docElem.contains) || docElem.compareDocumentPosition ? - function( a, b ) { - var adown = a.nodeType === 9 ? a.documentElement : a, - bup = b && b.parentNode; - return a === bup || !!( bup && bup.nodeType === 1 && ( - adown.contains ? - adown.contains( bup ) : - a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 - )); - } : - function( a, b ) { - if ( b ) { - while ( (b = b.parentNode) ) { - if ( b === a ) { - return true; - } - } - } - return false; - }; - - // Document order sorting - sortOrder = docElem.compareDocumentPosition ? - function( a, b ) { - var compare; - - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - if ( (compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b )) ) { - if ( compare & 1 || a.parentNode && a.parentNode.nodeType === 11 ) { - if ( a === doc || contains( preferredDoc, a ) ) { - return -1; - } - if ( b === doc || contains( preferredDoc, b ) ) { - return 1; - } - return 0; - } - return compare & 4 ? -1 : 1; - } - - return a.compareDocumentPosition ? -1 : 1; - } : - function( a, b ) { - var cur, - i = 0, - aup = a.parentNode, - bup = b.parentNode, - ap = [ a ], - bp = [ b ]; - - // Exit early if the nodes are identical - if ( a === b ) { - hasDuplicate = true; - return 0; - - // Parentless nodes are either documents or disconnected - } else if ( !aup || !bup ) { - return a === doc ? -1 : - b === doc ? 1 : - aup ? -1 : - bup ? 1 : - 0; - - // If the nodes are siblings, we can do a quick check - } else if ( aup === bup ) { - return siblingCheck( a, b ); - } - - // Otherwise we need full lists of their ancestors for comparison - cur = a; - while ( (cur = cur.parentNode) ) { - ap.unshift( cur ); - } - cur = b; - while ( (cur = cur.parentNode) ) { - bp.unshift( cur ); - } - - // Walk down the tree looking for a discrepancy - while ( ap[i] === bp[i] ) { - i++; - } - - return i ? - // Do a sibling check if the nodes have a common ancestor - siblingCheck( ap[i], bp[i] ) : - - // Otherwise nodes in our document sort first - ap[i] === preferredDoc ? -1 : - bp[i] === preferredDoc ? 1 : - 0; - }; - - // Always assume the presence of duplicates if sort doesn't - // pass them to our comparison function (as in Google Chrome). - hasDuplicate = false; - [0, 0].sort( sortOrder ); - support.detectDuplicates = hasDuplicate; - - return document; -}; - -Sizzle.matches = function( expr, elements ) { - return Sizzle( expr, null, null, elements ); -}; - -Sizzle.matchesSelector = function( elem, expr ) { - // Set document vars if needed - if ( ( elem.ownerDocument || elem ) !== document ) { - setDocument( elem ); - } - - // Make sure that attribute selectors are quoted - expr = expr.replace( rattributeQuotes, "='$1']" ); - - // rbuggyQSA always contains :focus, so no need for an existence check - if ( support.matchesSelector && !documentIsXML && (!rbuggyMatches || !rbuggyMatches.test(expr)) && !rbuggyQSA.test(expr) ) { - try { - var ret = matches.call( elem, expr ); - - // IE 9's matchesSelector returns false on disconnected nodes - if ( ret || support.disconnectedMatch || - // As well, disconnected nodes are said to be in a document - // fragment in IE 9 - elem.document && elem.document.nodeType !== 11 ) { - return ret; - } - } catch(e) {} - } - - return Sizzle( expr, document, null, [elem] ).length > 0; -}; - -Sizzle.contains = function( context, elem ) { - // Set document vars if needed - if ( ( context.ownerDocument || context ) !== document ) { - setDocument( context ); - } - return contains( context, elem ); -}; - -Sizzle.attr = function( elem, name ) { - var val; - - // Set document vars if needed - if ( ( elem.ownerDocument || elem ) !== document ) { - setDocument( elem ); - } - - if ( !documentIsXML ) { - name = name.toLowerCase(); - } - if ( (val = Expr.attrHandle[ name ]) ) { - return val( elem ); - } - if ( documentIsXML || support.attributes ) { - return elem.getAttribute( name ); - } - return ( (val = elem.getAttributeNode( name )) || elem.getAttribute( name ) ) && elem[ name ] === true ? - name : - val && val.specified ? val.value : null; -}; - -Sizzle.error = function( msg ) { - throw new Error( "Syntax error, unrecognized expression: " + msg ); -}; - -// Document sorting and removing duplicates -Sizzle.uniqueSort = function( results ) { - var elem, - duplicates = [], - i = 1, - j = 0; - - // Unless we *know* we can detect duplicates, assume their presence - hasDuplicate = !support.detectDuplicates; - results.sort( sortOrder ); - - if ( hasDuplicate ) { - for ( ; (elem = results[i]); i++ ) { - if ( elem === results[ i - 1 ] ) { - j = duplicates.push( i ); - } - } - while ( j-- ) { - results.splice( duplicates[ j ], 1 ); - } - } - - return results; -}; - -function siblingCheck( a, b ) { - var cur = b && a, - diff = cur && ( ~b.sourceIndex || MAX_NEGATIVE ) - ( ~a.sourceIndex || MAX_NEGATIVE ); - - // Use IE sourceIndex if available on both nodes - if ( diff ) { - return diff; - } - - // Check if b follows a - if ( cur ) { - while ( (cur = cur.nextSibling) ) { - if ( cur === b ) { - return -1; - } - } - } - - return a ? 1 : -1; -} - -// Returns a function to use in pseudos for input types -function createInputPseudo( type ) { - return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === type; - }; -} - -// Returns a function to use in pseudos for buttons -function createButtonPseudo( type ) { - return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return (name === "input" || name === "button") && elem.type === type; - }; -} - -// Returns a function to use in pseudos for positionals -function createPositionalPseudo( fn ) { - return markFunction(function( argument ) { - argument = +argument; - return markFunction(function( seed, matches ) { - var j, - matchIndexes = fn( [], seed.length, argument ), - i = matchIndexes.length; - - // Match elements found at the specified indexes - while ( i-- ) { - if ( seed[ (j = matchIndexes[i]) ] ) { - seed[j] = !(matches[j] = seed[j]); - } - } - }); - }); -} - -/** - * Utility function for retrieving the text value of an array of DOM nodes - * @param {Array|Element} elem - */ -getText = Sizzle.getText = function( elem ) { - var node, - ret = "", - i = 0, - nodeType = elem.nodeType; - - if ( !nodeType ) { - // If no nodeType, this is expected to be an array - for ( ; (node = elem[i]); i++ ) { - // Do not traverse comment nodes - ret += getText( node ); - } - } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { - // Use textContent for elements - // innerText usage removed for consistency of new lines (see #11153) - if ( typeof elem.textContent === "string" ) { - return elem.textContent; - } else { - // Traverse its children - for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { - ret += getText( elem ); - } - } - } else if ( nodeType === 3 || nodeType === 4 ) { - return elem.nodeValue; - } - // Do not include comment or processing instruction nodes - - return ret; -}; - -Expr = Sizzle.selectors = { - - // Can be adjusted by the user - cacheLength: 50, - - createPseudo: markFunction, - - match: matchExpr, - - find: {}, - - relative: { - ">": { dir: "parentNode", first: true }, - " ": { dir: "parentNode" }, - "+": { dir: "previousSibling", first: true }, - "~": { dir: "previousSibling" } - }, - - preFilter: { - "ATTR": function( match ) { - match[1] = match[1].replace( runescape, funescape ); - - // Move the given value to match[3] whether quoted or unquoted - match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape ); - - if ( match[2] === "~=" ) { - match[3] = " " + match[3] + " "; - } - - return match.slice( 0, 4 ); - }, - - "CHILD": function( match ) { - /* matches from matchExpr["CHILD"] - 1 type (only|nth|...) - 2 what (child|of-type) - 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) - 4 xn-component of xn+y argument ([+-]?\d*n|) - 5 sign of xn-component - 6 x of xn-component - 7 sign of y-component - 8 y of y-component - */ - match[1] = match[1].toLowerCase(); - - if ( match[1].slice( 0, 3 ) === "nth" ) { - // nth-* requires argument - if ( !match[3] ) { - Sizzle.error( match[0] ); - } - - // numeric x and y parameters for Expr.filter.CHILD - // remember that false/true cast respectively to 0/1 - match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); - match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); - - // other types prohibit arguments - } else if ( match[3] ) { - Sizzle.error( match[0] ); - } - - return match; - }, - - "PSEUDO": function( match ) { - var excess, - unquoted = !match[5] && match[2]; - - if ( matchExpr["CHILD"].test( match[0] ) ) { - return null; - } - - // Accept quoted arguments as-is - if ( match[4] ) { - match[2] = match[4]; - - // Strip excess characters from unquoted arguments - } else if ( unquoted && rpseudo.test( unquoted ) && - // Get excess from tokenize (recursively) - (excess = tokenize( unquoted, true )) && - // advance to the next closing parenthesis - (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { - - // excess is a negative index - match[0] = match[0].slice( 0, excess ); - match[2] = unquoted.slice( 0, excess ); - } - - // Return only captures needed by the pseudo filter method (type and argument) - return match.slice( 0, 3 ); - } - }, - - filter: { - - "TAG": function( nodeName ) { - if ( nodeName === "*" ) { - return function() { return true; }; - } - - nodeName = nodeName.replace( runescape, funescape ).toLowerCase(); - return function( elem ) { - return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; - }; - }, - - "CLASS": function( className ) { - var pattern = classCache[ className + " " ]; - - return pattern || - (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && - classCache( className, function( elem ) { - return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" ); - }); - }, - - "ATTR": function( name, operator, check ) { - return function( elem ) { - var result = Sizzle.attr( elem, name ); - - if ( result == null ) { - return operator === "!="; - } - if ( !operator ) { - return true; - } - - result += ""; - - return operator === "=" ? result === check : - operator === "!=" ? result !== check : - operator === "^=" ? check && result.indexOf( check ) === 0 : - operator === "*=" ? check && result.indexOf( check ) > -1 : - operator === "$=" ? check && result.slice( -check.length ) === check : - operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 : - operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : - false; - }; - }, - - "CHILD": function( type, what, argument, first, last ) { - var simple = type.slice( 0, 3 ) !== "nth", - forward = type.slice( -4 ) !== "last", - ofType = what === "of-type"; - - return first === 1 && last === 0 ? - - // Shortcut for :nth-*(n) - function( elem ) { - return !!elem.parentNode; - } : - - function( elem, context, xml ) { - var cache, outerCache, node, diff, nodeIndex, start, - dir = simple !== forward ? "nextSibling" : "previousSibling", - parent = elem.parentNode, - name = ofType && elem.nodeName.toLowerCase(), - useCache = !xml && !ofType; - - if ( parent ) { - - // :(first|last|only)-(child|of-type) - if ( simple ) { - while ( dir ) { - node = elem; - while ( (node = node[ dir ]) ) { - if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) { - return false; - } - } - // Reverse direction for :only-* (if we haven't yet done so) - start = dir = type === "only" && !start && "nextSibling"; - } - return true; - } - - start = [ forward ? parent.firstChild : parent.lastChild ]; - - // non-xml :nth-child(...) stores cache data on `parent` - if ( forward && useCache ) { - // Seek `elem` from a previously-cached index - outerCache = parent[ expando ] || (parent[ expando ] = {}); - cache = outerCache[ type ] || []; - nodeIndex = cache[0] === dirruns && cache[1]; - diff = cache[0] === dirruns && cache[2]; - node = nodeIndex && parent.childNodes[ nodeIndex ]; - - while ( (node = ++nodeIndex && node && node[ dir ] || - - // Fallback to seeking `elem` from the start - (diff = nodeIndex = 0) || start.pop()) ) { - - // When found, cache indexes on `parent` and break - if ( node.nodeType === 1 && ++diff && node === elem ) { - outerCache[ type ] = [ dirruns, nodeIndex, diff ]; - break; - } - } - - // Use previously-cached element index if available - } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) { - diff = cache[1]; - - // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...) - } else { - // Use the same loop as above to seek `elem` from the start - while ( (node = ++nodeIndex && node && node[ dir ] || - (diff = nodeIndex = 0) || start.pop()) ) { - - if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) { - // Cache the index of each encountered element - if ( useCache ) { - (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ]; - } - - if ( node === elem ) { - break; - } - } - } - } - - // Incorporate the offset, then check against cycle size - diff -= last; - return diff === first || ( diff % first === 0 && diff / first >= 0 ); - } - }; - }, - - "PSEUDO": function( pseudo, argument ) { - // pseudo-class names are case-insensitive - // http://www.w3.org/TR/selectors/#pseudo-classes - // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters - // Remember that setFilters inherits from pseudos - var args, - fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || - Sizzle.error( "unsupported pseudo: " + pseudo ); - - // The user may use createPseudo to indicate that - // arguments are needed to create the filter function - // just as Sizzle does - if ( fn[ expando ] ) { - return fn( argument ); - } - - // But maintain support for old signatures - if ( fn.length > 1 ) { - args = [ pseudo, pseudo, "", argument ]; - return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? - markFunction(function( seed, matches ) { - var idx, - matched = fn( seed, argument ), - i = matched.length; - while ( i-- ) { - idx = indexOf.call( seed, matched[i] ); - seed[ idx ] = !( matches[ idx ] = matched[i] ); - } - }) : - function( elem ) { - return fn( elem, 0, args ); - }; - } - - return fn; - } - }, - - pseudos: { - // Potentially complex pseudos - "not": markFunction(function( selector ) { - // Trim the selector passed to compile - // to avoid treating leading and trailing - // spaces as combinators - var input = [], - results = [], - matcher = compile( selector.replace( rtrim, "$1" ) ); - - return matcher[ expando ] ? - markFunction(function( seed, matches, context, xml ) { - var elem, - unmatched = matcher( seed, null, xml, [] ), - i = seed.length; - - // Match elements unmatched by `matcher` - while ( i-- ) { - if ( (elem = unmatched[i]) ) { - seed[i] = !(matches[i] = elem); - } - } - }) : - function( elem, context, xml ) { - input[0] = elem; - matcher( input, null, xml, results ); - return !results.pop(); - }; - }), - - "has": markFunction(function( selector ) { - return function( elem ) { - return Sizzle( selector, elem ).length > 0; - }; - }), - - "contains": markFunction(function( text ) { - return function( elem ) { - return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; - }; - }), - - // "Whether an element is represented by a :lang() selector - // is based solely on the element's language value - // being equal to the identifier C, - // or beginning with the identifier C immediately followed by "-". - // The matching of C against the element's language value is performed case-insensitively. - // The identifier C does not have to be a valid language name." - // http://www.w3.org/TR/selectors/#lang-pseudo - "lang": markFunction( function( lang ) { - // lang value must be a valid identifider - if ( !ridentifier.test(lang || "") ) { - Sizzle.error( "unsupported lang: " + lang ); - } - lang = lang.replace( runescape, funescape ).toLowerCase(); - return function( elem ) { - var elemLang; - do { - if ( (elemLang = documentIsXML ? - elem.getAttribute("xml:lang") || elem.getAttribute("lang") : - elem.lang) ) { - - elemLang = elemLang.toLowerCase(); - return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; - } - } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); - return false; - }; - }), - - // Miscellaneous - "target": function( elem ) { - var hash = window.location && window.location.hash; - return hash && hash.slice( 1 ) === elem.id; - }, - - "root": function( elem ) { - return elem === docElem; - }, - - "focus": function( elem ) { - return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); - }, - - // Boolean properties - "enabled": function( elem ) { - return elem.disabled === false; - }, - - "disabled": function( elem ) { - return elem.disabled === true; - }, - - "checked": function( elem ) { - // In CSS3, :checked should return both checked and selected elements - // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked - var nodeName = elem.nodeName.toLowerCase(); - return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); - }, - - "selected": function( elem ) { - // Accessing this property makes selected-by-default - // options in Safari work properly - if ( elem.parentNode ) { - elem.parentNode.selectedIndex; - } - - return elem.selected === true; - }, - - // Contents - "empty": function( elem ) { - // http://www.w3.org/TR/selectors/#empty-pseudo - // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)), - // not comment, processing instructions, or others - // Thanks to Diego Perini for the nodeName shortcut - // Greater than "@" means alpha characters (specifically not starting with "#" or "?") - for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { - if ( elem.nodeName > "@" || elem.nodeType === 3 || elem.nodeType === 4 ) { - return false; - } - } - return true; - }, - - "parent": function( elem ) { - return !Expr.pseudos["empty"]( elem ); - }, - - // Element/input types - "header": function( elem ) { - return rheader.test( elem.nodeName ); - }, - - "input": function( elem ) { - return rinputs.test( elem.nodeName ); - }, - - "button": function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === "button" || name === "button"; - }, - - "text": function( elem ) { - var attr; - // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) - // use getAttribute instead to test this case - return elem.nodeName.toLowerCase() === "input" && - elem.type === "text" && - ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === elem.type ); - }, - - // Position-in-collection - "first": createPositionalPseudo(function() { - return [ 0 ]; - }), - - "last": createPositionalPseudo(function( matchIndexes, length ) { - return [ length - 1 ]; - }), - - "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { - return [ argument < 0 ? argument + length : argument ]; - }), - - "even": createPositionalPseudo(function( matchIndexes, length ) { - var i = 0; - for ( ; i < length; i += 2 ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "odd": createPositionalPseudo(function( matchIndexes, length ) { - var i = 1; - for ( ; i < length; i += 2 ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { - var i = argument < 0 ? argument + length : argument; - for ( ; --i >= 0; ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { - var i = argument < 0 ? argument + length : argument; - for ( ; ++i < length; ) { - matchIndexes.push( i ); - } - return matchIndexes; - }) - } -}; - -// Add button/input type pseudos -for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { - Expr.pseudos[ i ] = createInputPseudo( i ); -} -for ( i in { submit: true, reset: true } ) { - Expr.pseudos[ i ] = createButtonPseudo( i ); -} - -function tokenize( selector, parseOnly ) { - var matched, match, tokens, type, - soFar, groups, preFilters, - cached = tokenCache[ selector + " " ]; - - if ( cached ) { - return parseOnly ? 0 : cached.slice( 0 ); - } - - soFar = selector; - groups = []; - preFilters = Expr.preFilter; - - while ( soFar ) { - - // Comma and first run - if ( !matched || (match = rcomma.exec( soFar )) ) { - if ( match ) { - // Don't consume trailing commas as valid - soFar = soFar.slice( match[0].length ) || soFar; - } - groups.push( tokens = [] ); - } - - matched = false; - - // Combinators - if ( (match = rcombinators.exec( soFar )) ) { - matched = match.shift(); - tokens.push( { - value: matched, - // Cast descendant combinators to space - type: match[0].replace( rtrim, " " ) - } ); - soFar = soFar.slice( matched.length ); - } - - // Filters - for ( type in Expr.filter ) { - if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || - (match = preFilters[ type ]( match ))) ) { - matched = match.shift(); - tokens.push( { - value: matched, - type: type, - matches: match - } ); - soFar = soFar.slice( matched.length ); - } - } - - if ( !matched ) { - break; - } - } - - // Return the length of the invalid excess - // if we're just parsing - // Otherwise, throw an error or return tokens - return parseOnly ? - soFar.length : - soFar ? - Sizzle.error( selector ) : - // Cache the tokens - tokenCache( selector, groups ).slice( 0 ); -} - -function toSelector( tokens ) { - var i = 0, - len = tokens.length, - selector = ""; - for ( ; i < len; i++ ) { - selector += tokens[i].value; - } - return selector; -} - -function addCombinator( matcher, combinator, base ) { - var dir = combinator.dir, - checkNonElements = base && dir === "parentNode", - doneName = done++; - - return combinator.first ? - // Check against closest ancestor/preceding element - function( elem, context, xml ) { - while ( (elem = elem[ dir ]) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - return matcher( elem, context, xml ); - } - } - } : - - // Check against all ancestor/preceding elements - function( elem, context, xml ) { - var data, cache, outerCache, - dirkey = dirruns + " " + doneName; - - // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching - if ( xml ) { - while ( (elem = elem[ dir ]) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - if ( matcher( elem, context, xml ) ) { - return true; - } - } - } - } else { - while ( (elem = elem[ dir ]) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - outerCache = elem[ expando ] || (elem[ expando ] = {}); - if ( (cache = outerCache[ dir ]) && cache[0] === dirkey ) { - if ( (data = cache[1]) === true || data === cachedruns ) { - return data === true; - } - } else { - cache = outerCache[ dir ] = [ dirkey ]; - cache[1] = matcher( elem, context, xml ) || cachedruns; - if ( cache[1] === true ) { - return true; - } - } - } - } - } - }; -} - -function elementMatcher( matchers ) { - return matchers.length > 1 ? - function( elem, context, xml ) { - var i = matchers.length; - while ( i-- ) { - if ( !matchers[i]( elem, context, xml ) ) { - return false; - } - } - return true; - } : - matchers[0]; -} - -function condense( unmatched, map, filter, context, xml ) { - var elem, - newUnmatched = [], - i = 0, - len = unmatched.length, - mapped = map != null; - - for ( ; i < len; i++ ) { - if ( (elem = unmatched[i]) ) { - if ( !filter || filter( elem, context, xml ) ) { - newUnmatched.push( elem ); - if ( mapped ) { - map.push( i ); - } - } - } - } - - return newUnmatched; -} - -function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { - if ( postFilter && !postFilter[ expando ] ) { - postFilter = setMatcher( postFilter ); - } - if ( postFinder && !postFinder[ expando ] ) { - postFinder = setMatcher( postFinder, postSelector ); - } - return markFunction(function( seed, results, context, xml ) { - var temp, i, elem, - preMap = [], - postMap = [], - preexisting = results.length, - - // Get initial elements from seed or context - elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), - - // Prefilter to get matcher input, preserving a map for seed-results synchronization - matcherIn = preFilter && ( seed || !selector ) ? - condense( elems, preMap, preFilter, context, xml ) : - elems, - - matcherOut = matcher ? - // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, - postFinder || ( seed ? preFilter : preexisting || postFilter ) ? - - // ...intermediate processing is necessary - [] : - - // ...otherwise use results directly - results : - matcherIn; - - // Find primary matches - if ( matcher ) { - matcher( matcherIn, matcherOut, context, xml ); - } - - // Apply postFilter - if ( postFilter ) { - temp = condense( matcherOut, postMap ); - postFilter( temp, [], context, xml ); - - // Un-match failing elements by moving them back to matcherIn - i = temp.length; - while ( i-- ) { - if ( (elem = temp[i]) ) { - matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); - } - } - } - - if ( seed ) { - if ( postFinder || preFilter ) { - if ( postFinder ) { - // Get the final matcherOut by condensing this intermediate into postFinder contexts - temp = []; - i = matcherOut.length; - while ( i-- ) { - if ( (elem = matcherOut[i]) ) { - // Restore matcherIn since elem is not yet a final match - temp.push( (matcherIn[i] = elem) ); - } - } - postFinder( null, (matcherOut = []), temp, xml ); - } - - // Move matched elements from seed to results to keep them synchronized - i = matcherOut.length; - while ( i-- ) { - if ( (elem = matcherOut[i]) && - (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) { - - seed[temp] = !(results[temp] = elem); - } - } - } - - // Add elements to results, through postFinder if defined - } else { - matcherOut = condense( - matcherOut === results ? - matcherOut.splice( preexisting, matcherOut.length ) : - matcherOut - ); - if ( postFinder ) { - postFinder( null, results, matcherOut, xml ); - } else { - push.apply( results, matcherOut ); - } - } - }); -} - -function matcherFromTokens( tokens ) { - var checkContext, matcher, j, - len = tokens.length, - leadingRelative = Expr.relative[ tokens[0].type ], - implicitRelative = leadingRelative || Expr.relative[" "], - i = leadingRelative ? 1 : 0, - - // The foundational matcher ensures that elements are reachable from top-level context(s) - matchContext = addCombinator( function( elem ) { - return elem === checkContext; - }, implicitRelative, true ), - matchAnyContext = addCombinator( function( elem ) { - return indexOf.call( checkContext, elem ) > -1; - }, implicitRelative, true ), - matchers = [ function( elem, context, xml ) { - return ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( - (checkContext = context).nodeType ? - matchContext( elem, context, xml ) : - matchAnyContext( elem, context, xml ) ); - } ]; - - for ( ; i < len; i++ ) { - if ( (matcher = Expr.relative[ tokens[i].type ]) ) { - matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; - } else { - matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); - - // Return special upon seeing a positional matcher - if ( matcher[ expando ] ) { - // Find the next relative operator (if any) for proper handling - j = ++i; - for ( ; j < len; j++ ) { - if ( Expr.relative[ tokens[j].type ] ) { - break; - } - } - return setMatcher( - i > 1 && elementMatcher( matchers ), - i > 1 && toSelector( tokens.slice( 0, i - 1 ) ).replace( rtrim, "$1" ), - matcher, - i < j && matcherFromTokens( tokens.slice( i, j ) ), - j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), - j < len && toSelector( tokens ) - ); - } - matchers.push( matcher ); - } - } - - return elementMatcher( matchers ); -} - -function matcherFromGroupMatchers( elementMatchers, setMatchers ) { - // A counter to specify which element is currently being matched - var matcherCachedRuns = 0, - bySet = setMatchers.length > 0, - byElement = elementMatchers.length > 0, - superMatcher = function( seed, context, xml, results, expandContext ) { - var elem, j, matcher, - setMatched = [], - matchedCount = 0, - i = "0", - unmatched = seed && [], - outermost = expandContext != null, - contextBackup = outermostContext, - // We must always have either seed elements or context - elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ), - // Use integer dirruns iff this is the outermost matcher - dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1); - - if ( outermost ) { - outermostContext = context !== document && context; - cachedruns = matcherCachedRuns; - } - - // Add elements passing elementMatchers directly to results - // Keep `i` a string if there are no elements so `matchedCount` will be "00" below - for ( ; (elem = elems[i]) != null; i++ ) { - if ( byElement && elem ) { - j = 0; - while ( (matcher = elementMatchers[j++]) ) { - if ( matcher( elem, context, xml ) ) { - results.push( elem ); - break; - } - } - if ( outermost ) { - dirruns = dirrunsUnique; - cachedruns = ++matcherCachedRuns; - } - } - - // Track unmatched elements for set filters - if ( bySet ) { - // They will have gone through all possible matchers - if ( (elem = !matcher && elem) ) { - matchedCount--; - } - - // Lengthen the array for every element, matched or not - if ( seed ) { - unmatched.push( elem ); - } - } - } - - // Apply set filters to unmatched elements - matchedCount += i; - if ( bySet && i !== matchedCount ) { - j = 0; - while ( (matcher = setMatchers[j++]) ) { - matcher( unmatched, setMatched, context, xml ); - } - - if ( seed ) { - // Reintegrate element matches to eliminate the need for sorting - if ( matchedCount > 0 ) { - while ( i-- ) { - if ( !(unmatched[i] || setMatched[i]) ) { - setMatched[i] = pop.call( results ); - } - } - } - - // Discard index placeholder values to get only actual matches - setMatched = condense( setMatched ); - } - - // Add matches to results - push.apply( results, setMatched ); - - // Seedless set matches succeeding multiple successful matchers stipulate sorting - if ( outermost && !seed && setMatched.length > 0 && - ( matchedCount + setMatchers.length ) > 1 ) { - - Sizzle.uniqueSort( results ); - } - } - - // Override manipulation of globals by nested matchers - if ( outermost ) { - dirruns = dirrunsUnique; - outermostContext = contextBackup; - } - - return unmatched; - }; - - return bySet ? - markFunction( superMatcher ) : - superMatcher; -} - -compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) { - var i, - setMatchers = [], - elementMatchers = [], - cached = compilerCache[ selector + " " ]; - - if ( !cached ) { - // Generate a function of recursive functions that can be used to check each element - if ( !group ) { - group = tokenize( selector ); - } - i = group.length; - while ( i-- ) { - cached = matcherFromTokens( group[i] ); - if ( cached[ expando ] ) { - setMatchers.push( cached ); - } else { - elementMatchers.push( cached ); - } - } - - // Cache the compiled function - cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); - } - return cached; -}; - -function multipleContexts( selector, contexts, results ) { - var i = 0, - len = contexts.length; - for ( ; i < len; i++ ) { - Sizzle( selector, contexts[i], results ); - } - return results; -} - -function select( selector, context, results, seed ) { - var i, tokens, token, type, find, - match = tokenize( selector ); - - if ( !seed ) { - // Try to minimize operations if there is only one group - if ( match.length === 1 ) { - - // Take a shortcut and set the context if the root selector is an ID - tokens = match[0] = match[0].slice( 0 ); - if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && - context.nodeType === 9 && !documentIsXML && - Expr.relative[ tokens[1].type ] ) { - - context = Expr.find["ID"]( token.matches[0].replace( runescape, funescape ), context )[0]; - if ( !context ) { - return results; - } - - selector = selector.slice( tokens.shift().value.length ); - } - - // Fetch a seed set for right-to-left matching - i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; - while ( i-- ) { - token = tokens[i]; - - // Abort if we hit a combinator - if ( Expr.relative[ (type = token.type) ] ) { - break; - } - if ( (find = Expr.find[ type ]) ) { - // Search, expanding context for leading sibling combinators - if ( (seed = find( - token.matches[0].replace( runescape, funescape ), - rsibling.test( tokens[0].type ) && context.parentNode || context - )) ) { - - // If seed is empty or no tokens remain, we can return early - tokens.splice( i, 1 ); - selector = seed.length && toSelector( tokens ); - if ( !selector ) { - push.apply( results, slice.call( seed, 0 ) ); - return results; - } - - break; - } - } - } - } - } - - // Compile and execute a filtering function - // Provide `match` to avoid retokenization if we modified the selector above - compile( selector, match )( - seed, - context, - documentIsXML, - results, - rsibling.test( selector ) - ); - return results; -} - -// Deprecated -Expr.pseudos["nth"] = Expr.pseudos["eq"]; - -// Easy API for creating new setFilters -function setFilters() {} -Expr.filters = setFilters.prototype = Expr.pseudos; -Expr.setFilters = new setFilters(); - -// Initialize with the default document -setDocument(); - -// Override sizzle attribute retrieval -Sizzle.attr = jQuery.attr; -jQuery.find = Sizzle; -jQuery.expr = Sizzle.selectors; -jQuery.expr[":"] = jQuery.expr.pseudos; -jQuery.unique = Sizzle.uniqueSort; -jQuery.text = Sizzle.getText; -jQuery.isXMLDoc = Sizzle.isXML; -jQuery.contains = Sizzle.contains; - - -})( window ); -var runtil = /Until$/, - rparentsprev = /^(?:parents|prev(?:Until|All))/, - isSimple = /^.[^:#\[\.,]*$/, - rneedsContext = jQuery.expr.match.needsContext, - // methods guaranteed to produce a unique set when starting from a unique set - guaranteedUnique = { - children: true, - contents: true, - next: true, - prev: true - }; - -jQuery.fn.extend({ - find: function( selector ) { - var i, ret, self, - len = this.length; - - if ( typeof selector !== "string" ) { - self = this; - return this.pushStack( jQuery( selector ).filter(function() { - for ( i = 0; i < len; i++ ) { - if ( jQuery.contains( self[ i ], this ) ) { - return true; - } - } - }) ); - } - - ret = []; - for ( i = 0; i < len; i++ ) { - jQuery.find( selector, this[ i ], ret ); - } - - // Needed because $( selector, context ) becomes $( context ).find( selector ) - ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret ); - ret.selector = ( this.selector ? this.selector + " " : "" ) + selector; - return ret; - }, - - has: function( target ) { - var i, - targets = jQuery( target, this ), - len = targets.length; - - return this.filter(function() { - for ( i = 0; i < len; i++ ) { - if ( jQuery.contains( this, targets[i] ) ) { - return true; - } - } - }); - }, - - not: function( selector ) { - return this.pushStack( winnow(this, selector, false) ); - }, - - filter: function( selector ) { - return this.pushStack( winnow(this, selector, true) ); - }, - - is: function( selector ) { - return !!selector && ( - typeof selector === "string" ? - // If this is a positional/relative selector, check membership in the returned set - // so $("p:first").is("p:last") won't return true for a doc with two "p". - rneedsContext.test( selector ) ? - jQuery( selector, this.context ).index( this[0] ) >= 0 : - jQuery.filter( selector, this ).length > 0 : - this.filter( selector ).length > 0 ); - }, - - closest: function( selectors, context ) { - var cur, - i = 0, - l = this.length, - ret = [], - pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? - jQuery( selectors, context || this.context ) : - 0; - - for ( ; i < l; i++ ) { - cur = this[i]; - - while ( cur && cur.ownerDocument && cur !== context && cur.nodeType !== 11 ) { - if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { - ret.push( cur ); - break; - } - cur = cur.parentNode; - } - } - - return this.pushStack( ret.length > 1 ? jQuery.unique( ret ) : ret ); - }, - - // Determine the position of an element within - // the matched set of elements - index: function( elem ) { - - // No argument, return index in parent - if ( !elem ) { - return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1; - } - - // index in selector - if ( typeof elem === "string" ) { - return jQuery.inArray( this[0], jQuery( elem ) ); - } - - // Locate the position of the desired element - return jQuery.inArray( - // If it receives a jQuery object, the first element is used - elem.jquery ? elem[0] : elem, this ); - }, - - add: function( selector, context ) { - var set = typeof selector === "string" ? - jQuery( selector, context ) : - jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), - all = jQuery.merge( this.get(), set ); - - return this.pushStack( jQuery.unique(all) ); - }, - - addBack: function( selector ) { - return this.add( selector == null ? - this.prevObject : this.prevObject.filter(selector) - ); - } -}); - -jQuery.fn.andSelf = jQuery.fn.addBack; - -function sibling( cur, dir ) { - do { - cur = cur[ dir ]; - } while ( cur && cur.nodeType !== 1 ); - - return cur; -} - -jQuery.each({ - parent: function( elem ) { - var parent = elem.parentNode; - return parent && parent.nodeType !== 11 ? parent : null; - }, - parents: function( elem ) { - return jQuery.dir( elem, "parentNode" ); - }, - parentsUntil: function( elem, i, until ) { - return jQuery.dir( elem, "parentNode", until ); - }, - next: function( elem ) { - return sibling( elem, "nextSibling" ); - }, - prev: function( elem ) { - return sibling( elem, "previousSibling" ); - }, - nextAll: function( elem ) { - return jQuery.dir( elem, "nextSibling" ); - }, - prevAll: function( elem ) { - return jQuery.dir( elem, "previousSibling" ); - }, - nextUntil: function( elem, i, until ) { - return jQuery.dir( elem, "nextSibling", until ); - }, - prevUntil: function( elem, i, until ) { - return jQuery.dir( elem, "previousSibling", until ); - }, - siblings: function( elem ) { - return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); - }, - children: function( elem ) { - return jQuery.sibling( elem.firstChild ); - }, - contents: function( elem ) { - return jQuery.nodeName( elem, "iframe" ) ? - elem.contentDocument || elem.contentWindow.document : - jQuery.merge( [], elem.childNodes ); - } -}, function( name, fn ) { - jQuery.fn[ name ] = function( until, selector ) { - var ret = jQuery.map( this, fn, until ); - - if ( !runtil.test( name ) ) { - selector = until; - } - - if ( selector && typeof selector === "string" ) { - ret = jQuery.filter( selector, ret ); - } - - ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret; - - if ( this.length > 1 && rparentsprev.test( name ) ) { - ret = ret.reverse(); - } - - return this.pushStack( ret ); - }; -}); - -jQuery.extend({ - filter: function( expr, elems, not ) { - if ( not ) { - expr = ":not(" + expr + ")"; - } - - return elems.length === 1 ? - jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : - jQuery.find.matches(expr, elems); - }, - - dir: function( elem, dir, until ) { - var matched = [], - cur = elem[ dir ]; - - while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { - if ( cur.nodeType === 1 ) { - matched.push( cur ); - } - cur = cur[dir]; - } - return matched; - }, - - sibling: function( n, elem ) { - var r = []; - - for ( ; n; n = n.nextSibling ) { - if ( n.nodeType === 1 && n !== elem ) { - r.push( n ); - } - } - - return r; - } -}); - -// Implement the identical functionality for filter and not -function winnow( elements, qualifier, keep ) { - - // Can't pass null or undefined to indexOf in Firefox 4 - // Set to 0 to skip string check - qualifier = qualifier || 0; - - if ( jQuery.isFunction( qualifier ) ) { - return jQuery.grep(elements, function( elem, i ) { - var retVal = !!qualifier.call( elem, i, elem ); - return retVal === keep; - }); - - } else if ( qualifier.nodeType ) { - return jQuery.grep(elements, function( elem ) { - return ( elem === qualifier ) === keep; - }); - - } else if ( typeof qualifier === "string" ) { - var filtered = jQuery.grep(elements, function( elem ) { - return elem.nodeType === 1; - }); - - if ( isSimple.test( qualifier ) ) { - return jQuery.filter(qualifier, filtered, !keep); - } else { - qualifier = jQuery.filter( qualifier, filtered ); - } - } - - return jQuery.grep(elements, function( elem ) { - return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep; - }); -} -function createSafeFragment( document ) { - var list = nodeNames.split( "|" ), - safeFrag = document.createDocumentFragment(); - - if ( safeFrag.createElement ) { - while ( list.length ) { - safeFrag.createElement( - list.pop() - ); - } - } - return safeFrag; -} - -var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + - "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", - rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, - rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"), - rleadingWhitespace = /^\s+/, - rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, - rtagName = /<([\w:]+)/, - rtbody = /\s*$/g, - - // We have to close these tags to support XHTML (#13200) - wrapMap = { - option: [ 1, "" ], - legend: [ 1, "
            ", "
            " ], - area: [ 1, "", "" ], - param: [ 1, "", "" ], - thead: [ 1, "", "
            " ], - tr: [ 2, "", "
            " ], - col: [ 2, "", "
            " ], - td: [ 3, "", "
            " ], - - // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags, - // unless wrapped in a div with non-breaking characters in front of it. - _default: jQuery.support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X
            ", "
            " ] - }, - safeFragment = createSafeFragment( document ), - fragmentDiv = safeFragment.appendChild( document.createElement("div") ); - -wrapMap.optgroup = wrapMap.option; -wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; -wrapMap.th = wrapMap.td; - -jQuery.fn.extend({ - text: function( value ) { - return jQuery.access( this, function( value ) { - return value === undefined ? - jQuery.text( this ) : - this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) ); - }, null, value, arguments.length ); - }, - - wrapAll: function( html ) { - if ( jQuery.isFunction( html ) ) { - return this.each(function(i) { - jQuery(this).wrapAll( html.call(this, i) ); - }); - } - - if ( this[0] ) { - // The elements to wrap the target around - var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true); - - if ( this[0].parentNode ) { - wrap.insertBefore( this[0] ); - } - - wrap.map(function() { - var elem = this; - - while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { - elem = elem.firstChild; - } - - return elem; - }).append( this ); - } - - return this; - }, - - wrapInner: function( html ) { - if ( jQuery.isFunction( html ) ) { - return this.each(function(i) { - jQuery(this).wrapInner( html.call(this, i) ); - }); - } - - return this.each(function() { - var self = jQuery( this ), - contents = self.contents(); - - if ( contents.length ) { - contents.wrapAll( html ); - - } else { - self.append( html ); - } - }); - }, - - wrap: function( html ) { - var isFunction = jQuery.isFunction( html ); - - return this.each(function(i) { - jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html ); - }); - }, - - unwrap: function() { - return this.parent().each(function() { - if ( !jQuery.nodeName( this, "body" ) ) { - jQuery( this ).replaceWith( this.childNodes ); - } - }).end(); - }, - - append: function() { - return this.domManip(arguments, true, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - this.appendChild( elem ); - } - }); - }, - - prepend: function() { - return this.domManip(arguments, true, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - this.insertBefore( elem, this.firstChild ); - } - }); - }, - - before: function() { - return this.domManip( arguments, false, function( elem ) { - if ( this.parentNode ) { - this.parentNode.insertBefore( elem, this ); - } - }); - }, - - after: function() { - return this.domManip( arguments, false, function( elem ) { - if ( this.parentNode ) { - this.parentNode.insertBefore( elem, this.nextSibling ); - } - }); - }, - - // keepData is for internal use only--do not document - remove: function( selector, keepData ) { - var elem, - i = 0; - - for ( ; (elem = this[i]) != null; i++ ) { - if ( !selector || jQuery.filter( selector, [ elem ] ).length > 0 ) { - if ( !keepData && elem.nodeType === 1 ) { - jQuery.cleanData( getAll( elem ) ); - } - - if ( elem.parentNode ) { - if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) { - setGlobalEval( getAll( elem, "script" ) ); - } - elem.parentNode.removeChild( elem ); - } - } - } - - return this; - }, - - empty: function() { - var elem, - i = 0; - - for ( ; (elem = this[i]) != null; i++ ) { - // Remove element nodes and prevent memory leaks - if ( elem.nodeType === 1 ) { - jQuery.cleanData( getAll( elem, false ) ); - } - - // Remove any remaining nodes - while ( elem.firstChild ) { - elem.removeChild( elem.firstChild ); - } - - // If this is a select, ensure that it displays empty (#12336) - // Support: IE<9 - if ( elem.options && jQuery.nodeName( elem, "select" ) ) { - elem.options.length = 0; - } - } - - return this; - }, - - clone: function( dataAndEvents, deepDataAndEvents ) { - dataAndEvents = dataAndEvents == null ? false : dataAndEvents; - deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; - - return this.map( function () { - return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); - }); - }, - - html: function( value ) { - return jQuery.access( this, function( value ) { - var elem = this[0] || {}, - i = 0, - l = this.length; - - if ( value === undefined ) { - return elem.nodeType === 1 ? - elem.innerHTML.replace( rinlinejQuery, "" ) : - undefined; - } - - // See if we can take a shortcut and just use innerHTML - if ( typeof value === "string" && !rnoInnerhtml.test( value ) && - ( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) && - ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) && - !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) { - - value = value.replace( rxhtmlTag, "<$1>" ); - - try { - for (; i < l; i++ ) { - // Remove element nodes and prevent memory leaks - elem = this[i] || {}; - if ( elem.nodeType === 1 ) { - jQuery.cleanData( getAll( elem, false ) ); - elem.innerHTML = value; - } - } - - elem = 0; - - // If using innerHTML throws an exception, use the fallback method - } catch(e) {} - } - - if ( elem ) { - this.empty().append( value ); - } - }, null, value, arguments.length ); - }, - - replaceWith: function( value ) { - var isFunc = jQuery.isFunction( value ); - - // Make sure that the elements are removed from the DOM before they are inserted - // this can help fix replacing a parent with child elements - if ( !isFunc && typeof value !== "string" ) { - value = jQuery( value ).not( this ).detach(); - } - - return this.domManip( [ value ], true, function( elem ) { - var next = this.nextSibling, - parent = this.parentNode; - - if ( parent ) { - jQuery( this ).remove(); - parent.insertBefore( elem, next ); - } - }); - }, - - detach: function( selector ) { - return this.remove( selector, true ); - }, - - domManip: function( args, table, callback ) { - - // Flatten any nested arrays - args = core_concat.apply( [], args ); - - var first, node, hasScripts, - scripts, doc, fragment, - i = 0, - l = this.length, - set = this, - iNoClone = l - 1, - value = args[0], - isFunction = jQuery.isFunction( value ); - - // We can't cloneNode fragments that contain checked, in WebKit - if ( isFunction || !( l <= 1 || typeof value !== "string" || jQuery.support.checkClone || !rchecked.test( value ) ) ) { - return this.each(function( index ) { - var self = set.eq( index ); - if ( isFunction ) { - args[0] = value.call( this, index, table ? self.html() : undefined ); - } - self.domManip( args, table, callback ); - }); - } - - if ( l ) { - fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this ); - first = fragment.firstChild; - - if ( fragment.childNodes.length === 1 ) { - fragment = first; - } - - if ( first ) { - table = table && jQuery.nodeName( first, "tr" ); - scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); - hasScripts = scripts.length; - - // Use the original fragment for the last item instead of the first because it can end up - // being emptied incorrectly in certain situations (#8070). - for ( ; i < l; i++ ) { - node = fragment; - - if ( i !== iNoClone ) { - node = jQuery.clone( node, true, true ); - - // Keep references to cloned scripts for later restoration - if ( hasScripts ) { - jQuery.merge( scripts, getAll( node, "script" ) ); - } - } - - callback.call( - table && jQuery.nodeName( this[i], "table" ) ? - findOrAppend( this[i], "tbody" ) : - this[i], - node, - i - ); - } - - if ( hasScripts ) { - doc = scripts[ scripts.length - 1 ].ownerDocument; - - // Reenable scripts - jQuery.map( scripts, restoreScript ); - - // Evaluate executable scripts on first document insertion - for ( i = 0; i < hasScripts; i++ ) { - node = scripts[ i ]; - if ( rscriptType.test( node.type || "" ) && - !jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) { - - if ( node.src ) { - // Hope ajax is available... - jQuery.ajax({ - url: node.src, - type: "GET", - dataType: "script", - async: false, - global: false, - "throws": true - }); - } else { - jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) ); - } - } - } - } - - // Fix #11809: Avoid leaking memory - fragment = first = null; - } - } - - return this; - } -}); - -function findOrAppend( elem, tag ) { - return elem.getElementsByTagName( tag )[0] || elem.appendChild( elem.ownerDocument.createElement( tag ) ); -} - -// Replace/restore the type attribute of script elements for safe DOM manipulation -function disableScript( elem ) { - var attr = elem.getAttributeNode("type"); - elem.type = ( attr && attr.specified ) + "/" + elem.type; - return elem; -} -function restoreScript( elem ) { - var match = rscriptTypeMasked.exec( elem.type ); - if ( match ) { - elem.type = match[1]; - } else { - elem.removeAttribute("type"); - } - return elem; -} - -// Mark scripts as having already been evaluated -function setGlobalEval( elems, refElements ) { - var elem, - i = 0; - for ( ; (elem = elems[i]) != null; i++ ) { - jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) ); - } -} - -function cloneCopyEvent( src, dest ) { - - if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { - return; - } - - var type, i, l, - oldData = jQuery._data( src ), - curData = jQuery._data( dest, oldData ), - events = oldData.events; - - if ( events ) { - delete curData.handle; - curData.events = {}; - - for ( type in events ) { - for ( i = 0, l = events[ type ].length; i < l; i++ ) { - jQuery.event.add( dest, type, events[ type ][ i ] ); - } - } - } - - // make the cloned public data object a copy from the original - if ( curData.data ) { - curData.data = jQuery.extend( {}, curData.data ); - } -} - -function fixCloneNodeIssues( src, dest ) { - var nodeName, e, data; - - // We do not need to do anything for non-Elements - if ( dest.nodeType !== 1 ) { - return; - } - - nodeName = dest.nodeName.toLowerCase(); - - // IE6-8 copies events bound via attachEvent when using cloneNode. - if ( !jQuery.support.noCloneEvent && dest[ jQuery.expando ] ) { - data = jQuery._data( dest ); - - for ( e in data.events ) { - jQuery.removeEvent( dest, e, data.handle ); - } - - // Event data gets referenced instead of copied if the expando gets copied too - dest.removeAttribute( jQuery.expando ); - } - - // IE blanks contents when cloning scripts, and tries to evaluate newly-set text - if ( nodeName === "script" && dest.text !== src.text ) { - disableScript( dest ).text = src.text; - restoreScript( dest ); - - // IE6-10 improperly clones children of object elements using classid. - // IE10 throws NoModificationAllowedError if parent is null, #12132. - } else if ( nodeName === "object" ) { - if ( dest.parentNode ) { - dest.outerHTML = src.outerHTML; - } - - // This path appears unavoidable for IE9. When cloning an object - // element in IE9, the outerHTML strategy above is not sufficient. - // If the src has innerHTML and the destination does not, - // copy the src.innerHTML into the dest.innerHTML. #10324 - if ( jQuery.support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) { - dest.innerHTML = src.innerHTML; - } - - } else if ( nodeName === "input" && manipulation_rcheckableType.test( src.type ) ) { - // IE6-8 fails to persist the checked state of a cloned checkbox - // or radio button. Worse, IE6-7 fail to give the cloned element - // a checked appearance if the defaultChecked value isn't also set - - dest.defaultChecked = dest.checked = src.checked; - - // IE6-7 get confused and end up setting the value of a cloned - // checkbox/radio button to an empty string instead of "on" - if ( dest.value !== src.value ) { - dest.value = src.value; - } - - // IE6-8 fails to return the selected option to the default selected - // state when cloning options - } else if ( nodeName === "option" ) { - dest.defaultSelected = dest.selected = src.defaultSelected; - - // IE6-8 fails to set the defaultValue to the correct value when - // cloning other types of input fields - } else if ( nodeName === "input" || nodeName === "textarea" ) { - dest.defaultValue = src.defaultValue; - } -} - -jQuery.each({ - appendTo: "append", - prependTo: "prepend", - insertBefore: "before", - insertAfter: "after", - replaceAll: "replaceWith" -}, function( name, original ) { - jQuery.fn[ name ] = function( selector ) { - var elems, - i = 0, - ret = [], - insert = jQuery( selector ), - last = insert.length - 1; - - for ( ; i <= last; i++ ) { - elems = i === last ? this : this.clone(true); - jQuery( insert[i] )[ original ]( elems ); - - // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get() - core_push.apply( ret, elems.get() ); - } - - return this.pushStack( ret ); - }; -}); - -function getAll( context, tag ) { - var elems, elem, - i = 0, - found = typeof context.getElementsByTagName !== core_strundefined ? context.getElementsByTagName( tag || "*" ) : - typeof context.querySelectorAll !== core_strundefined ? context.querySelectorAll( tag || "*" ) : - undefined; - - if ( !found ) { - for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) { - if ( !tag || jQuery.nodeName( elem, tag ) ) { - found.push( elem ); - } else { - jQuery.merge( found, getAll( elem, tag ) ); - } - } - } - - return tag === undefined || tag && jQuery.nodeName( context, tag ) ? - jQuery.merge( [ context ], found ) : - found; -} - -// Used in buildFragment, fixes the defaultChecked property -function fixDefaultChecked( elem ) { - if ( manipulation_rcheckableType.test( elem.type ) ) { - elem.defaultChecked = elem.checked; - } -} - -jQuery.extend({ - clone: function( elem, dataAndEvents, deepDataAndEvents ) { - var destElements, node, clone, i, srcElements, - inPage = jQuery.contains( elem.ownerDocument, elem ); - - if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) { - clone = elem.cloneNode( true ); - - // IE<=8 does not properly clone detached, unknown element nodes - } else { - fragmentDiv.innerHTML = elem.outerHTML; - fragmentDiv.removeChild( clone = fragmentDiv.firstChild ); - } - - if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) && - (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { - - // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 - destElements = getAll( clone ); - srcElements = getAll( elem ); - - // Fix all IE cloning issues - for ( i = 0; (node = srcElements[i]) != null; ++i ) { - // Ensure that the destination node is not null; Fixes #9587 - if ( destElements[i] ) { - fixCloneNodeIssues( node, destElements[i] ); - } - } - } - - // Copy the events from the original to the clone - if ( dataAndEvents ) { - if ( deepDataAndEvents ) { - srcElements = srcElements || getAll( elem ); - destElements = destElements || getAll( clone ); - - for ( i = 0; (node = srcElements[i]) != null; i++ ) { - cloneCopyEvent( node, destElements[i] ); - } - } else { - cloneCopyEvent( elem, clone ); - } - } - - // Preserve script evaluation history - destElements = getAll( clone, "script" ); - if ( destElements.length > 0 ) { - setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); - } - - destElements = srcElements = node = null; - - // Return the cloned set - return clone; - }, - - buildFragment: function( elems, context, scripts, selection ) { - var j, elem, contains, - tmp, tag, tbody, wrap, - l = elems.length, - - // Ensure a safe fragment - safe = createSafeFragment( context ), - - nodes = [], - i = 0; - - for ( ; i < l; i++ ) { - elem = elems[ i ]; - - if ( elem || elem === 0 ) { - - // Add nodes directly - if ( jQuery.type( elem ) === "object" ) { - jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); - - // Convert non-html into a text node - } else if ( !rhtml.test( elem ) ) { - nodes.push( context.createTextNode( elem ) ); - - // Convert html into DOM nodes - } else { - tmp = tmp || safe.appendChild( context.createElement("div") ); - - // Deserialize a standard representation - tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(); - wrap = wrapMap[ tag ] || wrapMap._default; - - tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1>" ) + wrap[2]; - - // Descend through wrappers to the right content - j = wrap[0]; - while ( j-- ) { - tmp = tmp.lastChild; - } - - // Manually add leading whitespace removed by IE - if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { - nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) ); - } - - // Remove IE's autoinserted from table fragments - if ( !jQuery.support.tbody ) { - - // String was a , *may* have spurious - elem = tag === "table" && !rtbody.test( elem ) ? - tmp.firstChild : - - // String was a bare or - wrap[1] === "
            " && !rtbody.test( elem ) ? - tmp : - 0; - - j = elem && elem.childNodes.length; - while ( j-- ) { - if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) { - elem.removeChild( tbody ); - } - } - } - - jQuery.merge( nodes, tmp.childNodes ); - - // Fix #12392 for WebKit and IE > 9 - tmp.textContent = ""; - - // Fix #12392 for oldIE - while ( tmp.firstChild ) { - tmp.removeChild( tmp.firstChild ); - } - - // Remember the top-level container for proper cleanup - tmp = safe.lastChild; - } - } - } - - // Fix #11356: Clear elements from fragment - if ( tmp ) { - safe.removeChild( tmp ); - } - - // Reset defaultChecked for any radios and checkboxes - // about to be appended to the DOM in IE 6/7 (#8060) - if ( !jQuery.support.appendChecked ) { - jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked ); - } - - i = 0; - while ( (elem = nodes[ i++ ]) ) { - - // #4087 - If origin and destination elements are the same, and this is - // that element, do not do anything - if ( selection && jQuery.inArray( elem, selection ) !== -1 ) { - continue; - } - - contains = jQuery.contains( elem.ownerDocument, elem ); - - // Append to fragment - tmp = getAll( safe.appendChild( elem ), "script" ); - - // Preserve script evaluation history - if ( contains ) { - setGlobalEval( tmp ); - } - - // Capture executables - if ( scripts ) { - j = 0; - while ( (elem = tmp[ j++ ]) ) { - if ( rscriptType.test( elem.type || "" ) ) { - scripts.push( elem ); - } - } - } - } - - tmp = null; - - return safe; - }, - - cleanData: function( elems, /* internal */ acceptData ) { - var elem, type, id, data, - i = 0, - internalKey = jQuery.expando, - cache = jQuery.cache, - deleteExpando = jQuery.support.deleteExpando, - special = jQuery.event.special; - - for ( ; (elem = elems[i]) != null; i++ ) { - - if ( acceptData || jQuery.acceptData( elem ) ) { - - id = elem[ internalKey ]; - data = id && cache[ id ]; - - if ( data ) { - if ( data.events ) { - for ( type in data.events ) { - if ( special[ type ] ) { - jQuery.event.remove( elem, type ); - - // This is a shortcut to avoid jQuery.event.remove's overhead - } else { - jQuery.removeEvent( elem, type, data.handle ); - } - } - } - - // Remove cache only if it was not already removed by jQuery.event.remove - if ( cache[ id ] ) { - - delete cache[ id ]; - - // IE does not allow us to delete expando properties from nodes, - // nor does it have a removeAttribute function on Document nodes; - // we must handle all of these cases - if ( deleteExpando ) { - delete elem[ internalKey ]; - - } else if ( typeof elem.removeAttribute !== core_strundefined ) { - elem.removeAttribute( internalKey ); - - } else { - elem[ internalKey ] = null; - } - - core_deletedIds.push( id ); - } - } - } - } - } -}); -var iframe, getStyles, curCSS, - ralpha = /alpha\([^)]*\)/i, - ropacity = /opacity\s*=\s*([^)]*)/, - rposition = /^(top|right|bottom|left)$/, - // swappable if display is none or starts with table except "table", "table-cell", or "table-caption" - // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display - rdisplayswap = /^(none|table(?!-c[ea]).+)/, - rmargin = /^margin/, - rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ), - rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ), - rrelNum = new RegExp( "^([+-])=(" + core_pnum + ")", "i" ), - elemdisplay = { BODY: "block" }, - - cssShow = { position: "absolute", visibility: "hidden", display: "block" }, - cssNormalTransform = { - letterSpacing: 0, - fontWeight: 400 - }, - - cssExpand = [ "Top", "Right", "Bottom", "Left" ], - cssPrefixes = [ "Webkit", "O", "Moz", "ms" ]; - -// return a css property mapped to a potentially vendor prefixed property -function vendorPropName( style, name ) { - - // shortcut for names that are not vendor prefixed - if ( name in style ) { - return name; - } - - // check for vendor prefixed names - var capName = name.charAt(0).toUpperCase() + name.slice(1), - origName = name, - i = cssPrefixes.length; - - while ( i-- ) { - name = cssPrefixes[ i ] + capName; - if ( name in style ) { - return name; - } - } - - return origName; -} - -function isHidden( elem, el ) { - // isHidden might be called from jQuery#filter function; - // in that case, element will be second argument - elem = el || elem; - return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); -} - -function showHide( elements, show ) { - var display, elem, hidden, - values = [], - index = 0, - length = elements.length; - - for ( ; index < length; index++ ) { - elem = elements[ index ]; - if ( !elem.style ) { - continue; - } - - values[ index ] = jQuery._data( elem, "olddisplay" ); - display = elem.style.display; - if ( show ) { - // Reset the inline display of this element to learn if it is - // being hidden by cascaded rules or not - if ( !values[ index ] && display === "none" ) { - elem.style.display = ""; - } - - // Set elements which have been overridden with display: none - // in a stylesheet to whatever the default browser style is - // for such an element - if ( elem.style.display === "" && isHidden( elem ) ) { - values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) ); - } - } else { - - if ( !values[ index ] ) { - hidden = isHidden( elem ); - - if ( display && display !== "none" || !hidden ) { - jQuery._data( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) ); - } - } - } - } - - // Set the display of most of the elements in a second loop - // to avoid the constant reflow - for ( index = 0; index < length; index++ ) { - elem = elements[ index ]; - if ( !elem.style ) { - continue; - } - if ( !show || elem.style.display === "none" || elem.style.display === "" ) { - elem.style.display = show ? values[ index ] || "" : "none"; - } - } - - return elements; -} - -jQuery.fn.extend({ - css: function( name, value ) { - return jQuery.access( this, function( elem, name, value ) { - var len, styles, - map = {}, - i = 0; - - if ( jQuery.isArray( name ) ) { - styles = getStyles( elem ); - len = name.length; - - for ( ; i < len; i++ ) { - map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); - } - - return map; - } - - return value !== undefined ? - jQuery.style( elem, name, value ) : - jQuery.css( elem, name ); - }, name, value, arguments.length > 1 ); - }, - show: function() { - return showHide( this, true ); - }, - hide: function() { - return showHide( this ); - }, - toggle: function( state ) { - var bool = typeof state === "boolean"; - - return this.each(function() { - if ( bool ? state : isHidden( this ) ) { - jQuery( this ).show(); - } else { - jQuery( this ).hide(); - } - }); - } -}); - -jQuery.extend({ - // Add in style property hooks for overriding the default - // behavior of getting and setting a style property - cssHooks: { - opacity: { - get: function( elem, computed ) { - if ( computed ) { - // We should always get a number back from opacity - var ret = curCSS( elem, "opacity" ); - return ret === "" ? "1" : ret; - } - } - } - }, - - // Exclude the following css properties to add px - cssNumber: { - "columnCount": true, - "fillOpacity": true, - "fontWeight": true, - "lineHeight": true, - "opacity": true, - "orphans": true, - "widows": true, - "zIndex": true, - "zoom": true - }, - - // Add in properties whose names you wish to fix before - // setting or getting the value - cssProps: { - // normalize float css property - "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat" - }, - - // Get and set the style property on a DOM Node - style: function( elem, name, value, extra ) { - // Don't set styles on text and comment nodes - if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { - return; - } - - // Make sure that we're working with the right name - var ret, type, hooks, - origName = jQuery.camelCase( name ), - style = elem.style; - - name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) ); - - // gets hook for the prefixed version - // followed by the unprefixed version - hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; - - // Check if we're setting a value - if ( value !== undefined ) { - type = typeof value; - - // convert relative number strings (+= or -=) to relative numbers. #7345 - if ( type === "string" && (ret = rrelNum.exec( value )) ) { - value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) ); - // Fixes bug #9237 - type = "number"; - } - - // Make sure that NaN and null values aren't set. See: #7116 - if ( value == null || type === "number" && isNaN( value ) ) { - return; - } - - // If a number was passed in, add 'px' to the (except for certain CSS properties) - if ( type === "number" && !jQuery.cssNumber[ origName ] ) { - value += "px"; - } - - // Fixes #8908, it can be done more correctly by specifing setters in cssHooks, - // but it would mean to define eight (for every problematic property) identical functions - if ( !jQuery.support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) { - style[ name ] = "inherit"; - } - - // If a hook was provided, use that value, otherwise just set the specified value - if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) { - - // Wrapped to prevent IE from throwing errors when 'invalid' values are provided - // Fixes bug #5509 - try { - style[ name ] = value; - } catch(e) {} - } - - } else { - // If a hook was provided get the non-computed value from there - if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) { - return ret; - } - - // Otherwise just get the value from the style object - return style[ name ]; - } - }, - - css: function( elem, name, extra, styles ) { - var num, val, hooks, - origName = jQuery.camelCase( name ); - - // Make sure that we're working with the right name - name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) ); - - // gets hook for the prefixed version - // followed by the unprefixed version - hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; - - // If a hook was provided get the computed value from there - if ( hooks && "get" in hooks ) { - val = hooks.get( elem, true, extra ); - } - - // Otherwise, if a way to get the computed value exists, use that - if ( val === undefined ) { - val = curCSS( elem, name, styles ); - } - - //convert "normal" to computed value - if ( val === "normal" && name in cssNormalTransform ) { - val = cssNormalTransform[ name ]; - } - - // Return, converting to number if forced or a qualifier was provided and val looks numeric - if ( extra === "" || extra ) { - num = parseFloat( val ); - return extra === true || jQuery.isNumeric( num ) ? num || 0 : val; - } - return val; - }, - - // A method for quickly swapping in/out CSS properties to get correct calculations - swap: function( elem, options, callback, args ) { - var ret, name, - old = {}; - - // Remember the old values, and insert the new ones - for ( name in options ) { - old[ name ] = elem.style[ name ]; - elem.style[ name ] = options[ name ]; - } - - ret = callback.apply( elem, args || [] ); - - // Revert the old values - for ( name in options ) { - elem.style[ name ] = old[ name ]; - } - - return ret; - } -}); - -// NOTE: we've included the "window" in window.getComputedStyle -// because jsdom on node.js will break without it. -if ( window.getComputedStyle ) { - getStyles = function( elem ) { - return window.getComputedStyle( elem, null ); - }; - - curCSS = function( elem, name, _computed ) { - var width, minWidth, maxWidth, - computed = _computed || getStyles( elem ), - - // getPropertyValue is only needed for .css('filter') in IE9, see #12537 - ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined, - style = elem.style; - - if ( computed ) { - - if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { - ret = jQuery.style( elem, name ); - } - - // A tribute to the "awesome hack by Dean Edwards" - // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right - // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels - // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values - if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) { - - // Remember the original values - width = style.width; - minWidth = style.minWidth; - maxWidth = style.maxWidth; - - // Put in the new values to get a computed value out - style.minWidth = style.maxWidth = style.width = ret; - ret = computed.width; - - // Revert the changed values - style.width = width; - style.minWidth = minWidth; - style.maxWidth = maxWidth; - } - } - - return ret; - }; -} else if ( document.documentElement.currentStyle ) { - getStyles = function( elem ) { - return elem.currentStyle; - }; - - curCSS = function( elem, name, _computed ) { - var left, rs, rsLeft, - computed = _computed || getStyles( elem ), - ret = computed ? computed[ name ] : undefined, - style = elem.style; - - // Avoid setting ret to empty string here - // so we don't default to auto - if ( ret == null && style && style[ name ] ) { - ret = style[ name ]; - } - - // From the awesome hack by Dean Edwards - // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 - - // If we're not dealing with a regular pixel number - // but a number that has a weird ending, we need to convert it to pixels - // but not position css attributes, as those are proportional to the parent element instead - // and we can't measure the parent instead because it might trigger a "stacking dolls" problem - if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) { - - // Remember the original values - left = style.left; - rs = elem.runtimeStyle; - rsLeft = rs && rs.left; - - // Put in the new values to get a computed value out - if ( rsLeft ) { - rs.left = elem.currentStyle.left; - } - style.left = name === "fontSize" ? "1em" : ret; - ret = style.pixelLeft + "px"; - - // Revert the changed values - style.left = left; - if ( rsLeft ) { - rs.left = rsLeft; - } - } - - return ret === "" ? "auto" : ret; - }; -} - -function setPositiveNumber( elem, value, subtract ) { - var matches = rnumsplit.exec( value ); - return matches ? - // Guard against undefined "subtract", e.g., when used as in cssHooks - Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) : - value; -} - -function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) { - var i = extra === ( isBorderBox ? "border" : "content" ) ? - // If we already have the right measurement, avoid augmentation - 4 : - // Otherwise initialize for horizontal or vertical properties - name === "width" ? 1 : 0, - - val = 0; - - for ( ; i < 4; i += 2 ) { - // both box models exclude margin, so add it if we want it - if ( extra === "margin" ) { - val += jQuery.css( elem, extra + cssExpand[ i ], true, styles ); - } - - if ( isBorderBox ) { - // border-box includes padding, so remove it if we want content - if ( extra === "content" ) { - val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); - } - - // at this point, extra isn't border nor margin, so remove border - if ( extra !== "margin" ) { - val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); - } - } else { - // at this point, extra isn't content, so add padding - val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); - - // at this point, extra isn't content nor padding, so add border - if ( extra !== "padding" ) { - val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); - } - } - } - - return val; -} - -function getWidthOrHeight( elem, name, extra ) { - - // Start with offset property, which is equivalent to the border-box value - var valueIsBorderBox = true, - val = name === "width" ? elem.offsetWidth : elem.offsetHeight, - styles = getStyles( elem ), - isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; - - // some non-html elements return undefined for offsetWidth, so check for null/undefined - // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 - // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 - if ( val <= 0 || val == null ) { - // Fall back to computed then uncomputed css if necessary - val = curCSS( elem, name, styles ); - if ( val < 0 || val == null ) { - val = elem.style[ name ]; - } - - // Computed unit is not pixels. Stop here and return. - if ( rnumnonpx.test(val) ) { - return val; - } - - // we need the check for style in case a browser which returns unreliable values - // for getComputedStyle silently falls back to the reliable elem.style - valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] ); - - // Normalize "", auto, and prepare for extra - val = parseFloat( val ) || 0; - } - - // use the active box-sizing model to add/subtract irrelevant styles - return ( val + - augmentWidthOrHeight( - elem, - name, - extra || ( isBorderBox ? "border" : "content" ), - valueIsBorderBox, - styles - ) - ) + "px"; -} - -// Try to determine the default display value of an element -function css_defaultDisplay( nodeName ) { - var doc = document, - display = elemdisplay[ nodeName ]; - - if ( !display ) { - display = actualDisplay( nodeName, doc ); - - // If the simple way fails, read from inside an iframe - if ( display === "none" || !display ) { - // Use the already-created iframe if possible - iframe = ( iframe || - jQuery("