From 55dda5c2908390409f0b3d76cae0c5a02d82c57e Mon Sep 17 00:00:00 2001 From: David Santos Date: Fri, 19 Jan 2024 10:10:25 +0000 Subject: [PATCH 01/40] chore: Enable javascript builds with ES2015+ syntax [BACKLOG-40011] --- .eslintignore | 13 + .eslintrc.json | 34 +- .gitignore | 1 + .prettierignore | 13 + .prettierrc | 4 + .puppeteerrc.js | 6 + README.md | 12 +- impl/client/pom.xml | 7 +- .../assembly/dependencies-js-assembly.xml | 2 +- .../src/main/config/javascript/build.js | 35 +- .../test/config/javascript/karma.ci.conf.js | 65 +- .../config/javascript/karma.headless.conf.js | 64 + package-lock.json | 12640 +++++++++++----- package.json | 33 +- 14 files changed, 9080 insertions(+), 3849 deletions(-) create mode 100644 .eslintignore create mode 100644 .prettierignore create mode 100644 .prettierrc create mode 100644 .puppeteerrc.js create mode 100644 impl/client/src/test/config/javascript/karma.headless.conf.js diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000000..8be410c2c3 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,13 @@ +node_modules +target +config +assembly +docs +resources +resources-filtered + +# ignored sources (external libs) +**/web/bootstrap +**/web/dataapi/Xmla.js +**/web/handlebars +**/web/underscore diff --git a/.eslintrc.json b/.eslintrc.json index 61166564a5..5c3c46920e 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,10 +1,28 @@ { - "extends": "google", + "extends": [ + "plugin:import/recommended", + "airbnb-base", + "prettier" + ], + + "plugins": ["import"], + + "parserOptions": { + "ecmaVersion": 2020 + }, + "env": { "amd" : true, "jasmine": true, "browser": true }, + + "globals": { + "inject": true, + "module": true, + "requirejs": true + }, + "rules": { "indent": ["error", 2, { "VariableDeclarator": { @@ -81,11 +99,13 @@ {"blankLine": "always", "prev": "block-like", "next": "return"}, {"blankLine": "always", "prev": "directive", "next": "*"}, {"blankLine": "any", "prev": "directive", "next": "directive"} - ] - }, - "globals": { - "inject": true, - "module": true, - "requirejs": true + ], + + "no-restricted-syntax": "off", + "no-plusplus": ["warn", { "allowForLoopAfterthoughts": true }], + "no-underscore-dangle": "off", + "import/no-amd": "off", + "prefer-rest-params": "off", + "prefer-spread": "off" } } diff --git a/.gitignore b/.gitignore index 47ca8d0651..5c3ce9ff72 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,4 @@ bin /impl/server/pentaho.log docs/.jekyll-metadata docs/_site +.eslintcache diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000000..8be410c2c3 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,13 @@ +node_modules +target +config +assembly +docs +resources +resources-filtered + +# ignored sources (external libs) +**/web/bootstrap +**/web/dataapi/Xmla.js +**/web/handlebars +**/web/underscore diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000000..12c91d0119 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,4 @@ +{ + "printWidth": 100, + "trailingComma": "es5" +} diff --git a/.puppeteerrc.js b/.puppeteerrc.js new file mode 100644 index 0000000000..33170a2465 --- /dev/null +++ b/.puppeteerrc.js @@ -0,0 +1,6 @@ +const { join } = require("path"); + +module.exports = { + // Changes the location where Puppeteer will install Chrome. + cacheDirectory: join(__dirname, "target"), +}; diff --git a/README.md b/README.md index ad4593357e..7468016906 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,17 @@ -# Common-UI # +
+ +# Common-UI + Common-ui historically contains commonly used utils/frameworks (e.g. jquery) that are used across the platform. As we move forward with OSGI it is expected for these to be removed from common-ui to be deployed in a more modular way. + +![Java](https://img.shields.io/badge/Java-11-brightorange?logo=openjdk) +![Javascript](https://img.shields.io/badge/JavaScript-323330?logo=javascript) +![Node](https://img.shields.io/badge/node-16-brightgreen?logo=node.js) + +
+ How to build -------------- diff --git a/impl/client/pom.xml b/impl/client/pom.xml index 86c86100e0..4efd704f58 100644 --- a/impl/client/pom.xml +++ b/impl/client/pom.xml @@ -19,7 +19,7 @@ for each of the constituents (e.g. vizapi, prompting) of the current artifact. - dojo-release,requirejs,jquery,jquery-i18n-properties,pentaho-cdf-js,angular,angular-animate,angular-i18n,uirouter__core,uirouter__angularjs,echarts + dojo-release,prantlf__requirejs,jquery,jquery-i18n-properties,pentaho-cdf-js,angular,angular-animate,angular-i18n,uirouter__core,uirouter__angularjs,echarts target/js-reports jsdoc-vizapi.json @@ -30,6 +30,9 @@ **/*-require-js-cfg.js ${build.dependenciesDirectory}/META-INF/resources/webjars + v16.20.2 + 8.19.4 + @@ -98,6 +99,11 @@ echarts ${echarts.version} + + org.webjars.npm + dompurify + ${dompurify.version} + From db0b0f5471322625c8843732884eb2d8fcaa62aa Mon Sep 17 00:00:00 2001 From: AAravind27 Date: Thu, 4 Jul 2024 19:35:20 +0530 Subject: [PATCH 22/40] [BACKLOG-41392] fix: show formatted value in legend for gauge --- .../web/pentaho/visual/views/echarts/Gauge.js | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/impl/client/src/main/javascript/web/pentaho/visual/views/echarts/Gauge.js b/impl/client/src/main/javascript/web/pentaho/visual/views/echarts/Gauge.js index 5638d53597..ce45a7e461 100644 --- a/impl/client/src/main/javascript/web/pentaho/visual/views/echarts/Gauge.js +++ b/impl/client/src/main/javascript/web/pentaho/visual/views/echarts/Gauge.js @@ -199,13 +199,16 @@ define([ var bandWidthHorizontal = bandPercent * stepWidthHorizontal; var detailWidthHorizontal = stepWidthHorizontal * 0.7; var offsetCenterX0 = -innerWidth / 2 + bandWidthHorizontal / 2; + var formattedValueMap = {}; for (var i = 0; i < rowCount; i++) { - offsetCenterX = offsetCenterX0 + stepWidthHorizontal * i + offsetCenterX = offsetCenterX0 + stepWidthHorizontal * i; + var measureValue = dataTable.getValue(i, measureColIndex); + formattedValueMap[measureValue] = dataTable.getFormattedValue(i, measureColIndex); records.push({ name: dataTable.getCompositeFormattedValue(i, categoriesColIndexes, self.groupedLabelSeparator), - value: dataTable.getValue(i, measureColIndex), + value: measureValue, tooltip: self._buildTooltip(self._buildRowTooltipHtml(dataTable, i), font), vars: {"rows": self._getCellsValues(dataTable.getRowCells(i, categoriesColIndexes))}, title: { @@ -216,7 +219,10 @@ define([ detail: { offsetCenter: [offsetCenterX, (offsetCenterYPercent + 15) + "%"], width: detailWidthHorizontal, - backgroundColor: bgColorDetail[i] + backgroundColor: bgColorDetail[i], + formatter: function (value) { + return formattedValueMap[value]; + } } }); } @@ -229,13 +235,16 @@ define([ var bandWidthVertical = bandPercent * stepWidthVertical; var detailWidthVertical = stepWidthVertical * 0.8; var offsetCenterY0 = -innerHeight / 2 + bandWidthVertical / 2; + var formattedValueMap = {}; for (var i = 0; i < rowCount; i++) { offsetCenterY = offsetCenterY0 + stepWidthVertical * i; + var measureValue = dataTable.getValue(i, measureColIndex); + formattedValueMap[measureValue] = dataTable.getFormattedValue(i, measureColIndex); records.push({ name: dataTable.getCompositeFormattedValue(i, categoriesColIndexes, self.groupedLabelSeparator), - value: dataTable.getValue(i, measureColIndex), + value: measureValue, tooltip: self._buildTooltip(self._buildRowTooltipHtml(dataTable, i), font), vars: {"rows": self._getCellsValues(dataTable.getRowCells(i, categoriesColIndexes))}, title: { @@ -246,7 +255,10 @@ define([ detail: { offsetCenter: [(offsetCenterXPercent + 40) + "%", offsetCenterY], width: detailWidthVertical, - backgroundColor: bgColorDetail[i] + backgroundColor: bgColorDetail[i], + formatter: function (value) { + return formattedValueMap[value]; + } } }); } From 43f8ae88b315f24c9fdcaa4bccfca2f6f1057e77 Mon Sep 17 00:00:00 2001 From: AAravind27 Date: Fri, 5 Jul 2024 16:49:53 +0530 Subject: [PATCH 23/40] [BACKLOG-41380] fix: show formatted value in tooltip for radar --- .../web/pentaho/visual/views/echarts/Radar.js | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/impl/client/src/main/javascript/web/pentaho/visual/views/echarts/Radar.js b/impl/client/src/main/javascript/web/pentaho/visual/views/echarts/Radar.js index fac0b27cff..0491215ea8 100644 --- a/impl/client/src/main/javascript/web/pentaho/visual/views/echarts/Radar.js +++ b/impl/client/src/main/javascript/web/pentaho/visual/views/echarts/Radar.js @@ -17,8 +17,9 @@ define([ "pentaho/module!_", "./Abstract", "pentaho/data/TableView", - "pentaho/util/object" -], function(module, BaseView, TableView, O) { + "pentaho/util/object", + "pentaho/visual/util" +], function(module, BaseView, TableView, O, util) { "use strict"; @@ -147,6 +148,11 @@ define([ return indicators; }, + _buildRadarTooltip: function(tooltipString) { + var font = util.getDefaultFont(null, 12); + return this._buildTooltip(tooltipString, font); + }, + _buildRadarRecords: function(dataTable, visualData, radarIndicators) { var records = []; @@ -183,6 +189,14 @@ define([ rowIndexes: rowIndexes }; + function escapeHTML(str) { + var elem = document.createElement("e"); + elem.appendChild(document.createTextNode(str)); + return elem.innerHTML; + } + + var tooltipString = record.name !== "" ? (escapeHTML(record.name) + "
") : ""; + // Given that series x category together form the // [visual key]{@link pentaho.visual.role.AbstractPropertyType#isVisualKey}, // there can be a single data row per series and category combination. @@ -210,9 +224,12 @@ define([ : ""; values.push(value); labels.push(label); + tooltipString = tooltipString + escapeHTML(indicator.name) + " : " + escapeHTML(label) + "
"; rowIndexes.push(rowIndex); }); + record.tooltip = this._buildRadarTooltip(tooltipString); + return record; } From 4f7bb15adfe8030f0cfb60bb03e7f93d8b27ad33 Mon Sep 17 00:00:00 2001 From: buildguy Date: Mon, 8 Jul 2024 17:58:33 -0400 Subject: [PATCH 24/40] [CLEANUP] updated versions via release version merger --- assemblies/client-config/pom.xml | 4 ++-- assemblies/npmpackage/pom.xml | 2 +- assemblies/platform-plugin/pom.xml | 8 ++++---- assemblies/pom.xml | 4 ++-- assemblies/webpackage/pom.xml | 2 +- impl/client-config/client-config/pom.xml | 4 ++-- impl/client-config/folder-enabler/pom.xml | 4 ++-- impl/client-config/pom.xml | 4 ++-- impl/client/pom.xml | 4 ++-- impl/pom.xml | 4 ++-- impl/server/pom.xml | 20 ++++++++++---------- pom.xml | 6 +++--- 12 files changed, 33 insertions(+), 33 deletions(-) diff --git a/assemblies/client-config/pom.xml b/assemblies/client-config/pom.xml index d25ba27106..46e9b951f7 100644 --- a/assemblies/client-config/pom.xml +++ b/assemblies/client-config/pom.xml @@ -5,10 +5,10 @@ org.pentaho common-ui-assemblies - 10.2.0.0-SNAPSHOT + 10.3.0.0-SNAPSHOT common-ui-client-config - 10.2.0.0-SNAPSHOT + 10.3.0.0-SNAPSHOT feature Client config folder Ensures the client's configuration deploy folder is enabled. diff --git a/assemblies/npmpackage/pom.xml b/assemblies/npmpackage/pom.xml index b175be7d94..25df587a6d 100644 --- a/assemblies/npmpackage/pom.xml +++ b/assemblies/npmpackage/pom.xml @@ -6,7 +6,7 @@ org.pentaho common-ui-assemblies - 10.2.0.0-SNAPSHOT + 10.3.0.0-SNAPSHOT diff --git a/assemblies/platform-plugin/pom.xml b/assemblies/platform-plugin/pom.xml index 7226c90615..1cf20b1e66 100644 --- a/assemblies/platform-plugin/pom.xml +++ b/assemblies/platform-plugin/pom.xml @@ -5,11 +5,11 @@ org.pentaho common-ui-assemblies - 10.2.0.0-SNAPSHOT + 10.3.0.0-SNAPSHOT pentaho common-ui - 10.2.0.0-SNAPSHOT + 10.3.0.0-SNAPSHOT pom Common-UI Platform Plugin @@ -33,8 +33,8 @@ 2.1 - 10.2.0.0-SNAPSHOT - 10.2.0.0-SNAPSHOT + 10.3.0.0-SNAPSHOT + 10.3.0.0-SNAPSHOT diff --git a/assemblies/pom.xml b/assemblies/pom.xml index 652c9da73c..e31c25311f 100644 --- a/assemblies/pom.xml +++ b/assemblies/pom.xml @@ -5,10 +5,10 @@ org.pentaho common-ui - 10.2.0.0-SNAPSHOT + 10.3.0.0-SNAPSHOT common-ui-assemblies - 10.2.0.0-SNAPSHOT + 10.3.0.0-SNAPSHOT pom Common-UI assemblies diff --git a/assemblies/webpackage/pom.xml b/assemblies/webpackage/pom.xml index cb1dc9b961..1d8184753f 100644 --- a/assemblies/webpackage/pom.xml +++ b/assemblies/webpackage/pom.xml @@ -6,7 +6,7 @@ org.pentaho common-ui-assemblies - 10.2.0.0-SNAPSHOT + 10.3.0.0-SNAPSHOT common-ui-webpackage diff --git a/impl/client-config/client-config/pom.xml b/impl/client-config/client-config/pom.xml index 3ac24ba54a..bf17d30e2e 100644 --- a/impl/client-config/client-config/pom.xml +++ b/impl/client-config/client-config/pom.xml @@ -7,11 +7,11 @@ org.pentaho common-ui-impl-client-config-umbrella - 10.2.0.0-SNAPSHOT + 10.3.0.0-SNAPSHOT common-ui-impl-client-config - 10.2.0.0-SNAPSHOT + 10.3.0.0-SNAPSHOT configuration-bundle diff --git a/impl/client-config/folder-enabler/pom.xml b/impl/client-config/folder-enabler/pom.xml index 9829fac57b..637382f6d6 100644 --- a/impl/client-config/folder-enabler/pom.xml +++ b/impl/client-config/folder-enabler/pom.xml @@ -5,10 +5,10 @@ org.pentaho common-ui-impl-client-config-umbrella - 10.2.0.0-SNAPSHOT + 10.3.0.0-SNAPSHOT common-ui-impl-client-config-folder-enabler - 10.2.0.0-SNAPSHOT + 10.3.0.0-SNAPSHOT bundle 1.8.8 diff --git a/impl/client-config/pom.xml b/impl/client-config/pom.xml index f18712f02a..aaf0339030 100644 --- a/impl/client-config/pom.xml +++ b/impl/client-config/pom.xml @@ -5,10 +5,10 @@ org.pentaho common-ui-impl - 10.2.0.0-SNAPSHOT + 10.3.0.0-SNAPSHOT common-ui-impl-client-config-umbrella - 10.2.0.0-SNAPSHOT + 10.3.0.0-SNAPSHOT pom client-config diff --git a/impl/client/pom.xml b/impl/client/pom.xml index 0e4ededa72..476f1db9b8 100644 --- a/impl/client/pom.xml +++ b/impl/client/pom.xml @@ -7,11 +7,11 @@ org.pentaho common-ui-impl - 10.2.0.0-SNAPSHOT + 10.3.0.0-SNAPSHOT common-ui-impl-client - 10.2.0.0-SNAPSHOT + 10.3.0.0-SNAPSHOT Common UI client side This artifact is a temporary container for all client side code that either was produced by pentaho or diff --git a/impl/pom.xml b/impl/pom.xml index 183c8d3e6b..c24ca7c7e0 100644 --- a/impl/pom.xml +++ b/impl/pom.xml @@ -5,10 +5,10 @@ org.pentaho common-ui - 10.2.0.0-SNAPSHOT + 10.3.0.0-SNAPSHOT common-ui-impl - 10.2.0.0-SNAPSHOT + 10.3.0.0-SNAPSHOT pom Common-UI implementation diff --git a/impl/server/pom.xml b/impl/server/pom.xml index af037cb8b9..78c71467a9 100644 --- a/impl/server/pom.xml +++ b/impl/server/pom.xml @@ -6,31 +6,31 @@ org.pentaho common-ui-impl - 10.2.0.0-SNAPSHOT + 10.3.0.0-SNAPSHOT common-ui-impl-server - 10.2.0.0-SNAPSHOT + 10.3.0.0-SNAPSHOT Common UI server side Java portion of the Common UI codebase http://www.pentaho.com 4.13.2 - 10.2.0.0-SNAPSHOT - 10.2.0.0-SNAPSHOT - 10.2.0.0-SNAPSHOT + 10.3.0.0-SNAPSHOT + 10.3.0.0-SNAPSHOT + 10.3.0.0-SNAPSHOT 1 false 2.3.2 - 10.2.0.0-SNAPSHOT + 10.3.0.0-SNAPSHOT 5.10.0 - 10.2.0.0-SNAPSHOT - 10.2.0.0-SNAPSHOT + 10.3.0.0-SNAPSHOT + 10.3.0.0-SNAPSHOT 2.1 3.1.1 2.0.0 - 10.2.0.0-SNAPSHOT + 10.3.0.0-SNAPSHOT 2.2 - 10.2.0.0-SNAPSHOT + 10.3.0.0-SNAPSHOT diff --git a/pom.xml b/pom.xml index 0747c49ab0..77de1b8cb4 100644 --- a/pom.xml +++ b/pom.xml @@ -6,11 +6,11 @@ org.pentaho pentaho-ce-jar-parent-pom - 10.2.0.0-SNAPSHOT + 10.3.0.0-SNAPSHOT common-ui - 10.2.0.0-SNAPSHOT + 10.3.0.0-SNAPSHOT pom Common-UI root POM @@ -31,7 +31,7 @@ 1.9.2 1.0.9 - 10.2.0.0-SNAPSHOT + 10.3.0.0-SNAPSHOT 5.4.3 3.1.5 From 3d148d8a2bcc9854badf2e3ebed627ff33e1aeeb Mon Sep 17 00:00:00 2001 From: Bruno Cavaleiro Date: Tue, 2 Jul 2024 17:12:12 +0100 Subject: [PATCH 25/40] [PPP-4305] Upgrade boostsrap.js to 3.4.1 --- impl/client/pom.xml | 6 +- .../assembly/dependencies-js-assembly.xml | 12 +- .../javascript/web/bootstrap/bootstrap.js | 2275 ----------------- .../web/dojo/dijit/templates/TitlePane.html | 4 +- .../dojo/pentaho/common/CheckedMenuItem.html | 2 +- .../dojo/pentaho/common/ComboColorPicker.html | 4 +- .../web/dojo/pentaho/common/ListItem.html | 2 +- .../web/dojo/pentaho/common/MenuItem.html | 2 +- .../web/dojo/pentaho/common/MessageBox.html | 2 +- .../dojo/pentaho/common/SectionHeader.html | 4 +- .../web/dojo/pentaho/common/SplashScreen.html | 2 +- .../dojo/pentaho/common/datasourceselect.html | 4 +- .../datasourceselect/datasourceselect.html | 2 +- .../javascript/testSamples/style-samples.html | 68 +- .../javascript/testSamples/tabsettest.html | 8 +- 15 files changed, 61 insertions(+), 2336 deletions(-) delete mode 100644 impl/client/src/main/javascript/web/bootstrap/bootstrap.js diff --git a/impl/client/pom.xml b/impl/client/pom.xml index 476f1db9b8..42a245f97f 100644 --- a/impl/client/pom.xml +++ b/impl/client/pom.xml @@ -19,7 +19,7 @@ for each of the constituents (e.g. vizapi, prompting) of the current artifact. - dojo-release,prantlf__requirejs,jquery,jquery-i18n-properties,pentaho-cdf-js,angular,angular-animate,angular-i18n,uirouter__core,uirouter__angularjs,echarts,dompurify + dojo-release,prantlf__requirejs,jquery,jquery-i18n-properties,pentaho-cdf-js,angular,angular-animate,angular-i18n,uirouter__core,uirouter__angularjs,echarts,dompurify,bootstrap target/js-reports jsdoc-vizapi.json @@ -92,6 +92,10 @@ org.webjars.npm dompurify + + org.webjars.npm + bootstrap + diff --git a/impl/client/src/main/assembly/dependencies-js-assembly.xml b/impl/client/src/main/assembly/dependencies-js-assembly.xml index 226e2298a3..958b598234 100644 --- a/impl/client/src/main/assembly/dependencies-js-assembly.xml +++ b/impl/client/src/main/assembly/dependencies-js-assembly.xml @@ -143,14 +143,10 @@ jquery - - - - - - - - + + ${webjars.target.directory}/bootstrap/${bootstrap.version}/dist/js/bootstrap.js + bootstrap + diff --git a/impl/client/src/main/javascript/web/bootstrap/bootstrap.js b/impl/client/src/main/javascript/web/bootstrap/bootstrap.js deleted file mode 100644 index 33a87c0e60..0000000000 --- a/impl/client/src/main/javascript/web/bootstrap/bootstrap.js +++ /dev/null @@ -1,2275 +0,0 @@ -/*! =================================================== -* bootstrap-transition.js v2.3.1 -* http://twitter.github.com/bootstrap/javascript.html#transitions -* =================================================== -* Copyright 2012 Twitter, Inc. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* ========================================================== */ - -!function ($) { - - "use strict"; // jshint ;_; - - - /* CSS TRANSITION SUPPORT (http://www.modernizr.com/) - * ======================================================= */ - - $(function () { - - $.support.transition = (function () { - - var transitionEnd = (function () { - - var el = document.createElement('bootstrap') - , transEndEventNames = { - 'WebkitTransition' : 'webkitTransitionEnd' - , 'MozTransition' : 'transitionend' - , 'OTransition' : 'oTransitionEnd otransitionend' - , 'transition' : 'transitionend' - } - , name - - for (name in transEndEventNames){ - if (el.style[name] !== undefined) { - return transEndEventNames[name] - } - } - - }()) - - return transitionEnd && { - end: transitionEnd - } - - })() - - }) - -}(window.jQuery);/* ========================================================== - * bootstrap-alert.js v2.3.1 - * http://twitter.github.com/bootstrap/javascript.html#alerts - * ========================================================== - * Copyright 2012 Twitter, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ========================================================== */ - - -!function ($) { - - "use strict"; // jshint ;_; - - - /* ALERT CLASS DEFINITION - * ====================== */ - - var dismiss = '[data-dismiss="alert"]' - , Alert = function (el) { - $(el).on('click', dismiss, this.close) - } - - Alert.prototype.close = function (e) { - var $this = $(this) - , selector = $this.attr('data-target') - , $parent - - if (!selector) { - selector = $this.attr('href') - selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 - } - - $parent = $(selector) - - e && e.preventDefault() - - $parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent()) - - $parent.trigger(e = $.Event('close')) - - if (e.isDefaultPrevented()) return - - $parent.removeClass('in') - - function removeElement() { - $parent - .trigger('closed') - .remove() - } - - $.support.transition && $parent.hasClass('fade') ? - $parent.on($.support.transition.end, removeElement) : - removeElement() - } - - - /* ALERT PLUGIN DEFINITION - * ======================= */ - - var old = $.fn.alert - - $.fn.alert = function (option) { - return this.each(function () { - var $this = $(this) - , data = $this.data('alert') - if (!data) $this.data('alert', (data = new Alert(this))) - if (typeof option == 'string') data[option].call($this) - }) - } - - $.fn.alert.Constructor = Alert - - - /* ALERT NO CONFLICT - * ================= */ - - $.fn.alert.noConflict = function () { - $.fn.alert = old - return this - } - - - /* ALERT DATA-API - * ============== */ - - $(document).on('click.alert.data-api', dismiss, Alert.prototype.close) - -}(window.jQuery);/* ============================================================ - * bootstrap-button.js v2.3.1 - * http://twitter.github.com/bootstrap/javascript.html#buttons - * ============================================================ - * Copyright 2012 Twitter, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============================================================ */ - - -!function ($) { - - "use strict"; // jshint ;_; - - - /* BUTTON PUBLIC CLASS DEFINITION - * ============================== */ - - var Button = function (element, options) { - this.$element = $(element) - this.options = $.extend({}, $.fn.button.defaults, options) - } - - Button.prototype.setState = function (state) { - var d = 'disabled' - , $el = this.$element - , data = $el.data() - , val = $el.is('input') ? 'val' : 'html' - - state = state + 'Text' - data.resetText || $el.data('resetText', $el[val]()) - - $el[val](data[state] || this.options[state]) - - // push to event loop to allow forms to submit - setTimeout(function () { - state == 'loadingText' ? - $el.addClass(d).attr(d, d) : - $el.removeClass(d).removeAttr(d) - }, 0) - } - - Button.prototype.toggle = function () { - var $parent = this.$element.closest('[data-toggle="buttons-radio"]') - - $parent && $parent - .find('.active') - .removeClass('active') - - this.$element.toggleClass('active') - } - - - /* BUTTON PLUGIN DEFINITION - * ======================== */ - - var old = $.fn.button - - $.fn.button = function (option) { - return this.each(function () { - var $this = $(this) - , data = $this.data('button') - , options = typeof option == 'object' && option - if (!data) $this.data('button', (data = new Button(this, options))) - if (option == 'toggle') data.toggle() - else if (option) data.setState(option) - }) - } - - $.fn.button.defaults = { - loadingText: 'loading...' - } - - $.fn.button.Constructor = Button - - - /* BUTTON NO CONFLICT - * ================== */ - - $.fn.button.noConflict = function () { - $.fn.button = old - return this - } - - - /* BUTTON DATA-API - * =============== */ - - $(document).on('click.button.data-api', '[data-toggle^=button]', function (e) { - var $btn = $(e.target) - if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn') - $btn.button('toggle') - }) - -}(window.jQuery);/* ========================================================== - * bootstrap-carousel.js v2.3.1 - * http://twitter.github.com/bootstrap/javascript.html#carousel - * ========================================================== - * Copyright 2012 Twitter, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ========================================================== */ - - -!function ($) { - - "use strict"; // jshint ;_; - - - /* CAROUSEL CLASS DEFINITION - * ========================= */ - - var Carousel = function (element, options) { - this.$element = $(element) - this.$indicators = this.$element.find('.carousel-indicators') - this.options = options - this.options.pause == 'hover' && this.$element - .on('mouseenter', $.proxy(this.pause, this)) - .on('mouseleave', $.proxy(this.cycle, this)) - } - - Carousel.prototype = { - - cycle: function (e) { - if (!e) this.paused = false - if (this.interval) clearInterval(this.interval); - this.options.interval - && !this.paused - && (this.interval = setInterval($.proxy(this.next, this), this.options.interval)) - return this - } - - , getActiveIndex: function () { - this.$active = this.$element.find('.item.active') - this.$items = this.$active.parent().children() - return this.$items.index(this.$active) - } - - , to: function (pos) { - var activeIndex = this.getActiveIndex() - , that = this - - if (pos > (this.$items.length - 1) || pos < 0) return - - if (this.sliding) { - return this.$element.one('slid', function () { - that.to(pos) - }) - } - - if (activeIndex == pos) { - return this.pause().cycle() - } - - return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos])) - } - - , pause: function (e) { - if (!e) this.paused = true - if (this.$element.find('.next, .prev').length && $.support.transition.end) { - this.$element.trigger($.support.transition.end) - this.cycle(true) - } - clearInterval(this.interval) - this.interval = null - return this - } - - , next: function () { - if (this.sliding) return - return this.slide('next') - } - - , prev: function () { - if (this.sliding) return - return this.slide('prev') - } - - , slide: function (type, next) { - var $active = this.$element.find('.item.active') - , $next = next || $active[type]() - , isCycling = this.interval - , direction = type == 'next' ? 'left' : 'right' - , fallback = type == 'next' ? 'first' : 'last' - , that = this - , e - - this.sliding = true - - isCycling && this.pause() - - $next = $next.length ? $next : this.$element.find('.item')[fallback]() - - e = $.Event('slide', { - relatedTarget: $next[0] - , direction: direction - }) - - if ($next.hasClass('active')) return - - if (this.$indicators.length) { - this.$indicators.find('.active').removeClass('active') - this.$element.one('slid', function () { - var $nextIndicator = $(that.$indicators.children()[that.getActiveIndex()]) - $nextIndicator && $nextIndicator.addClass('active') - }) - } - - if ($.support.transition && this.$element.hasClass('slide')) { - this.$element.trigger(e) - if (e.isDefaultPrevented()) return - $next.addClass(type) - $next[0].offsetWidth // force reflow - $active.addClass(direction) - $next.addClass(direction) - this.$element.one($.support.transition.end, function () { - $next.removeClass([type, direction].join(' ')).addClass('active') - $active.removeClass(['active', direction].join(' ')) - that.sliding = false - setTimeout(function () { that.$element.trigger('slid') }, 0) - }) - } else { - this.$element.trigger(e) - if (e.isDefaultPrevented()) return - $active.removeClass('active') - $next.addClass('active') - this.sliding = false - this.$element.trigger('slid') - } - - isCycling && this.cycle() - - return this - } - - } - - - /* CAROUSEL PLUGIN DEFINITION - * ========================== */ - - var old = $.fn.carousel - - $.fn.carousel = function (option) { - return this.each(function () { - var $this = $(this) - , data = $this.data('carousel') - , options = $.extend({}, $.fn.carousel.defaults, typeof option == 'object' && option) - , action = typeof option == 'string' ? option : options.slide - if (!data) $this.data('carousel', (data = new Carousel(this, options))) - if (typeof option == 'number') data.to(option) - else if (action) data[action]() - else if (options.interval) data.pause().cycle() - }) - } - - $.fn.carousel.defaults = { - interval: 5000 - , pause: 'hover' - } - - $.fn.carousel.Constructor = Carousel - - - /* CAROUSEL NO CONFLICT - * ==================== */ - - $.fn.carousel.noConflict = function () { - $.fn.carousel = old - return this - } - - /* CAROUSEL DATA-API - * ================= */ - - $(document).on('click.carousel.data-api', '[data-slide], [data-slide-to]', function (e) { - var $this = $(this), href - , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7 - , options = $.extend({}, $target.data(), $this.data()) - , slideIndex - - $target.carousel(options) - - if (slideIndex = $this.attr('data-slide-to')) { - $target.data('carousel').pause().to(slideIndex).cycle() - } - - e.preventDefault() - }) - -}(window.jQuery);/* ============================================================= - * bootstrap-collapse.js v2.3.1 - * http://twitter.github.com/bootstrap/javascript.html#collapse - * ============================================================= - * Copyright 2012 Twitter, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============================================================ */ - - -!function ($) { - - "use strict"; // jshint ;_; - - - /* COLLAPSE PUBLIC CLASS DEFINITION - * ================================ */ - - var Collapse = function (element, options) { - this.$element = $(element) - this.options = $.extend({}, $.fn.collapse.defaults, options) - - if (this.options.parent) { - this.$parent = $(this.options.parent) - } - - this.options.toggle && this.toggle() - } - - Collapse.prototype = { - - constructor: Collapse - - , dimension: function () { - var hasWidth = this.$element.hasClass('width') - return hasWidth ? 'width' : 'height' - } - - , show: function () { - var dimension - , scroll - , actives - , hasData - - if (this.transitioning || this.$element.hasClass('in')) return - - dimension = this.dimension() - scroll = $.camelCase(['scroll', dimension].join('-')) - actives = this.$parent && this.$parent.find('> .accordion-group > .in') - - if (actives && actives.length) { - hasData = actives.data('collapse') - if (hasData && hasData.transitioning) return - actives.collapse('hide') - hasData || actives.data('collapse', null) - } - - this.$element[dimension](0) - this.transition('addClass', $.Event('show'), 'shown') - $.support.transition && this.$element[dimension](this.$element[0][scroll]) - } - - , hide: function () { - var dimension - if (this.transitioning || !this.$element.hasClass('in')) return - dimension = this.dimension() - this.reset(this.$element[dimension]()) - this.transition('removeClass', $.Event('hide'), 'hidden') - this.$element[dimension](0) - } - - , reset: function (size) { - var dimension = this.dimension() - - this.$element - .removeClass('collapse') - [dimension](size || 'auto') - [0].offsetWidth - - this.$element[size !== null ? 'addClass' : 'removeClass']('collapse') - - return this - } - - , transition: function (method, startEvent, completeEvent) { - var that = this - , complete = function () { - if (startEvent.type == 'show') that.reset() - that.transitioning = 0 - that.$element.trigger(completeEvent) - } - - this.$element.trigger(startEvent) - - if (startEvent.isDefaultPrevented()) return - - this.transitioning = 1 - - this.$element[method]('in') - - $.support.transition && this.$element.hasClass('collapse') ? - this.$element.one($.support.transition.end, complete) : - complete() - } - - , toggle: function () { - this[this.$element.hasClass('in') ? 'hide' : 'show']() - } - - } - - - /* COLLAPSE PLUGIN DEFINITION - * ========================== */ - - var old = $.fn.collapse - - $.fn.collapse = function (option) { - return this.each(function () { - var $this = $(this) - , data = $this.data('collapse') - , options = $.extend({}, $.fn.collapse.defaults, $this.data(), typeof option == 'object' && option) - if (!data) $this.data('collapse', (data = new Collapse(this, options))) - if (typeof option == 'string') data[option]() - }) - } - - $.fn.collapse.defaults = { - toggle: true - } - - $.fn.collapse.Constructor = Collapse - - - /* COLLAPSE NO CONFLICT - * ==================== */ - - $.fn.collapse.noConflict = function () { - $.fn.collapse = old - return this - } - - - /* COLLAPSE DATA-API - * ================= */ - - $(document).on('click.collapse.data-api', '[data-toggle=collapse]', function (e) { - var $this = $(this), href - , target = $this.attr('data-target') - || e.preventDefault() - || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7 - , option = $(target).data('collapse') ? 'toggle' : $this.data() - $this[$(target).hasClass('in') ? 'addClass' : 'removeClass']('collapsed') - $(target).collapse(option) - }) - -}(window.jQuery);/* ============================================================ - * bootstrap-dropdown.js v2.3.1 - * http://twitter.github.com/bootstrap/javascript.html#dropdowns - * ============================================================ - * Copyright 2012 Twitter, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============================================================ */ - - -!function ($) { - - "use strict"; // jshint ;_; - - - /* DROPDOWN CLASS DEFINITION - * ========================= */ - - var toggle = '[data-toggle=dropdown]' - , Dropdown = function (element) { - var $el = $(element).on('click.dropdown.data-api', this.toggle) - $('html').on('click.dropdown.data-api', function () { - $el.parent().removeClass('open') - }) - } - - Dropdown.prototype = { - - constructor: Dropdown - - , toggle: function (e) { - var $this = $(this) - , $parent - , isActive - - if ($this.is('.disabled, :disabled')) return - - $parent = getParent($this) - - isActive = $parent.hasClass('open') - - clearMenus() - - if (!isActive) { - $parent.toggleClass('open') - } - - $this.focus() - - return false - } - - , keydown: function (e) { - var $this - , $items - , $active - , $parent - , isActive - , index - - if (!/(38|40|27)/.test(e.keyCode)) return - - $this = $(this) - - e.preventDefault() - e.stopPropagation() - - if ($this.is('.disabled, :disabled')) return - - $parent = getParent($this) - - isActive = $parent.hasClass('open') - - if (!isActive || (isActive && e.keyCode == 27)) { - if (e.which == 27) $parent.find(toggle).focus() - return $this.click() - } - - $items = $('[role=menu] li:not(.divider):visible a', $parent) - - if (!$items.length) return - - index = $items.index($items.filter(':focus')) - - if (e.keyCode == 38 && index > 0) index-- // up - if (e.keyCode == 40 && index < $items.length - 1) index++ // down - if (!~index) index = 0 - - $items - .eq(index) - .focus() - } - - } - - function clearMenus() { - $(toggle).each(function () { - getParent($(this)).removeClass('open') - }) - } - - function getParent($this) { - var selector = $this.attr('data-target') - , $parent - - if (!selector) { - selector = $this.attr('href') - selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 - } - - $parent = selector && $(selector) - - if (!$parent || !$parent.length) $parent = $this.parent() - - return $parent - } - - - /* DROPDOWN PLUGIN DEFINITION - * ========================== */ - - var old = $.fn.dropdown - - $.fn.dropdown = function (option) { - return this.each(function () { - var $this = $(this) - , data = $this.data('dropdown') - if (!data) $this.data('dropdown', (data = new Dropdown(this))) - if (typeof option == 'string') data[option].call($this) - }) - } - - $.fn.dropdown.Constructor = Dropdown - - - /* DROPDOWN NO CONFLICT - * ==================== */ - - $.fn.dropdown.noConflict = function () { - $.fn.dropdown = old - return this - } - - - /* APPLY TO STANDARD DROPDOWN ELEMENTS - * =================================== */ - - $(document) - .on('click.dropdown.data-api', clearMenus) - .on('click.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() }) - .on('click.dropdown-menu', function (e) { e.stopPropagation() }) - .on('click.dropdown.data-api' , toggle, Dropdown.prototype.toggle) - .on('keydown.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown) - -}(window.jQuery); -/* ========================================================= - * bootstrap-modal.js v2.3.1 - * http://twitter.github.com/bootstrap/javascript.html#modals - * ========================================================= - * Copyright 2012 Twitter, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ========================================================= */ - - -!function ($) { - - "use strict"; // jshint ;_; - - - /* MODAL CLASS DEFINITION - * ====================== */ - - var Modal = function (element, options) { - this.options = options - this.$element = $(element) - .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this)) - this.options.remote && this.$element.find('.modal-body').load(this.options.remote) - } - - Modal.prototype = { - - constructor: Modal - - , toggle: function () { - return this[!this.isShown ? 'show' : 'hide']() - } - - , show: function () { - var that = this - , e = $.Event('show') - - this.$element.trigger(e) - - if (this.isShown || e.isDefaultPrevented()) return - - this.isShown = true - - this.escape() - - this.backdrop(function () { - var transition = $.support.transition && that.$element.hasClass('fade') - - if (!that.$element.parent().length) { - that.$element.appendTo(document.body) //don't move modals dom position - } - - that.$element.show() - - if (transition) { - that.$element[0].offsetWidth // force reflow - } - - that.$element - .addClass('in') - .attr('aria-hidden', false) - - that.enforceFocus() - - transition ? - that.$element.one($.support.transition.end, function () { that.$element.focus().trigger('shown') }) : - that.$element.focus().trigger('shown') - - }) - } - - , hide: function (e) { - e && e.preventDefault() - - var that = this - - e = $.Event('hide') - - this.$element.trigger(e) - - if (!this.isShown || e.isDefaultPrevented()) return - - this.isShown = false - - this.escape() - - $(document).off('focusin.modal') - - this.$element - .removeClass('in') - .attr('aria-hidden', true) - - $.support.transition && this.$element.hasClass('fade') ? - this.hideWithTransition() : - this.hideModal() - } - - , enforceFocus: function () { - var that = this - $(document).on('focusin.modal', function (e) { - if (that.$element[0] !== e.target && !that.$element.has(e.target).length) { - that.$element.focus() - } - }) - } - - , escape: function () { - var that = this - if (this.isShown && this.options.keyboard) { - this.$element.on('keyup.dismiss.modal', function ( e ) { - e.which == 27 && that.hide() - }) - } else if (!this.isShown) { - this.$element.off('keyup.dismiss.modal') - } - } - - , hideWithTransition: function () { - var that = this - , timeout = setTimeout(function () { - that.$element.off($.support.transition.end) - that.hideModal() - }, 500) - - this.$element.one($.support.transition.end, function () { - clearTimeout(timeout) - that.hideModal() - }) - } - - , hideModal: function () { - var that = this - this.$element.hide() - this.backdrop(function () { - that.removeBackdrop() - that.$element.trigger('hidden') - }) - } - - , removeBackdrop: function () { - this.$backdrop && this.$backdrop.remove() - this.$backdrop = null - } - - , backdrop: function (callback) { - var that = this - , animate = this.$element.hasClass('fade') ? 'fade' : '' - - if (this.isShown && this.options.backdrop) { - var doAnimate = $.support.transition && animate - - this.$backdrop = $('