alfa 0.0.1.pre → 0.0.2.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/assets/css/960gs/960.css +653 -0
- data/assets/css/960gs/960_12_col.css +357 -0
- data/assets/css/960gs/960_12_col_rtl.css +357 -0
- data/assets/css/960gs/960_16_col.css +446 -0
- data/assets/css/960gs/960_16_col_rtl.css +446 -0
- data/assets/css/960gs/960_24_col.css +621 -0
- data/assets/css/960gs/960_24_col_rtl.css +621 -0
- data/assets/css/960gs/960_rtl.css +653 -0
- data/assets/css/960gs/demo.css +55 -0
- data/assets/css/960gs/min/960.css +1 -0
- data/assets/css/960gs/min/960_12_col.css +1 -0
- data/assets/css/960gs/min/960_12_col_rtl.css +1 -0
- data/assets/css/960gs/min/960_16_col.css +1 -0
- data/assets/css/960gs/min/960_16_col_rtl.css +1 -0
- data/assets/css/960gs/min/960_24_col.css +1 -0
- data/assets/css/960gs/min/960_24_col_rtl.css +1 -0
- data/assets/css/960gs/min/960_rtl.css +1 -0
- data/assets/css/960gs/min/reset.css +1 -0
- data/assets/css/960gs/min/reset_rtl.css +1 -0
- data/assets/css/960gs/min/text.css +1 -0
- data/assets/css/960gs/min/text_rtl.css +1 -0
- data/assets/css/960gs/reset.css +211 -0
- data/assets/css/960gs/reset_rtl.css +211 -0
- data/assets/css/960gs/text.css +86 -0
- data/assets/css/960gs/text_rtl.css +86 -0
- data/assets/js/jquery/jquery-1.3.2.js +4376 -0
- data/assets/js/jquery/jquery-1.3.2.min.js +19 -0
- data/assets/js/jquery/jquery-1.4.2.js +6240 -0
- data/assets/js/jquery/jquery-1.4.2.min.js +154 -0
- data/assets/js/jquery/jquery-1.4.4.js +7179 -0
- data/assets/js/jquery/jquery-1.4.4.min.js +167 -0
- data/assets/js/jquery/jquery-1.8.2.js +9440 -0
- data/assets/js/jquery/jquery-1.8.2.min.js +2 -0
- data/assets/js/jquery/jquery-latest.js +2 -0
- data/assets/js/jquery/plugins/corner.js +178 -0
- data/assets/js/jquery/plugins/corner_12x.js +503 -0
- data/assets/js/jquery/plugins/datepick/calendar-green.gif +0 -0
- data/assets/js/jquery/plugins/datepick/calendar.gif +0 -0
- data/assets/js/jquery/plugins/datepick/datepickBasics.html +34 -0
- data/assets/js/jquery/plugins/datepick/flora.datepick.css +221 -0
- data/assets/js/jquery/plugins/datepick/humanity.datepick.css +192 -0
- data/assets/js/jquery/plugins/datepick/jquery.datepick-ar.js +27 -0
- data/assets/js/jquery/plugins/datepick/jquery.datepick-az.js +26 -0
- data/assets/js/jquery/plugins/datepick/jquery.datepick-bg.js +26 -0
- data/assets/js/jquery/plugins/datepick/jquery.datepick-ca.js +26 -0
- data/assets/js/jquery/plugins/datepick/jquery.datepick-cs.js +26 -0
- data/assets/js/jquery/plugins/datepick/jquery.datepick-da.js +26 -0
- data/assets/js/jquery/plugins/datepick/jquery.datepick-de.js +26 -0
- data/assets/js/jquery/plugins/datepick/jquery.datepick-el.js +26 -0
- data/assets/js/jquery/plugins/datepick/jquery.datepick-eo.js +26 -0
- data/assets/js/jquery/plugins/datepick/jquery.datepick-es.js +26 -0
- data/assets/js/jquery/plugins/datepick/jquery.datepick-et.js +26 -0
- data/assets/js/jquery/plugins/datepick/jquery.datepick-fa.js +26 -0
- data/assets/js/jquery/plugins/datepick/jquery.datepick-fi.js +26 -0
- data/assets/js/jquery/plugins/datepick/jquery.datepick-fr.js +26 -0
- data/assets/js/jquery/plugins/datepick/jquery.datepick-he.js +26 -0
- data/assets/js/jquery/plugins/datepick/jquery.datepick-hr.js +26 -0
- data/assets/js/jquery/plugins/datepick/jquery.datepick-hu.js +26 -0
- data/assets/js/jquery/plugins/datepick/jquery.datepick-hy.js +26 -0
- data/assets/js/jquery/plugins/datepick/jquery.datepick-id.js +26 -0
- data/assets/js/jquery/plugins/datepick/jquery.datepick-is.js +26 -0
- data/assets/js/jquery/plugins/datepick/jquery.datepick-it.js +26 -0
- data/assets/js/jquery/plugins/datepick/jquery.datepick-ja.js +26 -0
- data/assets/js/jquery/plugins/datepick/jquery.datepick-ko.js +26 -0
- data/assets/js/jquery/plugins/datepick/jquery.datepick-lt.js +26 -0
- data/assets/js/jquery/plugins/datepick/jquery.datepick-lv.js +26 -0
- data/assets/js/jquery/plugins/datepick/jquery.datepick-ms.js +26 -0
- data/assets/js/jquery/plugins/datepick/jquery.datepick-nl.js +26 -0
- data/assets/js/jquery/plugins/datepick/jquery.datepick-no.js +26 -0
- data/assets/js/jquery/plugins/datepick/jquery.datepick-pl.js +26 -0
- data/assets/js/jquery/plugins/datepick/jquery.datepick-pt-BR.js +26 -0
- data/assets/js/jquery/plugins/datepick/jquery.datepick-ro.js +26 -0
- data/assets/js/jquery/plugins/datepick/jquery.datepick-ru.js +26 -0
- data/assets/js/jquery/plugins/datepick/jquery.datepick-sk.js +26 -0
- data/assets/js/jquery/plugins/datepick/jquery.datepick-sl.js +27 -0
- data/assets/js/jquery/plugins/datepick/jquery.datepick-sq.js +26 -0
- data/assets/js/jquery/plugins/datepick/jquery.datepick-sr-SR.js +25 -0
- data/assets/js/jquery/plugins/datepick/jquery.datepick-sr.js +25 -0
- data/assets/js/jquery/plugins/datepick/jquery.datepick-sv.js +26 -0
- data/assets/js/jquery/plugins/datepick/jquery.datepick-th.js +26 -0
- data/assets/js/jquery/plugins/datepick/jquery.datepick-tr.js +26 -0
- data/assets/js/jquery/plugins/datepick/jquery.datepick-uk.js +26 -0
- data/assets/js/jquery/plugins/datepick/jquery.datepick-validation.js +141 -0
- data/assets/js/jquery/plugins/datepick/jquery.datepick-validation.min.js +8 -0
- data/assets/js/jquery/plugins/datepick/jquery.datepick-validation.pack.js +8 -0
- data/assets/js/jquery/plugins/datepick/jquery.datepick-zh-CN.js +26 -0
- data/assets/js/jquery/plugins/datepick/jquery.datepick-zh-TW.js +26 -0
- data/assets/js/jquery/plugins/datepick/jquery.datepick.css +216 -0
- data/assets/js/jquery/plugins/datepick/jquery.datepick.ent +76 -0
- data/assets/js/jquery/plugins/datepick/jquery.datepick.js +1974 -0
- data/assets/js/jquery/plugins/datepick/jquery.datepick.min.js +8 -0
- data/assets/js/jquery/plugins/datepick/jquery.datepick.pack.js +8 -0
- data/assets/js/jquery/plugins/datepick/redmond.datepick.css +204 -0
- data/assets/js/jquery/plugins/datepick/smoothness.datepick.css +205 -0
- data/assets/js/jquery/plugins/fancybox/blank.gif +0 -0
- data/assets/js/jquery/plugins/fancybox/fancy_close.png +0 -0
- data/assets/js/jquery/plugins/fancybox/fancy_loading.png +0 -0
- data/assets/js/jquery/plugins/fancybox/fancy_nav_left.png +0 -0
- data/assets/js/jquery/plugins/fancybox/fancy_nav_right.png +0 -0
- data/assets/js/jquery/plugins/fancybox/fancy_shadow_e.png +0 -0
- data/assets/js/jquery/plugins/fancybox/fancy_shadow_n.png +0 -0
- data/assets/js/jquery/plugins/fancybox/fancy_shadow_ne.png +0 -0
- data/assets/js/jquery/plugins/fancybox/fancy_shadow_nw.png +0 -0
- data/assets/js/jquery/plugins/fancybox/fancy_shadow_s.png +0 -0
- data/assets/js/jquery/plugins/fancybox/fancy_shadow_se.png +0 -0
- data/assets/js/jquery/plugins/fancybox/fancy_shadow_sw.png +0 -0
- data/assets/js/jquery/plugins/fancybox/fancy_shadow_w.png +0 -0
- data/assets/js/jquery/plugins/fancybox/fancy_title_left.png +0 -0
- data/assets/js/jquery/plugins/fancybox/fancy_title_main.png +0 -0
- data/assets/js/jquery/plugins/fancybox/fancy_title_over.png +0 -0
- data/assets/js/jquery/plugins/fancybox/fancy_title_right.png +0 -0
- data/assets/js/jquery/plugins/fancybox/fancybox-x.png +0 -0
- data/assets/js/jquery/plugins/fancybox/fancybox-y.png +0 -0
- data/assets/js/jquery/plugins/fancybox/fancybox.png +0 -0
- data/assets/js/jquery/plugins/fancybox/jquery.easing-1.3.pack.js +72 -0
- data/assets/js/jquery/plugins/fancybox/jquery.fancybox-1.3.2.css +359 -0
- data/assets/js/jquery/plugins/fancybox/jquery.fancybox-1.3.2.js +1136 -0
- data/assets/js/jquery/plugins/fancybox/jquery.fancybox-1.3.2.pack.js +46 -0
- data/assets/js/jquery/plugins/fancybox/jquery.fancybox-1.3.4.css +359 -0
- data/assets/js/jquery/plugins/fancybox/jquery.fancybox-1.3.4.js +1156 -0
- data/assets/js/jquery/plugins/fancybox/jquery.fancybox-1.3.4.pack.js +46 -0
- data/assets/js/jquery/plugins/fancybox/jquery.mousewheel-3.0.4.pack.js +14 -0
- data/assets/js/jquery/plugins/jquery.cookie.js +96 -0
- data/assets/js/jquery/plugins/jquery.easing.1.3.js +205 -0
- data/assets/js/jquery/plugins/jquery.flash.js +288 -0
- data/assets/js/jquery/plugins/jquery.flash.min.js +1 -0
- data/assets/js/jquery/plugins/jquery.ifixpng.js +137 -0
- data/assets/js/jquery/plugins/jquery.mousewheel.js +84 -0
- data/assets/js/jquery/plugins/jquery.mousewheel.min.js +12 -0
- data/assets/js/jquery/plugins/jquery.numberformatter-1.2.2.js +486 -0
- data/assets/js/jquery/plugins/jquery.sifr.js +224 -0
- data/assets/js/jquery/plugins/jquery.sifr.min.js +1 -0
- data/assets/js/jquery/plugins/jquery.swfobject.js +1 -0
- data/assets/js/jquery/plugins/jquery.timers-1.1.2.js +147 -0
- data/assets/js/jquery/plugins/simplegallery.js +167 -0
- data/assets/js/jquery/ui/external/jquery.bgiframe-2.1.2.js +39 -0
- data/assets/js/jquery/ui/external/jquery.cookie.js +89 -0
- data/assets/js/jquery/ui/external/jquery.metadata.js +122 -0
- data/assets/js/jquery/ui/external/qunit.css +153 -0
- data/assets/js/jquery/ui/external/qunit.js +1261 -0
- data/assets/js/jquery/ui/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/assets/js/jquery/ui/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/assets/js/jquery/ui/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/assets/js/jquery/ui/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/assets/js/jquery/ui/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/assets/js/jquery/ui/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/assets/js/jquery/ui/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/assets/js/jquery/ui/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/assets/js/jquery/ui/images/ui-icons_222222_256x240.png +0 -0
- data/assets/js/jquery/ui/images/ui-icons_2e83ff_256x240.png +0 -0
- data/assets/js/jquery/ui/images/ui-icons_454545_256x240.png +0 -0
- data/assets/js/jquery/ui/images/ui-icons_888888_256x240.png +0 -0
- data/assets/js/jquery/ui/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/assets/js/jquery/ui/jquery-ui-latest.min.js +778 -0
- data/assets/js/jquery/ui/themes/base/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/assets/js/jquery/ui/themes/base/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/assets/js/jquery/ui/themes/base/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/assets/js/jquery/ui/themes/base/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/assets/js/jquery/ui/themes/base/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/assets/js/jquery/ui/themes/base/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/assets/js/jquery/ui/themes/base/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/assets/js/jquery/ui/themes/base/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/assets/js/jquery/ui/themes/base/images/ui-icons_222222_256x240.png +0 -0
- data/assets/js/jquery/ui/themes/base/images/ui-icons_2e83ff_256x240.png +0 -0
- data/assets/js/jquery/ui/themes/base/images/ui-icons_454545_256x240.png +0 -0
- data/assets/js/jquery/ui/themes/base/images/ui-icons_888888_256x240.png +0 -0
- data/assets/js/jquery/ui/themes/base/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/assets/js/jquery/ui/themes/base/jquery.ui.accordion.css +19 -0
- data/assets/js/jquery/ui/themes/base/jquery.ui.all.css +11 -0
- data/assets/js/jquery/ui/themes/base/jquery.ui.autocomplete.css +53 -0
- data/assets/js/jquery/ui/themes/base/jquery.ui.base.css +11 -0
- data/assets/js/jquery/ui/themes/base/jquery.ui.button.css +38 -0
- data/assets/js/jquery/ui/themes/base/jquery.ui.core.css +41 -0
- data/assets/js/jquery/ui/themes/base/jquery.ui.datepicker.css +68 -0
- data/assets/js/jquery/ui/themes/base/jquery.ui.dialog.css +21 -0
- data/assets/js/jquery/ui/themes/base/jquery.ui.progressbar.css +11 -0
- data/assets/js/jquery/ui/themes/base/jquery.ui.resizable.css +20 -0
- data/assets/js/jquery/ui/themes/base/jquery.ui.selectable.css +10 -0
- data/assets/js/jquery/ui/themes/base/jquery.ui.slider.css +24 -0
- data/assets/js/jquery/ui/themes/base/jquery.ui.tabs.css +18 -0
- data/assets/js/jquery/ui/themes/base/jquery.ui.theme.css +252 -0
- data/assets/js/jquery/ui/themes/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/assets/js/jquery/ui/themes/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/assets/js/jquery/ui/themes/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/assets/js/jquery/ui/themes/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/assets/js/jquery/ui/themes/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/assets/js/jquery/ui/themes/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/assets/js/jquery/ui/themes/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/assets/js/jquery/ui/themes/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/assets/js/jquery/ui/themes/smoothness/images/ui-icons_222222_256x240.png +0 -0
- data/assets/js/jquery/ui/themes/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
- data/assets/js/jquery/ui/themes/smoothness/images/ui-icons_454545_256x240.png +0 -0
- data/assets/js/jquery/ui/themes/smoothness/images/ui-icons_888888_256x240.png +0 -0
- data/assets/js/jquery/ui/themes/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/assets/js/jquery/ui/themes/smoothness/jquery-ui-1.8.6.custom.css +572 -0
- data/assets/js/jquery/ui/themes/smoothness/jquery.ui.accordion.css +19 -0
- data/assets/js/jquery/ui/themes/smoothness/jquery.ui.all.css +11 -0
- data/assets/js/jquery/ui/themes/smoothness/jquery.ui.autocomplete.css +53 -0
- data/assets/js/jquery/ui/themes/smoothness/jquery.ui.base.css +11 -0
- data/assets/js/jquery/ui/themes/smoothness/jquery.ui.button.css +38 -0
- data/assets/js/jquery/ui/themes/smoothness/jquery.ui.core.css +41 -0
- data/assets/js/jquery/ui/themes/smoothness/jquery.ui.datepicker.css +68 -0
- data/assets/js/jquery/ui/themes/smoothness/jquery.ui.dialog.css +21 -0
- data/assets/js/jquery/ui/themes/smoothness/jquery.ui.progressbar.css +11 -0
- data/assets/js/jquery/ui/themes/smoothness/jquery.ui.resizable.css +20 -0
- data/assets/js/jquery/ui/themes/smoothness/jquery.ui.selectable.css +10 -0
- data/assets/js/jquery/ui/themes/smoothness/jquery.ui.slider.css +24 -0
- data/assets/js/jquery/ui/themes/smoothness/jquery.ui.tabs.css +18 -0
- data/assets/js/jquery/ui/themes/smoothness/jquery.ui.theme.css +254 -0
- data/bin/alfa +15 -0
- data/lib/alfa/application.rb +36 -0
- data/lib/alfa/cli_application.rb +11 -3
- data/lib/alfa/commands/new.rb +4 -0
- data/lib/alfa/config.rb +11 -0
- data/lib/alfa/controller.rb +1 -1
- data/lib/alfa/database/mysql.rb +60 -8
- data/lib/alfa/database.rb +2 -1
- data/lib/alfa/logger.rb +38 -0
- data/lib/alfa/models/base.rb +1 -1
- data/lib/alfa/models/base_sql.rb +1 -1
- data/lib/alfa/models/dummy.rb +1 -1
- data/lib/alfa/models/mysql.rb +36 -26
- data/lib/alfa/models.rb +1 -1
- data/lib/alfa/query_logger.rb +29 -0
- data/lib/alfa/router.rb +155 -0
- data/lib/alfa/support.rb +58 -2
- data/lib/alfa/tfile.rb +97 -0
- data/lib/alfa/web_application.rb +106 -85
- data/lib/alfa.rb +1 -1
- data/lib/ruty/bugfix.rb +21 -0
- data/lib/ruty/tags/resources.rb +45 -2
- data/lib/ruty/upgrade.rb +61 -0
- data/test/data/test_router/config/routes.rb +4 -0
- data/test/test_alfa.rb +1 -52
- data/test/test_router.rb +132 -0
- data/test/test_support.rb +26 -0
- data/test/test_tfile.rb +186 -0
- metadata +259 -100
@@ -0,0 +1,486 @@
|
|
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.2-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 = [ 'cz','fi','fr','ru','se','pl' ];
|
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
|
+
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) {
|
131
|
+
if (nfLocales.size() == 0)
|
132
|
+
init();
|
133
|
+
|
134
|
+
// default values
|
135
|
+
var dec = ".";
|
136
|
+
var group = ",";
|
137
|
+
var neg = "-";
|
138
|
+
|
139
|
+
// hashtable lookup to match locale with codes
|
140
|
+
var codesIndex = nfLocales.get(locale);
|
141
|
+
if (codesIndex) {
|
142
|
+
var codes = nfLocaleFormatting[codesIndex];
|
143
|
+
if (codes) {
|
144
|
+
dec = codes[0];
|
145
|
+
group = codes[1];
|
146
|
+
}
|
147
|
+
}
|
148
|
+
return new FormatData(dec, group, neg);
|
149
|
+
};
|
150
|
+
|
151
|
+
|
152
|
+
/* Formatting Methods */
|
153
|
+
|
154
|
+
|
155
|
+
/**
|
156
|
+
* Formats anything containing a number in standard js number notation.
|
157
|
+
*
|
158
|
+
* @param {Object} options The formatting options to use
|
159
|
+
* @param {Boolean} writeBack (true) If the output value should be written back to the subject
|
160
|
+
* @param {Boolean} giveReturnValue (true) If the function should return the output string
|
161
|
+
*/
|
162
|
+
jQuery.fn.formatNumber = function(options, writeBack, giveReturnValue) {
|
163
|
+
|
164
|
+
return this.each(function() {
|
165
|
+
// enforce defaults
|
166
|
+
if (writeBack == null)
|
167
|
+
writeBack = true;
|
168
|
+
if (giveReturnValue == null)
|
169
|
+
giveReturnValue = true;
|
170
|
+
|
171
|
+
// get text
|
172
|
+
var text;
|
173
|
+
if (jQuery(this).is(":input"))
|
174
|
+
text = new String(jQuery(this).val());
|
175
|
+
else
|
176
|
+
text = new String(jQuery(this).text());
|
177
|
+
|
178
|
+
// format
|
179
|
+
var returnString = jQuery.formatNumber(text, options);
|
180
|
+
|
181
|
+
// set formatted string back, only if a success
|
182
|
+
// if (returnString) {
|
183
|
+
if (writeBack) {
|
184
|
+
if (jQuery(this).is(":input"))
|
185
|
+
jQuery(this).val(returnString);
|
186
|
+
else
|
187
|
+
jQuery(this).text(returnString);
|
188
|
+
}
|
189
|
+
if (giveReturnValue)
|
190
|
+
return returnString;
|
191
|
+
// }
|
192
|
+
// return '';
|
193
|
+
});
|
194
|
+
};
|
195
|
+
|
196
|
+
/**
|
197
|
+
* First parses a string and reformats it with the given options.
|
198
|
+
*
|
199
|
+
* @param {Object} numberString
|
200
|
+
* @param {Object} options
|
201
|
+
*/
|
202
|
+
jQuery.formatNumber = function(numberString, options){
|
203
|
+
var options = jQuery.extend({}, jQuery.fn.formatNumber.defaults, options);
|
204
|
+
var formatData = formatCodes(options.locale.toLowerCase());
|
205
|
+
|
206
|
+
var dec = formatData.dec;
|
207
|
+
var group = formatData.group;
|
208
|
+
var neg = formatData.neg;
|
209
|
+
|
210
|
+
var validFormat = "0#-,.";
|
211
|
+
|
212
|
+
// strip all the invalid characters at the beginning and the end
|
213
|
+
// of the format, and we'll stick them back on at the end
|
214
|
+
// make a special case for the negative sign "-" though, so
|
215
|
+
// we can have formats like -$23.32
|
216
|
+
var prefix = "";
|
217
|
+
var negativeInFront = false;
|
218
|
+
for (var i = 0; i < options.format.length; i++) {
|
219
|
+
if (validFormat.indexOf(options.format.charAt(i)) == -1)
|
220
|
+
prefix = prefix + options.format.charAt(i);
|
221
|
+
else
|
222
|
+
if (i == 0 && options.format.charAt(i) == '-') {
|
223
|
+
negativeInFront = true;
|
224
|
+
continue;
|
225
|
+
}
|
226
|
+
else
|
227
|
+
break;
|
228
|
+
}
|
229
|
+
var suffix = "";
|
230
|
+
for (var i = options.format.length - 1; i >= 0; i--) {
|
231
|
+
if (validFormat.indexOf(options.format.charAt(i)) == -1)
|
232
|
+
suffix = options.format.charAt(i) + suffix;
|
233
|
+
else
|
234
|
+
break;
|
235
|
+
}
|
236
|
+
|
237
|
+
options.format = options.format.substring(prefix.length);
|
238
|
+
options.format = options.format.substring(0, options.format.length - suffix.length);
|
239
|
+
|
240
|
+
// now we need to convert it into a number
|
241
|
+
//while (numberString.indexOf(group) > -1)
|
242
|
+
// numberString = numberString.replace(group, '');
|
243
|
+
//var number = new Number(numberString.replace(dec, ".").replace(neg, "-"));
|
244
|
+
var number = new Number(numberString);
|
245
|
+
|
246
|
+
return jQuery._formatNumber(number, options, suffix, prefix, negativeInFront);
|
247
|
+
};
|
248
|
+
|
249
|
+
/**
|
250
|
+
* Formats a Number object into a string, using the given formatting options
|
251
|
+
*
|
252
|
+
* @param {Object} numberString
|
253
|
+
* @param {Object} options
|
254
|
+
*/
|
255
|
+
jQuery._formatNumber = function(number, options, suffix, prefix, negativeInFront) {
|
256
|
+
var options = jQuery.extend({}, jQuery.fn.formatNumber.defaults, options);
|
257
|
+
var formatData = formatCodes(options.locale.toLowerCase());
|
258
|
+
|
259
|
+
var dec = formatData.dec;
|
260
|
+
var group = formatData.group;
|
261
|
+
var neg = formatData.neg;
|
262
|
+
|
263
|
+
var forcedToZero = false;
|
264
|
+
if (isNaN(number)) {
|
265
|
+
if (options.nanForceZero == true) {
|
266
|
+
number = 0;
|
267
|
+
forcedToZero = true;
|
268
|
+
} else
|
269
|
+
return null;
|
270
|
+
}
|
271
|
+
|
272
|
+
// special case for percentages
|
273
|
+
if (suffix == "%")
|
274
|
+
number = number * 100;
|
275
|
+
|
276
|
+
var returnString = "";
|
277
|
+
if (options.format.indexOf(".") > -1) {
|
278
|
+
var decimalPortion = dec;
|
279
|
+
var decimalFormat = options.format.substring(options.format.lastIndexOf(".") + 1);
|
280
|
+
|
281
|
+
// round or truncate number as needed
|
282
|
+
if (options.round == true)
|
283
|
+
number = new Number(number.toFixed(decimalFormat.length));
|
284
|
+
else {
|
285
|
+
var numStr = number.toString();
|
286
|
+
numStr = numStr.substring(0, numStr.lastIndexOf('.') + decimalFormat.length + 1);
|
287
|
+
number = new Number(numStr);
|
288
|
+
}
|
289
|
+
|
290
|
+
var decimalValue = number % 1;
|
291
|
+
var decimalString = new String(decimalValue.toFixed(decimalFormat.length));
|
292
|
+
decimalString = decimalString.substring(decimalString.lastIndexOf(".") + 1);
|
293
|
+
|
294
|
+
for (var i = 0; i < decimalFormat.length; i++) {
|
295
|
+
if (decimalFormat.charAt(i) == '#' && decimalString.charAt(i) != '0') {
|
296
|
+
decimalPortion += decimalString.charAt(i);
|
297
|
+
continue;
|
298
|
+
} else if (decimalFormat.charAt(i) == '#' && decimalString.charAt(i) == '0') {
|
299
|
+
var notParsed = decimalString.substring(i);
|
300
|
+
if (notParsed.match('[1-9]')) {
|
301
|
+
decimalPortion += decimalString.charAt(i);
|
302
|
+
continue;
|
303
|
+
} else
|
304
|
+
break;
|
305
|
+
} else if (decimalFormat.charAt(i) == "0")
|
306
|
+
decimalPortion += decimalString.charAt(i);
|
307
|
+
}
|
308
|
+
returnString += decimalPortion
|
309
|
+
} else
|
310
|
+
number = Math.round(number);
|
311
|
+
|
312
|
+
var ones = Math.floor(number);
|
313
|
+
if (number < 0)
|
314
|
+
ones = Math.ceil(number);
|
315
|
+
|
316
|
+
var onesFormat = "";
|
317
|
+
if (options.format.indexOf(".") == -1)
|
318
|
+
onesFormat = options.format;
|
319
|
+
else
|
320
|
+
onesFormat = options.format.substring(0, options.format.indexOf("."));
|
321
|
+
|
322
|
+
var onePortion = "";
|
323
|
+
if (!(ones == 0 && onesFormat.substr(onesFormat.length - 1) == '#') || forcedToZero) {
|
324
|
+
// find how many digits are in the group
|
325
|
+
var oneText = new String(Math.abs(ones));
|
326
|
+
var groupLength = 9999;
|
327
|
+
if (onesFormat.lastIndexOf(",") != -1)
|
328
|
+
groupLength = onesFormat.length - onesFormat.lastIndexOf(",") - 1;
|
329
|
+
var groupCount = 0;
|
330
|
+
for (var i = oneText.length - 1; i > -1; i--) {
|
331
|
+
onePortion = oneText.charAt(i) + onePortion;
|
332
|
+
groupCount++;
|
333
|
+
if (groupCount == groupLength && i != 0) {
|
334
|
+
onePortion = group + onePortion;
|
335
|
+
groupCount = 0;
|
336
|
+
}
|
337
|
+
}
|
338
|
+
|
339
|
+
// account for any pre-data 0's
|
340
|
+
if (onesFormat.length > onePortion.length) {
|
341
|
+
var padStart = onesFormat.indexOf('0');
|
342
|
+
if (padStart != -1) {
|
343
|
+
var padLen = onesFormat.length - padStart;
|
344
|
+
|
345
|
+
// pad to left with 0's
|
346
|
+
while (onePortion.length < padLen) {
|
347
|
+
onePortion = '0' + onePortion;
|
348
|
+
}
|
349
|
+
}
|
350
|
+
}
|
351
|
+
}
|
352
|
+
|
353
|
+
if (!onePortion && onesFormat.indexOf('0', onesFormat.length - 1) !== -1)
|
354
|
+
onePortion = '0';
|
355
|
+
|
356
|
+
returnString = onePortion + returnString;
|
357
|
+
|
358
|
+
// handle special case where negative is in front of the invalid characters
|
359
|
+
if (number < 0 && negativeInFront && prefix.length > 0)
|
360
|
+
prefix = neg + prefix;
|
361
|
+
else if (number < 0)
|
362
|
+
returnString = neg + returnString;
|
363
|
+
|
364
|
+
if (!options.decimalSeparatorAlwaysShown) {
|
365
|
+
if (returnString.lastIndexOf(dec) == returnString.length - 1) {
|
366
|
+
returnString = returnString.substring(0, returnString.length - 1);
|
367
|
+
}
|
368
|
+
}
|
369
|
+
returnString = prefix + returnString + suffix;
|
370
|
+
return returnString;
|
371
|
+
};
|
372
|
+
|
373
|
+
|
374
|
+
/* Parsing Methods */
|
375
|
+
|
376
|
+
|
377
|
+
/**
|
378
|
+
* Parses a number of given format from the element and returns a Number object.
|
379
|
+
* @param {Object} options
|
380
|
+
*/
|
381
|
+
jQuery.fn.parseNumber = function(options, writeBack, giveReturnValue) {
|
382
|
+
// enforce defaults
|
383
|
+
if (writeBack == null)
|
384
|
+
writeBack = true;
|
385
|
+
if (giveReturnValue == null)
|
386
|
+
giveReturnValue = true;
|
387
|
+
|
388
|
+
// get text
|
389
|
+
var text;
|
390
|
+
if (jQuery(this).is(":input"))
|
391
|
+
text = new String(jQuery(this).val());
|
392
|
+
else
|
393
|
+
text = new String(jQuery(this).text());
|
394
|
+
|
395
|
+
// parse text
|
396
|
+
var number = jQuery.parseNumber(text, options);
|
397
|
+
|
398
|
+
if (number) {
|
399
|
+
if (writeBack) {
|
400
|
+
if (jQuery(this).is(":input"))
|
401
|
+
jQuery(this).val(number.toString());
|
402
|
+
else
|
403
|
+
jQuery(this).text(number.toString());
|
404
|
+
}
|
405
|
+
if (giveReturnValue)
|
406
|
+
return number;
|
407
|
+
}
|
408
|
+
};
|
409
|
+
|
410
|
+
/**
|
411
|
+
* Parses a string of given format into a Number object.
|
412
|
+
*
|
413
|
+
* @param {Object} string
|
414
|
+
* @param {Object} options
|
415
|
+
*/
|
416
|
+
jQuery.parseNumber = function(numberString, options) {
|
417
|
+
var options = jQuery.extend({}, jQuery.fn.parseNumber.defaults, options);
|
418
|
+
var formatData = formatCodes(options.locale.toLowerCase());
|
419
|
+
|
420
|
+
var dec = formatData.dec;
|
421
|
+
var group = formatData.group;
|
422
|
+
var neg = formatData.neg;
|
423
|
+
|
424
|
+
var valid = "1234567890.-";
|
425
|
+
|
426
|
+
// now we need to convert it into a number
|
427
|
+
while (numberString.indexOf(group)>-1)
|
428
|
+
numberString = numberString.replace(group,'');
|
429
|
+
numberString = numberString.replace(dec,".").replace(neg,"-");
|
430
|
+
var validText = "";
|
431
|
+
var hasPercent = false;
|
432
|
+
if (numberString.charAt(numberString.length-1)=="%")
|
433
|
+
hasPercent = true;
|
434
|
+
for (var i=0; i<numberString.length; i++) {
|
435
|
+
if (valid.indexOf(numberString.charAt(i))>-1)
|
436
|
+
validText = validText + numberString.charAt(i);
|
437
|
+
}
|
438
|
+
var number = new Number(validText);
|
439
|
+
if (hasPercent) {
|
440
|
+
number = number / 100;
|
441
|
+
number = number.toFixed(validText.length-1);
|
442
|
+
}
|
443
|
+
|
444
|
+
return number;
|
445
|
+
};
|
446
|
+
|
447
|
+
jQuery.fn.parseNumber.defaults = {
|
448
|
+
locale: "us",
|
449
|
+
decimalSeparatorAlwaysShown: false
|
450
|
+
};
|
451
|
+
|
452
|
+
jQuery.fn.formatNumber.defaults = {
|
453
|
+
format: "#,###.00",
|
454
|
+
locale: "us",
|
455
|
+
decimalSeparatorAlwaysShown: false,
|
456
|
+
nanForceZero: true,
|
457
|
+
round: true
|
458
|
+
};
|
459
|
+
|
460
|
+
Number.prototype.toFixed = function(precision) {
|
461
|
+
return $._roundNumber(this, precision);
|
462
|
+
};
|
463
|
+
|
464
|
+
jQuery._roundNumber = function(number, decimalPlaces) {
|
465
|
+
var power = Math.pow(10, decimalPlaces || 0);
|
466
|
+
var value = String(Math.round(number * power) / power);
|
467
|
+
|
468
|
+
// ensure the decimal places are there
|
469
|
+
if (decimalPlaces > 0) {
|
470
|
+
var dp = value.indexOf(".");
|
471
|
+
if (dp == -1) {
|
472
|
+
value += '.';
|
473
|
+
dp = 0;
|
474
|
+
} else {
|
475
|
+
dp = value.length - (dp + 1);
|
476
|
+
}
|
477
|
+
|
478
|
+
while (dp < decimalPlaces) {
|
479
|
+
value += '0';
|
480
|
+
dp++;
|
481
|
+
}
|
482
|
+
}
|
483
|
+
return value;
|
484
|
+
};
|
485
|
+
|
486
|
+
})(jQuery);
|
@@ -0,0 +1,224 @@
|
|
1
|
+
/*
|
2
|
+
|
3
|
+
jQuery sIFR Plugin
|
4
|
+
* Version 2.0 Beta 3
|
5
|
+
* 2008-09-25 05:49:32
|
6
|
+
* URL: http://jquery.thewikies.com/sifr
|
7
|
+
* Description: jQuery Sifr Plugin replaces traditional text in a web page with flash text (sIFR).
|
8
|
+
* Author: Jonathan Neal
|
9
|
+
* Copyright: Copyright (c) 2008 Jonathan Neal under dual MIT/GPL license.
|
10
|
+
* JSLint: This javascript file passes JSLint verification.
|
11
|
+
*//*jslint
|
12
|
+
bitwise: true,
|
13
|
+
browser: true,
|
14
|
+
eqeqeq: true,
|
15
|
+
forin: true,
|
16
|
+
passfail: true,
|
17
|
+
regexp: true,
|
18
|
+
undef: true,
|
19
|
+
white: true
|
20
|
+
*//*global
|
21
|
+
jQuery
|
22
|
+
*/
|
23
|
+
|
24
|
+
(function ($) {
|
25
|
+
$.fn.sifr = function (prefs) {
|
26
|
+
|
27
|
+
/* == load our preferences == */
|
28
|
+
var t = true, u = undefined, s, p;
|
29
|
+
s = arguments.callee.prefs = arguments.callee.prefs || {
|
30
|
+
asHex: function (x) {
|
31
|
+
var d = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'];
|
32
|
+
return isNaN(x) ? '00' : d[(x - x % 16) / 16] + d[x % 16];
|
33
|
+
},
|
34
|
+
colors: {
|
35
|
+
aqua: [0, 255, 255],
|
36
|
+
azure: [240, 255, 255],
|
37
|
+
beige: [245, 245, 220],
|
38
|
+
black: [0, 0, 0],
|
39
|
+
blue: [0, 0, 255],
|
40
|
+
brown: [165, 42, 42],
|
41
|
+
cyan: [0, 255, 255],
|
42
|
+
darkblue: [0, 0, 139],
|
43
|
+
darkcyan: [0, 139, 139],
|
44
|
+
darkgrey: [169, 169, 169],
|
45
|
+
darkgreen: [0, 100, 0],
|
46
|
+
darkkhaki: [189, 183, 107],
|
47
|
+
darkmagenta: [139, 0, 139],
|
48
|
+
darkolivegreen: [85, 107, 47],
|
49
|
+
darkorange: [255, 140, 0],
|
50
|
+
darkorchid: [153, 50, 204],
|
51
|
+
darkred: [139, 0, 0],
|
52
|
+
darksalmon: [233, 150, 122],
|
53
|
+
darkviolet: [148, 0, 211],
|
54
|
+
fuchsia: [255, 0, 255],
|
55
|
+
gold: [255, 215, 0],
|
56
|
+
green: [0, 128, 0],
|
57
|
+
indigo: [75, 0, 130],
|
58
|
+
khaki: [240, 230, 140],
|
59
|
+
lightblue: [173, 216, 230],
|
60
|
+
lightcyan: [224, 255, 255],
|
61
|
+
lightgreen: [144, 238, 144],
|
62
|
+
lightgrey: [211, 211, 211],
|
63
|
+
lightpink: [255, 182, 193],
|
64
|
+
lightyellow: [255, 255, 224],
|
65
|
+
lime: [0, 255, 0],
|
66
|
+
magenta: [255, 0, 255],
|
67
|
+
maroon: [128, 0, 0],
|
68
|
+
navy: [0, 0, 128],
|
69
|
+
olive: [128, 128, 0],
|
70
|
+
orange: [255, 165, 0],
|
71
|
+
pink: [255, 192, 203],
|
72
|
+
purple: [128, 0, 128],
|
73
|
+
violet: [128, 0, 128],
|
74
|
+
red: [255, 0, 0],
|
75
|
+
silver: [192, 192, 192],
|
76
|
+
white: [255, 255, 255],
|
77
|
+
yellow: [255, 255, 0],
|
78
|
+
transparent: [255, 255, 255]
|
79
|
+
},
|
80
|
+
toHex: function (color) {
|
81
|
+
var rgb;
|
82
|
+
if (!color) {
|
83
|
+
return u;
|
84
|
+
}
|
85
|
+
return (rgb = color.match(/rgb\(([0-9]+),\s([0-9]+),\s([0-9]+)\)/)) ? '#' + this.asHex(rgb[1]) + this.asHex(rgb[2]) + this.asHex(rgb[3]) : (rgb = this.colors[color]) ? '#' + this.asHex(rgb[0]) + this.asHex(rgb[1]) + this.asHex(rgb[2]) : (color.length === 4) ? color.replace(/\#([0-9a-z])([0-9a-z])([0-9a-z])/, '#$1$1$2$2$3$3') : color;
|
86
|
+
}
|
87
|
+
};
|
88
|
+
|
89
|
+
/* == lock our preferences == */
|
90
|
+
p = $.extend({}, s, (prefs === false) ? {
|
91
|
+
unsifr: true
|
92
|
+
} : prefs);
|
93
|
+
|
94
|
+
/* == if necessary, save our prefs == */
|
95
|
+
if (p.save === t) {
|
96
|
+
arguments.callee.prefs = $.extend(p, { save: false });
|
97
|
+
}
|
98
|
+
|
99
|
+
/* == we're done if there's no sIFR specified == */
|
100
|
+
if (this[0] === document) {
|
101
|
+
return;
|
102
|
+
}
|
103
|
+
|
104
|
+
/* == if necessary, run a custom function before we begin == */
|
105
|
+
if (!p.unsifr && typeof p.before === 'function') {
|
106
|
+
p.before.apply(this, [p]);
|
107
|
+
}
|
108
|
+
|
109
|
+
/* == do this function on every element we've selected == */
|
110
|
+
this.each(function () {
|
111
|
+
var ele = $(this), txt, alt, fir, embedOptions;
|
112
|
+
|
113
|
+
/* == 'a' will mean the possible '.sIFR-alternate' child of 't' == */
|
114
|
+
fir = ele.children('.sIFR-alternate');
|
115
|
+
|
116
|
+
/* == if 'a' exists, then it's time to unSifr == */
|
117
|
+
if (fir) {
|
118
|
+
ele.html(fir.html());
|
119
|
+
|
120
|
+
/* == if unsifr was called, then it's time to go == */
|
121
|
+
if (p.unsifr) {
|
122
|
+
return;
|
123
|
+
}
|
124
|
+
}
|
125
|
+
|
126
|
+
/* == if necessary, run a custom function before we begin this one == */
|
127
|
+
if (typeof p.beforeEach === 'function') {
|
128
|
+
p.beforeEach.apply(this, [t, p]);
|
129
|
+
}
|
130
|
+
|
131
|
+
fir = ele.addClass('sIFR-replaced').wrapInner('<span class="sIFR-alternate" style="position: absolute; "></span>').children('.sIFR-alternate');
|
132
|
+
alt = ele.append('<span class="sIFR-jquery" style="position: absolute; ">' + $.trim(fir.text()) + '</span>').children('.sIFR-jquery');
|
133
|
+
txt = $.trim(fir.html()).replace(/(>)\s+|\s+(<)/g, '$1$2').replace(/(id|name)=[A-Za-z0-9]+/g, '');
|
134
|
+
|
135
|
+
if (p.textTransform) {
|
136
|
+
p.textTransform = p.textTransform.toLowerCase();
|
137
|
+
|
138
|
+
if (p.textTransform === 'uppercase') {
|
139
|
+
txt = txt.toUpperCase();
|
140
|
+
}
|
141
|
+
if (p.textTransform === 'lowercase') {
|
142
|
+
txt = txt.html().toLowerCase();
|
143
|
+
}
|
144
|
+
if (p.textTransform === 'capitalize') {
|
145
|
+
var cap = txt.split(/(\s|\>)/);
|
146
|
+
txt = '';
|
147
|
+
|
148
|
+
for (var i in cap) {
|
149
|
+
txt += cap[i].charAt(0).toUpperCase() + cap[i].substr(1);
|
150
|
+
}
|
151
|
+
}
|
152
|
+
}
|
153
|
+
|
154
|
+
txt = ele.attr('href') ? '<a href="' + ele.attr('href') + '">' + txt + '</a>' : txt;
|
155
|
+
|
156
|
+
/* == flash plugin embedOptions == */
|
157
|
+
embedOptions = {
|
158
|
+
flashvars: $.extend({
|
159
|
+
h: alt.height() * (p.zoom || 1),
|
160
|
+
offsetLeft: p.offsetLeft || u,
|
161
|
+
offsetTop: p.offsetTop || u,
|
162
|
+
textAlign: p.textAlign || ele.css('textAlign').match(/left|center|right/) || 'center',
|
163
|
+
textColor: p.toHex(p.color || ele.css('color')) || u,
|
164
|
+
txt: p.content || txt,
|
165
|
+
underline: (p.underline === t || ele.css('textDecoration') === 'underline') ? t : u,
|
166
|
+
w: alt.width() * (p.zoom || 1)
|
167
|
+
}, p.flashvars),
|
168
|
+
height: p.height || alt.height(),
|
169
|
+
src: (p.path || '').replace(/([^\/])$/, '$1/') + (p.font || ele.css('fontFamily').replace(/^\s+|\s+$|,[\S|\s]+|'|"|(,)\s+/g, '$1')).replace(/([^\.][^s][^w][^f])$/, '$1.swf'),
|
170
|
+
style: 'margin: 1px 0 0; position: absolute; vertical-align: text-top;',
|
171
|
+
width: p.width || alt.width(),
|
172
|
+
wmode: 'transparent'
|
173
|
+
};
|
174
|
+
|
175
|
+
/* == make some more flash plugin embedoptions (color) == */
|
176
|
+
embedOptions.flashvars.linkColor = p.toHex(p.link || ele.find('a').css('color')) || embedOptions.flashvars.textColor;
|
177
|
+
embedOptions.flashvars.hoverColor = p.toHex(p.hover) || embedOptions.flashvars.linkColor;
|
178
|
+
|
179
|
+
/* == make some more flash plugin embedoptions (zoom) == */
|
180
|
+
if (p.zoom) {
|
181
|
+
embedOptions.flashvars.offsetTop = ((p.offsetTop || 0) + ((alt.height() - (alt.height() * p.zoom)) / 2)) * (p.zoomTop || 1);
|
182
|
+
embedOptions.flashvars.offsetLeft = ((p.offsetLeft || 0) + ((alt.width() - (alt.width() * p.zoom)) / 2)) * (p.zoomLeft || 1);
|
183
|
+
}
|
184
|
+
|
185
|
+
/* == execute flash plugin == */
|
186
|
+
$().flash($.extend(embedOptions, p.embedOptions), $.extend({
|
187
|
+
expressInstall: p.expressInstall || false,
|
188
|
+
version: p.version || 7,
|
189
|
+
update: p.update || false
|
190
|
+
}, p.pluginOptions), function (options) {
|
191
|
+
fir.attr('style', 'visibility: hidden;');
|
192
|
+
alt.remove();
|
193
|
+
ele.prepend($.fn.flash.transform(options));
|
194
|
+
});
|
195
|
+
|
196
|
+
/* == if necessary, run a custom function before we begin this one == */
|
197
|
+
if (typeof p.afterEach === 'function') {
|
198
|
+
p.afterEach.apply(this, [t, p]);
|
199
|
+
}
|
200
|
+
});
|
201
|
+
|
202
|
+
/* == if necessary, run a custom function after we're done == */
|
203
|
+
if (!p.unsifr && typeof p.after === 'function') {
|
204
|
+
p.after.apply(this, [p]);
|
205
|
+
}
|
206
|
+
};
|
207
|
+
|
208
|
+
/* == jQuery Sifr Plugin (as unSifr) == */
|
209
|
+
$.fn.unsifr = function () {
|
210
|
+
return this.each(function () {
|
211
|
+
$(this).sifr(false);
|
212
|
+
});
|
213
|
+
};
|
214
|
+
|
215
|
+
/* == jQuery Sifr Plugin (without selectors) == */
|
216
|
+
$.sifr = function (prefs) {
|
217
|
+
$(document).sifr($.extend({
|
218
|
+
save: true
|
219
|
+
}, prefs));
|
220
|
+
};
|
221
|
+
|
222
|
+
/* == preload this == */
|
223
|
+
$.sifr();
|
224
|
+
})(jQuery);
|