Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

updated to jqm 1.2 and internal refactorings

  • Loading branch information...
commit 8a6ba967e51f31121db6762cde34a8e8a9886402 1 parent c773928
Tobias Bosch authored
Showing with 16,954 additions and 6,171 deletions.
  1. +3 −0  Changelog.md
  2. +2 −2 README.md
  3. +3 −3 build.js
  4. +270 −296 compiled/jquery-mobile-angular-adapter-1.1.2-SNAPSHOT.js
  5. +7,001 −5,481 compiled/jquery-mobile-angular-adapter-standalone-1.1.2-SNAPSHOT.js
  6. +1 −1  compiled/min/jquery-mobile-angular-adapter-1.1.2-SNAPSHOT.js
  7. +1 −1  compiled/min/jquery-mobile-angular-adapter-standalone-1.1.2-SNAPSHOT.js
  8. +1 −0  node_modules/.bin/uglifyjs
  9. +6 −0 node_modules/uglify-js/.npmignore
  10. +1,012 −0 node_modules/uglify-js/README.html
  11. +593 −0 node_modules/uglify-js/README.org
  12. +334 −0 node_modules/uglify-js/bin/uglifyjs
  13. +75 −0 node_modules/uglify-js/docstyle.css
  14. +1,220 −0 node_modules/uglify-js/lib/consolidator.js
  15. +1,369 −0 node_modules/uglify-js/lib/parse-js.js
  16. +2,117 −0 node_modules/uglify-js/lib/process.js
  17. +78 −0 node_modules/uglify-js/lib/squeeze-more.js
  18. +31 −0 node_modules/uglify-js/package.json
  19. +28 −0 node_modules/uglify-js/test/beautify.js
  20. +1,391 −0 node_modules/uglify-js/test/testconsolidator.js
  21. +409 −0 node_modules/uglify-js/test/testparser.js
  22. +1 −0  node_modules/uglify-js/test/unit/compress/expected/1e21.js
  23. +1 −0  node_modules/uglify-js/test/unit/compress/expected/array1.js
  24. +1 −0  node_modules/uglify-js/test/unit/compress/expected/array2.js
  25. +1 −0  node_modules/uglify-js/test/unit/compress/expected/array3.js
  26. +1 −0  node_modules/uglify-js/test/unit/compress/expected/array4.js
  27. +1 −0  node_modules/uglify-js/test/unit/compress/expected/assignment.js
  28. +1 −0  node_modules/uglify-js/test/unit/compress/expected/concatstring.js
  29. +1 −0  node_modules/uglify-js/test/unit/compress/expected/const.js
  30. +1 −0  node_modules/uglify-js/test/unit/compress/expected/div-with-regexp.js
  31. +1 −0  node_modules/uglify-js/test/unit/compress/expected/empty-blocks.js
  32. +1 −0  node_modules/uglify-js/test/unit/compress/expected/forstatement.js
  33. +1 −0  node_modules/uglify-js/test/unit/compress/expected/if-not.js
  34. +1 −0  node_modules/uglify-js/test/unit/compress/expected/if.js
  35. +1 −0  node_modules/uglify-js/test/unit/compress/expected/ifreturn.js
  36. +1 −0  node_modules/uglify-js/test/unit/compress/expected/ifreturn2.js
  37. +1 −0  node_modules/uglify-js/test/unit/compress/expected/infinite.js
  38. +1 −0  node_modules/uglify-js/test/unit/compress/expected/issue10.js
  39. +1 −0  node_modules/uglify-js/test/unit/compress/expected/issue11.js
  40. +1 −0  node_modules/uglify-js/test/unit/compress/expected/issue13.js
  41. +1 −0  node_modules/uglify-js/test/unit/compress/expected/issue14.js
  42. +1 −0  node_modules/uglify-js/test/unit/compress/expected/issue16.js
  43. +1 −0  node_modules/uglify-js/test/unit/compress/expected/issue17.js
  44. +1 −0  node_modules/uglify-js/test/unit/compress/expected/issue20.js
  45. +1 −0  node_modules/uglify-js/test/unit/compress/expected/issue21.js
  46. +1 −0  node_modules/uglify-js/test/unit/compress/expected/issue25.js
  47. +1 −0  node_modules/uglify-js/test/unit/compress/expected/issue27.js
  48. +1 −0  node_modules/uglify-js/test/unit/compress/expected/issue278.js
  49. +1 −0  node_modules/uglify-js/test/unit/compress/expected/issue28.js
  50. +1 −0  node_modules/uglify-js/test/unit/compress/expected/issue29.js
  51. +1 −0  node_modules/uglify-js/test/unit/compress/expected/issue30.js
  52. +1 −0  node_modules/uglify-js/test/unit/compress/expected/issue34.js
  53. +1 −0  node_modules/uglify-js/test/unit/compress/expected/issue349.js
  54. +1 −0  node_modules/uglify-js/test/unit/compress/expected/issue353.js
  55. +1 −0  node_modules/uglify-js/test/unit/compress/expected/issue372.js
  56. +1 −0  node_modules/uglify-js/test/unit/compress/expected/issue4.js
  57. +1 −0  node_modules/uglify-js/test/unit/compress/expected/issue48.js
  58. +1 −0  node_modules/uglify-js/test/unit/compress/expected/issue50.js
  59. +1 −0  node_modules/uglify-js/test/unit/compress/expected/issue53.js
  60. +1 −0  node_modules/uglify-js/test/unit/compress/expected/issue54.1.js
  61. +1 −0  node_modules/uglify-js/test/unit/compress/expected/issue68.js
  62. +1 −0  node_modules/uglify-js/test/unit/compress/expected/issue69.js
  63. +1 −0  node_modules/uglify-js/test/unit/compress/expected/issue9.js
  64. +1 −0  node_modules/uglify-js/test/unit/compress/expected/issues222_324.js
  65. +1 −0  node_modules/uglify-js/test/unit/compress/expected/mangle.js
  66. +1 −0  node_modules/uglify-js/test/unit/compress/expected/null_string.js
  67. +1 −0  node_modules/uglify-js/test/unit/compress/expected/strict-equals.js
  68. +1 −0  node_modules/uglify-js/test/unit/compress/expected/var.js
  69. +1 −0  node_modules/uglify-js/test/unit/compress/expected/whitespace.js
  70. +1 −0  node_modules/uglify-js/test/unit/compress/expected/with.js
  71. +1 −0  node_modules/uglify-js/test/unit/compress/test/1e21.js
  72. +3 −0  node_modules/uglify-js/test/unit/compress/test/array1.js
  73. +4 −0 node_modules/uglify-js/test/unit/compress/test/array2.js
  74. +4 −0 node_modules/uglify-js/test/unit/compress/test/array3.js
  75. +6 −0 node_modules/uglify-js/test/unit/compress/test/array4.js
  76. +20 −0 node_modules/uglify-js/test/unit/compress/test/assignment.js
  77. +3 −0  node_modules/uglify-js/test/unit/compress/test/concatstring.js
  78. +5 −0 node_modules/uglify-js/test/unit/compress/test/const.js
  79. +1 −0  node_modules/uglify-js/test/unit/compress/test/div-with-regexp.js
  80. +4 −0 node_modules/uglify-js/test/unit/compress/test/empty-blocks.js
  81. +10 −0 node_modules/uglify-js/test/unit/compress/test/forstatement.js
  82. +1 −0  node_modules/uglify-js/test/unit/compress/test/if-not.js
  83. +6 −0 node_modules/uglify-js/test/unit/compress/test/if.js
  84. +9 −0 node_modules/uglify-js/test/unit/compress/test/ifreturn.js
  85. +16 −0 node_modules/uglify-js/test/unit/compress/test/ifreturn2.js
  86. +1 −0  node_modules/uglify-js/test/unit/compress/test/infinite.js
  87. +1 −0  node_modules/uglify-js/test/unit/compress/test/issue10.js
  88. +3 −0  node_modules/uglify-js/test/unit/compress/test/issue11.js
  89. +1 −0  node_modules/uglify-js/test/unit/compress/test/issue13.js
  90. +1 −0  node_modules/uglify-js/test/unit/compress/test/issue14.js
  91. +1 −0  node_modules/uglify-js/test/unit/compress/test/issue16.js
  92. +4 −0 node_modules/uglify-js/test/unit/compress/test/issue17.js
  93. +1 −0  node_modules/uglify-js/test/unit/compress/test/issue20.js
  94. +6 −0 node_modules/uglify-js/test/unit/compress/test/issue21.js
  95. +7 −0 node_modules/uglify-js/test/unit/compress/test/issue25.js
  96. +1 −0  node_modules/uglify-js/test/unit/compress/test/issue27.js
  97. +1 −0  node_modules/uglify-js/test/unit/compress/test/issue278.js
  98. +3 −0  node_modules/uglify-js/test/unit/compress/test/issue28.js
  99. +1 −0  node_modules/uglify-js/test/unit/compress/test/issue29.js
  100. +3 −0  node_modules/uglify-js/test/unit/compress/test/issue30.js
  101. +3 −0  node_modules/uglify-js/test/unit/compress/test/issue34.js
  102. +25 −0 node_modules/uglify-js/test/unit/compress/test/issue349.js
  103. +4 −0 node_modules/uglify-js/test/unit/compress/test/issue353.js
  104. +32 −0 node_modules/uglify-js/test/unit/compress/test/issue372.js
  105. +3 −0  node_modules/uglify-js/test/unit/compress/test/issue4.js
  106. +1 −0  node_modules/uglify-js/test/unit/compress/test/issue48.js
  107. +9 −0 node_modules/uglify-js/test/unit/compress/test/issue50.js
  108. +1 −0  node_modules/uglify-js/test/unit/compress/test/issue53.js
  109. +3 −0  node_modules/uglify-js/test/unit/compress/test/issue54.1.js
  110. +5 −0 node_modules/uglify-js/test/unit/compress/test/issue68.js
  111. +1 −0  node_modules/uglify-js/test/unit/compress/test/issue69.js
  112. +4 −0 node_modules/uglify-js/test/unit/compress/test/issue9.js
  113. +82 −0 node_modules/uglify-js/test/unit/compress/test/issues222_324.js
  114. +5 −0 node_modules/uglify-js/test/unit/compress/test/mangle.js
  115. +1 −0  node_modules/uglify-js/test/unit/compress/test/null_string.js
  116. +3 −0  node_modules/uglify-js/test/unit/compress/test/strict-equals.js
  117. +3 −0  node_modules/uglify-js/test/unit/compress/test/var.js
  118. +21 −0 node_modules/uglify-js/test/unit/compress/test/whitespace.js
  119. +2 −0  node_modules/uglify-js/test/unit/compress/test/with.js
  120. +57 −0 node_modules/uglify-js/test/unit/scripts.js
  121. +33 −0 node_modules/uglify-js/tmp/hoist.js
  122. +97 −0 node_modules/uglify-js/tmp/instrument.js
  123. +30 −0 node_modules/uglify-js/tmp/test.js
  124. +18 −0 node_modules/uglify-js/uglify-js.js
  125. +10 −0 package.json
  126. +95 −96 src/main/webapp/integration/jqmAngularWidgets.js
  127. +101 −113 src/main/webapp/utils/waitDialog.js
  128. +0 −1  src/test/webapp/UiSpecRunner.html
  129. +1 −1  src/test/webapp/UnitSpecRunner.html
  130. +12 −2 src/test/webapp/devSnippetPage.html
  131. +0 −174 src/test/webapp/ui/utils/waitDialogServiceSpec.js
  132. +11 −0 src/test/webapp/unit/integration/buttonSpec.js
  133. +159 −0 src/test/webapp/unit/utils/waitDialogServiceSpec.js
