phcthemes_web_theme_pack 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +0 -0
- data/Rakefile +32 -0
- data/app/assets/config/phcthemes_web_theme_pack_manifest.js +3 -0
- data/app/assets/javascripts/common/backstretch/jquery.backstretch.js +1602 -0
- data/app/assets/javascripts/common/bootstrap-datepicker/bootstrap-datepicker.js +2039 -0
- data/app/assets/javascripts/common/bootstrap-markdown/bootstrap-markdown.js +1390 -0
- data/app/assets/javascripts/common/bootstrap-select/bootstrap-select.js +3139 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-am_ET.js +46 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-am_ET.js.map +1 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-am_ET.min.js +8 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-ar_AR.js +51 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-ar_AR.js.map +1 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-ar_AR.min.js +8 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-bg_BG.js +46 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-bg_BG.js.map +1 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-bg_BG.min.js +8 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-cs_CZ.js +39 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-cs_CZ.js.map +1 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-cs_CZ.min.js +8 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-da_DK.js +46 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-da_DK.js.map +1 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-da_DK.min.js +8 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-de_DE.js +46 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-de_DE.js.map +1 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-de_DE.min.js +8 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-en_US.js +46 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-en_US.js.map +1 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-en_US.min.js +8 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-es_CL.js +39 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-es_CL.js.map +1 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-es_CL.min.js +8 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-es_ES.js +39 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-es_ES.js.map +1 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-es_ES.min.js +8 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-et_EE.js +46 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-et_EE.js.map +1 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-et_EE.min.js +8 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-eu.js +39 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-eu.js.map +1 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-eu.min.js +8 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-fa_IR.js +39 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-fa_IR.js.map +1 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-fa_IR.min.js +8 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-fi_FI.js +46 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-fi_FI.js.map +1 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-fi_FI.min.js +8 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-fr_FR.js +46 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-fr_FR.js.map +1 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-fr_FR.min.js +8 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-hr_HR.js +46 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-hr_HR.js.map +1 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-hr_HR.min.js +8 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-hu_HU.js +46 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-hu_HU.js.map +1 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-hu_HU.min.js +8 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-id_ID.js +39 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-id_ID.js.map +1 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-id_ID.min.js +8 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-it_IT.js +41 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-it_IT.js.map +1 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-it_IT.min.js +8 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-ja_JP.js +39 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-ja_JP.js.map +1 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-ja_JP.min.js +8 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-kh_KM.js +46 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-kh_KM.js.map +1 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-kh_KM.min.js +8 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-ko_KR.js +46 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-ko_KR.js.map +1 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-ko_KR.min.js +8 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-lt_LT.js +46 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-lt_LT.js.map +1 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-lt_LT.min.js +8 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-lv_LV.js +46 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-lv_LV.js.map +1 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-lv_LV.min.js +8 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-nb_NO.js +46 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-nb_NO.js.map +1 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-nb_NO.min.js +8 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-nl_NL.js +39 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-nl_NL.js.map +1 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-nl_NL.min.js +8 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-pl_PL.js +39 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-pl_PL.js.map +1 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-pl_PL.min.js +8 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-pt_BR.js +39 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-pt_BR.js.map +1 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-pt_BR.min.js +8 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-pt_PT.js +39 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-pt_PT.js.map +1 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-pt_PT.min.js +8 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-ro_RO.js +40 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-ro_RO.js.map +1 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-ro_RO.min.js +8 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-ru_RU.js +40 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-ru_RU.js.map +1 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-ru_RU.min.js +8 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-sk_SK.js +39 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-sk_SK.js.map +1 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-sk_SK.min.js +8 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-sl_SI.js +44 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-sl_SI.js.map +1 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-sl_SI.min.js +8 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-sv_SE.js +46 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-sv_SE.js.map +1 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-sv_SE.min.js +8 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-tr_TR.js +46 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-tr_TR.js.map +1 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-tr_TR.min.js +8 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-ua_UA.js +39 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-ua_UA.js.map +1 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-ua_UA.min.js +8 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-vi_VN.js +46 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-vi_VN.js.map +1 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-vi_VN.min.js +8 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-zh_CN.js +39 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-zh_CN.js.map +1 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-zh_CN.min.js +8 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-zh_TW.js +39 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-zh_TW.js.map +1 -0
- data/app/assets/javascripts/common/bootstrap-select/i18n/defaults-zh_TW.min.js +8 -0
- data/app/assets/javascripts/common/bootstrap/bootstrap.bundle.js +7013 -0
- data/app/assets/javascripts/common/custom/custom.js +0 -0
- data/app/assets/javascripts/common/daterangepicker/daterangepicker.js +1565 -0
- data/app/assets/javascripts/common/flexslider/jquery.flexslider.js +1252 -0
- data/app/assets/javascripts/common/greenstock/greensock.js +36 -0
- data/app/assets/javascripts/common/icheck/icheck.js +509 -0
- data/app/assets/javascripts/common/imagesloaded/imagesloaded.pkgd.js +497 -0
- data/app/assets/javascripts/common/isotope/isotope.pkgd.js +3563 -0
- data/app/assets/javascripts/common/jquery-countdown/jquery.countdown.js +246 -0
- data/app/assets/javascripts/common/jquery-filterizer/jquery.filterizr.min.js +1 -0
- data/app/assets/javascripts/common/jquery-placeholder/jquery.placeholder.js +281 -0
- data/app/assets/javascripts/common/jquery-validation/jquery.validate.js +1650 -0
- data/app/assets/javascripts/common/jqvmap/jquery.vmap.js +1281 -0
- data/app/assets/javascripts/common/jqvmap/jquery.vmap.min.js +10 -0
- data/app/assets/javascripts/common/jqvmap/maps/continents/jquery.vmap.africa.js +2 -0
- data/app/assets/javascripts/common/jqvmap/maps/continents/jquery.vmap.asia.js +2 -0
- data/app/assets/javascripts/common/jqvmap/maps/continents/jquery.vmap.australia.js +2 -0
- data/app/assets/javascripts/common/jqvmap/maps/continents/jquery.vmap.europe.js +2 -0
- data/app/assets/javascripts/common/jqvmap/maps/continents/jquery.vmap.north-america.js +2 -0
- data/app/assets/javascripts/common/jqvmap/maps/continents/jquery.vmap.south-america.js +2 -0
- data/app/assets/javascripts/common/jqvmap/maps/jquery.vmap.algeria.js +2 -0
- data/app/assets/javascripts/common/jqvmap/maps/jquery.vmap.argentina.js +1 -0
- data/app/assets/javascripts/common/jqvmap/maps/jquery.vmap.brazil.js +2 -0
- data/app/assets/javascripts/common/jqvmap/maps/jquery.vmap.canada.js +2 -0
- data/app/assets/javascripts/common/jqvmap/maps/jquery.vmap.europe.js +2 -0
- data/app/assets/javascripts/common/jqvmap/maps/jquery.vmap.france.js +1 -0
- data/app/assets/javascripts/common/jqvmap/maps/jquery.vmap.germany.js +2 -0
- data/app/assets/javascripts/common/jqvmap/maps/jquery.vmap.greece.js +1 -0
- data/app/assets/javascripts/common/jqvmap/maps/jquery.vmap.iran.js +6 -0
- data/app/assets/javascripts/common/jqvmap/maps/jquery.vmap.iraq.js +1 -0
- data/app/assets/javascripts/common/jqvmap/maps/jquery.vmap.russia.js +2 -0
- data/app/assets/javascripts/common/jqvmap/maps/jquery.vmap.tunisia.js +2 -0
- data/app/assets/javascripts/common/jqvmap/maps/jquery.vmap.turkey.js +11 -0
- data/app/assets/javascripts/common/jqvmap/maps/jquery.vmap.usa.js +2 -0
- data/app/assets/javascripts/common/jqvmap/maps/jquery.vmap.world.js +2 -0
- data/app/assets/javascripts/common/js-cookie/js.cookie.js +165 -0
- data/app/assets/javascripts/common/layerslider/layerslider.kreaturamedia.jquery.js +13 -0
- data/app/assets/javascripts/common/layerslider/layerslider.origami.js +13 -0
- data/app/assets/javascripts/common/layerslider/layerslider.timeline.js +13 -0
- data/app/assets/javascripts/common/layerslider/layerslider.transitions.js +13 -0
- data/app/assets/javascripts/common/leaflet/leaflet.js +5 -0
- data/app/assets/javascripts/common/magnific-popup/jquery.magnific-popup.js +1860 -0
- data/app/assets/javascripts/common/mapbox/mapbox.js +51 -0
- data/app/assets/javascripts/common/moderizer/modernizr.js +11 -0
- data/app/assets/javascripts/common/owl-carousel/owl.carousel.js +3448 -0
- data/app/assets/javascripts/common/pace/pace.js +935 -0
- data/app/assets/javascripts/common/paroller/jquery.paroller.js +228 -0
- data/app/assets/javascripts/common/particlejs/particles.js +1541 -0
- data/app/assets/javascripts/common/plyr/plyr.js +9137 -0
- data/app/assets/javascripts/common/rangeslider/rangeslider.js +498 -0
- data/app/assets/javascripts/common/retina/retina.js +100 -0
- data/app/assets/javascripts/common/rev-slider/extensions/revolution.extension.actions.js +386 -0
- data/app/assets/javascripts/common/rev-slider/extensions/revolution.extension.carousel.js +365 -0
- data/app/assets/javascripts/common/rev-slider/extensions/revolution.extension.kenburn.js +199 -0
- data/app/assets/javascripts/common/rev-slider/extensions/revolution.extension.layeranimation.js +2524 -0
- data/app/assets/javascripts/common/rev-slider/extensions/revolution.extension.migration.js +260 -0
- data/app/assets/javascripts/common/rev-slider/extensions/revolution.extension.navigation.js +1156 -0
- data/app/assets/javascripts/common/rev-slider/extensions/revolution.extension.parallax.js +465 -0
- data/app/assets/javascripts/common/rev-slider/extensions/revolution.extension.slideanims.js +1447 -0
- data/app/assets/javascripts/common/rev-slider/extensions/revolution.extension.video.js +1464 -0
- data/app/assets/javascripts/common/rev-slider/jquery.themepunch.revolution.js +3286 -0
- data/app/assets/javascripts/common/rev-slider/jquery.themepunch.tools.min.js +8710 -0
- data/app/assets/javascripts/common/scrollup/jquery.scrollUp.js +168 -0
- data/app/assets/javascripts/common/select2/select2.full.js +6597 -0
- data/app/assets/javascripts/common/selectbox/jquery.selectBox.js +1092 -0
- data/app/assets/javascripts/common/smooth-scroll/SmoothScroll.js +788 -0
- data/app/assets/javascripts/common/spectrum/spectrum.js +2323 -0
- data/app/assets/javascripts/common/stepper/jquery.fs.stepper.js +339 -0
- data/app/assets/javascripts/common/swiper/swiper.js +8124 -0
- data/app/assets/javascripts/common/typed/typed.js +1045 -0
- data/app/assets/javascripts/common/visable/jquery.visible.js +68 -0
- data/app/assets/javascripts/common/waypoints/jquery.waypoints.js +662 -0
- data/app/assets/javascripts/phcthemes_web_theme_pack_appstrap.js +11 -0
- data/app/assets/javascripts/phcthemes_web_theme_pack_basic.js +39 -0
- data/app/assets/javascripts/phcthemes_web_theme_pack_bold.js +34 -0
- data/app/assets/javascripts/phcthemes_web_theme_pack_coloradmin.js +12 -0
- data/app/assets/javascripts/phcthemes_web_theme_pack_devine_villas.js +20 -0
- data/app/assets/javascripts/phcthemes_web_theme_pack_smarty.js +57 -0
- data/app/assets/javascripts/phcthemes_web_theme_pack_xero.js +18 -0
- data/app/assets/javascripts/phcthemes_web_theme_pack_zoner.js +24 -0
- data/app/assets/javascripts/themes/appstrap/custom/custom.js +0 -0
- data/app/assets/javascripts/themes/appstrap/theme/custom-script.js +69 -0
- data/app/assets/javascripts/themes/appstrap/theme/script.js +3096 -0
- data/app/assets/javascripts/themes/basic/custom/custom.js +0 -0
- data/app/assets/javascripts/themes/bold/custom/custom.js +0 -0
- data/app/assets/javascripts/themes/coloradmin/custom/custom.js +0 -0
- data/app/assets/javascripts/themes/coloradmin/theme/apps.js +236 -0
- data/app/assets/javascripts/themes/devine_villas/custom/custom.js +0 -0
- data/app/assets/javascripts/themes/devine_villas/theme/dashboard.js +19 -0
- data/app/assets/javascripts/themes/devine_villas/theme/main.js +384 -0
- data/app/assets/javascripts/themes/devine_villas/theme/map.js +563 -0
- data/app/assets/javascripts/themes/devine_villas/theme/searchmap.js +69 -0
- data/app/assets/javascripts/themes/smarty/custom/custom.js +0 -0
- data/app/assets/javascripts/themes/smarty/theme/scripts.js +4271 -0
- data/app/assets/javascripts/themes/xero/custom/custom.js +0 -0
- data/app/assets/javascripts/themes/xero/theme/app.js +696 -0
- data/app/assets/javascripts/themes/zoner/custom-maps/custom-map.js +289 -0
- data/app/assets/javascripts/themes/zoner/custom/custom.js +0 -0
- data/app/assets/javascripts/themes/zoner/draggable/draggable.js +196 -0
- data/app/assets/javascripts/themes/zoner/jquery-dependclass/dependclass.js +56 -0
- data/app/assets/javascripts/themes/zoner/jquery-slider/jquery.slider.js +700 -0
- data/app/assets/javascripts/themes/zoner/jquery-vanillabox/jquery.vanillabox.min.js +24 -0
- data/app/assets/javascripts/themes/zoner/jshashtable/hashtable.js +402 -0
- data/app/assets/javascripts/themes/zoner/numberformatter/numberformatter.js +566 -0
- data/app/assets/javascripts/themes/zoner/simple-js-templating/tmpl.js +35 -0
- data/app/assets/javascripts/themes/zoner/theme/main.js +667 -0
- data/app/assets/stylesheets/common/custom/custom.scss +0 -0
- data/app/assets/stylesheets/phcthemes_web_theme_pack_appstrap.scss +28 -0
- data/app/assets/stylesheets/phcthemes_web_theme_pack_basic.scss +0 -0
- data/app/assets/stylesheets/phcthemes_web_theme_pack_bold.scss +21 -0
- data/app/assets/stylesheets/phcthemes_web_theme_pack_coloradmin.scss +22 -0
- data/app/assets/stylesheets/phcthemes_web_theme_pack_devine_villas.scss +28 -0
- data/app/assets/stylesheets/phcthemes_web_theme_pack_smarty.scss +47 -0
- data/app/assets/stylesheets/phcthemes_web_theme_pack_xero.scss +28 -0
- data/app/assets/stylesheets/phcthemes_web_theme_pack_zoner.scss +22 -0
- data/app/assets/stylesheets/themes/appstrap/custom/custom.scss +0 -0
- data/app/assets/stylesheets/themes/bold/custom/custom.scss +0 -0
- data/app/assets/stylesheets/themes/coloradmin/custom/custom.scss +0 -0
- data/app/assets/stylesheets/themes/devine_villas/custom/custom.scss +0 -0
- data/app/assets/stylesheets/themes/smarty/custom/custom.scss +0 -0
- data/app/assets/stylesheets/themes/xero/custom/custom.scss +0 -0
- data/app/assets/stylesheets/themes/zoner/custom/custom.scss +0 -0
- data/lib/phcthemes_web_theme_pack.rb +5 -0
- data/lib/phcthemes_web_theme_pack/engine.rb +13 -0
- data/lib/phcthemes_web_theme_pack/version.rb +3 -0
- data/lib/tasks/phcthemes_web_theme_pack_tasks.rake +4 -0
- metadata +375 -0
@@ -0,0 +1,24 @@
|
|
1
|
+
(function($){/*
|
2
|
+
Vanillabox
|
3
|
+
(C) 2013 cocopon.
|
4
|
+
|
5
|
+
Licensed under the MIT license:
|
6
|
+
http://www.opensource.org/licenses/mit-license.php
|
7
|
+
*/
|
8
|
+
var d;function h(){}function k(a,b){return void 0!==a?a:b}function l(a){function b(){}b.prototype=m.prototype;a.prototype=new b}function n(a,b){var c=a.length,e;for(e=0;e<c;e++)b.call(this,a[e],e)}function q(a,b){var c=[],e=a.length,f;for(f=0;f<e;f++)c.push(b.call(this,a[f],f));return c}function r(){var a=new $.Deferred;setTimeout(function(){a.resolve()},0);return a.promise()}function s(){return!!navigator.userAgent.match(/(ipod|iphone|ipad)/ig)};function t(){};var u={ra:function(a){return a.a.show()},ba:function(a){return a.a.hide()},qa:function(a){u.Q(a);return a.a.show()},aa:function(a){return a.a.hide()},Q:function(a){var b=a.f,c=b.p(),e=v(a,c);b.a.css({width:c.width,height:c.height});a.a.css({left:e.left,top:e.top});return r()},pa:function(a){return a.a.show()},$:function(a){return a.a.hide()}},w={ra:function(a){return a.a.fadeIn(200)},ba:function(a){return a.a.fadeOut(300)},ta:function(a,b,c,e){var f=a.f.a;f.stop();b=f.animate({width:b.width,height:b.height},
|
9
|
+
e);a=a.a;a.stop();c=a.animate({left:c.left,top:c.top},e);return $.when(b,c)},qa:function(a){var b=a.f,c=b.p(),e=v(a,c);b.a.css({width:c.width,height:c.height});a.a.css({left:e.left,top:e.top});return r()},aa:function(){return r()},Q:function(a){var b=a.f.p(),c=v(a,b);return w.ta(a,b,c,300)},pa:function(a){return a.a.fadeIn(200)},$:function(a){return a.a.fadeOut(300)}};var x={none:u,"default":w};function z(){this.c()}d=z.prototype;d.c=function(){var a=$("<div>");a.addClass("vnbx-mask");this.a=a;this.e()};d.b=function(){this.g();this.a=null};d.e=function(){$(window).on("resize",$.proxy(this.H,this));this.a.on("click",$.proxy(this.o,this))};d.g=function(){$(window).off("resize",this.H);this.a.off("click",this.o)};d.B=function(){var a=this.a;a.width("");a.height("");var b=$(window),c=$(document),e=Math.max(c.width(),b.width()),b=Math.max(c.height(),b.height());a.width(e);a.height(b)};d.H=function(){this.B()};
|
10
|
+
d.o=function(){$(this).trigger("vnbx_click")};function A(a){a=a||{};this.l=k(a.u,w);this.k=k(a.s,"both");this.c()}d=A.prototype;d.c=function(){var a=$("<div>");a.addClass("vnbx-container");this.a=a;this.e()};d.b=function(){this.g();this.a=null};d.e=function(){};d.g=function(){this.w()};d.S=function(){$(this.d).on("vnbx_complete",$.proxy(this.D,this))};d.w=function(){$(this.d).off("vnbx_complete",this.D)};d.p=function(){var a=this.d,b={width:0,height:0};a&&(b=a.p());return{width:Math.max(b.width,200),height:Math.max(b.height,150)}};
|
11
|
+
function B(a){a.ea={width:!0===a.k||"both"===a.k||"horizontal"===a.k?(window.innerWidth||document.documentElement.clientWidth)-100:Number.MAX_VALUE,height:!0===a.k||"both"===a.k||"vertical"===a.k?(window.innerHeight||document.documentElement.clientHeight)-100:Number.MAX_VALUE};a.d&&C(a)}function C(a){var b=a.ea;a.d.W(Math.max(b.width,200),Math.max(b.height,150))}d.B=function(){var a=this.d,b=a.p();a.a.css({marginLeft:-Math.round(b.width/2),marginTop:-Math.round(b.height/2)})};d.D=function(){this.B()};function D(a){a=a||{};this.f=new A({u:a.u,s:a.s});this.c();this.e()}d=D.prototype;d.c=function(){var a=$("<div>");a.addClass("vnbx-frame");this.a=a;this.a.append(this.f.a)};d.b=function(){this.f.b();this.f=null;this.g();this.a=null};d.e=function(){this.a.on("click",$.proxy(this.o,this))};d.g=function(){this.a.off("click",this.o)};
|
12
|
+
function v(a,b){var c=a.f.a,e=c.width(),f=c.height();c.width(b.width);c.height(b.height);var g=$(window),p=a.a,y=window.innerWidth||document.documentElement.clientWidth,S=window.innerHeight||document.documentElement.clientHeight,y=Math.round(g.scrollLeft()+(y-p.outerWidth())/2),g=Math.max(Math.round(g.scrollTop()+(S-p.outerHeight())/2),0);c.width(e);c.height(f);return{left:y,top:g}}d.o=function(a){a.stopPropagation()};function m(a){a=a||{};this.sa=this.da=!1;this.oa=a.path;this.Ca=k(a.title,"");this.c()}d=m.prototype;d.c=function(){var a=$("<div>");a.addClass("vnbx-content");this.a=a;this.X();this.e()};d.X=h;d.e=h;d.g=h;d.b=function(){this.g();this.a=null};d.p=function(){var a=this.a;return{width:a.width(),height:a.height()}};d.W=function(a,b){this.a.css({maxWidth:a,maxHeight:b})};d.load=function(){this.a.addClass("vnbx-loading");this.da?E(this,this.sa):this.U()};d.U=h;
|
13
|
+
function E(a,b){var c=a.a;a.da=!0;a.sa=b;c.removeClass("vnbx-loading");b||c.addClass("vnbx-error");$(a).trigger("vnbx_complete",b)}function F(a){m.call(this,a)}l(F);F.prototype.c=function(){m.prototype.c.call(this);this.a.addClass("vnbx-empty")};F.prototype.load=function(){var a=this;setTimeout(function(){$(a).trigger("vnbx_complete",!0)},0)};function G(a){m.call(this,a)}l(G);d=G.prototype;d.X=function(){var a=$("<img>");this.a.append(a);this.A=a};d.b=function(){m.prototype.b.call(this);this.A=null};
|
14
|
+
d.e=function(){var a=this.A;a.on("load",$.proxy(this.G,this));a.on("error",$.proxy(this.F,this))};d.g=function(){var a=this.A;a.off("load",this.G);a.off("error",this.F)};d.W=function(a,b){this.A.css({maxWidth:a,maxHeight:b})};d.U=function(){this.A.attr("src",this.oa)};d.G=function(){E(this,!0)};d.F=function(){E(this,!1)};function H(a){a=a||{};this.ya=a.J;this.xa=a.I;m.call(this,a)}l(H);d=H.prototype;d.X=function(){var a=$("<iframe>");a.attr("frameborder",0);this.a.append(a);this.m=a};
|
15
|
+
d.b=function(){m.prototype.b.call(this);this.m=null};d.e=function(){var a=this.m;a.on("load",$.proxy(this.G,this));a.on("error",$.proxy(this.F,this))};d.g=function(){var a=this.m;a.off("load",this.G);a.off("error",this.F)};d.p=function(){var a=s()?this.a:this.m;return{width:a.width(),height:a.height()}};d.W=function(a,b){(s()?this.a:this.m).css({maxWidth:a,maxHeight:b})};d.U=function(){this.m.attr("src",this.oa)};
|
16
|
+
d.G=function(){if(this.m.attr("src")){var a=s()?this.a:this.m;a.width(this.ya);a.height(this.xa);E(this,!0)}};d.F=function(){E(this,!1)};var I={image:function(a){return new G({path:a.attr("href"),title:a.attr("title")})},iframe:function(a,b){return new H({path:a.attr("href"),J:b.J,I:b.I,title:a.attr("title")})}};function J(a){a=a||{};this.q=k(a.Da,1);this.t=k(a.loop,!1);K(this,k(a.page,0))}function K(a,b){var c=a.h,e=a.q,e=Math.min(Math.max(b,0),e-1);a.h=e;c!==e&&$(a).trigger("vnbx_change")}J.prototype.next=function(){var a=this.q,b=this.h,c=b+1;c>a-1&&(c=this.t?0:a-1);this.h=c;b!==c&&$(this).trigger("vnbx_change")};J.prototype.L=function(){var a=this.q,b=this.h,c=b-1;0>c&&(c=this.t?a-1:0);this.h=c;b!==c&&$(this).trigger("vnbx_change")};function L(a){this.v=a.r;this.T=k(a.disabled,!1);this.c()}d=L.prototype;d.c=function(){var a=$("<div>");a.addClass("vnbx-button");this.v&&a.addClass(this.v);a.attr("ontouchstart","void(0)");this.a=a;this.e()};d.b=function(){this.a=null};d.e=function(){this.a.on("click",$.proxy(this.o,this))};d.g=function(){this.a.off("click",this.o)};function M(a,b){var c=a.a;a.T=b;a.T?c.addClass("vnbx-disabled"):c.removeClass("vnbx-disabled")}d.o=function(a){a.stopPropagation();this.T||$(this).trigger("vnbx_click")};function N(a){this.v=a.r;this.c()}N.prototype.c=function(){var a=$("<div>");a.addClass("vnbx-label");this.v&&a.addClass(this.v);this.a=a};N.prototype.b=function(){this.a=null};function O(a){if(!a.Y||0===a.Y.length)throw new t;this.R=!1;this.M=a.Y;this.l=k(a.u,w);this.Aa=a.za;this.Ba=a.wa;this.N=a.ua;this.k=a.s;this.va={J:a.J,I:a.I,type:a.type};this.j=new J({loop:a.loop,Da:this.M.length});this.c()}d=O.prototype;
|
17
|
+
d.c=function(){var a=this,b=new z,c=b.a;c.addClass("vnbx");c.hide();$("body").append(c);a.n=b;P(a);var e=new D({u:a.l,s:a.k}),b=e.a;a.i=e;c.append(b);c=new N({r:"vnbx-title"});a.Z=c;b.append(c.a);c=new N({r:"vnbx-pager"});a.V=c;b.append(c.a);c=new L({r:"vnbx-prev"});a.K=c;b.append(c.a);c=new L({r:"vnbx-next"});a.C=c;b.append(c.a);c=new L({r:"vnbx-close"});a.N||c.a.hide();a.O=c;b.append(c.a);a.e();b=q(a.M,function(b){b=$(b);var c=a.va,e=I[c.type];if(!e)throw new t;return e(b,c)});a.P=b;b=new F;Q(a,
|
18
|
+
b)};function P(a){var b=a.n.a;s()&&b.addClass("vnbx-ios");a.N&&b.addClass("vnbx-close-button-enabled");1<a.j.q&&b.addClass("vnbx-group")}d.b=function(){R(this);this.g();n(this.P,function(a){a.b()});this.P=null;this.Z.b();this.Z=null;this.V.b();this.V=null;this.O.b();this.O=null;this.K.b();this.K=null;this.C.b();this.C=null;this.i.b();this.i=null;this.n.a.remove();this.n.b();this.n=null};
|
19
|
+
d.e=function(){this.M.on("click",$.proxy(this.ma,this));$(this.n).on("vnbx_click",$.proxy(this.ia,this));$(this.j).on("vnbx_change",$.proxy(this.ka,this));$(this.O).on("vnbx_click",$.proxy(this.fa,this));$(this.K).on("vnbx_click",$.proxy(this.la,this));$(this.C).on("vnbx_click",$.proxy(this.ja,this))};
|
20
|
+
d.g=function(){this.M.off("click",this.ma);$(this.n).off("vnbx_click",this.ia);$(this.j).off("vnbx_change",this.ka);$(this.O).off("vnbx_click",this.fa);$(this.K).off("vnbx_click",this.la);$(this.C).off("vnbx_click",this.ja);this.w();this.d=null};function T(a){var b=$(window),c=$(document);b.on("resize",$.proxy(a.H,a));b.on("scroll",$.proxy(a.na,a));c.on("keyup",$.proxy(a.ha,a))}function R(a){var b=$(window),c=$(document);b.off("resize",a.H,a);b.off("scroll",a.na,a);c.off("keyup",a.ha,a)}
|
21
|
+
d.S=function(){var a=this.i.f.d,b=a.a;$(a).on("vnbx_complete",$.proxy(this.D,this));b.on("click",$.proxy(this.ga,this))};d.w=function(){var a=this.i.f.d,b=a.a;$(a).off("complete",this.D);b.off("click",this.ga)};d.show=function(a){var b=this,c=b.l;if(b.R)return r();b.R=!0;T(b);B(b.i.f);var e=b.n;e.B();var e=c.ra(e),c=c.qa(b.i),f=b.j;a=k(a,0);var g=a!==f.h;K(f,a);g||U(b);return $.when(e,c).then(function(){$(b).trigger("vnbx_show")})};
|
22
|
+
d.hide=function(){var a=this;return a.R?$.when(a.l.aa(a.i),a.l.ba(a.n)).then(function(){R(a);a.R=!1;$(a).trigger("vnbx_hide")}):r()};d.L=function(){this.j.L()};d.next=function(){this.j.next()};function Q(a,b){var c=a.i.f,e=a.i.f.d;if(e!==b){e&&a.w();e=c.l;c.d&&(c.w(),e.$(c.d));c.d=b;c.S();c.ea&&C(c);var f=c.a,g=c.d.a,p=f.find("> *");0===p.length?f.append(g):g.insertBefore(p.first());e.pa(c.d);a.S();a.Z.a.text(b.Ca);b.load()}c.B()}
|
23
|
+
function U(a){var b=a.j;a.V.a.text(String(b.h+1)+" of "+String(b.q));M(a.K,!(b.t||0<b.h));M(a.C,!(b.t||b.h<b.q-1));Q(a,a.P[a.j.h])}function V(a){a.ca&&clearTimeout(a.ca);a.ca=setTimeout(function(){a.Aa&&a.l.Q(a.i)},300)}d.H=function(){V(this)};d.na=function(){V(this)};d.ha=function(a){if(this.Ba)switch(a.keyCode){case 27:this.hide();break;case 37:this.L();break;case 39:this.next()}};d.ma=function(a){var b=this.M.index(a.delegateTarget);0>b||(a.preventDefault(),this.show(b))};d.ka=function(){U(this)};
|
24
|
+
d.ia=function(){this.N||this.hide()};d.fa=function(){this.N&&this.hide()};d.la=function(){this.L()};d.ja=function(){this.next()};d.D=function(a,b){this.l.Q(this.i);var c=a.target,e;a:{e=this.P;var f=e.length,g;for(g=0;g<f;g++)if(e[g]===c){e=g;break a}e=-1}0<=e&&$(this).trigger("vnbx_load",[b,c,e])};d.ga=function(a){var b=this.j;a.stopPropagation();b.t||b.h<b.q-1?this.next():this.hide()};var W={animation:"default",closeButton:!1,adjustToWindow:"both",keyboard:!0,loop:!1,preferredHeight:600,preferredWidth:800,repositionOnScroll:!1,type:"image"};$.fn.Ea=function(a){var b={};$.extend(b,W);$.extend(b,a);a=$(this);return new O({u:x[b.animation]||w,ua:b.closeButton,s:b.adjustToWindow,wa:b.keyboard,loop:b.loop,I:b.preferredHeight,J:b.preferredWidth,za:b.repositionOnScroll,Y:a,type:b.type})};$.fn.vanillabox=$.fn.Ea;O.prototype.dispose=O.prototype.b;O.prototype.hide=O.prototype.hide;O.prototype.next=O.prototype.next;O.prototype.previous=O.prototype.L;O.prototype.show=O.prototype.show;})(jQuery);
|
@@ -0,0 +1,402 @@
|
|
1
|
+
/**
|
2
|
+
* @license jahashtable, a JavaScript implementation of a hash table. It creates a single constructor function called
|
3
|
+
* Hashtable in the global scope.
|
4
|
+
*
|
5
|
+
* http://www.timdown.co.uk/jshashtable/
|
6
|
+
* Copyright 2013 Tim Down.
|
7
|
+
* Version: 3.0
|
8
|
+
* Build date: 17 July 2013
|
9
|
+
*
|
10
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
11
|
+
* you may not use this file except in compliance with the License.
|
12
|
+
* You may obtain a copy of the License at
|
13
|
+
*
|
14
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
15
|
+
*
|
16
|
+
* Unless required by applicable law or agreed to in writing, software
|
17
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
18
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
19
|
+
* See the License for the specific language governing permissions and
|
20
|
+
* limitations under the License.
|
21
|
+
*/
|
22
|
+
var Hashtable = (function(UNDEFINED) {
|
23
|
+
var FUNCTION = "function", STRING = "string", UNDEF = "undefined";
|
24
|
+
|
25
|
+
// Require Array.prototype.splice, Object.prototype.hasOwnProperty and encodeURIComponent. In environments not
|
26
|
+
// having these (e.g. IE <= 5), we bail out now and leave Hashtable null.
|
27
|
+
if (typeof encodeURIComponent == UNDEF ||
|
28
|
+
Array.prototype.splice === UNDEFINED ||
|
29
|
+
Object.prototype.hasOwnProperty === UNDEFINED) {
|
30
|
+
return null;
|
31
|
+
}
|
32
|
+
|
33
|
+
function toStr(obj) {
|
34
|
+
return (typeof obj == STRING) ? obj : "" + obj;
|
35
|
+
}
|
36
|
+
|
37
|
+
function hashObject(obj) {
|
38
|
+
var hashCode;
|
39
|
+
if (typeof obj == STRING) {
|
40
|
+
return obj;
|
41
|
+
} else if (typeof obj.hashCode == FUNCTION) {
|
42
|
+
// Check the hashCode method really has returned a string
|
43
|
+
hashCode = obj.hashCode();
|
44
|
+
return (typeof hashCode == STRING) ? hashCode : hashObject(hashCode);
|
45
|
+
} else {
|
46
|
+
return toStr(obj);
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
50
|
+
function merge(o1, o2) {
|
51
|
+
for (var i in o2) {
|
52
|
+
if (o2.hasOwnProperty(i)) {
|
53
|
+
o1[i] = o2[i];
|
54
|
+
}
|
55
|
+
}
|
56
|
+
}
|
57
|
+
|
58
|
+
function equals_fixedValueHasEquals(fixedValue, variableValue) {
|
59
|
+
return fixedValue.equals(variableValue);
|
60
|
+
}
|
61
|
+
|
62
|
+
function equals_fixedValueNoEquals(fixedValue, variableValue) {
|
63
|
+
return (typeof variableValue.equals == FUNCTION) ?
|
64
|
+
variableValue.equals(fixedValue) : (fixedValue === variableValue);
|
65
|
+
}
|
66
|
+
|
67
|
+
function createKeyValCheck(kvStr) {
|
68
|
+
return function(kv) {
|
69
|
+
if (kv === null) {
|
70
|
+
throw new Error("null is not a valid " + kvStr);
|
71
|
+
} else if (kv === UNDEFINED) {
|
72
|
+
throw new Error(kvStr + " must not be undefined");
|
73
|
+
}
|
74
|
+
};
|
75
|
+
}
|
76
|
+
|
77
|
+
var checkKey = createKeyValCheck("key"), checkValue = createKeyValCheck("value");
|
78
|
+
|
79
|
+
/*----------------------------------------------------------------------------------------------------------------*/
|
80
|
+
|
81
|
+
function Bucket(hash, firstKey, firstValue, equalityFunction) {
|
82
|
+
this[0] = hash;
|
83
|
+
this.entries = [];
|
84
|
+
this.addEntry(firstKey, firstValue);
|
85
|
+
|
86
|
+
if (equalityFunction !== null) {
|
87
|
+
this.getEqualityFunction = function() {
|
88
|
+
return equalityFunction;
|
89
|
+
};
|
90
|
+
}
|
91
|
+
}
|
92
|
+
|
93
|
+
var EXISTENCE = 0, ENTRY = 1, ENTRY_INDEX_AND_VALUE = 2;
|
94
|
+
|
95
|
+
function createBucketSearcher(mode) {
|
96
|
+
return function(key) {
|
97
|
+
var i = this.entries.length, entry, equals = this.getEqualityFunction(key);
|
98
|
+
while (i--) {
|
99
|
+
entry = this.entries[i];
|
100
|
+
if ( equals(key, entry[0]) ) {
|
101
|
+
switch (mode) {
|
102
|
+
case EXISTENCE:
|
103
|
+
return true;
|
104
|
+
case ENTRY:
|
105
|
+
return entry;
|
106
|
+
case ENTRY_INDEX_AND_VALUE:
|
107
|
+
return [ i, entry[1] ];
|
108
|
+
}
|
109
|
+
}
|
110
|
+
}
|
111
|
+
return false;
|
112
|
+
};
|
113
|
+
}
|
114
|
+
|
115
|
+
function createBucketLister(entryProperty) {
|
116
|
+
return function(aggregatedArr) {
|
117
|
+
var startIndex = aggregatedArr.length;
|
118
|
+
for (var i = 0, entries = this.entries, len = entries.length; i < len; ++i) {
|
119
|
+
aggregatedArr[startIndex + i] = entries[i][entryProperty];
|
120
|
+
}
|
121
|
+
};
|
122
|
+
}
|
123
|
+
|
124
|
+
Bucket.prototype = {
|
125
|
+
getEqualityFunction: function(searchValue) {
|
126
|
+
return (typeof searchValue.equals == FUNCTION) ? equals_fixedValueHasEquals : equals_fixedValueNoEquals;
|
127
|
+
},
|
128
|
+
|
129
|
+
getEntryForKey: createBucketSearcher(ENTRY),
|
130
|
+
|
131
|
+
getEntryAndIndexForKey: createBucketSearcher(ENTRY_INDEX_AND_VALUE),
|
132
|
+
|
133
|
+
removeEntryForKey: function(key) {
|
134
|
+
var result = this.getEntryAndIndexForKey(key);
|
135
|
+
if (result) {
|
136
|
+
this.entries.splice(result[0], 1);
|
137
|
+
return result[1];
|
138
|
+
}
|
139
|
+
return null;
|
140
|
+
},
|
141
|
+
|
142
|
+
addEntry: function(key, value) {
|
143
|
+
this.entries.push( [key, value] );
|
144
|
+
},
|
145
|
+
|
146
|
+
keys: createBucketLister(0),
|
147
|
+
|
148
|
+
values: createBucketLister(1),
|
149
|
+
|
150
|
+
getEntries: function(destEntries) {
|
151
|
+
var startIndex = destEntries.length;
|
152
|
+
for (var i = 0, entries = this.entries, len = entries.length; i < len; ++i) {
|
153
|
+
// Clone the entry stored in the bucket before adding to array
|
154
|
+
destEntries[startIndex + i] = entries[i].slice(0);
|
155
|
+
}
|
156
|
+
},
|
157
|
+
|
158
|
+
containsKey: createBucketSearcher(EXISTENCE),
|
159
|
+
|
160
|
+
containsValue: function(value) {
|
161
|
+
var entries = this.entries, i = entries.length;
|
162
|
+
while (i--) {
|
163
|
+
if ( value === entries[i][1] ) {
|
164
|
+
return true;
|
165
|
+
}
|
166
|
+
}
|
167
|
+
return false;
|
168
|
+
}
|
169
|
+
};
|
170
|
+
|
171
|
+
/*----------------------------------------------------------------------------------------------------------------*/
|
172
|
+
|
173
|
+
// Supporting functions for searching hashtable buckets
|
174
|
+
|
175
|
+
function searchBuckets(buckets, hash) {
|
176
|
+
var i = buckets.length, bucket;
|
177
|
+
while (i--) {
|
178
|
+
bucket = buckets[i];
|
179
|
+
if (hash === bucket[0]) {
|
180
|
+
return i;
|
181
|
+
}
|
182
|
+
}
|
183
|
+
return null;
|
184
|
+
}
|
185
|
+
|
186
|
+
function getBucketForHash(bucketsByHash, hash) {
|
187
|
+
var bucket = bucketsByHash[hash];
|
188
|
+
|
189
|
+
// Check that this is a genuine bucket and not something inherited from the bucketsByHash's prototype
|
190
|
+
return ( bucket && (bucket instanceof Bucket) ) ? bucket : null;
|
191
|
+
}
|
192
|
+
|
193
|
+
/*----------------------------------------------------------------------------------------------------------------*/
|
194
|
+
|
195
|
+
function Hashtable() {
|
196
|
+
var buckets = [];
|
197
|
+
var bucketsByHash = {};
|
198
|
+
var properties = {
|
199
|
+
replaceDuplicateKey: true,
|
200
|
+
hashCode: hashObject,
|
201
|
+
equals: null
|
202
|
+
};
|
203
|
+
|
204
|
+
var arg0 = arguments[0], arg1 = arguments[1];
|
205
|
+
if (arg1 !== UNDEFINED) {
|
206
|
+
properties.hashCode = arg0;
|
207
|
+
properties.equals = arg1;
|
208
|
+
} else if (arg0 !== UNDEFINED) {
|
209
|
+
merge(properties, arg0);
|
210
|
+
}
|
211
|
+
|
212
|
+
var hashCode = properties.hashCode, equals = properties.equals;
|
213
|
+
|
214
|
+
this.properties = properties;
|
215
|
+
|
216
|
+
this.put = function(key, value) {
|
217
|
+
checkKey(key);
|
218
|
+
checkValue(value);
|
219
|
+
var hash = hashCode(key), bucket, bucketEntry, oldValue = null;
|
220
|
+
|
221
|
+
// Check if a bucket exists for the bucket key
|
222
|
+
bucket = getBucketForHash(bucketsByHash, hash);
|
223
|
+
if (bucket) {
|
224
|
+
// Check this bucket to see if it already contains this key
|
225
|
+
bucketEntry = bucket.getEntryForKey(key);
|
226
|
+
if (bucketEntry) {
|
227
|
+
// This bucket entry is the current mapping of key to value, so replace the old value.
|
228
|
+
// Also, we optionally replace the key so that the latest key is stored.
|
229
|
+
if (properties.replaceDuplicateKey) {
|
230
|
+
bucketEntry[0] = key;
|
231
|
+
}
|
232
|
+
oldValue = bucketEntry[1];
|
233
|
+
bucketEntry[1] = value;
|
234
|
+
} else {
|
235
|
+
// The bucket does not contain an entry for this key, so add one
|
236
|
+
bucket.addEntry(key, value);
|
237
|
+
}
|
238
|
+
} else {
|
239
|
+
// No bucket exists for the key, so create one and put our key/value mapping in
|
240
|
+
bucket = new Bucket(hash, key, value, equals);
|
241
|
+
buckets.push(bucket);
|
242
|
+
bucketsByHash[hash] = bucket;
|
243
|
+
}
|
244
|
+
return oldValue;
|
245
|
+
};
|
246
|
+
|
247
|
+
this.get = function(key) {
|
248
|
+
checkKey(key);
|
249
|
+
|
250
|
+
var hash = hashCode(key);
|
251
|
+
|
252
|
+
// Check if a bucket exists for the bucket key
|
253
|
+
var bucket = getBucketForHash(bucketsByHash, hash);
|
254
|
+
if (bucket) {
|
255
|
+
// Check this bucket to see if it contains this key
|
256
|
+
var bucketEntry = bucket.getEntryForKey(key);
|
257
|
+
if (bucketEntry) {
|
258
|
+
// This bucket entry is the current mapping of key to value, so return the value.
|
259
|
+
return bucketEntry[1];
|
260
|
+
}
|
261
|
+
}
|
262
|
+
return null;
|
263
|
+
};
|
264
|
+
|
265
|
+
this.containsKey = function(key) {
|
266
|
+
checkKey(key);
|
267
|
+
var bucketKey = hashCode(key);
|
268
|
+
|
269
|
+
// Check if a bucket exists for the bucket key
|
270
|
+
var bucket = getBucketForHash(bucketsByHash, bucketKey);
|
271
|
+
|
272
|
+
return bucket ? bucket.containsKey(key) : false;
|
273
|
+
};
|
274
|
+
|
275
|
+
this.containsValue = function(value) {
|
276
|
+
checkValue(value);
|
277
|
+
var i = buckets.length;
|
278
|
+
while (i--) {
|
279
|
+
if (buckets[i].containsValue(value)) {
|
280
|
+
return true;
|
281
|
+
}
|
282
|
+
}
|
283
|
+
return false;
|
284
|
+
};
|
285
|
+
|
286
|
+
this.clear = function() {
|
287
|
+
buckets.length = 0;
|
288
|
+
bucketsByHash = {};
|
289
|
+
};
|
290
|
+
|
291
|
+
this.isEmpty = function() {
|
292
|
+
return !buckets.length;
|
293
|
+
};
|
294
|
+
|
295
|
+
var createBucketAggregator = function(bucketFuncName) {
|
296
|
+
return function() {
|
297
|
+
var aggregated = [], i = buckets.length;
|
298
|
+
while (i--) {
|
299
|
+
buckets[i][bucketFuncName](aggregated);
|
300
|
+
}
|
301
|
+
return aggregated;
|
302
|
+
};
|
303
|
+
};
|
304
|
+
|
305
|
+
this.keys = createBucketAggregator("keys");
|
306
|
+
this.values = createBucketAggregator("values");
|
307
|
+
this.entries = createBucketAggregator("getEntries");
|
308
|
+
|
309
|
+
this.remove = function(key) {
|
310
|
+
checkKey(key);
|
311
|
+
|
312
|
+
var hash = hashCode(key), bucketIndex, oldValue = null;
|
313
|
+
|
314
|
+
// Check if a bucket exists for the bucket key
|
315
|
+
var bucket = getBucketForHash(bucketsByHash, hash);
|
316
|
+
|
317
|
+
if (bucket) {
|
318
|
+
// Remove entry from this bucket for this key
|
319
|
+
oldValue = bucket.removeEntryForKey(key);
|
320
|
+
if (oldValue !== null) {
|
321
|
+
// Entry was removed, so check if bucket is empty
|
322
|
+
if (bucket.entries.length == 0) {
|
323
|
+
// Bucket is empty, so remove it from the bucket collections
|
324
|
+
bucketIndex = searchBuckets(buckets, hash);
|
325
|
+
buckets.splice(bucketIndex, 1);
|
326
|
+
delete bucketsByHash[hash];
|
327
|
+
}
|
328
|
+
}
|
329
|
+
}
|
330
|
+
return oldValue;
|
331
|
+
};
|
332
|
+
|
333
|
+
this.size = function() {
|
334
|
+
var total = 0, i = buckets.length;
|
335
|
+
while (i--) {
|
336
|
+
total += buckets[i].entries.length;
|
337
|
+
}
|
338
|
+
return total;
|
339
|
+
};
|
340
|
+
}
|
341
|
+
|
342
|
+
Hashtable.prototype = {
|
343
|
+
each: function(callback) {
|
344
|
+
var entries = this.entries(), i = entries.length, entry;
|
345
|
+
while (i--) {
|
346
|
+
entry = entries[i];
|
347
|
+
callback(entry[0], entry[1]);
|
348
|
+
}
|
349
|
+
},
|
350
|
+
|
351
|
+
equals: function(hashtable) {
|
352
|
+
var keys, key, val, count = this.size();
|
353
|
+
if (count == hashtable.size()) {
|
354
|
+
keys = this.keys();
|
355
|
+
while (count--) {
|
356
|
+
key = keys[count];
|
357
|
+
val = hashtable.get(key);
|
358
|
+
if (val === null || val !== this.get(key)) {
|
359
|
+
return false;
|
360
|
+
}
|
361
|
+
}
|
362
|
+
return true;
|
363
|
+
}
|
364
|
+
return false;
|
365
|
+
},
|
366
|
+
|
367
|
+
putAll: function(hashtable, conflictCallback) {
|
368
|
+
var entries = hashtable.entries();
|
369
|
+
var entry, key, value, thisValue, i = entries.length;
|
370
|
+
var hasConflictCallback = (typeof conflictCallback == FUNCTION);
|
371
|
+
while (i--) {
|
372
|
+
entry = entries[i];
|
373
|
+
key = entry[0];
|
374
|
+
value = entry[1];
|
375
|
+
|
376
|
+
// Check for a conflict. The default behaviour is to overwrite the value for an existing key
|
377
|
+
if ( hasConflictCallback && (thisValue = this.get(key)) ) {
|
378
|
+
value = conflictCallback(key, thisValue, value);
|
379
|
+
}
|
380
|
+
this.put(key, value);
|
381
|
+
}
|
382
|
+
},
|
383
|
+
|
384
|
+
clone: function() {
|
385
|
+
var clone = new Hashtable(this.properties);
|
386
|
+
clone.putAll(this);
|
387
|
+
return clone;
|
388
|
+
}
|
389
|
+
};
|
390
|
+
|
391
|
+
Hashtable.prototype.toQueryString = function() {
|
392
|
+
var entries = this.entries(), i = entries.length, entry;
|
393
|
+
var parts = [];
|
394
|
+
while (i--) {
|
395
|
+
entry = entries[i];
|
396
|
+
parts[i] = encodeURIComponent( toStr(entry[0]) ) + "=" + encodeURIComponent( toStr(entry[1]) );
|
397
|
+
}
|
398
|
+
return parts.join("&");
|
399
|
+
};
|
400
|
+
|
401
|
+
return Hashtable;
|
402
|
+
})();
|
@@ -0,0 +1,566 @@
|
|
1
|
+
/**
|
2
|
+
* jquery.numberformatter - Formatting/Parsing Numbers in jQuery
|
3
|
+
*
|
4
|
+
* Written by
|
5
|
+
* Michael Abernethy (mike@abernethysoft.com),
|
6
|
+
* Andrew Parry (aparry0@gmail.com)
|
7
|
+
*
|
8
|
+
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
9
|
+
* and GPL (GPL-LICENSE.txt) licenses.
|
10
|
+
*
|
11
|
+
* @author Michael Abernethy, Andrew Parry
|
12
|
+
* @version 1.2.4-RELEASE ($Id$)
|
13
|
+
*
|
14
|
+
* Dependencies
|
15
|
+
*
|
16
|
+
* jQuery (http://jquery.com)
|
17
|
+
* jshashtable (http://www.timdown.co.uk/jshashtable)
|
18
|
+
*
|
19
|
+
* Notes & Thanks
|
20
|
+
*
|
21
|
+
* many thanks to advweb.nanasi.jp for his bug fixes
|
22
|
+
* jsHashtable is now used also, so thanks to the author for that excellent little class.
|
23
|
+
*
|
24
|
+
* This plugin can be used to format numbers as text and parse text as Numbers
|
25
|
+
* Because we live in an international world, we cannot assume that everyone
|
26
|
+
* uses "," to divide thousands, and "." as a decimal point.
|
27
|
+
*
|
28
|
+
* As of 1.2 the way this plugin works has changed slightly, parsing text to a number
|
29
|
+
* has 1 set of functions, formatting a number to text has it's own. Before things
|
30
|
+
* were a little confusing, so I wanted to separate the 2 out more.
|
31
|
+
*
|
32
|
+
*
|
33
|
+
* jQuery extension functions:
|
34
|
+
*
|
35
|
+
* formatNumber(options, writeBack, giveReturnValue) - Reads the value from the subject, parses to
|
36
|
+
* a Javascript Number object, then formats back to text using the passed options and write back to
|
37
|
+
* the subject.
|
38
|
+
*
|
39
|
+
* parseNumber(options) - Parses the value in the subject to a Number object using the passed options
|
40
|
+
* to decipher the actual number from the text, then writes the value as text back to the subject.
|
41
|
+
*
|
42
|
+
*
|
43
|
+
* Generic functions:
|
44
|
+
*
|
45
|
+
* formatNumber(numberString, options) - Takes a plain number as a string (e.g. '1002.0123') and returns
|
46
|
+
* a string of the given format options.
|
47
|
+
*
|
48
|
+
* parseNumber(numberString, options) - Takes a number as text that is formatted the same as the given
|
49
|
+
* options then and returns it as a plain Number object.
|
50
|
+
*
|
51
|
+
* To achieve the old way of combining parsing and formatting to keep say a input field always formatted
|
52
|
+
* to a given format after it has lost focus you'd simply use a combination of the functions.
|
53
|
+
*
|
54
|
+
* e.g.
|
55
|
+
* $("#salary").blur(function(){
|
56
|
+
* $(this).parseNumber({format:"#,###.00", locale:"us"});
|
57
|
+
* $(this).formatNumber({format:"#,###.00", locale:"us"});
|
58
|
+
* });
|
59
|
+
*
|
60
|
+
* The syntax for the formatting is:
|
61
|
+
* 0 = Digit
|
62
|
+
* # = Digit, zero shows as absent
|
63
|
+
* . = Decimal separator
|
64
|
+
* - = Negative sign
|
65
|
+
* , = Grouping Separator
|
66
|
+
* % = Percent (multiplies the number by 100)
|
67
|
+
*
|
68
|
+
* For example, a format of "#,###.00" and text of 4500.20 will
|
69
|
+
* display as "4.500,20" with a locale of "de", and "4,500.20" with a locale of "us"
|
70
|
+
*
|
71
|
+
*
|
72
|
+
* As of now, the only acceptable locales are
|
73
|
+
* Arab Emirates -> "ae"
|
74
|
+
* Australia -> "au"
|
75
|
+
* Austria -> "at"
|
76
|
+
* Brazil -> "br"
|
77
|
+
* Canada -> "ca"
|
78
|
+
* China -> "cn"
|
79
|
+
* Czech -> "cz"
|
80
|
+
* Denmark -> "dk"
|
81
|
+
* Egypt -> "eg"
|
82
|
+
* Finland -> "fi"
|
83
|
+
* France -> "fr"
|
84
|
+
* Germany -> "de"
|
85
|
+
* Greece -> "gr"
|
86
|
+
* Great Britain -> "gb"
|
87
|
+
* Hong Kong -> "hk"
|
88
|
+
* India -> "in"
|
89
|
+
* Israel -> "il"
|
90
|
+
* Japan -> "jp"
|
91
|
+
* Russia -> "ru"
|
92
|
+
* South Korea -> "kr"
|
93
|
+
* Spain -> "es"
|
94
|
+
* Sweden -> "se"
|
95
|
+
* Switzerland -> "ch"
|
96
|
+
* Taiwan -> "tw"
|
97
|
+
* Thailand -> "th"
|
98
|
+
* United States -> "us"
|
99
|
+
* Vietnam -> "vn"
|
100
|
+
**/
|
101
|
+
|
102
|
+
(function(jQuery) {
|
103
|
+
|
104
|
+
var nfLocales = new Hashtable();
|
105
|
+
|
106
|
+
var nfLocalesLikeUS = [ 'ae','au','ca','cn','eg','gb','hk','il','in','jp','sk','th','tw','us' ];
|
107
|
+
var nfLocalesLikeDE = [ 'at','br','de','dk','es','gr','it','nl','pt','tr','vn' ];
|
108
|
+
var nfLocalesLikeFR = [ 'bg','cz','fi','fr','no','pl','ru','se' ];
|
109
|
+
var nfLocalesLikeCH = [ 'ch' ];
|
110
|
+
|
111
|
+
var nfLocaleFormatting = [ [".", ","], [",", "."], [",", " "], [".", "'"] ];
|
112
|
+
var nfAllLocales = [ nfLocalesLikeUS, nfLocalesLikeDE, nfLocalesLikeFR, nfLocalesLikeCH ]
|
113
|
+
|
114
|
+
function FormatData(dec, group, neg) {
|
115
|
+
this.dec = dec;
|
116
|
+
this.group = group;
|
117
|
+
this.neg = neg;
|
118
|
+
};
|
119
|
+
|
120
|
+
function init() {
|
121
|
+
// write the arrays into the hashtable
|
122
|
+
for (var localeGroupIdx = 0; localeGroupIdx < nfAllLocales.length; localeGroupIdx++) {
|
123
|
+
var localeGroup = nfAllLocales[localeGroupIdx];
|
124
|
+
for (var i = 0; i < localeGroup.length; i++) {
|
125
|
+
nfLocales.put(localeGroup[i], localeGroupIdx);
|
126
|
+
}
|
127
|
+
}
|
128
|
+
};
|
129
|
+
|
130
|
+
function formatCodes(locale, isFullLocale) {
|
131
|
+
if (nfLocales.size() == 0)
|
132
|
+
init();
|
133
|
+
|
134
|
+
// default values
|
135
|
+
var dec = ".";
|
136
|
+
var group = ",";
|
137
|
+
var neg = "-";
|
138
|
+
|
139
|
+
if (isFullLocale == false) {
|
140
|
+
// Extract and convert to lower-case any language code from a real 'locale' formatted string, if not use as-is
|
141
|
+
// (To prevent locale format like : "fr_FR", "en_US", "de_DE", "fr_FR", "en-US", "de-DE")
|
142
|
+
if (locale.indexOf('_') != -1)
|
143
|
+
locale = locale.split('_')[1].toLowerCase();
|
144
|
+
else if (locale.indexOf('-') != -1)
|
145
|
+
locale = locale.split('-')[1].toLowerCase();
|
146
|
+
}
|
147
|
+
|
148
|
+
// hashtable lookup to match locale with codes
|
149
|
+
var codesIndex = nfLocales.get(locale);
|
150
|
+
if (codesIndex) {
|
151
|
+
var codes = nfLocaleFormatting[codesIndex];
|
152
|
+
if (codes) {
|
153
|
+
dec = codes[0];
|
154
|
+
group = codes[1];
|
155
|
+
}
|
156
|
+
}
|
157
|
+
return new FormatData(dec, group, neg);
|
158
|
+
};
|
159
|
+
|
160
|
+
|
161
|
+
/* Formatting Methods */
|
162
|
+
|
163
|
+
|
164
|
+
/**
|
165
|
+
* Formats anything containing a number in standard js number notation.
|
166
|
+
*
|
167
|
+
* @param {Object} options The formatting options to use
|
168
|
+
* @param {Boolean} writeBack (true) If the output value should be written back to the subject
|
169
|
+
* @param {Boolean} giveReturnValue (true) If the function should return the output string
|
170
|
+
*/
|
171
|
+
jQuery.fn.formatNumber = function(options, writeBack, giveReturnValue) {
|
172
|
+
|
173
|
+
return this.each(function() {
|
174
|
+
// enforce defaults
|
175
|
+
if (writeBack == null)
|
176
|
+
writeBack = true;
|
177
|
+
if (giveReturnValue == null)
|
178
|
+
giveReturnValue = true;
|
179
|
+
|
180
|
+
// get text
|
181
|
+
var text;
|
182
|
+
if (jQuery(this).is(":input"))
|
183
|
+
text = new String(jQuery(this).val());
|
184
|
+
else
|
185
|
+
text = new String(jQuery(this).text());
|
186
|
+
|
187
|
+
// format
|
188
|
+
var returnString = jQuery.formatNumber(text, options);
|
189
|
+
|
190
|
+
// set formatted string back, only if a success
|
191
|
+
// if (returnString) {
|
192
|
+
if (writeBack) {
|
193
|
+
if (jQuery(this).is(":input"))
|
194
|
+
jQuery(this).val(returnString);
|
195
|
+
else
|
196
|
+
jQuery(this).text(returnString);
|
197
|
+
}
|
198
|
+
if (giveReturnValue)
|
199
|
+
return returnString;
|
200
|
+
// }
|
201
|
+
// return '';
|
202
|
+
});
|
203
|
+
};
|
204
|
+
|
205
|
+
/**
|
206
|
+
* First parses a string and reformats it with the given options.
|
207
|
+
*
|
208
|
+
* @param {Object} numberString
|
209
|
+
* @param {Object} options
|
210
|
+
*/
|
211
|
+
jQuery.formatNumber = function(numberString, options){
|
212
|
+
var options = jQuery.extend({}, jQuery.fn.formatNumber.defaults, options);
|
213
|
+
var formatData = formatCodes(options.locale.toLowerCase(), options.isFullLocale);
|
214
|
+
|
215
|
+
var dec = formatData.dec;
|
216
|
+
var group = formatData.group;
|
217
|
+
var neg = formatData.neg;
|
218
|
+
|
219
|
+
var validFormat = "0#-,.";
|
220
|
+
|
221
|
+
// strip all the invalid characters at the beginning and the end
|
222
|
+
// of the format, and we'll stick them back on at the end
|
223
|
+
// make a special case for the negative sign "-" though, so
|
224
|
+
// we can have formats like -$23.32
|
225
|
+
var prefix = "";
|
226
|
+
var negativeInFront = false;
|
227
|
+
for (var i = 0; i < options.format.length; i++) {
|
228
|
+
if (validFormat.indexOf(options.format.charAt(i)) == -1)
|
229
|
+
prefix = prefix + options.format.charAt(i);
|
230
|
+
else
|
231
|
+
if (i == 0 && options.format.charAt(i) == '-') {
|
232
|
+
negativeInFront = true;
|
233
|
+
continue;
|
234
|
+
}
|
235
|
+
else
|
236
|
+
break;
|
237
|
+
}
|
238
|
+
var suffix = "";
|
239
|
+
for (var i = options.format.length - 1; i >= 0; i--) {
|
240
|
+
if (validFormat.indexOf(options.format.charAt(i)) == -1)
|
241
|
+
suffix = options.format.charAt(i) + suffix;
|
242
|
+
else
|
243
|
+
break;
|
244
|
+
}
|
245
|
+
|
246
|
+
options.format = options.format.substring(prefix.length);
|
247
|
+
options.format = options.format.substring(0, options.format.length - suffix.length);
|
248
|
+
|
249
|
+
// now we need to convert it into a number
|
250
|
+
//while (numberString.indexOf(group) > -1)
|
251
|
+
// numberString = numberString.replace(group, '');
|
252
|
+
//var number = new Number(numberString.replace(dec, ".").replace(neg, "-"));
|
253
|
+
var number = new Number(numberString);
|
254
|
+
|
255
|
+
return jQuery._formatNumber(number, options, suffix, prefix, negativeInFront);
|
256
|
+
};
|
257
|
+
|
258
|
+
/**
|
259
|
+
* Formats a Number object into a string, using the given formatting options
|
260
|
+
*
|
261
|
+
* @param {Object} numberString
|
262
|
+
* @param {Object} options
|
263
|
+
*/
|
264
|
+
jQuery._formatNumber = function(number, options, suffix, prefix, negativeInFront) {
|
265
|
+
var options = jQuery.extend({}, jQuery.fn.formatNumber.defaults, options);
|
266
|
+
var formatData = formatCodes(options.locale.toLowerCase(), options.isFullLocale);
|
267
|
+
|
268
|
+
var dec = formatData.dec;
|
269
|
+
var group = formatData.group;
|
270
|
+
var neg = formatData.neg;
|
271
|
+
|
272
|
+
// check overrides
|
273
|
+
if (options.overrideGroupSep != null) {
|
274
|
+
group = options.overrideGroupSep;
|
275
|
+
}
|
276
|
+
if (options.overrideDecSep != null) {
|
277
|
+
dec = options.overrideDecSep;
|
278
|
+
}
|
279
|
+
if (options.overrideNegSign != null) {
|
280
|
+
neg = options.overrideNegSign;
|
281
|
+
}
|
282
|
+
|
283
|
+
// Check NAN handling
|
284
|
+
var forcedToZero = false;
|
285
|
+
if (isNaN(number)) {
|
286
|
+
if (options.nanForceZero == true) {
|
287
|
+
number = 0;
|
288
|
+
forcedToZero = true;
|
289
|
+
} else {
|
290
|
+
return '';
|
291
|
+
}
|
292
|
+
}
|
293
|
+
|
294
|
+
// special case for percentages
|
295
|
+
if (options.isPercentage == true || (options.autoDetectPercentage && suffix.charAt(suffix.length - 1) == '%')) {
|
296
|
+
number = number * 100;
|
297
|
+
}
|
298
|
+
|
299
|
+
var returnString = "";
|
300
|
+
if (options.format.indexOf(".") > -1) {
|
301
|
+
var decimalPortion = dec;
|
302
|
+
var decimalFormat = options.format.substring(options.format.lastIndexOf(".") + 1);
|
303
|
+
|
304
|
+
// round or truncate number as needed
|
305
|
+
if (options.round == true)
|
306
|
+
number = new Number(number.toFixed(decimalFormat.length));
|
307
|
+
else {
|
308
|
+
var numStr = number.toString();
|
309
|
+
if (numStr.lastIndexOf('.') > 0) {
|
310
|
+
numStr = numStr.substring(0, numStr.lastIndexOf('.') + decimalFormat.length + 1);
|
311
|
+
}
|
312
|
+
number = new Number(numStr);
|
313
|
+
}
|
314
|
+
|
315
|
+
var decimalValue = new Number(number.toString().substring(number.toString().indexOf('.')));
|
316
|
+
decimalString = new String(decimalValue.toFixed(decimalFormat.length));
|
317
|
+
decimalString = decimalString.substring(decimalString.lastIndexOf('.') + 1);
|
318
|
+
for (var i = 0; i < decimalFormat.length; i++) {
|
319
|
+
if (decimalFormat.charAt(i) == '#' && decimalString.charAt(i) != '0') {
|
320
|
+
decimalPortion += decimalString.charAt(i);
|
321
|
+
continue;
|
322
|
+
} else if (decimalFormat.charAt(i) == '#' && decimalString.charAt(i) == '0') {
|
323
|
+
var notParsed = decimalString.substring(i);
|
324
|
+
if (notParsed.match('[1-9]')) {
|
325
|
+
decimalPortion += decimalString.charAt(i);
|
326
|
+
continue;
|
327
|
+
} else
|
328
|
+
break;
|
329
|
+
} else if (decimalFormat.charAt(i) == "0")
|
330
|
+
decimalPortion += decimalString.charAt(i);
|
331
|
+
}
|
332
|
+
returnString += decimalPortion
|
333
|
+
} else
|
334
|
+
number = Math.round(number);
|
335
|
+
|
336
|
+
var ones = Math.floor(number);
|
337
|
+
if (number < 0)
|
338
|
+
ones = Math.ceil(number);
|
339
|
+
|
340
|
+
var onesFormat = "";
|
341
|
+
if (options.format.indexOf(".") == -1)
|
342
|
+
onesFormat = options.format;
|
343
|
+
else
|
344
|
+
onesFormat = options.format.substring(0, options.format.indexOf("."));
|
345
|
+
|
346
|
+
var onePortion = "";
|
347
|
+
if (!(ones == 0 && onesFormat.substr(onesFormat.length - 1) == '#') || forcedToZero) {
|
348
|
+
// find how many digits are in the group
|
349
|
+
var oneText = new String(Math.abs(ones));
|
350
|
+
var groupLength = 9999;
|
351
|
+
if (onesFormat.lastIndexOf(",") != -1)
|
352
|
+
groupLength = onesFormat.length - onesFormat.lastIndexOf(",") - 1;
|
353
|
+
var groupCount = 0;
|
354
|
+
for (var i = oneText.length - 1; i > -1; i--) {
|
355
|
+
onePortion = oneText.charAt(i) + onePortion;
|
356
|
+
groupCount++;
|
357
|
+
if (groupCount == groupLength && i != 0) {
|
358
|
+
onePortion = group + onePortion;
|
359
|
+
groupCount = 0;
|
360
|
+
}
|
361
|
+
}
|
362
|
+
|
363
|
+
// account for any pre-data padding
|
364
|
+
if (onesFormat.length > onePortion.length) {
|
365
|
+
var padStart = onesFormat.indexOf('0');
|
366
|
+
if (padStart != -1) {
|
367
|
+
var padLen = onesFormat.length - padStart;
|
368
|
+
|
369
|
+
// pad to left with 0's or group char
|
370
|
+
var pos = onesFormat.length - onePortion.length - 1;
|
371
|
+
while (onePortion.length < padLen) {
|
372
|
+
var padChar = onesFormat.charAt(pos);
|
373
|
+
// replace with real group char if needed
|
374
|
+
if (padChar == ',')
|
375
|
+
padChar = group;
|
376
|
+
onePortion = padChar + onePortion;
|
377
|
+
pos--;
|
378
|
+
}
|
379
|
+
}
|
380
|
+
}
|
381
|
+
}
|
382
|
+
|
383
|
+
if (!onePortion && onesFormat.indexOf('0', onesFormat.length - 1) !== -1)
|
384
|
+
onePortion = '0';
|
385
|
+
|
386
|
+
returnString = onePortion + returnString;
|
387
|
+
|
388
|
+
// handle special case where negative is in front of the invalid characters
|
389
|
+
if (number < 0 && negativeInFront && prefix.length > 0)
|
390
|
+
prefix = neg + prefix;
|
391
|
+
else if (number < 0)
|
392
|
+
returnString = neg + returnString;
|
393
|
+
|
394
|
+
if (!options.decimalSeparatorAlwaysShown) {
|
395
|
+
if (returnString.lastIndexOf(dec) == returnString.length - 1) {
|
396
|
+
returnString = returnString.substring(0, returnString.length - 1);
|
397
|
+
}
|
398
|
+
}
|
399
|
+
returnString = prefix + returnString + suffix;
|
400
|
+
return returnString;
|
401
|
+
};
|
402
|
+
|
403
|
+
|
404
|
+
/* Parsing Methods */
|
405
|
+
|
406
|
+
|
407
|
+
/**
|
408
|
+
* Parses a number of given format from the element and returns a Number object.
|
409
|
+
* @param {Object} options
|
410
|
+
*/
|
411
|
+
jQuery.fn.parseNumber = function(options, writeBack, giveReturnValue) {
|
412
|
+
// enforce defaults
|
413
|
+
if (writeBack == null)
|
414
|
+
writeBack = true;
|
415
|
+
if (giveReturnValue == null)
|
416
|
+
giveReturnValue = true;
|
417
|
+
|
418
|
+
// get text
|
419
|
+
var text;
|
420
|
+
if (jQuery(this).is(":input"))
|
421
|
+
text = new String(jQuery(this).val());
|
422
|
+
else
|
423
|
+
text = new String(jQuery(this).text());
|
424
|
+
|
425
|
+
// parse text
|
426
|
+
var number = jQuery.parseNumber(text, options);
|
427
|
+
|
428
|
+
if (number) {
|
429
|
+
if (writeBack) {
|
430
|
+
if (jQuery(this).is(":input"))
|
431
|
+
jQuery(this).val(number.toString());
|
432
|
+
else
|
433
|
+
jQuery(this).text(number.toString());
|
434
|
+
}
|
435
|
+
if (giveReturnValue)
|
436
|
+
return number;
|
437
|
+
}
|
438
|
+
};
|
439
|
+
|
440
|
+
/**
|
441
|
+
* Parses a string of given format into a Number object.
|
442
|
+
*
|
443
|
+
* @param {Object} string
|
444
|
+
* @param {Object} options
|
445
|
+
*/
|
446
|
+
jQuery.parseNumber = function(numberString, options) {
|
447
|
+
var options = jQuery.extend({}, jQuery.fn.parseNumber.defaults, options);
|
448
|
+
var formatData = formatCodes(options.locale.toLowerCase(), options.isFullLocale);
|
449
|
+
|
450
|
+
var dec = formatData.dec;
|
451
|
+
var group = formatData.group;
|
452
|
+
var neg = formatData.neg;
|
453
|
+
|
454
|
+
// check overrides
|
455
|
+
if (options.overrideGroupSep != null) {
|
456
|
+
group = options.overrideGroupSep;
|
457
|
+
}
|
458
|
+
if (options.overrideDecSep != null) {
|
459
|
+
dec = options.overrideDecSep;
|
460
|
+
}
|
461
|
+
if (options.overrideNegSign != null) {
|
462
|
+
neg = options.overrideNegSign;
|
463
|
+
}
|
464
|
+
|
465
|
+
var valid = "1234567890";
|
466
|
+
var validOnce = '.-';
|
467
|
+
var strictMode = options.strict;
|
468
|
+
|
469
|
+
// now we need to convert it into a number
|
470
|
+
while (numberString.indexOf(group)>-1) {
|
471
|
+
numberString = numberString.replace(group, '');
|
472
|
+
}
|
473
|
+
numberString = numberString.replace(dec, '.').replace(neg, '-');
|
474
|
+
var validText = '';
|
475
|
+
var hasPercent = false;
|
476
|
+
|
477
|
+
if (options.isPercentage == true || (options.autoDetectPercentage && numberString.charAt(numberString.length - 1) == '%')) {
|
478
|
+
hasPercent = true;
|
479
|
+
}
|
480
|
+
|
481
|
+
for (var i = 0; i < numberString.length; i++) {
|
482
|
+
if (valid.indexOf(numberString.charAt(i)) > -1) {
|
483
|
+
validText = validText + numberString.charAt(i);
|
484
|
+
} else if (validOnce.indexOf(numberString.charAt(i)) > -1) {
|
485
|
+
validText = validText + numberString.charAt(i);
|
486
|
+
validOnce = validOnce.replace(numberString.charAt(i), '');
|
487
|
+
} else {
|
488
|
+
if (options.allowPostfix) {
|
489
|
+
// treat anything after this point (inclusive) as a postfix
|
490
|
+
break;
|
491
|
+
} else if (strictMode) {
|
492
|
+
// abort and force the text to NaN as it's not strictly valid
|
493
|
+
validText = 'NaN';
|
494
|
+
break;
|
495
|
+
}
|
496
|
+
}
|
497
|
+
}
|
498
|
+
var number = new Number(validText);
|
499
|
+
if (hasPercent) {
|
500
|
+
number = number / 100;
|
501
|
+
var decimalPos = validText.indexOf('.');
|
502
|
+
if (decimalPos != -1) {
|
503
|
+
var decimalPoints = validText.length - decimalPos - 1;
|
504
|
+
number = number.toFixed(decimalPoints + 2);
|
505
|
+
} else {
|
506
|
+
number = number.toFixed(2);
|
507
|
+
}
|
508
|
+
}
|
509
|
+
|
510
|
+
return number;
|
511
|
+
};
|
512
|
+
|
513
|
+
jQuery.fn.parseNumber.defaults = {
|
514
|
+
locale: "us",
|
515
|
+
decimalSeparatorAlwaysShown: false,
|
516
|
+
isPercentage: false, // treats the input as a percentage (i.e. input divided by 100)
|
517
|
+
autoDetectPercentage: true, // will search if the input string ends with '%', if it does then the above option is implicitly set
|
518
|
+
isFullLocale: false,
|
519
|
+
strict: false, // will abort the parse if it hits any unknown char
|
520
|
+
overrideGroupSep: null, // override for group separator
|
521
|
+
overrideDecSep: null, // override for decimal point separator
|
522
|
+
overrideNegSign: null, // override for negative sign
|
523
|
+
allowPostfix: false // will truncate the input string as soon as it hits an unknown char
|
524
|
+
};
|
525
|
+
|
526
|
+
jQuery.fn.formatNumber.defaults = {
|
527
|
+
format: "#,###.00",
|
528
|
+
locale: "us",
|
529
|
+
decimalSeparatorAlwaysShown: false,
|
530
|
+
nanForceZero: true,
|
531
|
+
round: true,
|
532
|
+
isFullLocale: false,
|
533
|
+
overrideGroupSep: null,
|
534
|
+
overrideDecSep: null,
|
535
|
+
overrideNegSign: null,
|
536
|
+
isPercentage: false, // treats the input as a percentage (i.e. input multiplied by 100)
|
537
|
+
autoDetectPercentage: true // will search if the format string ends with '%', if it does then the above option is implicitly set
|
538
|
+
};
|
539
|
+
|
540
|
+
Number.prototype.toFixed = function(precision) {
|
541
|
+
return jQuery._roundNumber(this, precision);
|
542
|
+
};
|
543
|
+
|
544
|
+
jQuery._roundNumber = function(number, decimalPlaces) {
|
545
|
+
var power = Math.pow(10, decimalPlaces || 0);
|
546
|
+
var value = String(Math.round(number * power) / power);
|
547
|
+
|
548
|
+
// ensure the decimal places are there
|
549
|
+
if (decimalPlaces > 0) {
|
550
|
+
var dp = value.indexOf(".");
|
551
|
+
if (dp == -1) {
|
552
|
+
value += '.';
|
553
|
+
dp = 0;
|
554
|
+
} else {
|
555
|
+
dp = value.length - (dp + 1);
|
556
|
+
}
|
557
|
+
|
558
|
+
while (dp < decimalPlaces) {
|
559
|
+
value += '0';
|
560
|
+
dp++;
|
561
|
+
}
|
562
|
+
}
|
563
|
+
return value;
|
564
|
+
};
|
565
|
+
|
566
|
+
})(jQuery);
|