From f3f4dcd84a375eaff21f69946442ce9440a5a712 Mon Sep 17 00:00:00 2001 From: Eric Riggs Date: Tue, 6 Mar 2018 05:52:02 -0400 Subject: [PATCH] - Make Mayan behave like a Single Page App by using partials. - Add URI.js, Ajax form. - Split base.js into mayan_app.js, mayan_image.js, partial_navigation.js. - Add a HOME_VIEW setting. Use it for the default view to be loaded. - New template loading order root.html -> base.html -> any template. root.html is only loaded once. Other templates are loaded and merged with base.html via ajax load. - Fix bug in document page view. Was storing the URL and the querystring as a single url variable. Signed-off-by: Eric Riggs --- .../appearance/static/appearance/js/base.js | 265 +- .../static/appearance/js/mayan_app.js | 157 + .../static/appearance/js/mayan_image.js | 84 + .../appearance/js/partial_navigation.js | 203 + .../vendors/URI.js-1.19.1/.editorconfig | 9 + .../vendors/URI.js-1.19.1/.gitignore | 2 + .../vendors/URI.js-1.19.1/.jshintrc | 31 + .../vendors/URI.js-1.19.1/CHANGELOG.md | 383 ++ .../vendors/URI.js-1.19.1/Gruntfile.js | 22 + .../vendors/URI.js-1.19.1/LICENSE.txt | 21 + .../vendors/URI.js-1.19.1/README.md | 245 ++ .../vendors/URI.js-1.19.1/about-uris.html | 189 + .../vendors/URI.js-1.19.1/bower.json | 16 + .../vendors/URI.js-1.19.1/build.html | 71 + .../appearance/vendors/URI.js-1.19.1/build.js | 78 + .../vendors/URI.js-1.19.1/contributing.md | 19 + .../vendors/URI.js-1.19.1/docs.html | 1410 +++++++ .../vendors/URI.js-1.19.1/index.html | 173 + .../URI.js-1.19.1/jquery-1.10.2.min.js | 6 + .../vendors/URI.js-1.19.1/jquery-1.7.2.min.js | 4 + .../vendors/URI.js-1.19.1/jquery-1.8.2.min.js | 2 + .../vendors/URI.js-1.19.1/jquery-1.9.1.min.js | 5 + .../URI.js-1.19.1/jquery-uri-plugin.html | 203 + .../vendors/URI.js-1.19.1/package.json | 78 + .../URI.js-1.19.1/prettify/lang-apollo.js | 2 + .../URI.js-1.19.1/prettify/lang-clj.js | 18 + .../URI.js-1.19.1/prettify/lang-css.js | 2 + .../vendors/URI.js-1.19.1/prettify/lang-go.js | 1 + .../vendors/URI.js-1.19.1/prettify/lang-hs.js | 2 + .../URI.js-1.19.1/prettify/lang-lisp.js | 3 + .../URI.js-1.19.1/prettify/lang-lua.js | 2 + .../vendors/URI.js-1.19.1/prettify/lang-ml.js | 2 + .../vendors/URI.js-1.19.1/prettify/lang-n.js | 4 + .../URI.js-1.19.1/prettify/lang-proto.js | 1 + .../URI.js-1.19.1/prettify/lang-scala.js | 2 + .../URI.js-1.19.1/prettify/lang-sql.js | 2 + .../URI.js-1.19.1/prettify/lang-tex.js | 1 + .../vendors/URI.js-1.19.1/prettify/lang-vb.js | 2 + .../URI.js-1.19.1/prettify/lang-vhdl.js | 3 + .../URI.js-1.19.1/prettify/lang-wiki.js | 2 + .../vendors/URI.js-1.19.1/prettify/lang-xq.js | 3 + .../URI.js-1.19.1/prettify/lang-yaml.js | 2 + .../URI.js-1.19.1/prettify/prettify.css | 1 + .../URI.js-1.19.1/prettify/prettify.js | 28 + .../prettify/prettify.sunburst.css | 52 + .../vendors/URI.js-1.19.1/screen.css | 181 + .../vendors/URI.js-1.19.1/screen.js | 39 + .../vendors/URI.js-1.19.1/src/IPv6.js | 185 + .../URI.js-1.19.1/src/SecondLevelDomains.js | 245 ++ .../URI.js-1.19.1/src/URI.fragmentQuery.js | 121 + .../URI.js-1.19.1/src/URI.fragmentURI.js | 97 + .../vendors/URI.js-1.19.1/src/URI.js | 2338 +++++++++++ .../vendors/URI.js-1.19.1/src/URI.min.js | 93 + .../vendors/URI.js-1.19.1/src/URITemplate.js | 516 +++ .../vendors/URI.js-1.19.1/src/jquery.URI.js | 234 ++ .../URI.js-1.19.1/src/jquery.URI.min.js | 7 + .../vendors/URI.js-1.19.1/src/punycode.js | 533 +++ .../vendors/URI.js-1.19.1/test/index.html | 26 + .../vendors/URI.js-1.19.1/test/pre_libs.js | 7 + .../test/qunit/qunit-composite.css | 13 + .../test/qunit/qunit-composite.js | 167 + .../URI.js-1.19.1/test/qunit/qunit.css | 244 ++ .../vendors/URI.js-1.19.1/test/qunit/qunit.js | 2212 +++++++++++ .../vendors/URI.js-1.19.1/test/test.URI.html | 26 + .../test/test.fragmentQuery.html | 31 + .../URI.js-1.19.1/test/test.fragmentURI.html | 31 + .../URI.js-1.19.1/test/test.jQuery-1.10.html | 31 + .../URI.js-1.19.1/test/test.jQuery-1.7.html | 31 + .../URI.js-1.19.1/test/test.jQuery-1.8.html | 31 + .../URI.js-1.19.1/test/test.jQuery-1.9.html | 31 + .../vendors/URI.js-1.19.1/test/test.js | 2036 ++++++++++ .../URI.js-1.19.1/test/test_fragmentQuery.js | 67 + .../URI.js-1.19.1/test/test_fragmentURI.js | 61 + .../vendors/URI.js-1.19.1/test/test_jim.js | 158 + .../vendors/URI.js-1.19.1/test/test_jquery.js | 141 + .../URI.js-1.19.1/test/test_template.js | 417 ++ .../vendors/URI.js-1.19.1/test/urls.js | 1941 +++++++++ .../vendors/URI.js-1.19.1/uri-template.html | 239 ++ .../vendors/URI.js-1.19.1/utils/SLDs.php | 37 + .../vendors/URI.js-1.19.1/utils/sld.js | 101 + .../vendors/form-4.2.2/.circleci/config.yml | 50 + .../vendors/form-4.2.2/.editorconfig | 21 + .../vendors/form-4.2.2/.eslintrc.js | 359 ++ .../form-4.2.2/.github/issue_template.md | 17 + .../appearance/vendors/form-4.2.2/.gitignore | 298 ++ .../appearance/vendors/form-4.2.2/.travis.yml | 11 + .../vendors/form-4.2.2/CODE_OF_CONDUCT.md | 74 + .../vendors/form-4.2.2/CONTRIBUTING.md | 109 + .../vendors/form-4.2.2/CONTRIBUTORS.md | 10 + .../vendors/form-4.2.2/Gruntfile.js | 69 + .../appearance/vendors/form-4.2.2/LICENSE | 502 +++ .../appearance/vendors/form-4.2.2/LICENSE-MIT | 21 + .../appearance/vendors/form-4.2.2/README.md | 241 ++ .../appearance/vendors/form-4.2.2/_config.yml | 1 + .../appearance/vendors/form-4.2.2/bower.json | 25 + .../vendors/form-4.2.2/composer.json | 29 + .../form-4.2.2/dist/jquery.form.min.js | 23 + .../form-4.2.2/dist/jquery.form.min.js.map | 1 + .../vendors/form-4.2.2/docs/.gitignore | 3 + .../vendors/form-4.2.2/docs/Gemfile | 2 + .../vendors/form-4.2.2/docs/_config.yml | 21 + .../form-4.2.2/docs/_layouts/default.html | 73 + .../vendors/form-4.2.2/docs/_sass/style.scss | 21 + .../appearance/vendors/form-4.2.2/docs/api.md | 92 + .../form-4.2.2/docs/assets/css/style.scss | 5 + .../appearance/vendors/form-4.2.2/docs/faq.md | 36 + .../vendors/form-4.2.2/docs/index.md | 40 + .../vendors/form-4.2.2/docs/options.md | 153 + .../vendors/form-4.2.2/form.jquery.json | 54 + .../vendors/form-4.2.2/install/pre-commit.sh | 9 + .../form-4.2.2/install/template/shell.hb | 4 + .../vendors/form-4.2.2/package-lock.json | 3451 +++++++++++++++++ .../vendors/form-4.2.2/package.json | 33 + .../vendors/form-4.2.2/src/jquery.form.js | 1531 ++++++++ .../vendors/form-4.2.2/test/.eslintrc.js | 32 + .../test/ajax/doc-with-scripts.html | 27 + .../vendors/form-4.2.2/test/ajax/json.json | 1 + .../vendors/form-4.2.2/test/ajax/json.txt | 1 + .../vendors/form-4.2.2/test/ajax/script.txt | 3 + .../vendors/form-4.2.2/test/ajax/test.xml | 5 + .../vendors/form-4.2.2/test/ajax/text.html | 12 + .../vendors/form-4.2.2/test/img/submit.gif | Bin 0 -> 1648 bytes .../vendors/form-4.2.2/test/test.html | 235 ++ .../vendors/form-4.2.2/test/test.js | 914 +++++ .../appearance/templates/appearance/base.html | 295 +- .../appearance/templates/appearance/root.html | 132 + mayan/apps/common/urls.py | 5 +- mayan/apps/common/views.py | 5 + .../documents/views/document_page_views.py | 2 +- mayan/settings/base.py | 5 +- 130 files changed, 25110 insertions(+), 432 deletions(-) create mode 100644 mayan/apps/appearance/static/appearance/js/mayan_app.js create mode 100644 mayan/apps/appearance/static/appearance/js/mayan_image.js create mode 100644 mayan/apps/appearance/static/appearance/js/partial_navigation.js create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/.editorconfig create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/.gitignore create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/.jshintrc create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/CHANGELOG.md create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/Gruntfile.js create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/LICENSE.txt create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/README.md create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/about-uris.html create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/bower.json create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/build.html create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/build.js create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/contributing.md create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/docs.html create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/index.html create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/jquery-1.10.2.min.js create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/jquery-1.7.2.min.js create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/jquery-1.8.2.min.js create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/jquery-1.9.1.min.js create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/jquery-uri-plugin.html create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/package.json create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/prettify/lang-apollo.js create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/prettify/lang-clj.js create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/prettify/lang-css.js create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/prettify/lang-go.js create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/prettify/lang-hs.js create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/prettify/lang-lisp.js create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/prettify/lang-lua.js create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/prettify/lang-ml.js create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/prettify/lang-n.js create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/prettify/lang-proto.js create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/prettify/lang-scala.js create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/prettify/lang-sql.js create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/prettify/lang-tex.js create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/prettify/lang-vb.js create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/prettify/lang-vhdl.js create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/prettify/lang-wiki.js create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/prettify/lang-xq.js create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/prettify/lang-yaml.js create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/prettify/prettify.css create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/prettify/prettify.js create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/prettify/prettify.sunburst.css create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/screen.css create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/screen.js create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/src/IPv6.js create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/src/SecondLevelDomains.js create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/src/URI.fragmentQuery.js create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/src/URI.fragmentURI.js create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/src/URI.js create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/src/URI.min.js create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/src/URITemplate.js create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/src/jquery.URI.js create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/src/jquery.URI.min.js create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/src/punycode.js create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/test/index.html create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/test/pre_libs.js create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/test/qunit/qunit-composite.css create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/test/qunit/qunit-composite.js create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/test/qunit/qunit.css create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/test/qunit/qunit.js create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/test/test.URI.html create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/test/test.fragmentQuery.html create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/test/test.fragmentURI.html create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/test/test.jQuery-1.10.html create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/test/test.jQuery-1.7.html create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/test/test.jQuery-1.8.html create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/test/test.jQuery-1.9.html create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/test/test.js create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/test/test_fragmentQuery.js create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/test/test_fragmentURI.js create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/test/test_jim.js create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/test/test_jquery.js create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/test/test_template.js create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/test/urls.js create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/uri-template.html create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/utils/SLDs.php create mode 100644 mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/utils/sld.js create mode 100644 mayan/apps/appearance/static/appearance/vendors/form-4.2.2/.circleci/config.yml create mode 100644 mayan/apps/appearance/static/appearance/vendors/form-4.2.2/.editorconfig create mode 100644 mayan/apps/appearance/static/appearance/vendors/form-4.2.2/.eslintrc.js create mode 100644 mayan/apps/appearance/static/appearance/vendors/form-4.2.2/.github/issue_template.md create mode 100644 mayan/apps/appearance/static/appearance/vendors/form-4.2.2/.gitignore create mode 100644 mayan/apps/appearance/static/appearance/vendors/form-4.2.2/.travis.yml create mode 100644 mayan/apps/appearance/static/appearance/vendors/form-4.2.2/CODE_OF_CONDUCT.md create mode 100644 mayan/apps/appearance/static/appearance/vendors/form-4.2.2/CONTRIBUTING.md create mode 100644 mayan/apps/appearance/static/appearance/vendors/form-4.2.2/CONTRIBUTORS.md create mode 100644 mayan/apps/appearance/static/appearance/vendors/form-4.2.2/Gruntfile.js create mode 100644 mayan/apps/appearance/static/appearance/vendors/form-4.2.2/LICENSE create mode 100644 mayan/apps/appearance/static/appearance/vendors/form-4.2.2/LICENSE-MIT create mode 100644 mayan/apps/appearance/static/appearance/vendors/form-4.2.2/README.md create mode 100644 mayan/apps/appearance/static/appearance/vendors/form-4.2.2/_config.yml create mode 100644 mayan/apps/appearance/static/appearance/vendors/form-4.2.2/bower.json create mode 100644 mayan/apps/appearance/static/appearance/vendors/form-4.2.2/composer.json create mode 100644 mayan/apps/appearance/static/appearance/vendors/form-4.2.2/dist/jquery.form.min.js create mode 100644 mayan/apps/appearance/static/appearance/vendors/form-4.2.2/dist/jquery.form.min.js.map create mode 100644 mayan/apps/appearance/static/appearance/vendors/form-4.2.2/docs/.gitignore create mode 100644 mayan/apps/appearance/static/appearance/vendors/form-4.2.2/docs/Gemfile create mode 100644 mayan/apps/appearance/static/appearance/vendors/form-4.2.2/docs/_config.yml create mode 100644 mayan/apps/appearance/static/appearance/vendors/form-4.2.2/docs/_layouts/default.html create mode 100644 mayan/apps/appearance/static/appearance/vendors/form-4.2.2/docs/_sass/style.scss create mode 100644 mayan/apps/appearance/static/appearance/vendors/form-4.2.2/docs/api.md create mode 100644 mayan/apps/appearance/static/appearance/vendors/form-4.2.2/docs/assets/css/style.scss create mode 100644 mayan/apps/appearance/static/appearance/vendors/form-4.2.2/docs/faq.md create mode 100644 mayan/apps/appearance/static/appearance/vendors/form-4.2.2/docs/index.md create mode 100644 mayan/apps/appearance/static/appearance/vendors/form-4.2.2/docs/options.md create mode 100644 mayan/apps/appearance/static/appearance/vendors/form-4.2.2/form.jquery.json create mode 100644 mayan/apps/appearance/static/appearance/vendors/form-4.2.2/install/pre-commit.sh create mode 100644 mayan/apps/appearance/static/appearance/vendors/form-4.2.2/install/template/shell.hb create mode 100644 mayan/apps/appearance/static/appearance/vendors/form-4.2.2/package-lock.json create mode 100644 mayan/apps/appearance/static/appearance/vendors/form-4.2.2/package.json create mode 100644 mayan/apps/appearance/static/appearance/vendors/form-4.2.2/src/jquery.form.js create mode 100644 mayan/apps/appearance/static/appearance/vendors/form-4.2.2/test/.eslintrc.js create mode 100644 mayan/apps/appearance/static/appearance/vendors/form-4.2.2/test/ajax/doc-with-scripts.html create mode 100644 mayan/apps/appearance/static/appearance/vendors/form-4.2.2/test/ajax/json.json create mode 100644 mayan/apps/appearance/static/appearance/vendors/form-4.2.2/test/ajax/json.txt create mode 100644 mayan/apps/appearance/static/appearance/vendors/form-4.2.2/test/ajax/script.txt create mode 100644 mayan/apps/appearance/static/appearance/vendors/form-4.2.2/test/ajax/test.xml create mode 100644 mayan/apps/appearance/static/appearance/vendors/form-4.2.2/test/ajax/text.html create mode 100644 mayan/apps/appearance/static/appearance/vendors/form-4.2.2/test/img/submit.gif create mode 100644 mayan/apps/appearance/static/appearance/vendors/form-4.2.2/test/test.html create mode 100644 mayan/apps/appearance/static/appearance/vendors/form-4.2.2/test/test.js create mode 100644 mayan/apps/appearance/templates/appearance/root.html diff --git a/mayan/apps/appearance/static/appearance/js/base.js b/mayan/apps/appearance/static/appearance/js/base.js index eae3ec89d4..a49ba26e43 100644 --- a/mayan/apps/appearance/static/appearance/js/base.js +++ b/mayan/apps/appearance/static/appearance/js/base.js @@ -1,261 +1,24 @@ 'use strict'; -var App = function (parameters) { - var self = this; - - parameters = parameters || {} - - this.window = $(window); -} - -App.tagSelectionTemplate = function (tag, container) { - var $tag = $( - ' ' + tag.text + '' - ); - container[0].style.background = tag.element.style.color; - return $tag; -} - -App.tagResultTemplate = function (tag) { - if (!tag.element) { return ''; } - var $tag = $( - ' ' + tag.text + '' - ); - return $tag; -} - -App.prototype.setupAutoSubmit = function () { - $('.select-auto-submit').change(function () { - if ($(this).val()) { - this.form.submit(); - } - }); -} - -App.prototype.setupScrollView = function () { - $('.scrollable').scrollview(); -} - -App.prototype.setupTableSelector = function () { - $('th input:checkbox').click(function(e) { - var table = $(e.target).closest('table'); - var checked = $(e.target).prop('checked'); - $('td input:checkbox', table).prop('checked', checked); - }); -} - -App.prototype.setupItemsSelector = function () { - $('.check-all').click(function(e) { - var parent = $(e.target).closest('.well'); - var checked = $(e.target).prop('checked'); - $('.panel-item input:checkbox', parent).prop('checked', checked); - }); -} - -App.prototype.setupWindowPopUp = function () { - $('a.new_window').click(function(event) { - event.preventDefault(); - var newWindow = window.open($(this).attr('href'), '_blank'); - newWindow.focus(); - }); -} - -App.prototype.setupSelect2 = function () { - $('.select2').select2({ - dropdownAutoWidth: true, - width: '100%' - }); - - $('.select2-tags').select2({ - templateSelection: App.tagSelectionTemplate, - templateResult: App.tagResultTemplate, - width: '100%' - }); -} - -App.prototype.setupFullHeightResizing = function () { - var self = this; - - this.resizeFullHeight(); - - this.window.resize(function() { - self.resizeFullHeight(); - }); -} - -App.prototype.resizeFullHeight = function () { - $('.full-height').height(this.window.height() - $('.full-height').data('height-difference')); -} - -App.prototype.doToastrMessages = function () { - toastr.options = { - 'closeButton': true, - 'debug': false, - 'newestOnTop': true, - 'positionClass': 'toast-top-right', - 'preventDuplicates': false, - 'onclick': null, - 'showDuration': '300', - 'hideDuration': '1000', - 'timeOut': '5000', - 'extendedTimeOut': '1000', - 'showEasing': 'swing', - 'hideEasing': 'linear', - 'showMethod': 'fadeIn', - 'hideMethod': 'fadeOut' - } - - // Add invisible bootstrap messages to copy the styles to toastr.js - - $('body').append('\ - \ - \ - \ - \ - '); - - // Copy the bootstrap style from the sample alerts to toaster.js via - // dynamic document style tag - - $('head').append('\ - \ - '); - - $.each(DjangoMessages, function (index, value) { - var options = {}; - - if (value.tags === 'error') { - // Error messages persist - options['timeOut'] = 10000; - } - toastr[value.tags](value.message, '', options); - }); -} - -/* MayanImage class */ - -var MayanImage = function (options) { - this.element = options.element; - this.load(); -} - -MayanImage.intialize = function () { - $('a.fancybox').fancybox({ - beforeShow : function(){ - this.title = $(this.element).data('caption'); - }, - openEffect : 'elastic', - closeEffect : 'elastic', - prevEffect : 'none', - nextEffect : 'none', - titleShow : true, - type : 'image', - autoResize : true, - }); - - $('img.lazy-load').lazyload({ - appear: function(elements_left, settings) { - new MayanImage({element: $(this)}); - }, - threshold: 400, - }); - - $('img.lazy-load-carousel').lazyload({ - appear: function(elements_left, settings) { - new MayanImage({element: $(this)}); - }, - container: $('#carousel-container'), - threshold: 2000 - }); - - $('.lazy-load').on('load', function() { - $(this).hide(); - $(this).fadeIn(); - $(this).siblings('.spinner-container').remove(); - $(this).removeClass('lazy-load pull-left'); - }); - - $('.lazy-load-carousel').on('load', function() { - $(this).hide(); - $(this).fadeIn(); - $(this).siblings('.spinner-container').remove(); - $(this).removeClass('lazy-load-carousel pull-left'); - }); -} - -MayanImage.prototype.onImageError = function () { - this.element.parent().parent().html('\ -
\ - \ - \ - \ - \ -
\ - ') - - // Remove border to indicate non interactive image - this.element.removeClass('thin_border'); - - var container = this.element.parent().parent(); - // Save img HTML - var html = this.element.parent().html(); - // Remove anchor - this.element.parent().remove(); - // Place again img - container.html(html); -}; - -MayanImage.prototype.load = function () { - var self = this; - - this.element.error(function(event) { - self.onImageError(); - }); - - this.element.attr('src', this.element.attr('data-url')); - $.fn.matchHeight._update(); - $.fn.matchHeight._maintainScroll = true; -}; +var app = new App(); jQuery(document).ready(function() { - var app = new App(); - app.setupFullHeightResizing(); + var partialNavigation = new PartialNavigation({ + initialURL: initialURL, + excludeAnchorClasses: ['fancybox', 'new_window'], + }); +}); + +var afterBaseLoad = function () { MayanImage.intialize(); app.doToastrMessages(); - - app.setupSelect2(); - - app.setupScrollView(); - - app.setupItemsSelector(); - - app.setupTableSelector(); - - app.setupWindowPopUp(); - app.setupAutoSubmit(); -}); + app.setupItemsSelector(); + app.setupNewWindowAnchor(); + app.setupTableSelector(); + app.setupSelect2(); + app.setupScrollView(); +} diff --git a/mayan/apps/appearance/static/appearance/js/mayan_app.js b/mayan/apps/appearance/static/appearance/js/mayan_app.js new file mode 100644 index 0000000000..fc745b23e9 --- /dev/null +++ b/mayan/apps/appearance/static/appearance/js/mayan_app.js @@ -0,0 +1,157 @@ +'use strict'; + +var App = function (parameters) { + var self = this; + + parameters = parameters || {} + + this.window = $(window); +} + +// Class methods and variables + +App.tagSelectionTemplate = function (tag, container) { + var $tag = $( + ' ' + tag.text + '' + ); + container[0].style.background = tag.element.style.color; + return $tag; +} + +App.tagResultTemplate = function (tag) { + if (!tag.element) { return ''; } + var $tag = $( + ' ' + tag.text + '' + ); + return $tag; +} + +// Instance methods + +App.prototype.doToastrMessages = function () { + toastr.options = { + 'closeButton': true, + 'debug': false, + 'newestOnTop': true, + 'positionClass': 'toast-top-right', + 'preventDuplicates': false, + 'onclick': null, + 'showDuration': '300', + 'hideDuration': '1000', + 'timeOut': '5000', + 'extendedTimeOut': '1000', + 'showEasing': 'swing', + 'hideEasing': 'linear', + 'showMethod': 'fadeIn', + 'hideMethod': 'fadeOut' + } + + // Add invisible bootstrap messages to copy the styles to toastr.js + + $('body').append('\ + \ + \ + \ + \ + '); + + // Copy the bootstrap style from the sample alerts to toaster.js via + // dynamic document style tag + + $('head').append('\ + \ + '); + + $.each(DjangoMessages, function (index, value) { + var options = {}; + + if (value.tags === 'error') { + // Error messages persist + options['timeOut'] = 10000; + } + toastr[value.tags](value.message, '', options); + }); +} + +App.prototype.setupAutoSubmit = function () { + $('.select-auto-submit').change(function () { + if ($(this).val()) { + this.form.submit(); + } + }); +} + +App.prototype.setupNewWindowAnchor = function () { + $('a.new_window').click(function (event) { + var newWindow = window.open($(this).attr('href'), '_blank'); + newWindow.focus(); + }); +} + +App.prototype.setupScrollView = function () { + $('.scrollable').scrollview(); +} + +App.prototype.setupTableSelector = function () { + $('th input:checkbox').click(function(e) { + var table = $(e.target).closest('table'); + var checked = $(e.target).prop('checked'); + $('td input:checkbox', table).prop('checked', checked); + }); +} + +App.prototype.setupItemsSelector = function () { + $('.check-all').click(function(e) { + var parent = $(e.target).closest('.well'); + var checked = $(e.target).prop('checked'); + $('.panel-item input:checkbox', parent).prop('checked', checked); + }); +} + +App.prototype.setupSelect2 = function () { + $('.select2').select2({ + dropdownAutoWidth: true, + width: '100%' + }); + + $('.select2-tags').select2({ + templateSelection: App.tagSelectionTemplate, + templateResult: App.tagResultTemplate, + width: '100%' + }); +} + +App.prototype.setupFullHeightResizing = function () { + var self = this; + + this.resizeFullHeight(); + + this.window.resize(function() { + self.resizeFullHeight(); + }); +} + +App.prototype.resizeFullHeight = function () { + $('.full-height').height(this.window.height() - $('.full-height').data('height-difference')); +} diff --git a/mayan/apps/appearance/static/appearance/js/mayan_image.js b/mayan/apps/appearance/static/appearance/js/mayan_image.js new file mode 100644 index 0000000000..f146b4b279 --- /dev/null +++ b/mayan/apps/appearance/static/appearance/js/mayan_image.js @@ -0,0 +1,84 @@ +'use strict'; + +var MayanImage = function (options) { + this.element = options.element; + this.load(); +} + +MayanImage.intialize = function () { + $('a.fancybox').fancybox({ + beforeShow : function(){ + this.title = $(this.element).data('caption'); + }, + openEffect : 'elastic', + closeEffect : 'elastic', + prevEffect : 'none', + nextEffect : 'none', + titleShow : true, + type : 'image', + autoResize : true, + }); + + $('img.lazy-load').lazyload({ + appear: function(elements_left, settings) { + new MayanImage({element: $(this)}); + }, + threshold: 400, + }); + + $('img.lazy-load-carousel').lazyload({ + appear: function(elements_left, settings) { + new MayanImage({element: $(this)}); + }, + container: $('#carousel-container'), + threshold: 2000 + }); + + $('.lazy-load').on('load', function() { + $(this).hide(); + $(this).fadeIn(); + $(this).siblings('.spinner-container').remove(); + $(this).removeClass('lazy-load pull-left'); + }); + + $('.lazy-load-carousel').on('load', function() { + $(this).hide(); + $(this).fadeIn(); + $(this).siblings('.spinner-container').remove(); + $(this).removeClass('lazy-load-carousel pull-left'); + }); +} + +MayanImage.prototype.onImageError = function () { + this.element.parent().parent().html('\ +
\ + \ + \ + \ + \ +
\ + ') + + // Remove border to indicate non interactive image + this.element.removeClass('thin_border'); + + var container = this.element.parent().parent(); + // Save img HTML + var html = this.element.parent().html(); + // Remove anchor + this.element.parent().remove(); + // Place again img + container.html(html); +}; + +MayanImage.prototype.load = function () { + var self = this; + + this.element.error(function(event) { + self.onImageError(); + }); + + this.element.attr('src', this.element.attr('data-url')); + $.fn.matchHeight._update(); + $.fn.matchHeight._maintainScroll = true; +}; diff --git a/mayan/apps/appearance/static/appearance/js/partial_navigation.js b/mayan/apps/appearance/static/appearance/js/partial_navigation.js new file mode 100644 index 0000000000..062bceaae8 --- /dev/null +++ b/mayan/apps/appearance/static/appearance/js/partial_navigation.js @@ -0,0 +1,203 @@ +'use strict'; + +$.fn.hasAnyClass = function() { + for (var i = 0; i < arguments[0].length; i++) { + if (this.hasClass(arguments[0][i])) { + return true; + } + } + return false; +} + +var PartialNavigation = function (parameters) { + parameters = parameters || {}; + + this.initialURL = parameters.initialURL || null; + this.excludeAnchorClasses = parameters.excludeAnchorClasses || []; + + if (!this.initialURL) { + alert('Need to setup initialURL'); + } + + this.setupAjaxAnchors(); + this.setupHashLocation(); + this.setupAjaxForm(); +} + +PartialNavigation.prototype.filterLocation = function (location) { + var uri = new URI(location); + + console.log('>> filterLocation.location: ' + location); + console.log('>> filterLocation.uri.path(): ' + uri.path()); + if (uri.path() === '/') { + // Root URL is not allowed + return this.initialURL; + } + + return location; +} + +PartialNavigation.prototype.loadAjaxContent = function (url) { + var app = this; + + console.log('>> loadAjaxContent.url: ' + url); + url = this.filterLocation(url); + console.log('>> loadAjaxContent.filterLocation.url: ' + url); + $.ajax({ + async: true, + mimeType: 'text/html; charset=utf-8', // ! Need set mimeType only when run from local file + url: url, + type: 'GET', + success: function(data, textStatus, response){ + if (response.status == 278) { + console.log('>> loadAjaxContent.ajax: got HTTP278'); + var newLocation = response.getResponseHeader('Location'); + + console.log('>> loadAjaxContent.ajax.newLocation: ' + newLocation); + + app.setLocation(newLocation); + } else { + if (response.getResponseHeader('Content-Disposition')) { + window.location = this.url; + } else { + $('#ajax-content').html(data); + } + } + }, + error: function(jqXHR, textStatus, errorThrown){ + app.processAjaxRequestError(jqXHR); + }, + dataType: 'html', + }); +} + +PartialNavigation.prototype.onAnchorClick = function ($this, event) { + console.log('>> onAnchorClick'); + var url; + + if ($this.hasAnyClass(this.excludeAnchorClasses)) { + return true; + } + + url = $this.attr('href'); + if (url === undefined) { + return true; + } + + event.preventDefault(); + + console.log('>> onAnchorClick.url: ' + url); + + if ((url !== '#') && !($this.hasClass('disabled') || $this.parent().hasClass('disabled'))) { + this.setLocation(url); + } +} + +PartialNavigation.prototype.processAjaxRequestError = function (jqXHR) { + window.history.back(); + + if (jqXHR.status == 0) { + $('#modal-server-error .modal-body').html($('#template-error').html()); + } else { + $('#modal-server-error .modal-body').html(jqXHR.responseText.replace(/\n/g, "
")); + } + + $('#modal-server-error').modal('show') +} + +PartialNavigation.prototype.setLocation = function (newLocation) { + console.log('>> setLocation.newLocation: ' + newLocation); + console.log('>> setLocation.location: ' + location); + newLocation = this.filterLocation(newLocation); + + var currentLocationPath = new URI(location).fragment(); + var newLocationPath = new URI(newLocation).path(); + + console.log(currentLocationPath); + console.log(newLocationPath); + if (currentLocationPath === newLocationPath) { + // New location same as old, force a reload + this.loadAjaxContent(newLocation); + } + window.location.hash = newLocation; +} + +PartialNavigation.prototype.setupAjaxAnchors = function () { + var app = this; + $('body').on('click', 'a', function (event) { + app.onAnchorClick($(this), event); + }); +} + +PartialNavigation.prototype.setupAjaxForm = function () { + var app = this; + + $('form').ajaxForm({ + async: true, + beforeSubmit: function(arr, $form, options) { + console.log('>> ajaxForm.beforeSubmit.$form.target: ' + $form.attr('action')); + + var uri = new URI(location); + var uriFragment = uri.fragment(); + console.log('>>ajaxForm.$form.target.uriFragment:' + uriFragment); + + var url = $form.attr('action') || uriFragment; + + options.url = url; + console.log('>>ajaxForm.url:' + url); + }, + dataType: 'html', + delegation: true, + error: function(jqXHR, textStatus, errorThrown){ + app.processAjaxRequestError(jqXHR); + }, + mimeType: 'text/html; charset=utf-8', // ! Need set mimeType only when run from local file + success: function(data, textStatus, request){ + if (request.status == 278) { + console.log('>> ajaxForm: Got HTTP 278'); + var newLocation = request.getResponseHeader('Location'); + + var uri = new URI(newLocation); + var uriFragment = uri.fragment(); + + console.log('>>ajaxForm.newLocation:' + newLocation); + console.log('>>ajaxForm.newLocation.uriFragment:' + uriFragment); + console.log('>>ajaxForm.window.location.hash:' + window.location.hash); + + var currentUri = new URI(window.location.hash); + var currentUriFragment = currentUri.fragment(); + + var url = uriFragment || currentUriFragment; + + app.setLocation(newLocation); + + } else { + console.log('>>ajaxForm.success'); + $('#ajax-content').html(data); + } + } + }); +} + +PartialNavigation.prototype.setupHashLocation = function () { + var app = this; + + // Load ajax content when the hash changes + if (window.history && window.history.pushState) { + $(window).on('popstate', function() { + console.log('>> setupHashLocation.location: ' + location); + var uri = new URI(location); + var uriFragment = uri.fragment(); + app.loadAjaxContent(uriFragment); + }); + } + + // Load any initial address in the URL of the browser + if (window.location.hash) { + var uri = new URI(window.location.hash); + var uriFragment = uri.fragment(); + this.setLocation(uriFragment); + } else { + this.setLocation('/'); + } +} diff --git a/mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/.editorconfig b/mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/.editorconfig new file mode 100644 index 0000000000..778c1485cb --- /dev/null +++ b/mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[**] +charset = utf-8 +end_of_line = lf +indent_size = 2 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true diff --git a/mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/.gitignore b/mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/.gitignore new file mode 100644 index 0000000000..9daa8247da --- /dev/null +++ b/mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/.gitignore @@ -0,0 +1,2 @@ +.DS_Store +node_modules diff --git a/mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/.jshintrc b/mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/.jshintrc new file mode 100644 index 0000000000..8327de8cb3 --- /dev/null +++ b/mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/.jshintrc @@ -0,0 +1,31 @@ +{ + "node": true, + "browser": false, + "esnext": false, + "bitwise": false, + "camelcase": true, + "curly": true, + "eqeqeq": true, + "immed": true, + "indent": 2, + "latedef": true, + "newcap": true, + "noarg": true, + "quotmark": "single", + "regexp": true, + "undef": true, + "unused": true, + "strict": true, + "trailing": true, + "smarttabs": true, + "expr": true, + "globals": { + "describe": false, + "it": false, + "before": false, + "beforeEach": false, + "after": false, + "afterEach": false, + "define": false + } +} \ No newline at end of file diff --git a/mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/CHANGELOG.md b/mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/CHANGELOG.md new file mode 100644 index 0000000000..e3641caa87 --- /dev/null +++ b/mayan/apps/appearance/static/appearance/vendors/URI.js-1.19.1/CHANGELOG.md @@ -0,0 +1,383 @@ +# URI.js - Changelog # + +The release notes tracked in this document are also made available on the [releases page](https://github.com/medialize/URI.js/releases) + +### 1.19.1 (February 10th 2018) ### + +* fixing [`.href()`](http://medialize.github.io/URI.js/docs.html#href) to parse `query` property - [Issue #366](https://github.com/medialize/URI.js/issues/366), [PR #367](https://github.com/medialize/URI.js/issues/367) + +### 1.19.0 (October 1st 2017) ### + +* adding `.setFragment()` to [query fragment plugin](http://medialize.github.io/URI.js/docs.html#fragment-abuse-query) - [Issue #338](https://github.com/medialize/URI.js/issues/338), [PR #356](https://github.com/medialize/URI.js/issues/356) +* adding setting [`URI.preventInvalidHostname`](http://medialize.github.io/URI.js/docs.html#setting-preventInvalidHostname) to control if an error should be thrown on invalid input - [Issue #352](https://github.com/medialize/URI.js/issues/352), [Issue #354](https://github.com/medialize/URI.js/issues/354), [Issue #355](https://github.com/medialize/URI.js/issues/355) - effectively making the changes of version 1.18.11 opt-in rather than default. + +### 1.18.12 (August 9th 2017) ### + +* making [`URI.parse()`](http://medialize.github.io/URI.js/docs.html#static-parse) allow `_` in hostname - [Issue #347](https://github.com/medialize/URI.js/issues/347), [PR #348](https://github.com/medialize/URI.js/issues/348) +* fixing [`URI.parse()`](http://medialize.github.io/URI.js/docs.html#static-parse) to not use `Number.isNumber()` for IE compatibility - [Issue #350](https://github.com/medialize/URI.js/issues/350), [PR #351](https://github.com/medialize/URI.js/issues/351) + +### 1.18.11 (August 8th 2017) ### + +* making [`URI.parse()`](http://medialize.github.io/URI.js/docs.html#static-parse) throw on invalid port and hostname - [Issue #344](https://github.com/medialize/URI.js/issues/344), [PR #345](https://github.com/medialize/URI.js/issues/345) + +### 1.18.10 (March 30th 2017) ### + +* adding support for [CentralNic](https://en.wikipedia.org/wiki/CentralNic#Second-level_domains) Second Level Domains - [Issue #333](https://github.com/medialize/URI.js/issues/333) + +### 1.18.9 (March 6th 2017) ### + +* adding option `strict` to [`URITemplate()`](http://medialize.github.io/URI.js/uri-template.html) in order to throw an exception in case a placeholder could not be replaced - [PR #330](https://github.com/medialize/URI.js/issues/330) + +### 1.18.8 (February 27th 2017) ### + +* fixing [`.absoluteTo()`](http://medialize.github.io/URI.js/docs.html#absoluteto) to not resolve URIs containing a scheme - [Issue #328](https://github.com/medialize/URI.js/issues/328) + +### 1.18.7 (February 13th 2017) ### + +* fixing [`URI.withinString()`](http://medialize.github.io/URI.js/docs.html#static-withinString) to ignore `www.` and `http://.` - [Issue #327](https://github.com/medialize/URI.js/issues/327) + +### 1.18.6 (February 10th 2017) ### + +* fixing [`URITemplate()`](http://medialize.github.io/URI.js/uri-template.html) to allow `'` (single quotes) in literals - [PR #326](https://github.com/medialize/URI.js/pull/326) + +### 1.18.5 (January 30th 2017) ### + +* prevent `new URI(null)` from blowing up - [PR #321](https://github.com/medialize/URI.js/issues/321) +* fixing [`URI.withinString()`](http://medialize.github.io/URI.js/docs.html#static-withinString) to properly handle fully contained parentheses - [Issue #325](https://github.com/medialize/URI.js/issues/325) + +### 1.18.4 (December 4th 2016) ### + +* fixing [`URI.withinString()`](http://medialize.github.io/URI.js/docs.html#static-withinString) to capture balanced parentheses - [Issue #247](https://github.com/medialize/URI.js/issues/247) + +### 1.18.3 (November 17th 2016) ### + +* fixing UMD wrappers to properly detect CommonJS - [Issue #318](https://github.com/medialize/URI.js/issues/318), [PR #319](https://github.com/medialize/URI.js/pull/319) + +### 1.18.2 (September 25th 2016) ### + +* fixing [`URI.withinString()`](http://medialize.github.io/URI.js/docs.html#static-withinString) to allow callback to return `undefined` or `string` - [Issue #303](https://github.com/medialize/URI.js/issues/303) +* fixing [`.absoluteTo()`](http://medialize.github.io/URI.js/docs.html#absoluteto) to properly resolve relative paths for fragment-only URLs + +### 1.18.1 (May 29th 2016) ### + +* fixing UMD wrapper of `jquery.URI.js` - [Issue #295](https://github.com/medialize/URI.js/issues/295) + +### 1.18.0 (April 30th 2016) ### + +* adding [`URI.joinPaths()`](http://medialize.github.io/URI.js/docs.html#static-joinPaths) to compose paths from directory tokens - [Issue #285](https://github.com/medialize/URI.js/issues/285) +* fixing [`URITemplate()`](http://medialize.github.io/URI.js/uri-template.html) to allow `.` in variable names - [PR #287](https://github.com/medialize/URI.js/pull/287) +* fixing [`URITemplate()`](http://medialize.github.io/URI.js/uri-template.html) to reject invalid literals - [PR #289](https://github.com/medialize/URI.js/pull/289) +* fixing [`URITemplate()`](http://medialize.github.io/URI.js/uri-template.html) to reject prefix modifier on composite values - [PR #290](https://github.com/medialize/URI.js/pull/290) +* fixing [`URI.buildUserinfo()`](http://medialize.github.io/URI.js/docs.html#static-buildUserinfo) to properly serialize password-only values - [PR #293](https://github.com/medialize/URI.js/pull/293) + +### 1.17.1 (February 25th 2016) ### + +* fixing [`.normalizePath()`](http://medialize.github.io/URI.js/docs.html#normalize-path) to properly handle percent-encoded dot segments and leading dots in basename - [Issue #264](https://github.com/medialize/URI.js/issues/264), by [JordanMilne](https://github.com/JordanMilne) +* fixing [`.hasQuery()`](http://medialize.github.io/URI.js/docs.html#search-has) to accept `RegExp` for name argument - [Issue #274](https://github.com/medialize/URI.js/issues/274), [Issue #277](https://github.com/medialize/URI.js/issues/277) by [mbrodala](https://github.com/mbrodala) + +### 1.17.0 (November 13th 2015) ### + +* fixing [`URI.removeQuery()`](http://medialize.github.io/URI.js/docs.html#search-remove) to cast values to string before matching - [Issue #250](https://github.com/medialize/URI.js/pull/250), [Issue #252](https://github.com/medialize/URI.js/pull/252), by [ryanelian](https://github.com/ryanelian) and [Siltaar](https://github.com/Siltaar) +* fixing [`.segment()`](http://medialize.github.io/URI.js/docs.html#accessors-segment) to allow appending an empty element - [Issue #236](https://github.com/medialize/URI.js/issues/236), [Issue #253](https://github.com/medialize/URI.js/pull/253), by [orlando](https://github.com/orlando) +* adding [`.origin()`](http://medialize.github.io/URI.js/docs.html#accessors-origin) to get protocol and authority, counter-part to `.resource()` - [Issue #210](https://github.com/medialize/URI.js/issues/210), [Issue #263](https://github.com/medialize/URI.js/pull/263), by [justinmchase](https://github.com/justinmchase) + +### 1.16.1 (September 19th 2015) ### + +Package Management Cleanup - no changes to source code! + +* renaming package to "urijs", was "URIjs" (because npm decided to go lower-case at some point and maintaining capitals in your package name poses all sorts of stupid issues) +* removing [jam](http://jamjs.org/), [spm](http://spmjs.org/), `component.json` and `URI.jquery.json` as nobody cared that URI.js was stuck on 1.14 for a year + +### 1.16.0 (July 24th 2015) ### + +* **SECURITY** fixing [`URI.parseHost()`](http://medialize.github.io/URI.js/docs.html#static-parseHost) to rewrite `\` to `/` as Node and Browsers do - [Issue #233](https://github.com/medialize/URI.js/pull/233) +* fixing [`.host()`](http://medialize.github.io/URI.js/docs.html#accessors-host) and [`.authority()`](http://medialize.github.io/URI.js/docs.html#accessors-authority) to raise an error if they contain a path segment (extending [Issue #233](https://github.com/medialize/URI.js/pull/233)) + +### 1.15.2 (July 2nd 2015) ### + +* fixing [`URI.parseQuery()`](http://medialize.github.io/URI.js/docs.html#static-parseQuery) to accept `?foo&foo=bar` - [Issue #220](https://github.com/medialize/URI.js/issues/220) +* fixing [`.segmentCoded()`](http://medialize.github.io/URI.js/docs.html#accessors-segmentCoded) to encode (instead of decode) array input - [Issue #223](https://github.com/medialize/URI.js/issues/223) +* fixing [`.normalizePath()`](http://medialize.github.io/URI.js/docs.html#normalize-path) to properly resolve `/foo/..` to `/` - [Issue #224](https://github.com/medialize/URI.js/issues/224) +* fixing [`.relativeTo()`](http://medialize.github.io/URI.js/docs.html#relativeto) to resolve `/foo/` and `/foo/bar` to `./` instead of empty string - [Issue #226](https://github.com/medialize/URI.js/issues/226) +* fixing `bower.json`'s `"main": "src/URI.js"` - [Issue #227](https://github.com/medialize/URI.js/issues/227) + +### 1.15.1 (April 5th 2015) ### + +* fixing `URI()` to match behavior of `new URI()` (caused by [#196](https://github.com/medialize/URI.js/issues/196)) - [Issue #205](https://github.com/medialize/URI.js/issues/205) +* fixing [`URI.removeQuery()`](http://medialize.github.io/URI.js/docs.html#search-remove) to accept RegExp for name and value arguments - ([Issue #204](https://github.com/medialize/URI.js/issues/204), [peterwillis](https://github.com/peterwillis)) + +### 1.15.0 (April 1st 2015 - no joke, promise!) ### + +* fixing `URI(undefined)` to throw TypeError - ([Issue #189](https://github.com/medialize/URI.js/issues/189), [Issue #196](https://github.com/medialize/URI.js/issues/196), [eakron](https://github.com/eakron)) - *tiny backward-compatibility-break* +* fixing [`.absoluteTo()`](http://medialize.github.io/URI.js/docs.html#absoluteto) - ([Issue #200](https://github.com/medialize/URI.js/issues/200), [giltayar](https://github.com/giltayar)) +* fixing [`.pathname()`](http://medialize.github.io/URI.js/docs.html#accessors-pathname) to properly en/decode URN paths - ([Issue #201](https://github.com/medialize/URI.js/pull/201), [mlefoster](https://github.com/mlefoster)) +* fixing URI normalization to properly handle URN paths based on [RFC 2141](https://www.ietf.org/rfc/rfc2141.txt) syntax - ([Issue #201](https://github.com/medialize/URI.js/pull/201), [mlefoster](https://github.com/mlefoster)) + * fixing [`.normalize()`](http://medialize.github.io/URI.js/docs.html#normalize) and [`.normalizePath()`](http://medialize.github.io/URI.js/docs.html#normalize-path) to properly normalize URN paths + * adding `URI.encodeUrnPathSegment()` + * adding `URI.decodeUrnPathSegment()` + * adding `URI.decodeUrnPath()` + * adding `URI.recodeUrnPath()` + +### 1.14.2 (February 25th 2015) ### + +* fixing inclusion of LICENSE in packages - ([Issue #174](https://github.com/medialize/URI.js/issues/174)) +* fixing [`URI.parseHost()`](http://medialize.github.io/URI.js/docs.html#static-parseHost) to not interpret colon in path as IPv6 hostname - ([Issue #190](https://github.com/medialize/URI.js/issues/190)) +* adding meta data for [SPM](http://www.spmjs.io/) package manager - ([Issue #176](https://github.com/medialize/URI.js/issues/176)) +* adding license meta to `bower.json` + +### 1.14.1 (October 1st 2014) ### + +* fixing handling of String instances (not string primitives) - ([Issue #146](https://github.com/medialize/URI.js/issues/146)) +* fixing Firefox [`.watch()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/watch) interfering with `.parseQuery()` - ([Issue #169](https://github.com/medialize/URI.js/issues/169)) +* fixing [`addQuery()`](http://medialize.github.io/URI.js/docs.html#search-add) to not throw error on null value - ([Issue #171](https://github.com/medialize/URI.js/issues/171)) + +### 1.14.0 (September 8th 2014) ### + +* adding Hungarian second level domains - ([Issue #159](https://github.com/medialize/URI.js/issues/159)) +* adding `