View
3  Changelog.md
@@ -6,6 +6,9 @@ Changelog
- added missing event directives. Changed `ngm-click` to `ngm-vclick` as this matches directly to the jqm docs.
- updated to angular 1.0.2
- updated to jqm 1.2.0
+- Checkboxes/Radio buttons: We always wrap them into a `<fieldset>` element, if not already done. This ok from
+ jquery mobile perspective and fixes problems when there is a ng-repeat on the `<input>`.
+- Location for Wait-Dialog default messages changed.
1.1.1
-------------
View
4 README.md
@@ -241,8 +241,8 @@ The service `$waitDialog` allows the access to the jquery mobile wait dialog. It
when the user clicks on the wait dialog.
Default messages are:
-- `$.mobile.loadingMessageWithCancel`: for waitForWithCancel
-- `$.mobile.loadingMessage`: for all other cases
+- `$.mobile.loader.prototype.options.textWithCancel`: for waitForWithCancel. This is a new property.
+- `$.mobile.loader.prototype.options.text`: for all other cases, see the jquery mobile docs.
### Filter `paged`: Paging for lists
View
6 build.js
@@ -1,11 +1,11 @@
var fs = require("fs");
-var carrier = require('carrier');
var uglify = require('uglify-js');
var encoding = "utf-8";
+var pjson = require('./package.json');
+
function readVersion() {
- var pom = fs.readFileSync('pom.xml', encoding);
- return /<version>(.*)<\/version>/.exec(pom)[1];
+ return pjson.version;
}
var versionPlaceholder = "${project.version}";
View
566 compiled/jquery-mobile-angular-adapter-1.1.2-SNAPSHOT.js
@@ -31,6 +31,10 @@ factory(window.jQuery, window.angular);
listbox && listbox.remove();
});
+ // native selectmenu throws an error is no option is contained!
+ $.mobile.selectmenu.prototype.placeholder = "";
+
+
// Listview may create subpages that need to be removed when the widget is destroyed.
patch($.mobile.listview.prototype, "destroy", function (old, self, args) {
// Destroy the widget instance first to prevent
@@ -73,26 +77,13 @@ factory(window.jQuery, window.angular);
// Patch 1: controlgroup should not exclude invisible children
// as long as it is not visible itself!
- // Patch 2: to refresh a controlgroup we call it multiple times.
- // However, controlgroup then wraps its children multiple times
- // in nested divs.
-
patch($.fn, "controlgroup", function (old, self, args) {
- var _wrapInner = $.fn.wrapInner;
- if (self.children(".ui-controlgroup-controls").length > 0) {
- $.fn.wrapInner = function () {
- };
- }
- try {
- if (self.filter(":visible").length === 0) {
- var options = args[0] || {};
- options.excludeInvisible = false;
- return old.call(self, options);
- }
- return old.apply(self, args);
- } finally {
- $.fn.wrapInner = _wrapInner;
+ if (self.filter(":visible").length === 0) {
+ var options = args[0] || {};
+ options.excludeInvisible = false;
+ return old.call(self, options);
}
+ return old.apply(self, args);
});
// collapsible has problems when a collapsible is created with a nested collapsible,
@@ -725,9 +716,11 @@ factory(window.jQuery, window.angular);
precompile:checkboxRadioPrecompile,
create:checkboxRadioCreate
},
+ // Button wraps itself into a new element.
+ // Angular does not like this, so we do it in advance.
button:{
handlers:[disabledHandler],
- precompile:buttonPrecompile,
+ precompile:wrapIntoDivPrecompile,
create:buttonCreate
},
collapsible:{
@@ -736,11 +729,11 @@ factory(window.jQuery, window.angular);
textinput:{
handlers:[disabledHandler],
precompile:textinputPrecompile,
- create:textinputCreate
+ create:unwrapFromDivCreate
},
slider:{
handlers:[disabledHandler, refreshAfterNgModelRender],
- precompile:sliderPrecompile,
+ precompile:wrapIntoDivPrecompile,
create:sliderCreate
},
listview:{
@@ -749,10 +742,12 @@ factory(window.jQuery, window.angular);
collapsibleset:{
handlers:[refreshOnChildrenChange]
},
+ // selectmenu wraps itself into a button and an outer div.
+ // Angular does not like this, so we do it in advance.
selectmenu:{
handlers:[disabledHandler, refreshAfterNgModelRender, refreshOnChildrenChange],
- precompile:selectmenuPrecompile,
- create:selectmenuCreate
+ precompile:wrapIntoDivPrecompile,
+ create:unwrapFromDivCreate
},
controlgroup:{
handlers:[refreshControlgroupOnChildrenChange]
@@ -789,121 +784,58 @@ factory(window.jQuery, window.angular);
}
// -------------------
- // precompile functions
+ // precompile and create functions
- // Checkboxradio wraps the input and label into a new element.
- // The angular compiler does not like this, as it changes elements that are not
- // in the subtree of the input element that is currently linked.
+ // Slider appends a new element after the input/select element for which it was created.
+ // The angular compiler does not like this, so we wrap the two elements into a new parent node.
+ function sliderCreate(origCreate, element, initArgs) {
+ var slider = element.children().eq(0);
+ origCreate.apply(slider, initArgs);
+ }
+
+ // Checkboxradio requires a label for every checkbox input. From the jqm perspective, the label
+ // can be at different locations in the DOM tree. However, if the
+ // label is not under the same parent as the checkbox, this could change the DOM structure
+ // too much for angular's compiler.
+ // So we dynamically create a parent <fieldset> and move the label into that tag if needed.
+ // Also, the checkboxradio widget changes dom elements in the neighbouring label element,
+ // which is also a no-go for the angular compiler. For this, we create the checkboxradio widget
+ // when we are linking the <fieldset> element, as changing children is fine for the compiler.
function checkboxRadioPrecompile(origElement, initArgs) {
- // Selectors: See the checkboxradio-Plugin in jqm.
+ // See the checkboxradio-Plugin in jqm for the selectors used to locate the label.
var parentLabel = $(origElement).closest("label");
var container = $(origElement).closest("form,fieldset,:jqmData(role='page'),:jqmData(role='dialog')");
- if (container.length===0) {
+ if (container.length === 0) {
container = origElement.parent();
}
var label = parentLabel.length ? parentLabel : container.find("label").filter("[for='" + origElement[0].id + "']");
- var wrapper = $("<div></div>").insertBefore(origElement).append(origElement).append(label);
- moveCloningDirectives(origElement, origElement.parent());
- return wrapper;
- }
-
- function checkboxRadioCreate(origCreate, element, initArgs) {
- var _wrapAll = $.fn.wrapAll;
- var input = element.children("input");
- var wrapper = element;
-
- return withPatches($.fn, {
- wrapAll: function(_wrapAll, self, args) {
- var container = args[0];
- if (self[0] === input[0]) {
- $.fn.wrapAll = _wrapAll;
- var tempContainer = $(container);
- wrapper[0].className = tempContainer[0].className;
- return input;
- }
- return _wrapAll.apply(self, args);
- }
- }, function() {
- return origCreate.apply(input, initArgs);
- });
- }
-
- // Slider appends a new element after the input/select element for which it was created.
- // The angular compiler does not like this, so we wrap the two elements into a new parent node.
- function sliderPrecompile(origElement, initArgs) {
- origElement.wrapAll("<div></div>");
+ var parent = origElement.parent();
+ if (parent[0].tagName.toUpperCase() !== 'FIELDSET') {
+ origElement.wrap("<fieldset></fieldset>");
+ }
+ // ensure that the label is after the input element in each case.
var wrapper = origElement.parent();
+ wrapper.append(label);
moveCloningDirectives(origElement, wrapper);
return wrapper;
}
- function sliderCreate(origCreate, element, initArgs) {
- var slider = element.children().eq(0);
- origCreate.apply(slider, initArgs);
- }
-
- // Button wraps itself into a new element.
- // Angular does not like this, so we do it in advance.
- function buttonPrecompile(origElement, initArgs) {
- var wrapper = $("<div></div>")
- .text(origElement.text() || origElement.val())
- .insertBefore(origElement)
- .append(origElement);
- moveCloningDirectives(origElement, wrapper);
- return wrapper;
+ function checkboxRadioCreate(origCreate, element, initArgs) {
+ // we ensured in precompile that the label is after the checkbox and both are within a <fieldset>
+ var checkbox = element.children().eq(0);
+ origCreate.apply(checkbox, initArgs);
}
function buttonCreate(origCreate, element, initArgs) {
- var wrapper = element;
+ // Button destroys the text node and recreates a new one. This does not work
+ // if the text node contains angular expressions.
var button = element.children().eq(0);
- return withPatches($.fn, {
- text: function(_text, self, args) {
- if (args.length > 0) {
- // Only catch the first setter call
- $.fn.text = _text;
- return wrapper;
- }
- return _text.apply(self, args);
- },
- insertBefore: function(_insertBefore, self, args) {
- var element = args[0];
- if (self[0] === wrapper[0] && element[0] === button[0]) {
- return wrapper;
- }
- return _insertBefore.apply(self, args);
- }
- }, function() {
- return origCreate.apply(button, initArgs);
- });
- }
-
- // selectmenu wraps itself into a new element.
- // Angular does not like this, so we do it in advance.
- function selectmenuPrecompile(origElement, initArgs) {
- var wrapper = $("<div></div>").insertBefore(origElement).append(origElement);
- moveCloningDirectives(origElement, wrapper);
- return wrapper;
- }
-
- function selectmenuCreate(origCreate, element, initArgs) {
- var wrapper = element;
- var select = element.children().eq(0);
-
- return withPatches($.fn, {
- wrap: function(_wrap, self, args) {
- var container = args[0];
- if (self[0] === select[0]) {
- $.fn.wrap = _wrap;
- var tempContainer = $(container);
- wrapper[0].className = tempContainer[0].className;
-
- return select;
- }
- return _wrap.apply(self, args);
- }
- }, function() {
- return origCreate.apply(select, initArgs);
- });
+ var textNode = button.contents();
+ var res = unwrapFromDivCreate(origCreate, element, initArgs);
+ var textSpan = element.find("span span");
+ textSpan.empty();
+ textSpan.append(textNode);
+ return res;
}
// textinput for input-type "search" wraps itself into a new element
@@ -911,94 +843,145 @@ factory(window.jQuery, window.angular);
if (!origElement.is("[type='search'],:jqmData(type='search')")) {
return origElement;
}
- var wrapper = $("<div></div>").insertBefore(origElement).append(origElement);
+ return wrapIntoDivPrecompile(origElement, initArgs);
+ }
+
+ function wrapIntoDivPrecompile(origElement, initArgs) {
+ origElement.wrapAll("<div></div>");
+ var wrapper = origElement.parent();
moveCloningDirectives(origElement, wrapper);
return wrapper;
}
- function textinputCreate(origCreate, element, initArgs) {
- if (element[0].nodeName.toUpperCase()!=="DIV") {
- // no wrapper
+ function unwrapFromDivCreate(origCreate, element, initArgs) {
+ if (element[0].nodeName.toUpperCase() !== "DIV") {
+ // no wrapper existing.
return origCreate.apply(element, initArgs);
}
- var wrapper = element;
- var input = element.children().eq(0);
- return withPatches($.fn, {
- wrap: function(_wrap, self, args) {
- var container = args[0];
- if (self[0] === input[0]) {
- $.fn.wrap = _wrap;
- var tempContainer = $(container);
- wrapper[0].className = tempContainer[0].className;
+ if (isMock(origCreate)) {
+ // spy that does not call through
+ return origCreate.apply(element, initArgs);
+ }
- return input;
- }
- return _wrap.apply(self, args);
- }
- }, function() {
- return origCreate.apply(input, initArgs);
+ var child = element.children().eq(0);
+ child.insertBefore(element);
+ element.empty();
+ return useExistingElementsForNewElements(element, function() {
+ return origCreate.apply(child, initArgs);
});
}
// Dialog: separate event binding and dom enhancement.
// Note: We do need to add the close button during precompile,
- // as the enhancement for the dialog header and footer depends on it.
+ // as the enhancement for the dialog header depends on it (calculation which button is left, right, ...)
// We cannot adjust the timing of the header enhancement as it is no jqm widget.
function dialogPrecompile(origElement, initAttrs) {
var options = $.mobile.dialog.prototype.options;
- var $el = origElement,
- headerCloseButton = $( "<a href='#' data-" + $.mobile.ns + "icon='delete' data-" + $.mobile.ns + "iconpos='notext'>"+ options.closeBtnText + "</a>" ),
- dialogWrap = $("<div/>", {
- "role" : "dialog",
- "class" : "ui-dialog-contain ui-corner-all ui-overlay-shadow"
- });
-
- $el
- .wrapInner( dialogWrap )
- .children()
- .find( ":jqmData(role='header')" )
- .prepend( headerCloseButton )
- .end()
- .children( ':first-child')
- .addClass( "ui-corner-top" )
- .end()
- .children( ":last-child" )
- .addClass( "ui-corner-bottom" );
+ var headerCloseButton = $("<a href='#' data-" + $.mobile.ns + "icon='delete' data-" + $.mobile.ns + "iconpos='notext'>" + options.closeBtnText + "</a>");
+ origElement.find(":jqmData(role='header')").prepend(headerCloseButton);
+ origElement.data('headerCloseButton', headerCloseButton);
+ return origElement;
+ }
- $el.data("headerCloseButton", headerCloseButton);
+ function dialogCreate(origCreate, element, initArgs) {
+ if (isMock(origCreate)) {
+ // During unit tests...
+ return origCreate.apply(element, initArgs);
+ }
+ var headerCloseButton = element.data('headerCloseButton');
+ return useExistingElementsForNewElements(headerCloseButton, function() {
+ return origCreate.apply(element, initArgs);
+ });
+ }
- return $el;
+ function isMock(origCreate) {
+ return origCreate.isSpy && origCreate.originalValue !== origCreate.plan;
}
- function dialogCreate(origCreate, element, initArgs) {
- return withPatches($.fn, {
- init: function(_init, self, args) {
- // return the already created header close button
+ function useExistingElementsForNewElements(existingElements, callback) {
+ var i, el, tagName;
+ var existingElementsHashByElementName = {};
+ for (i = 0; i < existingElements.length; i++) {
+ el = existingElements.eq(i);
+ // Do not use jQuery.fn.remove as this will fire a destroy event,
+ // which leads to unwanted side effects by it's listeners.
+ el[0].parentNode.removeChild(el[0]);
+ tagName = el[0].nodeName.toUpperCase();
+ existingElementsHashByElementName[tagName] = el;
+ }
+
+ function useExistingElementIfPossible(selector) {
+ if (selector) {
+ var template = $(selector);
+ var tagName = template[0].nodeName.toUpperCase();
+ var existingElement = existingElementsHashByElementName[tagName];
+ if (existingElement) {
+ delete existingElementsHashByElementName[tagName];
+ existingElement[0].className += ' ' + template[0].className;
+ return existingElement;
+ }
+ }
+ return false;
+ }
+ var res = withPatches($.fn, {
+ init:function (_init, self, args) {
var selector = args[0];
- if (selector && selector.indexOf && selector.indexOf("<a href='#' data-")===0) {
- return element.data("headerCloseButton");
+ if (typeof selector === "string" && selector.charAt(0) === '<') {
+ var existingElement = useExistingElementIfPossible(selector);
+ if (existingElement) {
+ return existingElement;
+ }
}
return _init.apply(self, args);
},
- wrapInner: function(_wrapInner, self, args) {
- if (self[0]===element[0]) {
- return $();
+ wrap:function (_wrap, self, args) {
+ var selector = args[0];
+ var wrapper = useExistingElementIfPossible(selector);
+ if (wrapper) {
+ wrapper.insertBefore(self);
+ wrapper.append(self);
+ return self;
}
- return _wrapInner.apply(self, args);
+ return _wrap.apply(self, args);
+ },
+ wrapAll:function (_wrapAll, self, args) {
+ var selector = args[0];
+ var wrapper = useExistingElementIfPossible(selector);
+ if (wrapper) {
+ wrapper.insertBefore(self);
+ wrapper.append(self);
+ return self;
+ }
+ return _wrapAll.apply(self, args);
}
- }, function() {
- return origCreate.apply(element, initArgs);
- });
+ }, callback);
+ for (tagName in existingElementsHashByElementName) {
+ throw new Error("existing element with tagName "+tagName+" was not used!");
+ }
+ return res;
}
function withPatches(obj, patches, callback) {
var _old = {};
+ var executingCount = 0;
function patchProp(prop) {
var oldFn = _old[prop] = obj[prop];
- obj[prop] = function() {
- return patches[prop](oldFn, this, arguments);
+ oldFn.restore = function () {
+ obj[prop] = oldFn;
+ delete oldFn.restore;
+ };
+ obj[prop] = function () {
+ if (executingCount) {
+ return oldFn.apply(this, arguments);
+ }
+ executingCount++;
+ try {
+ return patches[prop](oldFn, this, arguments);
+ } finally {
+ executingCount--;
+ }
};
obj[prop].prototype = oldFn.prototype;
}
@@ -1011,7 +994,7 @@ factory(window.jQuery, window.angular);
return callback();
} finally {
for (prop in _old) {
- obj[prop] = _old[prop];
+ _old[prop].restore && _old[prop].restore();
}
}
}
@@ -1077,7 +1060,7 @@ factory(window.jQuery, window.angular);
if (iAttrs.collapsed) {
var collapsedGetter = $parse(iAttrs.collapsed);
var collapsedSetter = collapsedGetter.assign;
- scope.$watch(collapsedGetter, function(value) {
+ scope.$watch(collapsedGetter, function (value) {
if (value) {
iElement.trigger("collapse");
} else {
@@ -1086,12 +1069,12 @@ factory(window.jQuery, window.angular);
});
iElement.bind("collapse", function () {
- scope.$apply(function() {
+ scope.$apply(function () {
collapsedSetter(scope, true);
});
});
iElement.bind("expand", function () {
- scope.$apply(function() {
+ scope.$apply(function () {
collapsedSetter(scope, false);
});
});
@@ -1154,7 +1137,8 @@ factory(window.jQuery, window.angular);
}
-})(angular, $);
+})
+ (angular, $);
/**
* This is an extension to the locationProvider of angular and provides a new mode: jqmCompat-mode.
* <p>
@@ -1829,8 +1813,10 @@ factory(window.jQuery, window.angular);
var _addNew = urlHistory.addNew;
urlHistory.addNew = function() {
var res = _addNew.apply(this, arguments);
- var lastEntry = urlHistory.stack[urlHistory.stack.length-1];
- lastEntry.pageId = lastToPage.attr("id");
+ if (lastToPage) {
+ var lastEntry = urlHistory.stack[urlHistory.stack.length-1];
+ lastEntry.pageId = lastToPage.attr("id");
+ }
return res;
}
}
@@ -1989,137 +1975,125 @@ factory(window.jQuery, window.angular);
};
}]);
})(angular);
-(function($, angular) {
- var showCalls = [];
-
- function onClick(event) {
- var lastCall = showCalls[showCalls.length - 1];
- if (lastCall.callback) {
- rootScope.$apply(function() {
- lastCall.callback.apply(this, arguments);
- });
- }
- // This is required to prevent a second
- // click event, see
- // https://github.com/jquery/jquery-mobile/issues/1787
- event.preventDefault();
- }
-
- var loadDialog;
+(function ($, angular) {
- function initIfNeeded() {
- if (!loadDialog || loadDialog.length == 0) {
- loadDialog = $(".ui-loader");
- loadDialog.bind('vclick', onClick);
- }
- }
+ function waitDialogFactory(rootScope) {
- if (!$.mobile.loadingMessageWithCancel) {
- $.mobile.loadingMessageWithCancel = 'Loading. Click to cancel.';
- }
+ var showCalls = [];
- function updateUi() {
- initIfNeeded();
- if (showCalls.length > 0) {
+ function onClick(event) {
var lastCall = showCalls[showCalls.length - 1];
- var msg = lastCall.msg;
- var oldMessage = $.mobile.loadingMessage;
- var oldTextVisible = $.mobile.loadingMessageTextVisible;
- if (msg) {
- $.mobile.loadingMessage = msg;
- $.mobile.loadingMessageTextVisible = true;
+ if (lastCall.callback) {
+ rootScope.$apply(function () {
+ lastCall.callback.apply(this, arguments);
+ });
}
- $.mobile.showPageLoadingMsg();
- $.mobile.loadingMessageTextVisible = oldTextVisible;
- $.mobile.loadingMessage = oldMessage;
- } else {
- $.mobile.hidePageLoadingMsg();
+ // This is required to prevent a second
+ // click event, see
+ // https://github.com/jquery/jquery-mobile/issues/1787
+ event.preventDefault();
}
- }
- /**
- * jquery mobile hides the wait dialog when pages are transitioned.
- * This immediately closes wait dialogs that are opened in the pagebeforeshow event.
- */
- $('div').live('pageshow', function(event, ui) {
- updateUi();
- });
+ var loadDialog;
- /**
- *
- * @param msg (optional)
- * @param tapCallback (optional)
- */
- function show() {
- var msg, tapCallback;
- if (typeof arguments[0] == 'string') {
- msg = arguments[0];
- }
- if (typeof arguments[0] == 'function') {
- tapCallback = arguments[0];
+ $(document).delegate(".ui-loader", "vclick", onClick);
+
+ if (!$.mobile.loader.prototype.options.textWithCancel) {
+ $.mobile.loader.prototype.options.textWithCancel = 'Loading. Click to cancel.';
}
- if (typeof arguments[1] == 'function') {
- tapCallback = arguments[1];
+
+ function updateUi() {
+ if (showCalls.length > 0) {
+ var lastCall = showCalls[showCalls.length - 1];
+ var msg = lastCall.msg;
+ if (msg) {
+ $.mobile.loading('show', {text:msg, textVisible:!!msg});
+ } else {
+ $.mobile.loading('show');
+ }
+ } else {
+ $.mobile.loading('hide');
+ }
}
- showCalls.push({msg: msg, callback: tapCallback});
- updateUi();
- }
+ /**
+ * jquery mobile hides the wait dialog when pages are transitioned.
+ * This immediately closes wait dialogs that are opened in the pagebeforeshow event.
+ */
+ $('div').live('pageshow', function (event, ui) {
+ updateUi();
+ });
- function hide() {
- showCalls.pop();
- updateUi();
- }
+ /**
+ *
+ * @param msg (optional)
+ * @param tapCallback (optional)
+ */
+ function show() {
+ var msg, tapCallback;
+ if (typeof arguments[0] == 'string') {
+ msg = arguments[0];
+ }
+ if (typeof arguments[0] == 'function') {
+ tapCallback = arguments[0];
+ }
+ if (typeof arguments[1] == 'function') {
+ tapCallback = arguments[1];
+ }
- function always(promise, callback) {
- promise.then(callback, callback);
- }
+ showCalls.push({msg:msg, callback:tapCallback});
+ updateUi();
+ }
- /**
- *
- * @param promise
- * @param msg (optional)
- */
- function waitFor(promise, msg) {
- show(msg);
- always(promise, function() {
- hide();
- });
- }
+ function hide() {
+ showCalls.pop();
+ updateUi();
+ }
- /**
- *
- * @param deferred
- * @param cancelData
- * @param msg (optional)
- */
- function waitForWithCancel(deferred, cancelData, msg) {
- if (!msg) {
- msg = $.mobile.loadingMessageWithCancel;
+ function always(promise, callback) {
+ promise.then(callback, callback);
}
- show(msg, function() {
- deferred.reject(cancelData);
- });
- always(deferred.promise, function() {
- hide();
- });
- }
- var res = {
- show: show,
- hide: hide,
- waitFor: waitFor,
- waitForWithCancel:waitForWithCancel
- };
+ /**
+ *
+ * @param promise
+ * @param msg (optional)
+ */
+ function waitFor(promise, msg) {
+ show(msg);
+ always(promise, function () {
+ hide();
+ });
+ }
- var mod = angular.module('ng');
- var rootScope;
- mod.factory('$waitDialog', ['$rootScope', function($rootScope) {
- rootScope = $rootScope;
- return res;
- }]);
+ /**
+ *
+ * @param deferred
+ * @param cancelData
+ * @param msg (optional)
+ */
+ function waitForWithCancel(deferred, cancelData, msg) {
+ if (!msg) {
+ msg = $.mobile.loader.prototype.options.textWithCancel;
+ }
+ show(msg, function () {
+ deferred.reject(cancelData);
+ });
+ always(deferred.promise, function () {
+ hide();
+ });
+ }
- return res;
+ return {
+ show:show,
+ hide:hide,
+ waitFor:waitFor,
+ waitForWithCancel:waitForWithCancel
+ };
+ }
+
+ var mod = angular.module('ng');
+ mod.factory('$waitDialog', ['$rootScope', waitDialogFactory]);
})($, angular);
(function ($, angular) {
View
12,482 compiled/jquery-mobile-angular-adapter-standalone-1.1.2-SNAPSHOT.js
7,001 additions, 5,481 deletions not shown
View
2  compiled/min/jquery-mobile-angular-adapter-1.1.2-SNAPSHOT.js
@@ -1 +1 @@
-(function(a){typeof define=="function"&&define.amd?define(["jquery","angular","jquery.mobile"],a):a(window.jQuery,window.angular)})(function(a,b){(function(a){function b(a,b,c){var d=a[b];a[b]=function(){return c(d,this,arguments)}}b(a.mobile.selectmenu.prototype,"destroy",function(a,b,c){a.apply(b,c);var d=b.menuPage,e=b.screen,f=b.listbox;d&&d.remove(),e&&e.remove(),f&&f.remove()}),b(a.mobile.listview.prototype,"destroy",function(b,c,d){var e=c.element.attr("id"),f=new RegExp(a.mobile.subPageUrlKey+"="+e+"-"),g=c.childPages();b.apply(c,d);for(var h=0;h<g.length;h++){var i=a(g[h]),j=i.attr("data-url");j.match(f)&&i.remove()}}),b(a.mobile.listview.prototype,"refresh",function(a,b,c){return b.element.filter(":visible").length===0?a.call(b,!0):a.apply(b,c)}),a.fn.controlgroup&&a(document).bind("pagecreate create",function(b){a(":jqmData(role='controlgroup')",b.target).jqmEnhanceable().controlgroup({excludeInvisible:!1})}),b(a.fn,"controlgroup",function(b,c,d){var e=a.fn.wrapInner;c.children(".ui-controlgroup-controls").length>0&&(a.fn.wrapInner=function(){});try{if(c.filter(":visible").length===0){var f=d[0]||{};return f.excludeInvisible=!1,b.call(c,f)}return b.apply(c,d)}finally{a.fn.wrapInner=e}});var c=a.fn.collapsible,d="ui-collapsible-content";a.fn.collapsible=function(){var a=this.find(".ui-collapsible-content");a.removeClass(d);try{return c.apply(this,arguments)}finally{a.addClass(d)}},b(a.mobile.navbar.prototype,"_create",function(b,c,d){var e=a.fn.find,f=c.element,g;a.fn.find=function(a){var b=e.apply(this,arguments);return a==="a"&&f.data("$navbtns",b),b};try{return b.apply(c,d)}finally{a.fn.find=e}}),a.mobile.navbar.prototype.refresh=function(){var b=this.element,c=b.data("$navbtns");c.splice(0,c.length),a.each(b.find("a"),function(a,b){c.push(b)});var d=c.filter(":jqmData(icon)").length?this.options.iconpos:undefined,e=b.find("ul"),f=e.children("li");e.removeClass(function(a,b){return(b.match(/\bui-grid-\S+/g)||[]).join(" ")}),f.removeClass(function(a,b){return(b.match(/\bui-block-\S+/g)||[]).join(" ")}),e.jqmEnhanceable().grid({grid:this.options.grid}),c.buttonMarkup({corners:!1,shadow:!1,inline:!0,iconpos:d})}})(a),function(a,b){function d(b,c){a.holdReady(!0);var d=b.nodeType===9?b:b.ownerDocument;f(d,function(){var d=e(b);d&&a(function(){c(d.appElement,d.module)}),a.holdReady(!1)})}function e(a){function h(a){a&&b.push(a)}var b=[a],d,e,f=["ng:app","ng-app","x-ng-app","data-ng-app"],g=/\sng[:\-]app(:\s*([\w\d_]+);?)?\s/;return c(f,function(b){f[b]=!0,h(document.getElementById(b)),b=b.replace(":","\\:"),a.querySelectorAll&&(c(a.querySelectorAll("."+b),h),c(a.querySelectorAll("."+b+"\\:"),h),c(a.querySelectorAll("["+b+"]"),h))}),c(b,function(a){if(!d){if(a.getAttribute){var b=a.getAttribute("id");c(f,function(c){b===c&&a.removeAttribute("id")})}if(a.className){var h=a.className.replace(/[^;]+;?/g,function(b){var c=" "+b+" ",f=g.exec(c);return f?(d=a,e=(f[2]||"").replace(/\s+/g,","),""):b});h?a.className=h:a.removeAttribute("class")}var i=[];c(a.attributes,function(b){!d&&f[b.name]&&(d=a,e=b.value,i.push(b))}),c(i,function(b){a.removeAttributeNode(b)})}}),d?{appElement:d,module:e?[e]:[]}:undefined}function f(a,b){function d(){return a.readyState==="complete"}function e(){c||(c=!0,b())}var c=!1;d()?e():a.attachEvent?(a.attachEvent("onreadystatechange",function(){e()}),window.attachEvent("onload",e)):(a.addEventListener("DOMContentLoaded",e,!1),window.addEventListener("load",e,!1))}var c=b.forEach;d(document,b.bootstrap),a.mobile.deferAngularBootstrap=d}(a,b),function(a,b){function d(b,c){var d=a("<div>"+b+"</div>");return c(d.contents()),d.html()}var c=b.module("ng");c.factory("$precompile",function(){return function(a){return a}}),c.config(["$provide",function(a){a.decorator("$compile",["$precompile","$delegate",function(a,b){return function(){return arguments[0]=a(arguments[0]),b.apply(this,arguments)}}])}]),c.config(["$compileProvider","$provide",function(a,b){var c={},e=a.directive;a.directive=function(a,b){var f=function(a,e){var f=e.invoke(b);return f.template?f.template=d(f.template,a):f.templateUrl&&(c[f.templateUrl]=!0),f};return e.call(this,a,["$precompile","$injector",f])},b.decorator("$http",["$q","$delegate","$precompile",function(a,b,e){var f=b.get;return b.get=function(a){var b=f.apply(this,arguments);if(c[a]){var g=b.success;b.success=function(a){var b=function(){var b=arguments[0];return arguments[0]=d(b,e),a.apply(this,arguments)};return g(b)}}return b},b}])}])}(a,b),function(a){var b=a.module("ng");b.config(["$provide",function(a){a.decorator("$rootScope",["$delegate",function(a){return a.$disconnect=function(){if(this.$root==this)return;var a=this.$parent;this.$$disconnected=!0,a.$$childHead==this&&(a.$$childHead=this.$$nextSibling),a.$$childTail==this&&(a.$$childTail=this.$$prevSibling),this.$$prevSibling&&(this.$$prevSibling.$$nextSibling=this.$$nextSibling),this.$$nextSibling&&(this.$$nextSibling.$$prevSibling=this.$$prevSibling),this.$$nextSibling=this.$$prevSibling=null},a.$reconnect=function(){if(this.$root==this)return;var a=this;if(!a.$$disconnected)return;var b=a.$parent;a.$$disconnected=!1,a.$$prevSibling=b.$$childTail,b.$$childHead?(b.$$childTail.$$nextSibling=a,b.$$childTail=a):b.$$childHead=b.$$childTail=a},a}])}])}(b),function(a){var b=a.module("ng");b.config(["$provide",function(a){a.decorator("$rootScope",["$delegate",function(a){var b=a.$apply;a.$apply=function(){return a.$$phase?a.$eval.apply(this,arguments):b.apply(this,arguments)};var c=!1,d=a.$digest;return a.$digest=function(){if(a.$$phase)return;var b=d.apply(this,arguments)},a}])}])}(b),function(a,b){function f(a,b){if(!a.parentNode)return b();while(a.parentNode&&a.parentNode.nodeType===1)a=a.parentNode;var c=a.parentNode;c!==document&&document.documentElement.appendChild(a);try{return b()}finally{c!==document&&c.appendChild(a)}}function h(b,c){i(b,function(){if(m()){var d=Array.prototype.slice.call(arguments),e=this;for(var f=0;f<e.length;f++){var g=e.eq(f),h=g;c&&(h=c(g,d)||h);var i=h.attr("ngm-create")||"{}",j=JSON.parse(i);j[b]=d,h.attr("ngm-create",JSON.stringify(j));var k=g.attr("ngm-link")||"{}",n=JSON.parse(k);n[b]=!0,g.attr("ngm-link",JSON.stringify(n))}}return l()?!1:a.fn.orig[b].apply(this,arguments)})}function i(b,c){a.fn.orig[b]=a.fn.orig[b]||a.fn[b],a.fn[b]=c}function k(a,b){if(!b)return j[a];var c=j[a];j[a]=!0;var d=b();return j[a]=c,d}function l(a){return k("preventJqmWidgetCreation",a)}function m(a){return k("markJqmWidgetCreation",a)}function n(b){l(function(){var c=a.mobile.page.prototype.widgetEventPrefix;a.mobile.page.prototype.widgetEventPrefix="noop",b.page(),a.mobile.page.prototype.widgetEventPrefix=c})}var c=b.module("ng");a("div").live("pagebeforeshow",function(b,c){var d=a(b.target),e=d.scope();e&&e.$root.$digest()}),a.mobile.autoInitializePage=!1;var d=[],e=!1;c.config(["$provide",function(b){b.decorator("$rootScope",["$delegate",function(b){var c=b.$digest,f;return b.$digest=function(){if(this===b){var g=a.mobile.activePage,h=g&&g.scope();f&&f!==h&&f.$disconnect(),f=h,h&&h.$reconnect()}var i=c.apply(this,arguments);if(this===b){var j=d.length;while(d.length){var k=d.shift();k.$disconnect()}j&&!e&&(e=!0,a.mobile.initializePage())}return i},b}])}]),c.factory("$precompile",function(){var a=':jqmData(role="page"), :jqmData(role="dialog")';return function(b){var c=b[0].parentNode;f(b[0],function(){var c=b.find(a).add(b.filter(a));c.attr("ngm-page","true"),m(function(){l(function(){c.length>0?c.page():b.parent().trigger("create")})}),c.page("destroy")});while(b[0].parentNode!==c)b=b.eq(0).parent();return b}}),c.directive("ngmPage",function(){return{restrict:"A",scope:!0,compile:function(a,b){return a.removeAttr("ngm-page"),{pre:function(a,b,c){n(b),d.push(a)}}}}}),c.run(["$rootScope","$compile",function(b,c){i("page",function(){return!l()&&!this.data("page")&&this.attr("data-"+a.mobile.ns+"external-page")&&c(this)(b),a.fn.orig.page.apply(this,arguments)})}]),a.mobile.registerJqmNgWidget=function(a,b){g[a]=b,h(a,b.precompile)};var g={};c.directive("ngmCreate",function(){return{restrict:"A",priority:0,compile:function(b,c){var d=JSON.parse(c.ngmCreate);return{post:function(b,c,e,f){var h,i,j,k;for(h in d)i=g[h],j=d[h],k=a.fn.orig[h],i.create?i.create(k,c,j):k.apply(c,j)}}}}}),c.directive("ngmLink",["$injector",function(a){return{restrict:"A",priority:0,require:["?ngModel"],compile:function(b,c){var d=JSON.parse(c.ngmLink);return{post:function(b,c,e,f){var h,i;for(h in d)i=g[h],i.link(b,c,e,f,a)}}}}}]),a.fn.orig={};var j={}}(a,b),function(a,b){function d(a,b){return function(c){var d=Array.prototype.slice.call(arguments);d.unshift(a),d.push(c);for(var e=0;e<b.length;e++)b[e].apply(this,d)}}function g(a,c){var d=b(a).closest("label"),e=b(a).closest("form,fieldset,:jqmData(role='page'),:jqmData(role='dialog')");e.length===0&&(e=a.parent());var f=d.length?d:e.find("label").filter("[for='"+a[0].id+"']"),g=b("<div></div>").insertBefore(a).append(a).append(f);return u(a,a.parent()),g}function h(a,c,d){var e=b.fn.wrapAll,f=c.children("input"),g=c;return s(b.fn,{wrapAll:function(a,c,d){var e=d[0];if(c[0]===f[0]){b.fn.wrapAll=a;var h=b(e);return g[0].className=h[0].className,f}return a.apply(c,d)}},function(){return a.apply(f,d)})}function i(a,b){a.wrapAll("<div></div>");var c=a.parent();return u(a,c),c}function j(a,b,c){var d=b.children().eq(0);a.apply(d,c)}function k(a,c){var d=b("<div></div>").text(a.text()||a.val()).insertBefore(a).append(a);return u(a,d),d}function l(a,c,d){var e=c,f=c.children().eq(0);return s(b.fn,{text:function(a,c,d){return d.length>0?(b.fn.text=a,e):a.apply(c,d)},insertBefore:function(a,b,c){var d=c[0];return b[0]===e[0]&&d[0]===f[0]?e:a.apply(b,c)}},function(){return a.apply(f,d)})}function m(a,c){var d=b("<div></div>").insertBefore(a).append(a);return u(a,d),d}function n(a,c,d){var e=c,f=c.children().eq(0);return s(b.fn,{wrap:function(a,c,d){var g=d[0];if(c[0]===f[0]){b.fn.wrap=a;var h=b(g);return e[0].className=h[0].className,f}return a.apply(c,d)}},function(){return a.apply(f,d)})}function o(a,c){if(!a.is("[type='search'],:jqmData(type='search')"))return a;var d=b("<div></div>").insertBefore(a).append(a);return u(a,d),d}function p(a,c,d){if(c[0].nodeName.toUpperCase()!=="DIV")return a.apply(c,d);var e=c,f=c.children().eq(0);return s(b.fn,{wrap:function(a,c,d){var g=d[0];if(c[0]===f[0]){b.fn.wrap=a;var h=b(g);return e[0].className=h[0].className,f}return a.apply(c,d)}},function(){return a.apply(f,d)})}function q(a,c){var d=b.mobile.dialog.prototype.options,e=a,f=b("<a href='#' data-"+b.mobile.ns+"icon='delete' data-"+b.mobile.ns+"iconpos='notext'>"+d.closeBtnText+"</a>"),g=b("<div/>",{role:"dialog","class":"ui-dialog-contain ui-corner-all ui-overlay-shadow"});return e.wrapInner(g).children().find(":jqmData(role='header')").prepend(f).end().children(":first-child").addClass("ui-corner-top").end().children(":last-child").addClass("ui-corner-bottom"),e.data("headerCloseButton",f),e}function r(a,c,d){return s(b.fn,{init:function(a,b,d){var e=d[0];return e&&e.indexOf&&e.indexOf("<a href='#' data-")===0?c.data("headerCloseButton"):a.apply(b,d)},wrapInner:function(a,d,e){return d[0]===c[0]?b():a.apply(d,e)}},function(){return a.apply(c,d)})}function s(a,b,c){function e(c){var e=d[c]=a[c];a[c]=function(){return b[c](e,this,arguments)},a[c].prototype=e.prototype}var d={},f;for(f in b)e(f);try{return c()}finally{for(f in d)a[f]=d[f]}}function u(a,b){var c=[],d=a[0],e=b[0],f=d.attributes,g=f&&f.length;if(g)for(var h,i,j=g-1;j>=0;j--)h=f[j],i=h.name,t.test(i)&&(d.removeAttributeNode(h),e.setAttributeNode(h));var k="",l=d.className,m;l&&(l=l.replace(/[^;]+;?/,function(a){return t.test(a)?(k+=a,""):a})),k&&(e.className=k,d.className=l)}function v(a,b,c,d,e){d.$observe("disabled",function(b){b?c[a]("disable"):c[a]("enable")})}function w(a,b,c,d,e,f){var g=f.get("$parse");if(d.collapsed){var h=g(d.collapsed),i=h.assign;b.$watch(h,function(a){a?c.trigger("collapse"):c.trigger("expand")}),c.bind("collapse",function(){b.$apply(function(){i(b,!0)})}),c.bind("expand",function(){b.$apply(function(){i(b,!1)})})}}function x(a,b,c,d,e){d.$observe("checked",function(d){C(a,b,c,"refresh")})}function y(a,b,c){var d="_listeners"+b;if(!a[d]){a[d]=[];var e=a[b];a[b]=function(){var b=e.apply(this,arguments);for(var c=0;c<a[d].length;c++)a[d][c]();return b}}a[d].push(c)}function z(a,b,c,d,e){var f=e[0];f&&y(f,"$render",function(){C(a,b,c,"refresh")})}function A(a,b,c,d,e){c.bind("$childrenChanged",function(){C(a,b,c,{})})}function B(a,b,c,d,e){c.bind("$childrenChanged",function(){C(a,b,c,"refresh")})}function C(a,b,c,d){var e="_refresh"+a,f=(c.data(e)||0)+1;c.data(e,f),b.$evalAsync(function(){c.data(e)===f&&c[a](d)})}var c={checkboxradio:{handlers:[v,z,x],precompile:g,create:h},button:{handlers:[v],precompile:k,create:l},collapsible:{handlers:[v,w]},textinput:{handlers:[v],precompile:o,create:p},slider:{handlers:[v,z],precompile:i,create:j},listview:{handlers:[B]},collapsibleset:{handlers:[B]},selectmenu:{handlers:[v,z,B],precompile:m,create:n},controlgroup:{handlers:[A]},navbar:{handlers:[B]},dialog:{handlers:[],precompile:q,create:r},fixedtoolbar:{handlers:[]}},e;for(var f in c)e=c[f],e.link=d(f,e.handlers),b.mobile.registerJqmNgWidget(f,e);var t=/(^|[\W])(repeat|switch-when|if)($|[\W])/;b.mobile.moveCloningDirectives=u}(b,a),function(a,b){function f(b){var c={},d,e;return a.forEach((b||"").split("&"),function(b){b&&(d=b.split("="),e=decodeURIComponent(d[0]),c[e]=a.isDefined(d[1])?decodeURIComponent(d[1]):!0)}),c}function g(a,b){return encodeURIComponent(a).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(b?null:/%20/g,"+")}function h(a){var b=a.split("/"),c=b.length;while(c--)b[c]=i(b[c]);return b.join("/")}function i(a){return g(a,!0).replace(/%26/gi,"&").replace(/%3D/gi,"=").replace(/%2B/gi,"+")}function j(b){var c=[];return a.forEach(b,function(a,b){c.push(g(b,!0)+(a===!0?"":"="+g(a,!0)))}),c.length?c.join("&"):""}function k(a){return parseInt(a,10)}function l(a,b){var d=c.exec(a);return d={protocol:d[1],host:d[3],port:k(d[5])||e[d[1]]||null,path:d[6]||"/",search:d[8],hash:d[10]},b&&(b.$$protocol=d.protocol,b.$$host=d.host,b.$$port=d.port),d}function m(a,b,c){return a+"://"+b+(c==e[a]?"":":"+c)}function n(a,b){a.$$parse=function(a){var b=l(a,this);this.$$path=decodeURIComponent(b.path),this.$$search=f(b.search),this.$$hash=b.hash&&decodeURIComponent(b.hash)||"",this.$$compose()},a.$$compose=function(){var a=j(this.$$search),b=this.$$hash?"#"+h(this.$$hash):"";this.$$url=h(this.$$path)+(a?"?"+a:"")+b,this.$$absUrl=m(this.$$protocol,this.$$host,this.$$port)+this.$$url},a.$$rewriteAppUrl=function(a){return null},a.$$parse(b)}function o(a){if(a.isMock)return;var c=!1,d=a.onUrlChange,e;a.onUrlChange=function(a){var f;if(!c){var g=b.fn.bind;b.fn.bind=function(a,b){e=b};var f=d(a);b.fn.bind=g;var h=b.mobile._handleHashChange;b.mobile._handleHashChange=function(a){e(),h(a)};var i=b.mobile.path.set;b.mobile.path.set=function(a){var b=i.apply(this,arguments);return e(),b};if(window.history){var j=history.replaceState;history.replaceState=function(){var a=j.apply(this,arguments);return e(),a}}c=!0}else f=d(a);return f}}var c=/^([^:]+):\/\/(\w+:{0,1}\w*@)?([\w\.-]*)(:([0-9]+))?(\/[^\?#]*)?(\?([^#]*))?(#(.*))?$/,d=/^([^\?#]*)?(\?([^#]*))?(#(.*))?$/,e={http:80,https:443,ftp:21},p=a.module("ng");p.config(["$provide","$locationProvider",function(a,b){a.decorator("$browser",["$sniffer","$delegate",function(a,c){return b.jqmCompatMode()&&(a.history=!1,o(c)),c}])}]),p.config(["$locationProvider",function(c){var d=!0;c.jqmCompatMode=function(b){return a.isDefined(b)?(d=b,this):d};var e=c.$get;c.$get=["$injector","$browser",function(a,f){if(d){var g=f.url;f.url=function(){return g.call(this)};var h=a.invoke(e,c);return f.url=g,n(h,f.url()),h}return b.mobile.pushStateEnabled=!1,b.mobile.hashListeningEnabled=!1,b.mobile.linkBindingEnabled=!1,b.mobile.changePage.defaults.changeHash=!1,a.invoke(e,c)}]}])}(b,a),function(a,b){function c(a,b){if(!!a^!!b)return!1;for(var c in a)if(b[c]!==a[c])return!1;for(var c in b)if(b[c]!==a[c])return!1;return!0}function d(a){if(!a)return a;var b;a.length?b=[]:b={};for(var c in a)b[c]=a[c];return b}var e=b.module("ng");e.directive("ngRepeat",function(){return{priority:1e3,compile:function(a,b,e){return{pre:function(a,b,e){var f=e.ngRepeat,g=f.match(/^.+in\s+(.*)\s*$/);if(!g)throw Error("Expected ngRepeat in form of '_item_ in _collection_' but got '"+f+"'.");var h=g[1],i,j=0;a.$watch(function(){var b=a.$eval(h);return c(b,i)||(i=d(b),j++),j},function(){b.parent().trigger("$childrenChanged")})}}}}})}(a,b),function(a,b){function c(a){var b=[];for(var c in a)a.hasOwnProperty(c)&&b.push(c);return b.sort()}var d=/^\s*(.*?)(?:\s+as\s+(.*?))?(?:\s+group\s+by\s+(.*))?\s+for\s+(?:([\$\w][\$\w\d]*)|(?:\(\s*([\$\w][\$\w\d]*)\s*,\s*([\$\w][\$\w\d]*)\s*\)))\s+in\s+(.*)$/,e=b.module("ng");e.directive("ngOptions",["$parse",function(a){return{require:["select","?ngModel"],link:function(b,e,f,g){function p(){var a=[],d,e=o(b)||[],f=l?c(e):e,g,h,i={};for(h=0;g=f.length,h<g;h++){var n=e[h];i[k]=e[l?i[l]=f[h]:h],d=m(b,i),a.push({id:l?f[h]:h,label:j(b,i),optionGroup:d})}return a}if(!g[1])return;var h,i=f.ngOptions;if(!(h=i.match(d)))throw Error("Expected ngOptions in form of '_select_ (as _label_)? for (_key_,)?_value_ in _collection_' but got '"+i+"'.");var j=a(h[2]||h[1]),k=h[4]||h[6],l=h[5],m=a(h[3]||""),n=a(h[2]?h[1]:k),o=a(h[7]);b.$watch(p,function(){e.trigger("$childrenChanged")},!0)}}}])}(a,b),function(a){var b=a.module("ng");b.directive("option",["$interpolate",function(a){return{restrict:"E",compile:function(b,c){var d=a(b.text(),!0),e=a(b.attr("value"),!0);return function(a,b,c){a.$watch(d,function(){b.trigger("$childrenChanged")}),a.$watch(e,function(){b.trigger("$childrenChanged")})}}}}])}(b),function(b){var c=b.module("ng");c.directive("li",function(){return{restrict:"E",compile:function(b,c){return function(b,c,d){c.bind("$childrenChanged",function(){c.removeClass("ui-li");var b=c.data("buttonElements");if(b){var d=b.text;while(d.firstChild)c[0].appendChild(d.firstChild);a(b.inner).remove()}c.removeData("buttonElements")})}}}})}(b),function(a){var b=a.module("ng");b.directive("ngSwitch",function(){return{restrict:"EA",compile:function(a,b){var c=b.ngSwitch||b.on;return function(a,b){a.$watch(c,function(a){b.trigger("$childrenChanged")})}}}})}(b),function(a){var b=a.module("ng");b.directive("ngInclude",function(){return{restrict:"ECA",compile:function(a,b){var c=b.ngInclude||b.src;return function(a,b){a.$watch(c,function(a){b.trigger("$childrenChanged")}),a.$on("$includeContentLoaded",function(){b.trigger("$childrenChanged")})}}}})}(b),function(a,b){function d(){return{restrict:"E",require:"?ngModel",compile:function(a,b){var c=a.attr("type");return{pre:function(a,b,d,e){if(!e)return;var f=[];c==="date"&&f.push("blur"),f.push("change");var g=b.bind;b.bind=function(a,b){if(a.indexOf("input")!=-1||a.indexOf("change")!=-1)for(var c=0;c<f.length;c++){var d=f[c];a.indexOf(d)===-1&&(a+=" "+d)}return g.call(this,a,b)}}}}}}var c=b.module("ng");c.directive("input",d),c.directive("textarea",d)}(a,b),function(a){var b={transclude:"element",priority:1e3,terminal:!0,compile:function(a,b,c){return function(a,b,d){b[0].doNotMove=!0;var e=d.ngmIf,f,g;a.$watch(e,function(d){f&&(f.remove(),f=null),g&&g.$destroy(),d&&(g=a.$new(),c(g,function(a){f=a,b.after(a)})),b.parent().trigger("$childrenChanged")})}}},c=a.module("ng");c.directive("ngmIf",function(){return b})}(b),function(a){function c(a,b,c,d){b.bind(c,function(e){var f=a.$apply(d,b);c.charAt(0)=="v"&&e.preventDefault()})}function d(a,d){b.directive(a,function(){return function(b,e,f){var g=f[a];c(b,e,d,g)}})}var b=a.module("ng"),e=["tap","taphold","swipe","swiperight","swipeleft","vmouseover","vmouseout","vmousedown","vmousemove","vmouseup","vclick","vmousecancel","orientationchange","scrollstart","scrollend","pagebeforeshow","pagebeforehide","pageshow","pagehide"],f,g,h;for(h=0;h<e.length;h++)f=e[h],g="ngm"+f.substring(0,1).toUpperCase()+f.substring(1),d(g,f)}(b),function(a,b){function c(a){var b=a.indexOf(":");return b===-1?[a]:[a.substring(0,b),a.substring(b+1)]}function d(){var b;a(document).on("pagebeforechange",function(a,c){typeof c.toPage=="object"&&(b=c.toPage)});var c=a.mobile.urlHistory,d=c.addNew;c.addNew=function(){var a=d.apply(this,arguments),e=c.stack[c.stack.length-1];return e.pageId=b.attr("id"),a}}function e(b){var c=a.mobile.urlHistory,d=c.activeIndex,e=a.mobile.urlHistory.stack;for(var f=e.length-1;f>=0;f--)if(f!==d&&e[f].pageId===b)return f-d;return undefined}function f(b,c){b&&a(document).one("pagebeforechange",function(d,e){function h(){var a=g.scope();a[b].apply(a,c)}var f=a.mobile.path.parseUrl(e.toPage),g=a("#"+f.hash.substring(1));if(!g.data("page")){g.one("pagecreate",h);return}h()})}function g(b,d){var g=Array.prototype.slice.call(arguments,2);f(d,g);var i;typeof b=="object"&&(i=b,b=i.target);var j=c(b),k=!1;j.length===2&&j[0]==="back"?(k=!0,b=j[1]):j.length===2&&(i={transition:j[0]},b=j[1]);if(b==="back"){window.history.go(-1);return}k?a.mobile.loadPage(b,{showLoadMsg:!0}).then(function(a,c,d){var f=e(d.attr("id"));f!==undefined?window.history.go(f):h(b,{reverse:!0})}):h(b,i)}function h(b,c){c?a.mobile.changePage(b,c):a.mobile.changePage(b)}d();var i=b.module("ng");return i.factory("$navigate",function(){return g}),g}(a,b),function(a){function c(a){return a[b]=a[b]||{}}function d(a,b,d,e){var f=c(a),g=f[b];return g||(g=a.$new(),d(b,{$scope:g}),f[b]=g,g.$$referenceCount=0),g.$$referenceCount++,e.bind("$destroy",function(){g.$$referenceCount--,g.$$referenceCount===0&&(g.$destroy(),delete f[b])}),g}function e(a){var b=/([^\s,:]+)\s*:\s*([^\s,:]+)/g,c,d=!1,e={};while(c=b.exec(a))d=!0,e[c[1]]=c[2];if(!d)throw"Expression "+a+" needs to have the syntax <name>:<controller>,...";return e}var b="$$sharedControllers",f=a.module("ng");f.directive("ngmSharedController",["$controller",function(a){return{scope:!0,compile:function(b,c){var f=c.ngmSharedController,g=e(f),h=function(c){for(var e in g)c[e]=d(c.$root,g[e],a,b)};return{pre:h}}}}])}(b),function(a,b){function d(a){var b=c[c.length-1];b.callback&&o.$apply(function(){b.callback.apply(this,arguments)}),a.preventDefault()}function f(){if(!e||e.length==0)e=a(".ui-loader"),e.bind("vclick",d)}function g(){f();if(c.length>0){var b=c[c.length-1],d=b.msg,e=a.mobile.loadingMessage,g=a.mobile.loadingMessageTextVisible;d&&(a.mobile.loadingMessage=d,a.mobile.loadingMessageTextVisible=!0),a.mobile.showPageLoadingMsg(),a.mobile.loadingMessageTextVisible=g,a.mobile.loadingMessage=e}else a.mobile.hidePageLoadingMsg()}function h(){var a,b;typeof arguments[0]=="string"&&(a=arguments[0]),typeof arguments[0]=="function"&&(b=arguments[0]),typeof arguments[1]=="function"&&(b=arguments[1]),c.push({msg:a,callback:b}),g()}function i(){c.pop(),g()}function j(a,b){a.then(b,b)}function k(a,b){h(b),j(a,function(){i()})}function l(b,c,d){d||(d=a.mobile.loadingMessageWithCancel),h(d,function(){b.reject(c)}),j(b.promise,function(){i()})}var c=[],e;a.mobile.loadingMessageWithCancel||(a.mobile.loadingMessageWithCancel="Loading. Click to cancel."),a("div").live("pageshow",function(a,b){g()});var m={show:h,hide:i,waitFor:k,waitForWithCancel:l},n=b.module("ng"),o;return n.factory("$waitDialog",["$rootScope",function(a){return o=a,m}]),m}(a,b),function(a,b){function c(a){return function(b,c,d){if(!b)return b;if(!c)throw new Error("Missing pager property");var e=this,f=e[c];f||(f=e[c]={loadMore:function(){this.loadMoreCalled=!0}});var g=d?+d:a,h=f.endIndex||g;return f.loadMoreCalled&&(f.loadMoreCalled=!1,h+=g),h>=b.length&&(h=b.length),h<g&&(h=g),f.hasMore=h<b.length,f.endIndex=h,f.cache=b.slice(0,h),f.cache}}c.$inject=["defaultListPageSize"];var d=b.module(["ng"]);d.constant("defaultListPageSize",10),d.filter("paged",c)}(a,b)})
+(function(e){typeof define=="function"&&define.amd?define(["jquery","angular","jquery.mobile"],e):e(window.jQuery,window.angular)})(function(e,t){(function(e){function t(e,t,n){var r=e[t];e[t]=function(){return n(r,this,arguments)}}t(e.mobile.selectmenu.prototype,"destroy",function(e,t,n){e.apply(t,n);var r=t.menuPage,i=t.screen,s=t.listbox;r&&r.remove(),i&&i.remove(),s&&s.remove()}),e.mobile.selectmenu.prototype.placeholder="",t(e.mobile.listview.prototype,"destroy",function(t,n,r){var i=n.element.attr("id"),s=new RegExp(e.mobile.subPageUrlKey+"="+i+"-"),o=n.childPages();t.apply(n,r);for(var u=0;u<o.length;u++){var a=e(o[u]),f=a.attr("data-url");f.match(s)&&a.remove()}}),t(e.mobile.listview.prototype,"refresh",function(e,t,n){return t.element.filter(":visible").length===0?e.call(t,!0):e.apply(t,n)}),e.fn.controlgroup&&e(document).bind("pagecreate create",function(t){e(":jqmData(role='controlgroup')",t.target).jqmEnhanceable().controlgroup({excludeInvisible:!1})}),t(e.fn,"controlgroup",function(e,t,n){if(t.filter(":visible").length===0){var r=n[0]||{};return r.excludeInvisible=!1,e.call(t,r)}return e.apply(t,n)});var n=e.fn.collapsible,r="ui-collapsible-content";e.fn.collapsible=function(){var e=this.find(".ui-collapsible-content");e.removeClass(r);try{return n.apply(this,arguments)}finally{e.addClass(r)}},t(e.mobile.navbar.prototype,"_create",function(t,n,r){var i=e.fn.find,s=n.element,o;e.fn.find=function(e){var t=i.apply(this,arguments);return e==="a"&&s.data("$navbtns",t),t};try{return t.apply(n,r)}finally{e.fn.find=i}}),e.mobile.navbar.prototype.refresh=function(){var t=this.element,n=t.data("$navbtns");n.splice(0,n.length),e.each(t.find("a"),function(e,t){n.push(t)});var r=n.filter(":jqmData(icon)").length?this.options.iconpos:undefined,i=t.find("ul"),s=i.children("li");i.removeClass(function(e,t){return(t.match(/\bui-grid-\S+/g)||[]).join(" ")}),s.removeClass(function(e,t){return(t.match(/\bui-block-\S+/g)||[]).join(" ")}),i.jqmEnhanceable().grid({grid:this.options.grid}),n.buttonMarkup({corners:!1,shadow:!1,inline:!0,iconpos:r})}})(e),function(e,t){function r(t,n){e.holdReady(!0);var r=t.nodeType===9?t:t.ownerDocument;s(r,function(){var r=i(t);r&&e(function(){n(r.appElement,r.module)}),e.holdReady(!1)})}function i(e){function u(e){e&&t.push(e)}var t=[e],r,i,s=["ng:app","ng-app","x-ng-app","data-ng-app"],o=/\sng[:\-]app(:\s*([\w\d_]+);?)?\s/;return n(s,function(t){s[t]=!0,u(document.getElementById(t)),t=t.replace(":","\\:"),e.querySelectorAll&&(n(e.querySelectorAll("."+t),u),n(e.querySelectorAll("."+t+"\\:"),u),n(e.querySelectorAll("["+t+"]"),u))}),n(t,function(e){if(!r){if(e.getAttribute){var t=e.getAttribute("id");n(s,function(n){t===n&&e.removeAttribute("id")})}if(e.className){var u=e.className.replace(/[^;]+;?/g,function(t){var n=" "+t+" ",s=o.exec(n);return s?(r=e,i=(s[2]||"").replace(/\s+/g,","),""):t});u?e.className=u:e.removeAttribute("class")}var a=[];n(e.attributes,function(t){!r&&s[t.name]&&(r=e,i=t.value,a.push(t))}),n(a,function(t){e.removeAttributeNode(t)})}}),r?{appElement:r,module:i?[i]:[]}:undefined}function s(e,t){function r(){return e.readyState==="complete"}function i(){n||(n=!0,t())}var n=!1;r()?i():e.attachEvent?(e.attachEvent("onreadystatechange",function(){i()}),window.attachEvent("onload",i)):(e.addEventListener("DOMContentLoaded",i,!1),window.addEventListener("load",i,!1))}var n=t.forEach;r(document,t.bootstrap),e.mobile.deferAngularBootstrap=r}(e,t),function(e,t){function r(t,n){var r=e("<div>"+t+"</div>");return n(r.contents()),r.html()}var n=t.module("ng");n.factory("$precompile",function(){return function(e){return e}}),n.config(["$provide",function(e){e.decorator("$compile",["$precompile","$delegate",function(e,t){return function(){return arguments[0]=e(arguments[0]),t.apply(this,arguments)}}])}]),n.config(["$compileProvider","$provide",function(e,t){var n={},i=e.directive;e.directive=function(e,t){var s=function(e,i){var s=i.invoke(t);return s.template?s.template=r(s.template,e):s.templateUrl&&(n[s.templateUrl]=!0),s};return i.call(this,e,["$precompile","$injector",s])},t.decorator("$http",["$q","$delegate","$precompile",function(e,t,i){var s=t.get;return t.get=function(e){var t=s.apply(this,arguments);if(n[e]){var o=t.success;t.success=function(e){var t=function(){var t=arguments[0];return arguments[0]=r(t,i),e.apply(this,arguments)};return o(t)}}return t},t}])}])}(e,t),function(e){var t=e.module("ng");t.config(["$provide",function(e){e.decorator("$rootScope",["$delegate",function(e){return e.$disconnect=function(){if(this.$root==this)return;var e=this.$parent;this.$$disconnected=!0,e.$$childHead==this&&(e.$$childHead=this.$$nextSibling),e.$$childTail==this&&(e.$$childTail=this.$$prevSibling),this.$$prevSibling&&(this.$$prevSibling.$$nextSibling=this.$$nextSibling),this.$$nextSibling&&(this.$$nextSibling.$$prevSibling=this.$$prevSibling),this.$$nextSibling=this.$$prevSibling=null},e.$reconnect=function(){if(this.$root==this)return;var e=this;if(!e.$$disconnected)return;var t=e.$parent;e.$$disconnected=!1,e.$$prevSibling=t.$$childTail,t.$$childHead?(t.$$childTail.$$nextSibling=e,t.$$childTail=e):t.$$childHead=t.$$childTail=e},e}])}])}(t),function(e){var t=e.module("ng");t.config(["$provide",function(e){e.decorator("$rootScope",["$delegate",function(e){var t=e.$apply;e.$apply=function(){return e.$$phase?e.$eval.apply(this,arguments):t.apply(this,arguments)};var n=!1,r=e.$digest;return e.$digest=function(){if(e.$$phase)return;var t=r.apply(this,arguments)},e}])}])}(t),function(e,t){function s(e,t){if(!e.parentNode)return t();while(e.parentNode&&e.parentNode.nodeType===1)e=e.parentNode;var n=e.parentNode;n!==document&&document.documentElement.appendChild(e);try{return t()}finally{n!==document&&n.appendChild(e)}}function u(t,n){a(t,function(){if(h()){var r=Array.prototype.slice.call(arguments),i=this;for(var s=0;s<i.length;s++){var o=i.eq(s),u=o;n&&(u=n(o,r)||u);var a=u.attr("ngm-create")||"{}",f=JSON.parse(a);f[t]=r,u.attr("ngm-create",JSON.stringify(f));var l=o.attr("ngm-link")||"{}",p=JSON.parse(l);p[t]=!0,o.attr("ngm-link",JSON.stringify(p))}}return c()?!1:e.fn.orig[t].apply(this,arguments)})}function a(t,n){e.fn.orig[t]=e.fn.orig[t]||e.fn[t],e.fn[t]=n}function l(e,t){if(!t)return f[e];var n=f[e];f[e]=!0;var r=t();return f[e]=n,r}function c(e){return l("preventJqmWidgetCreation",e)}function h(e){return l("markJqmWidgetCreation",e)}function p(t){c(function(){var n=e.mobile.page.prototype.widgetEventPrefix;e.mobile.page.prototype.widgetEventPrefix="noop",t.page(),e.mobile.page.prototype.widgetEventPrefix=n})}var n=t.module("ng");e("div").live("pagebeforeshow",function(t,n){var r=e(t.target),i=r.scope();i&&i.$root.$digest()}),e.mobile.autoInitializePage=!1;var r=[],i=!1;n.config(["$provide",function(t){t.decorator("$rootScope",["$delegate",function(t){var n=t.$digest,s;return t.$digest=function(){if(this===t){var o=e.mobile.activePage,u=o&&o.scope();s&&s!==u&&s.$disconnect(),s=u,u&&u.$reconnect()}var a=n.apply(this,arguments);if(this===t){var f=r.length;while(r.length){var l=r.shift();l.$disconnect()}f&&!i&&(i=!0,e.mobile.initializePage())}return a},t}])}]),n.factory("$precompile",function(){var e=':jqmData(role="page"), :jqmData(role="dialog")';return function(t){var n=t[0].parentNode;s(t[0],function(){var n=t.find(e).add(t.filter(e));n.attr("ngm-page","true"),h(function(){c(function(){n.length>0?n.page():t.parent().trigger("create")})}),n.page("destroy")});while(t[0].parentNode!==n)t=t.eq(0).parent();return t}}),n.directive("ngmPage",function(){return{restrict:"A",scope:!0,compile:function(e,t){return e.removeAttr("ngm-page"),{pre:function(e,t,n){p(t),r.push(e)}}}}}),n.run(["$rootScope","$compile",function(t,n){a("page",function(){return!c()&&!this.data("page")&&this.attr("data-"+e.mobile.ns+"external-page")&&n(this)(t),e.fn.orig.page.apply(this,arguments)})}]),e.mobile.registerJqmNgWidget=function(e,t){o[e]=t,u(e,t.precompile)};var o={};n.directive("ngmCreate",function(){return{restrict:"A",priority:0,compile:function(t,n){var r=JSON.parse(n.ngmCreate);return{post:function(t,n,i,s){var u,a,f,l;for(u in r)a=o[u],f=r[u],l=e.fn.orig[u],a.create?a.create(l,n,f):l.apply(n,f)}}}}}),n.directive("ngmLink",["$injector",function(e){return{restrict:"A",priority:0,require:["?ngModel"],compile:function(t,n){var r=JSON.parse(n.ngmLink);return{post:function(t,n,i,s){var u,a;for(u in r)a=o[u],a.link(t,n,i,s,e)}}}}}]),e.fn.orig={};var f={}}(e,t),function(e,t){function r(e,t){return function(n){var r=Array.prototype.slice.call(arguments);r.unshift(e),r.push(n);for(var i=0;i<t.length;i++)t[i].apply(this,r)}}function o(e,t,n){var r=t.children().eq(0);e.apply(r,n)}function u(e,n){var r=t(e).closest("label"),i=t(e).closest("form,fieldset,:jqmData(role='page'),:jqmData(role='dialog')");i.length===0&&(i=e.parent());var s=r.length?r:i.find("label").filter("[for='"+e[0].id+"']"),o=e.parent();o[0].tagName.toUpperCase()!=="FIELDSET"&&e.wrap("<fieldset></fieldset>");var u=e.parent();return u.append(s),b(e,u),u}function a(e,t,n){var r=t.children().eq(0);e.apply(r,n)}function f(e,t,n){var r=t.children().eq(0),i=r.contents(),s=h(e,t,n),o=t.find("span span");return o.empty(),o.append(i),s}function l(e,t){return e.is("[type='search'],:jqmData(type='search')")?c(e,t):e}function c(e,t){e.wrapAll("<div></div>");var n=e.parent();return b(e,n),n}function h(e,t,n){if(t[0].nodeName.toUpperCase()!=="DIV")return e.apply(t,n);if(v(e))return e.apply(t,n);var r=t.children().eq(0);return r.insertBefore(t),t.empty(),m(t,function(){return e.apply(r,n)})}function p(e,n){var r=t.mobile.dialog.prototype.options,i=t("<a href='#' data-"+t.mobile.ns+"icon='delete' data-"+t.mobile.ns+"iconpos='notext'>"+r.closeBtnText+"</a>");return e.find(":jqmData(role='header')").prepend(i),e.data("headerCloseButton",i),e}function d(e,t,n){if(v(e))return e.apply(t,n);var r=t.data("headerCloseButton");return m(r,function(){return e.apply(t,n)})}function v(e){return e.isSpy&&e.originalValue!==e.plan}function m(e,n){function u(e){if(e){var n=t(e),r=n[0].nodeName.toUpperCase(),i=o[r];if(i)return delete o[r],i[0].className+=" "+n[0].className,i}return!1}var r,i,s,o={};for(r=0;r<e.length;r++)i=e.eq(r),i[0].parentNode.removeChild(i[0]),s=i[0].nodeName.toUpperCase(),o[s]=i;var a=g(t.fn,{init:function(e,t,n){var r=n[0];if(typeof r=="string"&&r.charAt(0)==="<"){var i=u(r);if(i)return i}return e.apply(t,n)},wrap:function(e,t,n){var r=n[0],i=u(r);return i?(i.insertBefore(t),i.append(t),t):e.apply(t,n)},wrapAll:function(e,t,n){var r=n[0],i=u(r);return i?(i.insertBefore(t),i.append(t),t):e.apply(t,n)}},n);for(s in o)throw new Error("existing element with tagName "+s+" was not used!");return a}function g(e,t,n){function s(n){var s=r[n]=e[n];s.restore=function(){e[n]=s,delete s.restore},e[n]=function(){if(i)return s.apply(this,arguments);i++;try{return t[n](s,this,arguments)}finally{i--}},e[n].prototype=s.prototype}var r={},i=0,o;for(o in t)s(o);try{return n()}finally{for(o in r)r[o].restore&&r[o].restore()}}function b(e,t){var n=[],r=e[0],i=t[0],s=r.attributes,o=s&&s.length;if(o)for(var u,a,f=o-1;f>=0;f--)u=s[f],a=u.name,y.test(a)&&(r.removeAttributeNode(u),i.setAttributeNode(u));var l="",c=r.className,h;c&&(c=c.replace(/[^;]+;?/,function(e){return y.test(e)?(l+=e,""):e})),l&&(i.className=l,r.className=c)}function w(e,t,n,r,i){r.$observe("disabled",function(t){t?n[e]("disable"):n[e]("enable")})}function E(e,t,n,r,i,s){var o=s.get("$parse");if(r.collapsed){var u=o(r.collapsed),a=u.assign;t.$watch(u,function(e){e?n.trigger("collapse"):n.trigger("expand")}),n.bind("collapse",function(){t.$apply(function(){a(t,!0)})}),n.bind("expand",function(){t.$apply(function(){a(t,!1)})})}}function S(e,t,n,r,i){r.$observe("checked",function(r){k(e,t,n,"refresh")})}function x(e,t,n){var r="_listeners"+t;if(!e[r]){e[r]=[];var i=e[t];e[t]=function(){var t=i.apply(this,arguments);for(var n=0;n<e[r].length;n++)e[r][n]();return t}}e[r].push(n)}function T(e,t,n,r,i){var s=i[0];s&&x(s,"$render",function(){k(e,t,n,"refresh")})}function N(e,t,n,r,i){n.bind("$childrenChanged",function(){k(e,t,n,{})})}function C(e,t,n,r,i){n.bind("$childrenChanged",function(){k(e,t,n,"refresh")})}function k(e,t,n,r){var i="_refresh"+e,s=(n.data(i)||0)+1;n.data(i,s),t.$evalAsync(function(){n.data(i)===s&&n[e](r)})}var n={checkboxradio:{handlers:[w,T,S],precompile:u,create:a},button:{handlers:[w],precompile:c,create:f},collapsible:{handlers:[w,E]},textinput:{handlers:[w],precompile:l,create:h},slider:{handlers:[w,T],precompile:c,create:o},listview:{handlers:[C]},collapsibleset:{handlers:[C]},selectmenu:{handlers:[w,T,C],precompile:c,create:h},controlgroup:{handlers:[N]},navbar:{handlers:[C]},dialog:{handlers:[],precompile:p,create:d},fixedtoolbar:{handlers:[]}},i;for(var s in n)i=n[s],i.link=r(s,i.handlers),t.mobile.registerJqmNgWidget(s,i);var y=/(^|[\W])(repeat|switch-when|if)($|[\W])/;t.mobile.moveCloningDirectives=b}(t,e),function(e,t){function s(t){var n={},r,i;return e.forEach((t||"").split("&"),function(t){t&&(r=t.split("="),i=decodeURIComponent(r[0]),n[i]=e.isDefined(r[1])?decodeURIComponent(r[1]):!0)}),n}function o(e,t){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(t?null:/%20/g,"+")}function u(e){var t=e.split("/"),n=t.length;while(n--)t[n]=a(t[n]);return t.join("/")}function a(e){return o(e,!0).replace(/%26/gi,"&").replace(/%3D/gi,"=").replace(/%2B/gi,"+")}function f(t){var n=[];return e.forEach(t,function(e,t){n.push(o(t,!0)+(e===!0?"":"="+o(e,!0)))}),n.length?n.join("&"):""}function l(e){return parseInt(e,10)}function c(e,t){var r=n.exec(e);return r={protocol:r[1],host:r[3],port:l(r[5])||i[r[1]]||null,path:r[6]||"/",search:r[8],hash:r[10]},t&&(t.$$protocol=r.protocol,t.$$host=r.host,t.$$port=r.port),r}function h(e,t,n){return e+"://"+t+(n==i[e]?"":":"+n)}function p(e,t){e.$$parse=function(e){var t=c(e,this);this.$$path=decodeURIComponent(t.path),this.$$search=s(t.search),this.$$hash=t.hash&&decodeURIComponent(t.hash)||"",this.$$compose()},e.$$compose=function(){var e=f(this.$$search),t=this.$$hash?"#"+u(this.$$hash):"";this.$$url=u(this.$$path)+(e?"?"+e:"")+t,this.$$absUrl=h(this.$$protocol,this.$$host,this.$$port)+this.$$url},e.$$rewriteAppUrl=function(e){return null},e.$$parse(t)}function d(e){if(e.isMock)return;var n=!1,r=e.onUrlChange,i;e.onUrlChange=function(e){var s;if(!n){var o=t.fn.bind;t.fn.bind=function(e,t){i=t};var s=r(e);t.fn.bind=o;var u=t.mobile._handleHashChange;t.mobile._handleHashChange=function(e){i(),u(e)};var a=t.mobile.path.set;t.mobile.path.set=function(e){var t=a.apply(this,arguments);return i(),t};if(window.history){var f=history.replaceState;history.replaceState=function(){var e=f.apply(this,arguments);return i(),e}}n=!0}else s=r(e);return s}}var n=/^([^:]+):\/\/(\w+:{0,1}\w*@)?([\w\.-]*)(:([0-9]+))?(\/[^\?#]*)?(\?([^#]*))?(#(.*))?$/,r=/^([^\?#]*)?(\?([^#]*))?(#(.*))?$/,i={http:80,https:443,ftp:21},v=e.module("ng");v.config(["$provide","$locationProvider",function(e,t){e.decorator("$browser",["$sniffer","$delegate",function(e,n){return t.jqmCompatMode()&&(e.history=!1,d(n)),n}])}]),v.config(["$locationProvider",function(n){var r=!0;n.jqmCompatMode=function(t){return e.isDefined(t)?(r=t,this):r};var i=n.$get;n.$get=["$injector","$browser",function(e,s){if(r){var o=s.url;s.url=function(){return o.call(this)};var u=e.invoke(i,n);return s.url=o,p(u,s.url()),u}return t.mobile.pushStateEnabled=!1,t.mobile.hashListeningEnabled=!1,t.mobile.linkBindingEnabled=!1,t.mobile.changePage.defaults.changeHash=!1,e.invoke(i,n)}]}])}(t,e),function(e,t){function n(e,t){if(!!e^!!t)return!1;for(var n in e)if(t[n]!==e[n])return!1;for(var n in t)if(t[n]!==e[n])return!1;return!0}function r(e){if(!e)return e;var t;e.length?t=[]:t={};for(var n in e)t[n]=e[n];return t}var i=t.module("ng");i.directive("ngRepeat",function(){return{priority:1e3,compile:function(e,t,i){return{pre:function(e,t,i){var s=i.ngRepeat,o=s.match(/^.+in\s+(.*)\s*$/);if(!o)throw Error("Expected ngRepeat in form of '_item_ in _collection_' but got '"+s+"'.");var u=o[1],a,f=0;e.$watch(function(){var t=e.$eval(u);return n(t,a)||(a=r(t),f++),f},function(){t.parent().trigger("$childrenChanged")})}}}}})}(e,t),function(e,t){function n(e){var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(n);return t.sort()}var r=/^\s*(.*?)(?:\s+as\s+(.*?))?(?:\s+group\s+by\s+(.*))?\s+for\s+(?:([\$\w][\$\w\d]*)|(?:\(\s*([\$\w][\$\w\d]*)\s*,\s*([\$\w][\$\w\d]*)\s*\)))\s+in\s+(.*)$/,i=t.module("ng");i.directive("ngOptions",["$parse",function(e){return{require:["select","?ngModel"],link:function(t,i,s,o){function v(){var e=[],r,i=d(t)||[],s=c?n(i):i,o,u,a={};for(u=0;o=s.length,u<o;u++){var p=i[u];a[l]=i[c?a[c]=s[u]:u],r=h(t,a),e.push({id:c?s[u]:u,label:f(t,a),optionGroup:r})}return e}if(!o[1])return;var u,a=s.ngOptions;if(!(u=a.match(r)))throw Error("Expected ngOptions in form of '_select_ (as _label_)? for (_key_,)?_value_ in _collection_' but got '"+a+"'.");var f=e(u[2]||u[1]),l=u[4]||u[6],c=u[5],h=e(u[3]||""),p=e(u[2]?u[1]:l),d=e(u[7]);t.$watch(v,function(){i.trigger("$childrenChanged")},!0)}}}])}(e,t),function(e){var t=e.module("ng");t.directive("option",["$interpolate",function(e){return{restrict:"E",compile:function(t,n){var r=e(t.text(),!0),i=e(t.attr("value"),!0);return function(e,t,n){e.$watch(r,function(){t.trigger("$childrenChanged")}),e.$watch(i,function(){t.trigger("$childrenChanged")})}}}}])}(t),function(t){var n=t.module("ng");n.directive("li",function(){return{restrict:"E",compile:function(t,n){return function(t,n,r){n.bind("$childrenChanged",function(){n.removeClass("ui-li");var t=n.data("buttonElements");if(t){var r=t.text;while(r.firstChild)n[0].appendChild(r.firstChild);e(t.inner).remove()}n.removeData("buttonElements")})}}}})}(t),function(e){var t=e.module("ng");t.directive("ngSwitch",function(){return{restrict:"EA",compile:function(e,t){var n=t.ngSwitch||t.on;return function(e,t){e.$watch(n,function(e){t.trigger("$childrenChanged")})}}}})}(t),function(e){var t=e.module("ng");t.directive("ngInclude",function(){return{restrict:"ECA",compile:function(e,t){var n=t.ngInclude||t.src;return function(e,t){e.$watch(n,function(e){t.trigger("$childrenChanged")}),e.$on("$includeContentLoaded",function(){t.trigger("$childrenChanged")})}}}})}(t),function(e,t){function r(){return{restrict:"E",require:"?ngModel",compile:function(e,t){var n=e.attr("type");return{pre:function(e,t,r,i){if(!i)return;var s=[];n==="date"&&s.push("blur"),s.push("change");var o=t.bind;t.bind=function(e,t){if(e.indexOf("input")!=-1||e.indexOf("change")!=-1)for(var n=0;n<s.length;n++){var r=s[n];e.indexOf(r)===-1&&(e+=" "+r)}return o.call(this,e,t)}}}}}}var n=t.module("ng");n.directive("input",r),n.directive("textarea",r)}(e,t),function(e){var t={transclude:"element",priority:1e3,terminal:!0,compile:function(e,t,n){return function(e,t,r){t[0].doNotMove=!0;var i=r.ngmIf,s,o;e.$watch(i,function(r){s&&(s.remove(),s=null),o&&o.$destroy(),r&&(o=e.$new(),n(o,function(e){s=e,t.after(e)})),t.parent().trigger("$childrenChanged")})}}},n=e.module("ng");n.directive("ngmIf",function(){return t})}(t),function(e){function n(e,t,n,r){t.bind(n,function(i){var s=e.$apply(r,t);n.charAt(0)=="v"&&i.preventDefault()})}function r(e,r){t.directive(e,function(){return function(t,i,s){var o=s[e];n(t,i,r,o)}})}var t=e.module("ng"),i=["tap","taphold","swipe","swiperight","swipeleft","vmouseover","vmouseout","vmousedown","vmousemove","vmouseup","vclick","vmousecancel","orientationchange","scrollstart","scrollend","pagebeforeshow","pagebeforehide","pageshow","pagehide"],s,o,u;for(u=0;u<i.length;u++)s=i[u],o="ngm"+s.substring(0,1).toUpperCase()+s.substring(1),r(o,s)}(t),function(e,t){function n(e){var t=e.indexOf(":");return t===-1?[e]:[e.substring(0,t),e.substring(t+1)]}function r(){var t;e(document).on("pagebeforechange",function(e,n){typeof n.toPage=="object"&&(t=n.toPage)});var n=e.mobile.urlHistory,r=n.addNew;n.addNew=function(){var e=r.apply(this,arguments);if(t){var i=n.stack[n.stack.length-1];i.pageId=t.attr("id")}return e}}function i(t){var n=e.mobile.urlHistory,r=n.activeIndex,i=e.mobile.urlHistory.stack;for(var s=i.length-1;s>=0;s--)if(s!==r&&i[s].pageId===t)return s-r;return undefined}function s(t,n){t&&e(document).one("pagebeforechange",function(r,i){function u(){var e=o.scope();e[t].apply(e,n)}var s=e.mobile.path.parseUrl(i.toPage),o=e("#"+s.hash.substring(1));if(!o.data("page")){o.one("pagecreate",u);return}u()})}function o(t,r){var o=Array.prototype.slice.call(arguments,2);s(r,o);var a;typeof t=="object"&&(a=t,t=a.target);var f=n(t),l=!1;f.length===2&&f[0]==="back"?(l=!0,t=f[1]):f.length===2&&(a={transition:f[0]},t=f[1]);if(t==="back"){window.history.go(-1);return}l?e.mobile.loadPage(t,{showLoadMsg:!0}).then(function(e,n,r){var s=i(r.attr("id"));s!==undefined?window.history.go(s):u(t,{reverse:!0})}):u(t,a)}function u(t,n){n?e.mobile.changePage(t,n):e.mobile.changePage(t)}r();var a=t.module("ng");return a.factory("$navigate",function(){return o}),o}(e,t),function(e){function n(e){return e[t]=e[t]||{}}function r(e,t,r,i){var s=n(e),o=s[t];return o||(o=e.$new(),r(t,{$scope:o}),s[t]=o,o.$$referenceCount=0),o.$$referenceCount++,i.bind("$destroy",function(){o.$$referenceCount--,o.$$referenceCount===0&&(o.$destroy(),delete s[t])}),o}function i(e){var t=/([^\s,:]+)\s*:\s*([^\s,:]+)/g,n,r=!1,i={};while(n=t.exec(e))r=!0,i[n[1]]=n[2];if(!r)throw"Expression "+e+" needs to have the syntax <name>:<controller>,...";return i}var t="$$sharedControllers",s=e.module("ng");s.directive("ngmSharedController",["$controller",function(e){return{scope:!0,compile:function(t,n){var s=n.ngmSharedController,o=i(s),u=function(n){for(var i in o)n[i]=r(n.$root,o[i],e,t)};return{pre:u}}}}])}(t),function(e,t){function n(t){function r(e){var r=n[n.length-1];r.callback&&t.$apply(function(){r.callback.apply(this,arguments)}),e.preventDefault()}function s(){if(n.length>0){var t=n[n.length-1],r=t.msg;r?e.mobile.loading("show",{text:r,textVisible:!!r}):e.mobile.loading("show")}else e.mobile.loading("hide")}function o(){var e,t;typeof arguments[0]=="string"&&(e=arguments[0]),typeof arguments[0]=="function"&&(t=arguments[0]),typeof arguments[1]=="function"&&(t=arguments[1]),n.push({msg:e,callback:t}),s()}function u(){n.pop(),s()}function a(e,t){e.then(t,t)}function f(e,t){o(t),a(e,function(){u()})}function l(t,n,r){r||(r=e.mobile.loader.prototype.options.textWithCancel),o(r,function(){t.reject(n)}),a(t.promise,function(){u()})}var n=[],i;return e(document).delegate(".ui-loader","vclick",r),e.mobile.loader.prototype.options.textWithCancel||(e.mobile.loader.prototype.options.textWithCancel="Loading. Click to cancel."),e("div").live("pageshow",function(e,t){s()}),{show:o,hide:u,waitFor:f,waitForWithCancel:l}}var r=t.module("ng");r.factory("$waitDialog",["$rootScope",n])}(e,t),function(e,t){function n(e){return function(t,n,r){if(!t)return t;if(!n)throw new Error("Missing pager property");var i=this,s=i[n];s||(s=i[n]={loadMore:function(){this.loadMoreCalled=!0}});var o=r?+r:e,u=s.endIndex||o;return s.loadMoreCalled&&(s.loadMoreCalled=!1,u+=o),u>=t.length&&(u=t.length),u<o&&(u=o),s.hasMore=u<t.length,s.endIndex=u,s.cache=t.slice(0,u),s.cache}}n.$inject=["defaultListPageSize"];var r=t.module(["ng"]);r.constant("defaultListPageSize",10),r.filter("paged",n)}(e,t)})
View
2  compiled/min/jquery-mobile-angular-adapter-standalone-1.1.2-SNAPSHOT.js
1 addition, 1 deletion not shown
View
1  node_modules/.bin/uglifyjs
View
6 node_modules/uglify-js/.npmignore
@@ -0,0 +1,6 @@
+.DS_Store
+.tmp*~
+*.local.*
+.pinf-*
+node_modules/
+npm-debug.log
View
1,012 node_modules/uglify-js/README.html
@@ -0,0 +1,1012 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+lang="en" xml:lang="en">
+<head>
+<title>UglifyJS &ndash; a JavaScript parser/compressor/beautifier</title>
+<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
+<meta name="generator" content="Org-mode"/>
+<meta name="generated" content="2012-08-27 12:38:12 EEST"/>
+<meta name="author" content="Mihai Bazon"/>
+<meta name="description" content="a JavaScript parser/compressor/beautifier in JavaScript"/>
+<meta name="keywords" content="javascript, js, parser, compiler, compressor, mangle, minify, minifier"/>
+<style type="text/css">
+ <!--/*--><![CDATA[/*><!--*/
+ html { font-family: Times, serif; font-size: 12pt; }
+ .title { text-align: center; }
+ .todo { color: red; }
+ .done { color: green; }
+ .tag { background-color: #add8e6; font-weight:normal }
+ .target { }
+ .timestamp { color: #bebebe; }
+ .timestamp-kwd { color: #5f9ea0; }
+ .right {margin-left:auto; margin-right:0px; text-align:right;}
+ .left {margin-left:0px; margin-right:auto; text-align:left;}
+ .center {margin-left:auto; margin-right:auto; text-align:center;}
+ p.verse { margin-left: 3% }
+ pre {
+ border: 1pt solid #AEBDCC;
+ background-color: #F3F5F7;
+ padding: 5pt;
+ font-family: courier, monospace;
+ font-size: 90%;
+ overflow:auto;
+ }
+ table { border-collapse: collapse; }
+ td, th { vertical-align: top; }
+ th.right { text-align:center; }
+ th.left { text-align:center; }
+ th.center { text-align:center; }
+ td.right { text-align:right; }
+ td.left { text-align:left; }
+ td.center { text-align:center; }
+ dt { font-weight: bold; }
+ div.figure { padding: 0.5em; }
+ div.figure p { text-align: center; }
+ div.inlinetask {
+ padding:10px;
+ border:2px solid gray;
+ margin:10px;
+ background: #ffffcc;
+ }
+ textarea { overflow-x: auto; }
+ .linenr { font-size:smaller }
+ .code-highlighted {background-color:#ffff00;}
+ .org-info-js_info-navigation { border-style:none; }
+ #org-info-js_console-label { font-size:10px; font-weight:bold;
+ white-space:nowrap; }
+ .org-info-js_search-highlight {background-color:#ffff00; color:#000000;
+ font-weight:bold; }
+ /*]]>*/-->
+</style>
+<link rel="stylesheet" type="text/css" href="docstyle.css" />
+<script type="text/javascript">
+<!--/*--><![CDATA[/*><!--*/
+ function CodeHighlightOn(elem, id)
+ {
+ var target = document.getElementById(id);
+ if(null != target) {
+ elem.cacheClassElem = elem.className;
+ elem.cacheClassTarget = target.className;
+ target.className = "code-highlighted";
+ elem.className = "code-highlighted";
+ }
+ }
+ function CodeHighlightOff(elem, id)
+ {
+ var target = document.getElementById(id);
+ if(elem.cacheClassElem)
+ elem.className = elem.cacheClassElem;
+ if(elem.cacheClassTarget)
+ target.className = elem.cacheClassTarget;
+ }
+/*]]>*///-->
+</script>
+
+</head>
+<body>
+
+<div id="preamble">
+
+</div>
+
+<div id="content">
+<h1 class="title">UglifyJS &ndash; a JavaScript parser/compressor/beautifier</h1>
+
+
+<div id="table-of-contents">
+<h2>Table of Contents</h2>
+<div id="text-table-of-contents">
+<ul>
+<li><a href="#sec-1">1 NEW: UglifyJS2 </a></li>
+<li><a href="#sec-2">2 UglifyJS &mdash; a JavaScript parser/compressor/beautifier </a>
+<ul>
+<li><a href="#sec-2-1">2.1 Unsafe transformations </a>
+<ul>
+<li><a href="#sec-2-1-1">2.1.1 Calls involving the global Array constructor </a></li>
+<li><a href="#sec-2-1-2">2.1.2 <code>obj.toString()</code> ==&gt; <code>obj+“”</code> </a></li>
+</ul>
+</li>
+<li><a href="#sec-2-2">2.2 Install (NPM) </a></li>
+<li><a href="#sec-2-3">2.3 Install latest code from GitHub </a></li>
+<li><a href="#sec-2-4">2.4 Usage </a>
+<ul>
+<li><a href="#sec-2-4-1">2.4.1 API </a></li>
+<li><a href="#sec-2-4-2">2.4.2 Beautifier shortcoming &ndash; no more comments </a></li>
+<li><a href="#sec-2-4-3">2.4.3 Use as a code pre-processor </a></li>
+</ul>
+</li>
+<li><a href="#sec-2-5">2.5 Compression &ndash; how good is it? </a></li>
+<li><a href="#sec-2-6">2.6 Bugs? </a></li>
+<li><a href="#sec-2-7">2.7 Links </a></li>
+<li><a href="#sec-2-8">2.8 License </a></li>
+</ul>
+</li>
+</ul>
+</div>
+</div>
+
+<div id="outline-container-1" class="outline-2">
+<h2 id="sec-1"><span class="section-number-2">1</span> NEW: UglifyJS2 </h2>
+<div class="outline-text-2" id="text-1">
+
+
+<p>
+I started working on UglifyJS's successor, version 2. It's almost a full
+rewrite (except for the parser which is heavily modified, everything else
+starts from scratch). I've detailed my reasons in the README, see the
+project page.
+</p>
+<p>
+<a href="https://github.com/mishoo/UglifyJS2">https://github.com/mishoo/UglifyJS2</a>
+</p>
+<p>
+Version 1 will continue to be maintained for fixing show-stopper bugs, but
+no new features should be expected.
+</p>
+<p>
+Please help me focus on version 2 by <a href="http://pledgie.com/campaigns/18110">making a donation</a>!
+</p>
+</div>
+
+</div>
+
+<div id="outline-container-2" class="outline-2">
+<h2 id="sec-2"><span class="section-number-2">2</span> UglifyJS &mdash; a JavaScript parser/compressor/beautifier </h2>
+<div class="outline-text-2" id="text-2">
+
+
+<p>
+This package implements a general-purpose JavaScript
+parser/compressor/beautifier toolkit. It is developed on <a href="http://nodejs.org/">NodeJS</a>, but it
+should work on any JavaScript platform supporting the CommonJS module system
+(and if your platform of choice doesn't support CommonJS, you can easily
+implement it, or discard the <code>exports.*</code> lines from UglifyJS sources).
+</p>
+<p>
+The tokenizer/parser generates an abstract syntax tree from JS code. You
+can then traverse the AST to learn more about the code, or do various
+manipulations on it. This part is implemented in <a href="../lib/parse-js.js">parse-js.js</a> and it's a
+port to JavaScript of the excellent <a href="http://marijn.haverbeke.nl/parse-js/">parse-js</a> Common Lisp library from <a href="http://marijn.haverbeke.nl/">Marijn Haverbeke</a>.
+</p>
+<p>
+( See <a href="http://github.com/mishoo/cl-uglify-js">cl-uglify-js</a> if you're looking for the Common Lisp version of
+UglifyJS. )
+</p>
+<p>
+The second part of this package, implemented in <a href="../lib/process.js">process.js</a>, inspects and
+manipulates the AST generated by the parser to provide the following:
+</p>
+<ul>
+<li>ability to re-generate JavaScript code from the AST. Optionally
+ indented&mdash;you can use this if you want to “beautify” a program that has
+ been compressed, so that you can inspect the source. But you can also run
+ our code generator to print out an AST without any whitespace, so you
+ achieve compression as well.
+
+</li>
+<li>shorten variable names (usually to single characters). Our mangler will
+ analyze the code and generate proper variable names, depending on scope
+ and usage, and is smart enough to deal with globals defined elsewhere, or
+ with <code>eval()</code> calls or <code>with{}</code> statements. In short, if <code>eval()</code> or
+ <code>with{}</code> are used in some scope, then all variables in that scope and any
+ variables in the parent scopes will remain unmangled, and any references
+ to such variables remain unmangled as well.
+
+</li>
+<li>various small optimizations that may lead to faster code but certainly
+ lead to smaller code. Where possible, we do the following:
+
+<ul>
+<li>foo["bar"] ==&gt; foo.bar
+
+</li>
+<li>remove block brackets <code>{}</code>
+
+</li>
+<li>join consecutive var declarations:
+ var a = 10; var b = 20; ==&gt; var a=10,b=20;
+
+</li>
+<li>resolve simple constant expressions: 1 +2 * 3 ==&gt; 7. We only do the
+ replacement if the result occupies less bytes; for example 1/3 would
+ translate to 0.333333333333, so in this case we don't replace it.
+
+</li>
+<li>consecutive statements in blocks are merged into a sequence; in many
+ cases, this leaves blocks with a single statement, so then we can remove
+ the block brackets.
+
+</li>
+<li>various optimizations for IF statements:
+
+<ul>
+<li>if (foo) bar(); else baz(); ==&gt; foo?bar():baz();
+</li>
+<li>if (!foo) bar(); else baz(); ==&gt; foo?baz():bar();
+</li>
+<li>if (foo) bar(); ==&gt; foo&amp;&amp;bar();
+</li>
+<li>if (!foo) bar(); ==&gt; foo||bar();
+</li>
+<li>if (foo) return bar(); else return baz(); ==&gt; return foo?bar():baz();
+</li>
+<li>if (foo) return bar(); else something(); ==&gt; {if(foo)return bar();something()}
+
+</li>
+</ul>
+
+</li>
+<li>remove some unreachable code and warn about it (code that follows a
+ <code>return</code>, <code>throw</code>, <code>break</code> or <code>continue</code> statement, except
+ function/variable declarations).
+
+</li>
+<li>act a limited version of a pre-processor (c.f. the pre-processor of
+ C/C++) to allow you to safely replace selected global symbols with
+ specified values. When combined with the optimisations above this can
+ make UglifyJS operate slightly more like a compilation process, in
+ that when certain symbols are replaced by constant values, entire code
+ blocks may be optimised away as unreachable.
+</li>
+</ul>
+
+</li>
+</ul>
+
+
+
+</div>
+
+<div id="outline-container-2-1" class="outline-3">
+<h3 id="sec-2-1"><span class="section-number-3">2.1</span> <span class="target">Unsafe transformations</span> </h3>
+<div class="outline-text-3" id="text-2-1">
+
+
+<p>
+The following transformations can in theory break code, although they're
+probably safe in most practical cases. To enable them you need to pass the
+<code>--unsafe</code> flag.
+</p>
+
+</div>
+
+<div id="outline-container-2-1-1" class="outline-4">
+<h4 id="sec-2-1-1"><span class="section-number-4">2.1.1</span> Calls involving the global Array constructor </h4>
+<div class="outline-text-4" id="text-2-1-1">
+
+
+<p>
+The following transformations occur:
+</p>
+
+
+
+<pre class="src src-js"><span class="org-keyword">new</span> <span class="org-type">Array</span>(1, 2, 3, 4) =&gt; [1,2,3,4]
+Array(a, b, c) =&gt; [a,b,c]
+<span class="org-keyword">new</span> <span class="org-type">Array</span>(5) =&gt; Array(5)
+<span class="org-keyword">new</span> <span class="org-type">Array</span>(a) =&gt; Array(a)
+</pre>
+
+
+<p>
+These are all safe if the Array name isn't redefined. JavaScript does allow
+one to globally redefine Array (and pretty much everything, in fact) but I
+personally don't see why would anyone do that.
+</p>
+<p>
+UglifyJS does handle the case where Array is redefined locally, or even
+globally but with a <code>function</code> or <code>var</code> declaration. Therefore, in the
+following cases UglifyJS <b>doesn't touch</b> calls or instantiations of Array:
+</p>
+
+
+
+<pre class="src src-js"><span class="org-comment-delimiter">// </span><span class="org-comment">case 1. globally declared variable</span>
+ <span class="org-keyword">var</span> <span class="org-variable-name">Array</span>;
+ <span class="org-keyword">new</span> <span class="org-type">Array</span>(1, 2, 3);
+ Array(a, b);
+
+ <span class="org-comment-delimiter">// </span><span class="org-comment">or (can be declared later)</span>
+ <span class="org-keyword">new</span> <span class="org-type">Array</span>(1, 2, 3);
+ <span class="org-keyword">var</span> <span class="org-variable-name">Array</span>;
+
+ <span class="org-comment-delimiter">// </span><span class="org-comment">or (can be a function)</span>
+ <span class="org-keyword">new</span> <span class="org-type">Array</span>(1, 2, 3);
+ <span class="org-keyword">function</span> <span class="org-function-name">Array</span>() { ... }
+
+<span class="org-comment-delimiter">// </span><span class="org-comment">case 2. declared in a function</span>
+ (<span class="org-keyword">function</span>(){
+ a = <span class="org-keyword">new</span> <span class="org-type">Array</span>(1, 2, 3);
+ b = Array(5, 6);
+ <span class="org-keyword">var</span> <span class="org-variable-name">Array</span>;
+ })();
+
+ <span class="org-comment-delimiter">// </span><span class="org-comment">or</span>
+ (<span class="org-keyword">function</span>(<span class="org-variable-name">Array</span>){
+ <span class="org-keyword">return</span> Array(5, 6, 7);
+ })();
+
+ <span class="org-comment-delimiter">// </span><span class="org-comment">or</span>
+ (<span class="org-keyword">function</span>(){
+ <span class="org-keyword">return</span> <span class="org-keyword">new</span> <span class="org-type">Array</span>(1, 2, 3, 4);
+ <span class="org-keyword">function</span> <span class="org-function-name">Array</span>() { ... }
+ })();
+
+ <span class="org-comment-delimiter">// </span><span class="org-comment">etc.</span>
+</pre>
+
+
+</div>
+
+</div>
+
+<div id="outline-container-2-1-2" class="outline-4">
+<h4 id="sec-2-1-2"><span class="section-number-4">2.1.2</span> <code>obj.toString()</code> ==&gt; <code>obj+“”</code> </h4>
+<div class="outline-text-4" id="text-2-1-2">
+
+
+</div>
+</div>
+
+</div>
+
+<div id="outline-container-2-2" class="outline-3">
+<h3 id="sec-2-2"><span class="section-number-3">2.2</span> Install (NPM) </h3>
+<div class="outline-text-3" id="text-2-2">
+
+
+<p>
+UglifyJS is now available through NPM &mdash; <code>npm install uglify-js</code> should do
+the job.
+</p>
+</div>
+
+</div>
+
+<div id="outline-container-2-3" class="outline-3">
+<h3 id="sec-2-3"><span class="section-number-3">2.3</span> Install latest code from GitHub </h3>
+<div class="outline-text-3" id="text-2-3">
+
+
+
+
+
+<pre class="src src-sh"><span class="org-comment-delimiter">## </span><span class="org-comment">clone the repository</span>
+mkdir -p /where/you/wanna/put/it
+<span class="org-builtin">cd</span> /where/you/wanna/put/it
+git clone git://github.com/mishoo/UglifyJS.git
+
+<span class="org-comment-delimiter">## </span><span class="org-comment">make the module available to Node</span>
+mkdir -p ~/.node_libraries/
+<span class="org-builtin">cd</span> ~/.node_libraries/
+ln -s /where/you/wanna/put/it/UglifyJS/uglify-js.js
+
+<span class="org-comment-delimiter">## </span><span class="org-comment">and if you want the CLI script too:</span>
+mkdir -p ~/bin
+<span class="org-builtin">cd</span> ~/bin
+ln -s /where/you/wanna/put/it/UglifyJS/bin/uglifyjs
+ <span class="org-comment-delimiter"># </span><span class="org-comment">(then add ~/bin to your $PATH if it's not there already)</span>
+</pre>
+
+
+</div>
+
+</div>
+
+<div id="outline-container-2-4" class="outline-3">
+<h3 id="sec-2-4"><span class="section-number-3">2.4</span> Usage </h3>
+<div class="outline-text-3" id="text-2-4">
+
+
+<p>
+There is a command-line tool that exposes the functionality of this library
+for your shell-scripting needs:
+</p>
+
+
+
+<pre class="src src-sh">uglifyjs [ options... ] [ filename ]
+</pre>
+
+
+<p>
+<code>filename</code> should be the last argument and should name the file from which
+to read the JavaScript code. If you don't specify it, it will read code
+from STDIN.
+</p>
+<p>
+Supported options:
+</p>
+<ul>
+<li><code>-b</code> or <code>--beautify</code> &mdash; output indented code; when passed, additional
+ options control the beautifier:
+
+<ul>
+<li><code>-i N</code> or <code>--indent N</code> &mdash; indentation level (number of spaces)
+
+</li>
+<li><code>-q</code> or <code>--quote-keys</code> &mdash; quote keys in literal objects (by default,
+ only keys that cannot be identifier names will be quotes).
+
+</li>
+</ul>
+
+</li>
+<li><code>-c</code> or <code>----consolidate-primitive-values</code> &mdash; consolidates null, Boolean,
+ and String values. Known as aliasing in the Closure Compiler. Worsens the
+ data compression ratio of gzip.
+
+</li>
+<li><code>--ascii</code> &mdash; pass this argument to encode non-ASCII characters as
+ <code>\uXXXX</code> sequences. By default UglifyJS won't bother to do it and will
+ output Unicode characters instead. (the output is always encoded in UTF8,
+ but if you pass this option you'll only get ASCII).
+
+</li>
+<li><code>-nm</code> or <code>--no-mangle</code> &mdash; don't mangle names.
+
+</li>
+<li><code>-nmf</code> or <code>--no-mangle-functions</code> &ndash; in case you want to mangle variable
+ names, but not touch function names.
+
+</li>
+<li><code>-ns</code> or <code>--no-squeeze</code> &mdash; don't call <code>ast_squeeze()</code> (which does various
+ optimizations that result in smaller, less readable code).
+
+</li>
+<li><code>-mt</code> or <code>--mangle-toplevel</code> &mdash; mangle names in the toplevel scope too
+ (by default we don't do this).
+
+</li>
+<li><code>--no-seqs</code> &mdash; when <code>ast_squeeze()</code> is called (thus, unless you pass
+ <code>--no-squeeze</code>) it will reduce consecutive statements in blocks into a
+ sequence. For example, "a = 10; b = 20; foo();" will be written as
+ "a=10,b=20,foo();". In various occasions, this allows us to discard the
+ block brackets (since the block becomes a single statement). This is ON
+ by default because it seems safe and saves a few hundred bytes on some
+ libs that I tested it on, but pass <code>--no-seqs</code> to disable it.
+
+</li>
+<li><code>--no-dead-code</code> &mdash; by default, UglifyJS will remove code that is
+ obviously unreachable (code that follows a <code>return</code>, <code>throw</code>, <code>break</code> or
+ <code>continue</code> statement and is not a function/variable declaration). Pass
+ this option to disable this optimization.
+
+</li>
+<li><code>-nc</code> or <code>--no-copyright</code> &mdash; by default, <code>uglifyjs</code> will keep the initial
+ comment tokens in the generated code (assumed to be copyright information
+ etc.). If you pass this it will discard it.
+
+</li>
+<li><code>-o filename</code> or <code>--output filename</code> &mdash; put the result in <code>filename</code>. If
+ this isn't given, the result goes to standard output (or see next one).
+
+</li>
+<li><code>--overwrite</code> &mdash; if the code is read from a file (not from STDIN) and you
+ pass <code>--overwrite</code> then the output will be written in the same file.
+
+</li>
+<li><code>--ast</code> &mdash; pass this if you want to get the Abstract Syntax Tree instead
+ of JavaScript as output. Useful for debugging or learning more about the
+ internals.
+
+</li>
+<li><code>-v</code> or <code>--verbose</code> &mdash; output some notes on STDERR (for now just how long
+ each operation takes).
+
+</li>
+<li><code>-d SYMBOL[=VALUE]</code> or <code>--define SYMBOL[=VALUE]</code> &mdash; will replace
+ all instances of the specified symbol where used as an identifier
+ (except where symbol has properly declared by a var declaration or
+ use as function parameter or similar) with the specified value. This
+ argument may be specified multiple times to define multiple
+ symbols - if no value is specified the symbol will be replaced with
+ the value <code>true</code>, or you can specify a numeric value (such as
+ <code>1024</code>), a quoted string value (such as ="object"= or
+ ='https://github.com'<code>), or the name of another symbol or keyword (such as =null</code> or <code>document</code>).
+ This allows you, for example, to assign meaningful names to key
+ constant values but discard the symbolic names in the uglified
+ version for brevity/efficiency, or when used wth care, allows
+ UglifyJS to operate as a form of <b>conditional compilation</b>
+ whereby defining appropriate values may, by dint of the constant
+ folding and dead code removal features above, remove entire
+ superfluous code blocks (e.g. completely remove instrumentation or
+ trace code for production use).
+ Where string values are being defined, the handling of quotes are
+ likely to be subject to the specifics of your command shell
+ environment, so you may need to experiment with quoting styles
+ depending on your platform, or you may find the option
+ <code>--define-from-module</code> more suitable for use.
+
+</li>
+<li><code>-define-from-module SOMEMODULE</code> &mdash; will load the named module (as
+ per the NodeJS <code>require()</code> function) and iterate all the exported
+ properties of the module defining them as symbol names to be defined
+ (as if by the <code>--define</code> option) per the name of each property
+ (i.e. without the module name prefix) and given the value of the
+ property. This is a much easier way to handle and document groups of
+ symbols to be defined rather than a large number of <code>--define</code>
+ options.
+
+</li>
+<li><code>--unsafe</code> &mdash; enable other additional optimizations that are known to be
+ unsafe in some contrived situations, but could still be generally useful.
+ For now only these:
+
+<ul>
+<li>foo.toString() ==&gt; foo+""
+</li>
+<li>new Array(x,&hellip;) ==&gt; [x,&hellip;]
+</li>
+<li>new Array(x) ==&gt; Array(x)
+
+</li>
+</ul>
+
+</li>
+<li><code>--max-line-len</code> (default 32K characters) &mdash; add a newline after around
+ 32K characters. I've seen both FF and Chrome croak when all the code was
+ on a single line of around 670K. Pass &ndash;max-line-len 0 to disable this
+ safety feature.
+
+</li>
+<li><code>--reserved-names</code> &mdash; some libraries rely on certain names to be used, as
+ pointed out in issue #92 and #81, so this option allow you to exclude such
+ names from the mangler. For example, to keep names <code>require</code> and <code>$super</code>
+ intact you'd specify &ndash;reserved-names "require,$super".
+
+</li>
+<li><code>--inline-script</code> &ndash; when you want to include the output literally in an
+ HTML <code>&lt;script&gt;</code> tag you can use this option to prevent <code>&lt;/script</code> from
+ showing up in the output.
+
+</li>
+<li><code>--lift-vars</code> &ndash; when you pass this, UglifyJS will apply the following
+ transformations (see the notes in API, <code>ast_lift_variables</code>):
+
+<ul>
+<li>put all <code>var</code> declarations at the start of the scope
+</li>
+<li>make sure a variable is declared only once
+</li>
+<li>discard unused function arguments
+</li>
+<li>discard unused inner (named) functions
+</li>
+<li>finally, try to merge assignments into that one <code>var</code> declaration, if
+ possible.
+</li>
+</ul>
+
+</li>
+</ul>
+
+
+
+</div>
+
+<div id="outline-container-2-4-1" class="outline-4">
+<h4 id="sec-2-4-1"><span class="section-number-4">2.4.1</span> API </h4>
+<div class="outline-text-4" id="text-2-4-1">
+
+
+<p>
+To use the library from JavaScript, you'd do the following (example for
+NodeJS):
+</p>
+
+
+
+<pre class="src src-js"><span class="org-keyword">var</span> <span class="org-variable-name">jsp</span> = require(<span class="org-string">"uglify-js"</span>).parser;
+<span class="org-keyword">var</span> <span class="org-variable-name">pro</span> = require(<span class="org-string">"uglify-js"</span>).uglify;
+
+<span class="org-keyword">var</span> <span class="org-variable-name">orig_code</span> = <span class="org-string">"... JS code here"</span>;
+<span class="org-keyword">var</span> <span class="org-variable-name">ast</span> = jsp.parse(orig_code); <span class="org-comment-delimiter">// </span><span class="org-comment">parse code and get the initial AST</span>
+ast = pro.ast_mangle(ast); <span class="org-comment-delimiter">// </span><span class="org-comment">get a new AST with mangled names</span>
+ast = pro.ast_squeeze(ast); <span class="org-comment-delimiter">// </span><span class="org-comment">get an AST with compression optimizations</span>
+<span class="org-keyword">var</span> <span class="org-variable-name">final_code</span> = pro.gen_code(ast); <span class="org-comment-delimiter">// </span><span class="org-comment">compressed code here</span>
+</pre>
+
+
+<p>
+The above performs the full compression that is possible right now. As you
+can see, there are a sequence of steps which you can apply. For example if
+you want compressed output but for some reason you don't want to mangle
+variable names, you would simply skip the line that calls
+<code>pro.ast_mangle(ast)</code>.
+</p>
+<p>
+Some of these functions take optional arguments. Here's a description:
+</p>
+<ul>
+<li><code>jsp.parse(code, strict_semicolons)</code> &ndash; parses JS code and returns an AST.
+ <code>strict_semicolons</code> is optional and defaults to <code>false</code>. If you pass
+ <code>true</code> then the parser will throw an error when it expects a semicolon and
+ it doesn't find it. For most JS code you don't want that, but it's useful
+ if you want to strictly sanitize your code.
+
+</li>
+<li><code>pro.ast_lift_variables(ast)</code> &ndash; merge and move <code>var</code> declarations to the
+ scop of the scope; discard unused function arguments or variables; discard
+ unused (named) inner functions. It also tries to merge assignments
+ following the <code>var</code> declaration into it.
+
+<p>
+ If your code is very hand-optimized concerning <code>var</code> declarations, this
+ lifting variable declarations might actually increase size. For me it
+ helps out. On jQuery it adds 865 bytes (243 after gzip). YMMV. Also
+ note that (since it's not enabled by default) this operation isn't yet
+ heavily tested (please report if you find issues!).
+</p>
+<p>
+ Note that although it might increase the image size (on jQuery it gains
+ 865 bytes, 243 after gzip) it's technically more correct: in certain
+ situations, dead code removal might drop variable declarations, which
+ would not happen if the variables are lifted in advance.
+</p>
+<p>
+ Here's an example of what it does:
+</p></li>
+</ul>
+
+
+
+
+
+<pre class="src src-js"><span class="org-keyword">function</span> <span class="org-function-name">f</span>(<span class="org-variable-name">a</span>, <span class="org-variable-name">b</span>, <span class="org-variable-name">c</span>, <span class="org-variable-name">d</span>, <span class="org-variable-name">e</span>) {
+ <span class="org-keyword">var</span> <span class="org-variable-name">q</span>;
+ <span class="org-keyword">var</span> <span class="org-variable-name">w</span>;
+ w = 10;
+ q = 20;
+ <span class="org-keyword">for</span> (<span class="org-keyword">var</span> <span class="org-variable-name">i</span> = 1; i &lt; 10; ++i) {
+ <span class="org-keyword">var</span> <span class="org-variable-name">boo</span> = foo(a);
+ }
+ <span class="org-keyword">for</span> (<span class="org-keyword">var</span> <span class="org-variable-name">i</span> = 0; i &lt; 1; ++i) {
+ <span class="org-keyword">var</span> <span class="org-variable-name">boo</span> = bar(c);
+ }
+ <span class="org-keyword">function</span> <span class="org-function-name">foo</span>(){ ... }
+ <span class="org-keyword">function</span> <span class="org-function-name">bar</span>(){ ... }
+ <span class="org-keyword">function</span> <span class="org-function-name">baz</span>(){ ... }
+}
+
+<span class="org-comment-delimiter">// </span><span class="org-comment">transforms into ==&gt;</span>
+
+<span class="org-keyword">function</span> <span class="org-function-name">f</span>(<span class="org-variable-name">a</span>, <span class="org-variable-name">b</span>, <span class="org-variable-name">c</span>) {
+ <span class="org-keyword">var</span> <span class="org-variable-name">i</span>, <span class="org-variable-name">boo</span>, <span class="org-variable-name">w</span> = 10, <span class="org-variable-name">q</span> = 20;
+ <span class="org-keyword">for</span> (i = 1; i &lt; 10; ++i) {
+ boo = foo(a);
+ }
+ <span class="org-keyword">for</span> (i = 0; i &lt; 1; ++i) {
+ boo = bar(c);
+ }
+ <span class="org-keyword">function</span> <span class="org-function-name">foo</span>() { ... }
+ <span class="org-keyword">function</span> <span class="org-function-name">bar</span>() { ... }
+}
+</pre>
+
+
+<ul>
+<li><code>pro.ast_mangle(ast, options)</code> &ndash; generates a new AST containing mangled
+ (compressed) variable and function names. It supports the following
+ options:
+
+<ul>
+<li><code>toplevel</code> &ndash; mangle toplevel names (by default we don't touch them).
+</li>
+<li><code>except</code> &ndash; an array of names to exclude from compression.
+</li>
+<li><code>defines</code> &ndash; an object with properties named after symbols to
+ replace (see the <code>--define</code> option for the script) and the values
+ representing the AST replacement value.
+
+</li>
+</ul>
+
+</li>
+<li><code>pro.ast_squeeze(ast, options)</code> &ndash; employs further optimizations designed
+ to reduce the size of the code that <code>gen_code</code> would generate from the
+ AST. Returns a new AST. <code>options</code> can be a hash; the supported options
+ are:
+
+<ul>
+<li><code>make_seqs</code> (default true) which will cause consecutive statements in a
+ block to be merged using the "sequence" (comma) operator
+
+</li>
+<li><code>dead_code</code> (default true) which will remove unreachable code.
+
+</li>
+</ul>
+
+</li>
+<li><code>pro.gen_code(ast, options)</code> &ndash; generates JS code from the AST. By
+ default it's minified, but using the <code>options</code> argument you can get nicely
+ formatted output. <code>options</code> is, well, optional :-) and if you pass it it
+ must be an object and supports the following properties (below you can see
+ the default values):
+
+<ul>
+<li><code>beautify: false</code> &ndash; pass <code>true</code> if you want indented output
+</li>
+<li><code>indent_start: 0</code> (only applies when <code>beautify</code> is <code>true</code>) &ndash; initial
+ indentation in spaces
+</li>
+<li><code>indent_level: 4</code> (only applies when <code>beautify</code> is <code>true</code>) --
+ indentation level, in spaces (pass an even number)
+</li>
+<li><code>quote_keys: false</code> &ndash; if you pass <code>true</code> it will quote all keys in
+ literal objects
+</li>
+<li><code>space_colon: false</code> (only applies when <code>beautify</code> is <code>true</code>) &ndash; wether
+ to put a space before the colon in object literals
+</li>
+<li><code>ascii_only: false</code> &ndash; pass <code>true</code> if you want to encode non-ASCII
+ characters as <code>\uXXXX</code>.
+</li>
+<li><code>inline_script: false</code> &ndash; pass <code>true</code> to escape occurrences of
+ <code>&lt;/script</code> in strings
+</li>
+</ul>
+
+</li>
+</ul>
+
+
+</div>
+
+</div>
+
+<div id="outline-container-2-4-2" class="outline-4">
+<h4 id="sec-2-4-2"><span class="section-number-4">2.4.2</span> Beautifier shortcoming &ndash; no more comments </h4>
+<div class="outline-text-4" id="text-2-4-2">
+
+
+<p>
+The beautifier can be used as a general purpose indentation tool. It's
+useful when you want to make a minified file readable. One limitation,
+though, is that it discards all comments, so you don't really want to use it
+to reformat your code, unless you don't have, or don't care about, comments.
+</p>
+<p>
+In fact it's not the beautifier who discards comments &mdash; they are dumped at
+the parsing stage, when we build the initial AST. Comments don't really
+make sense in the AST, and while we could add nodes for them, it would be
+inconvenient because we'd have to add special rules to ignore them at all
+the processing stages.
+</p>
+</div>
+
+</div>
+
+<div id="outline-container-2-4-3" class="outline-4">
+<h4 id="sec-2-4-3"><span class="section-number-4">2.4.3</span> Use as a code pre-processor </h4>
+<div class="outline-text-4" id="text-2-4-3">
+
+
+<p>
+The <code>--define</code> option can be used, particularly when combined with the
+constant folding logic, as a form of pre-processor to enable or remove
+particular constructions, such as might be used for instrumenting
+development code, or to produce variations aimed at a specific
+platform.
+</p>
+<p>
+The code below illustrates the way this can be done, and how the
+symbol replacement is performed.
+</p>
+
+
+
+<pre class="src src-js">CLAUSE1: <span class="org-keyword">if</span> (<span class="org-keyword">typeof</span> DEVMODE === <span class="org-string">'undefined'</span>) {
+ DEVMODE = <span class="org-constant">true</span>;
+}
+
+<span class="org-function-name">CLAUSE2</span>: <span class="org-keyword">function</span> init() {
+ <span class="org-keyword">if</span> (DEVMODE) {
+ console.log(<span class="org-string">"init() called"</span>);
+ }
+ ....
+ DEVMODE &amp;amp;&amp;amp; console.log(<span class="org-string">"init() complete"</span>);
+}
+
+<span class="org-function-name">CLAUSE3</span>: <span class="org-keyword">function</span> reportDeviceStatus(<span class="org-variable-name">device</span>) {
+ <span class="org-keyword">var</span> <span class="org-variable-name">DEVMODE</span> = device.mode, <span class="org-variable-name">DEVNAME</span> = device.name;
+ <span class="org-keyword">if</span> (DEVMODE === <span class="org-string">'open'</span>) {
+ ....
+ }
+}
+</pre>
+
+
+<p>
+When the above code is normally executed, the undeclared global
+variable <code>DEVMODE</code> will be assigned the value <b>true</b> (see <code>CLAUSE1</code>)
+and so the <code>init()</code> function (<code>CLAUSE2</code>) will write messages to the
+console log when executed, but in <code>CLAUSE3</code> a locally declared
+variable will mask access to the <code>DEVMODE</code> global symbol.
+</p>
+<p>
+If the above code is processed by UglifyJS with an argument of
+<code>--define DEVMODE=false</code> then UglifyJS will replace <code>DEVMODE</code> with the
+boolean constant value <b>false</b> within <code>CLAUSE1</code> and <code>CLAUSE2</code>, but it
+will leave <code>CLAUSE3</code> as it stands because there <code>DEVMODE</code> resolves to
+a validly declared variable.
+</p>
+<p>
+And more so, the constant-folding features of UglifyJS will recognise
+that the <code>if</code> condition of <code>CLAUSE1</code> is thus always false, and so will
+remove the test and body of <code>CLAUSE1</code> altogether (including the
+otherwise slightly problematical statement <code>false = true;</code> which it
+will have formed by replacing <code>DEVMODE</code> in the body). Similarly,
+within <code>CLAUSE2</code> both calls to <code>console.log()</code> will be removed
+altogether.
+</p>
+<p>
+In this way you can mimic, to a limited degree, the functionality of
+the C/C++ pre-processor to enable or completely remove blocks
+depending on how certain symbols are defined - perhaps using UglifyJS
+to generate different versions of source aimed at different
+environments
+</p>
+<p>
+It is recommmended (but not made mandatory) that symbols designed for
+this purpose are given names consisting of <code>UPPER_CASE_LETTERS</code> to
+distinguish them from other (normal) symbols and avoid the sort of
+clash that <code>CLAUSE3</code> above illustrates.
+</p>
+</div>
+</div>
+
+</div>
+
+<div id="outline-container-2-5" class="outline-3">
+<h3 id="sec-2-5"><span class="section-number-3">2.5</span> Compression &ndash; how good is it? </h3>
+<div class="outline-text-3" id="text-2-5">
+
+
+<p>
+Here are updated statistics. (I also updated my Google Closure and YUI
+installations).
+</p>
+<p>
+We're still a lot better than YUI in terms of compression, though slightly
+slower. We're still a lot faster than Closure, and compression after gzip
+is comparable.
+</p>
+<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
+<caption></caption>
+<colgroup><col class="left" /><col class="left" /><col class="right" /><col class="left" /><col class="right" /><col class="left" /><col class="right" />
+</colgroup>
+<thead>
+<tr><th scope="col" class="left">File</th><th scope="col" class="left">UglifyJS</th><th scope="col" class="right">UglifyJS+gzip</th><th scope="col" class="left">Closure</th><th scope="col" class="right">Closure+gzip</th><th scope="col" class="left">YUI</th><th scope="col" class="right">YUI+gzip</th></tr>
+</thead>
+<tbody>
+<tr><td class="left">jquery-1.6.2.js</td><td class="left">91001 (0:01.59)</td><td class="right">31896</td><td class="left">90678 (0:07.40)</td><td class="right">31979</td><td class="left">101527 (0:01.82)</td><td class="right">34646</td></tr>
+<tr><td class="left">paper.js</td><td class="left">142023 (0:01.65)</td><td class="right">43334</td><td class="left">134301 (0:07.42)</td><td class="right">42495</td><td class="left">173383 (0:01.58)</td><td class="right">48785</td></tr>
+<tr><td class="left">prototype.js</td><td class="left">88544 (0:01.09)</td><td class="right">26680</td><td class="left">86955 (0:06.97)</td><td class="right">26326</td><td class="left">92130 (0:00.79)</td><td class="right">28624</td></tr>
+<tr><td class="left">thelib-full.js (DynarchLIB)</td><td class="left">251939 (0:02.55)</td><td class="right">72535</td><td class="left">249911 (0:09.05)</td><td class="right">72696</td><td class="left">258869 (0:01.94)</td><td class="right">76584</td></tr>
+</tbody>
+</table>
+
+
+</div>
+
+</div>
+
+<div id="outline-container-2-6" class="outline-3">
+<h3 id="sec-2-6"><span class="section-number-3">2.6</span> Bugs? </h3>
+<div class="outline-text-3" id="text-2-6">
+
+
+<p>
+Unfortunately, for the time being there is no automated test suite. But I
+ran the compressor manually on non-trivial code, and then I tested that the
+generated code works as expected. A few hundred times.
+</p>
+<p>
+DynarchLIB was started in times when there was no good JS minifier.
+Therefore I was quite religious about trying to write short code manually,
+and as such DL contains a lot of syntactic hacks<sup><a class="footref" name="fnr.1" href="#fn.1">1</a></sup> such as “foo == bar ? a
+= 10 : b = 20”, though the more readable version would clearly be to use
+“if/else”.
+</p>
+<p>
+Since the parser/compressor runs fine on DL and jQuery, I'm quite confident
+that it's solid enough for production use. If you can identify any bugs,
+I'd love to hear about them (<a href="http://groups.google.com/group/uglifyjs">use the Google Group</a> or email me directly).
+</p>
+</div>
+
+</div>
+
+<div id="outline-container-2-7" class="outline-3">
+<h3 id="sec-2-7"><span class="section-number-3">2.7</span> Links </h3>
+<div class="outline-text-3" id="text-2-7">
+
+
+<ul>
+<li>Twitter: <a href="http://twitter.com/UglifyJS">@UglifyJS</a>
+</li>
+<li>Project at GitHub: <a href="http://github.com/mishoo/UglifyJS">http://github.com/mishoo/UglifyJS</a>
+</li>
+<li>Google Group: <a href="http://groups.google.com/group/uglifyjs">http://groups.google.com/group/uglifyjs</a>
+</li>
+<li>Common Lisp JS parser: <a href="http://marijn.haverbeke.nl/parse-js/">http://marijn.haverbeke.nl/parse-js/</a>
+</li>
+<li>JS-to-Lisp compiler: <a href="http://github.com/marijnh/js">http://github.com/marijnh/js</a>
+</li>
+<li>Common Lisp JS uglifier: <a href="http://github.com/mishoo/cl-uglify-js">http://github.com/mishoo/cl-uglify-js</a>
+</li>
+</ul>
+
+
+</div>
+
+</div>
+
+<div id="outline-container-2-8" class="outline-3">
+<h3 id="sec-2-8"><span class="section-number-3">2.8</span> License </h3>
+<div class="outline-text-3" id="text-2-8">
+
+
+<p>
+UglifyJS is released under the BSD license:
+</p>
+
+
+
+<pre class="example">Copyright 2010 (c) Mihai Bazon &lt;mihai.bazon@gmail.com&gt;
+Based on parse-js (http://marijn.haverbeke.nl/parse-js/).
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+ * Redistributions of source code must retain the above
+ copyright notice, this list of conditions and the following
+ disclaimer.
+
+ * 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 SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “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 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.
+</pre>
+
+
+<div id="footnotes">
+<h2 class="footnotes">Footnotes: </h2>
+<div id="text-footnotes">
+<p class="footnote"><sup><a class="footnum" name="fn.1" href="#fnr.1">1</a></sup> I even reported a few bugs and suggested some fixes in the original
+ <a href="http://marijn.haverbeke.nl/parse-js/">parse-js</a> library, and Marijn pushed fixes literally in minutes.
+</p></div>
+</div>
+</div>
+
+</div>
+</div>
+</div>
+
+<div id="postamble">
+<p class="date">Date: 2012-08-27 12:38:12 EEST</p>
+<p class="author">Author: Mihai Bazon</p>
+<p class="creator">Org version 7.7 with Emacs version 23</p>
+<a href="http://validator.w3.org/check?uri=referer">Validate XHTML 1.0</a>
+
+</div>
+</body>
+</html>
View
593 node_modules/uglify-js/README.org
@@ -0,0 +1,593 @@
+#+TITLE: UglifyJS -- a JavaScript parser/compressor/beautifier
+#+KEYWORDS: javascript, js, parser, compiler, compressor, mangle, minify, minifier
+#+DESCRIPTION: a JavaScript parser/compressor/beautifier in JavaScript
+#+STYLE: <link rel="stylesheet" type="text/css" href="docstyle.css" />
+#+AUTHOR: Mihai Bazon
+#+EMAIL: mihai.bazon@gmail.com
+
+* NEW: UglifyJS2
+
+I started working on UglifyJS's successor, version 2. It's almost a full
+rewrite (except for the parser which is heavily modified, everything else
+starts from scratch). I've detailed my reasons in the README, see the
+project page.
+
+[[https://github.com/mishoo/UglifyJS2][https://github.com/mishoo/UglifyJS2]]
+
+Version 1 will continue to be maintained for fixing show-stopper bugs, but
+no new features should be expected.
+
+Please help me focus on version 2 by [[http://pledgie.com/campaigns/18110][making a donation]]!
+
+* UglifyJS --- a JavaScript parser/compressor/beautifier
+
+This package implements a general-purpose JavaScript
+parser/compressor/beautifier toolkit. It is developed on [[http://nodejs.org/][NodeJS]], but it
+should work on any JavaScript platform supporting the CommonJS module system
+(and if your platform of choice doesn't support CommonJS, you can easily
+implement it, or discard the =exports.*= lines from UglifyJS sources).
+
+The tokenizer/parser generates an abstract syntax tree from JS code. You
+can then traverse the AST to learn more about the code, or do various
+manipulations on it. This part is implemented in [[../lib/parse-js.js][parse-js.js]] and it's a
+port to JavaScript of the excellent [[http://marijn.haverbeke.nl/parse-js/][parse-js]] Common Lisp library from [[http://marijn.haverbeke.nl/][Marijn
+Haverbeke]].
+
+( See [[http://github.com/mishoo/cl-uglify-js][cl-uglify-js]] if you're looking for the Common Lisp version of
+UglifyJS. )
+
+The second part of this package, implemented in [[../lib/process.js][process.js]], inspects and
+manipulates the AST generated by the parser to provide the following:
+
+- ability to re-generate JavaScript code from the AST. Optionally
+ indented---you can use this if you want to “beautify” a program that has
+ been compressed, so that you can inspect the source. But you can also run
+ our code generator to print out an AST without any whitespace, so you
+ achieve compression as well.
+
+- shorten variable names (usually to single characters). Our mangler will
+ analyze the code and generate proper variable names, depending on scope
+ and usage, and is smart enough to deal with globals defined elsewhere, or
+ with =eval()= calls or =with{}= statements. In short, if =eval()= or
+ =with{}= are used in some scope, then all variables in that scope and any
+ variables in the parent scopes will remain unmangled, and any references
+ to such variables remain unmangled as well.
+
+- various small optimizations that may lead to faster code but certainly
+ lead to smaller code. Where possible, we do the following:
+
+ - foo["bar"] ==> foo.bar
+
+ - remove block brackets ={}=
+
+ - join consecutive var declarations:
+ var a = 10; var b = 20; ==> var a=10,b=20;
+
+ - resolve simple constant expressions: 1 +2 * 3 ==> 7. We only do the
+ replacement if the result occupies less bytes; for example 1/3 would
+ translate to 0.333333333333, so in this case we don't replace it.
+
+ - consecutive statements in blocks are merged into a sequence; in many
+ cases, this leaves blocks with a single statement, so then we can remove
+ the block brackets.
+
+ - various optimizations for IF statements:
+