kiteditor 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +25 -0
- data/app/controllers/mercury/images_controller.rb +5 -0
- data/app/controllers/mercury_controller.rb +34 -0
- data/app/models/mercury/image.rb +17 -0
- data/app/views/layouts/mercury.html.erb +33 -0
- data/app/views/layouts/popup.html.haml +9 -0
- data/app/views/mercury/images/_list.html.haml +22 -0
- data/app/views/mercury/images/index.html.haml +4 -0
- data/app/views/mercury/images/index.js.erb +2 -0
- data/app/views/mercury/lightviews/about.html +11 -0
- data/app/views/mercury/modals/character.html +255 -0
- data/app/views/mercury/modals/htmleditor.html +13 -0
- data/app/views/mercury/modals/link.html +94 -0
- data/app/views/mercury/modals/media.html +1 -0
- data/app/views/mercury/modals/table.html +84 -0
- data/app/views/mercury/palettes/backcolor.html +73 -0
- data/app/views/mercury/palettes/forecolor.html +73 -0
- data/app/views/mercury/panels/history.html +3 -0
- data/app/views/mercury/panels/notes.html +3 -0
- data/app/views/mercury/panels/snippets.html +12 -0
- data/app/views/mercury/selects/formatblock.html +11 -0
- data/app/views/mercury/selects/style.html +5 -0
- data/app/views/mercury/snippets/example/options.html.erb +34 -0
- data/app/views/mercury/snippets/example/preview.html.erb +1 -0
- data/config/engine.rb +44 -0
- data/db/migrate/20110526035601_create_mercury_images.rb +11 -0
- data/features/loading/loading.feature +22 -0
- data/features/loading/navigating.feature +77 -0
- data/features/loading/user_interface.feature +67 -0
- data/features/regions/editable/advanced_editing.feature +0 -0
- data/features/regions/editable/basic_editing.feature +195 -0
- data/features/regions/editable/inserting_links.feature +98 -0
- data/features/regions/editable/inserting_media.feature +110 -0
- data/features/regions/editable/inserting_snippets.feature +102 -0
- data/features/regions/editable/inserting_special_characters.feature +24 -0
- data/features/regions/editable/inserting_tables.feature +109 -0
- data/features/regions/editable/pasting.feature +0 -0
- data/features/regions/editable/uploading_images.feature +0 -0
- data/features/regions/markupable/advanced_editing.feature +0 -0
- data/features/regions/markupable/basic_editing.feature +0 -0
- data/features/regions/markupable/inserting_links.feature +0 -0
- data/features/regions/markupable/inserting_media.feature +0 -0
- data/features/regions/markupable/inserting_snippets.feature +0 -0
- data/features/regions/markupable/inserting_special_characters.feature +0 -0
- data/features/regions/markupable/inserting_tables.feature +0 -0
- data/features/regions/markupable/uploading_images.feature +0 -0
- data/features/regions/snippetable/advanced_editing.feature +0 -0
- data/features/regions/snippetable/basic_editing.feature +0 -0
- data/features/regions/snippetable/inserting_snippets.feature +0 -0
- data/features/saving/saving.feature +33 -0
- data/features/step_definitions/debug_steps.rb +14 -0
- data/features/step_definitions/mercury_steps.rb +438 -0
- data/features/step_definitions/web_steps.rb +211 -0
- data/features/support/env.rb +46 -0
- data/features/support/mercury_contents.rb +25 -0
- data/features/support/mercury_selectors.rb +148 -0
- data/features/support/paths.rb +38 -0
- data/features/support/selectors.rb +44 -0
- data/lib/generators/mercury/install/install_generator.rb +49 -0
- data/lib/generators/mercury/install/templates/mongoid_paperclip_image.rb +17 -0
- data/lib/mercury/authentication.rb +8 -0
- data/lib/mercury-rails.rb +3 -0
- data/spec/javascripts/mercury/dialog_spec.js.coffee +281 -0
- data/spec/javascripts/mercury/dialogs/backcolor_spec.js.coffee +37 -0
- data/spec/javascripts/mercury/dialogs/forecolor_spec.js.coffee +37 -0
- data/spec/javascripts/mercury/dialogs/formatblock_spec.js.coffee +25 -0
- data/spec/javascripts/mercury/dialogs/snippetpanel_spec.js.coffee +30 -0
- data/spec/javascripts/mercury/dialogs/style_spec.js.coffee +25 -0
- data/spec/javascripts/mercury/history_buffer_spec.js.coffee +76 -0
- data/spec/javascripts/mercury/lightview_spec.js.coffee +497 -0
- data/spec/javascripts/mercury/mercury_spec.js.coffee +132 -0
- data/spec/javascripts/mercury/modal_spec.js.coffee +504 -0
- data/spec/javascripts/mercury/modals/htmleditor_spec.js.coffee +30 -0
- data/spec/javascripts/mercury/modals/insertcharacter_spec.js.coffee +29 -0
- data/spec/javascripts/mercury/modals/insertlink_spec.js.coffee +220 -0
- data/spec/javascripts/mercury/modals/insertmedia_spec.js.coffee +167 -0
- data/spec/javascripts/mercury/modals/insertsnippet_spec.js.coffee +52 -0
- data/spec/javascripts/mercury/modals/inserttable_spec.js.coffee +160 -0
- data/spec/javascripts/mercury/native_extensions_spec.js.coffee +60 -0
- data/spec/javascripts/mercury/page_editor_spec.js.coffee +750 -0
- data/spec/javascripts/mercury/palette_spec.js.coffee +49 -0
- data/spec/javascripts/mercury/panel_spec.js.coffee +185 -0
- data/spec/javascripts/mercury/region_spec.js.coffee +298 -0
- data/spec/javascripts/mercury/regions/editable_spec.js.coffee +561 -0
- data/spec/javascripts/mercury/regions/markupable_spec.js.coffee +367 -0
- data/spec/javascripts/mercury/regions/snippetable_spec.js.coffee +370 -0
- data/spec/javascripts/mercury/select_spec.js.coffee +49 -0
- data/spec/javascripts/mercury/snippet_spec.js.coffee +245 -0
- data/spec/javascripts/mercury/snippet_toolbar_spec.js.coffee +184 -0
- data/spec/javascripts/mercury/statusbar_spec.js.coffee +150 -0
- data/spec/javascripts/mercury/table_editor_spec.js.coffee +194 -0
- data/spec/javascripts/mercury/toolbar.button_group_spec.js.coffee +90 -0
- data/spec/javascripts/mercury/toolbar.button_spec.js.coffee +360 -0
- data/spec/javascripts/mercury/toolbar.expander_spec.js.coffee +118 -0
- data/spec/javascripts/mercury/toolbar_spec.js.coffee +222 -0
- data/spec/javascripts/mercury/tooltip_spec.js.coffee +186 -0
- data/spec/javascripts/mercury/uploader_spec.js.coffee +514 -0
- data/spec/javascripts/spec_helper.js +513 -0
- data/spec/javascripts/templates/mercury/dialog.html +2 -0
- data/spec/javascripts/templates/mercury/dialogs/backcolor.html +5 -0
- data/spec/javascripts/templates/mercury/dialogs/forecolor.html +5 -0
- data/spec/javascripts/templates/mercury/dialogs/formatblock.html +3 -0
- data/spec/javascripts/templates/mercury/dialogs/snippetpanel.html +16 -0
- data/spec/javascripts/templates/mercury/dialogs/style.html +3 -0
- data/spec/javascripts/templates/mercury/lightview.html +13 -0
- data/spec/javascripts/templates/mercury/modal.html +13 -0
- data/spec/javascripts/templates/mercury/modals/htmleditor.html +5 -0
- data/spec/javascripts/templates/mercury/modals/insertcharacter.html +5 -0
- data/spec/javascripts/templates/mercury/modals/insertlink.html +30 -0
- data/spec/javascripts/templates/mercury/modals/insertmedia.html +35 -0
- data/spec/javascripts/templates/mercury/modals/insertsnippet.html +6 -0
- data/spec/javascripts/templates/mercury/modals/inserttable.html +27 -0
- data/spec/javascripts/templates/mercury/page_editor.html +35 -0
- data/spec/javascripts/templates/mercury/palette.html +16 -0
- data/spec/javascripts/templates/mercury/panel.html +16 -0
- data/spec/javascripts/templates/mercury/region.html +2 -0
- data/spec/javascripts/templates/mercury/regions/editable.html +3 -0
- data/spec/javascripts/templates/mercury/regions/snippetable.html +4 -0
- data/spec/javascripts/templates/mercury/select.html +16 -0
- data/spec/javascripts/templates/mercury/snippet.html +1 -0
- data/spec/javascripts/templates/mercury/snippet_toolbar.html +16 -0
- data/spec/javascripts/templates/mercury/statusbar.html +8 -0
- data/spec/javascripts/templates/mercury/table_editor.html +65 -0
- data/spec/javascripts/templates/mercury/toolbar.button.html +64 -0
- data/spec/javascripts/templates/mercury/toolbar.button_group.html +9 -0
- data/spec/javascripts/templates/mercury/toolbar.expander.html +18 -0
- data/spec/javascripts/templates/mercury/toolbar.html +11 -0
- data/spec/javascripts/templates/mercury/tooltip.html +12 -0
- data/spec/javascripts/templates/mercury/uploader.html +11 -0
- data/vendor/assets/images/mercury/button.png +0 -0
- data/vendor/assets/images/mercury/close.png +0 -0
- data/vendor/assets/images/mercury/default-snippet.png +0 -0
- data/vendor/assets/images/mercury/loading-dark.gif +0 -0
- data/vendor/assets/images/mercury/loading-light.gif +0 -0
- data/vendor/assets/images/mercury/missing-image.png +0 -0
- data/vendor/assets/images/mercury/search-icon.png +0 -0
- data/vendor/assets/images/mercury/temp-logo.png +0 -0
- data/vendor/assets/images/mercury/toolbar/editable/buttons.png +0 -0
- data/vendor/assets/images/mercury/toolbar/primary/_expander.png +0 -0
- data/vendor/assets/images/mercury/toolbar/primary/_pressed.png +0 -0
- data/vendor/assets/images/mercury/toolbar/primary/historypanel.png +0 -0
- data/vendor/assets/images/mercury/toolbar/primary/insertcharacter.png +0 -0
- data/vendor/assets/images/mercury/toolbar/primary/insertlink.png +0 -0
- data/vendor/assets/images/mercury/toolbar/primary/insertmedia.png +0 -0
- data/vendor/assets/images/mercury/toolbar/primary/inserttable.png +0 -0
- data/vendor/assets/images/mercury/toolbar/primary/inspectorpanel.png +0 -0
- data/vendor/assets/images/mercury/toolbar/primary/notespanel.png +0 -0
- data/vendor/assets/images/mercury/toolbar/primary/preview.png +0 -0
- data/vendor/assets/images/mercury/toolbar/primary/redo.png +0 -0
- data/vendor/assets/images/mercury/toolbar/primary/save.png +0 -0
- data/vendor/assets/images/mercury/toolbar/primary/snippetpanel.png +0 -0
- data/vendor/assets/images/mercury/toolbar/primary/undo.png +0 -0
- data/vendor/assets/images/mercury/toolbar/snippetable/buttons.png +0 -0
- data/vendor/assets/javascripts/mercury/dependencies/jquery-1.7.js +9300 -0
- data/vendor/assets/javascripts/mercury/dependencies/jquery-ui-1.8.13.custom.js +1328 -0
- data/vendor/assets/javascripts/mercury/dependencies/jquery-ui-1.8.18.custom.min.js +356 -0
- data/vendor/assets/javascripts/mercury/dependencies/jquery-ui.1.8.13.custom.min.js +356 -0
- data/vendor/assets/javascripts/mercury/dependencies/jquery.additions.js +206 -0
- data/vendor/assets/javascripts/mercury/dependencies/jquery.htmlClean.js +527 -0
- data/vendor/assets/javascripts/mercury/dependencies/liquidmetal.js +88 -0
- data/vendor/assets/javascripts/mercury/dependencies/showdown.js +1340 -0
- data/vendor/assets/javascripts/mercury/dialog.js.coffee +159 -0
- data/vendor/assets/javascripts/mercury/dialogs/backcolor.js.coffee +6 -0
- data/vendor/assets/javascripts/mercury/dialogs/forecolor.js.coffee +6 -0
- data/vendor/assets/javascripts/mercury/dialogs/formatblock.js.coffee +4 -0
- data/vendor/assets/javascripts/mercury/dialogs/snippetpanel.js.coffee +10 -0
- data/vendor/assets/javascripts/mercury/dialogs/style.js.coffee +4 -0
- data/vendor/assets/javascripts/mercury/finalize.js.coffee +3 -0
- data/vendor/assets/javascripts/mercury/history_buffer.js.coffee +30 -0
- data/vendor/assets/javascripts/mercury/lightview.js.coffee +205 -0
- data/vendor/assets/javascripts/mercury/locales/da.locale.js.coffee +0 -0
- data/vendor/assets/javascripts/mercury/locales/de.locale.js.coffee +206 -0
- data/vendor/assets/javascripts/mercury/locales/es.locale.js.coffee +211 -0
- data/vendor/assets/javascripts/mercury/locales/example.local.js.coffee +211 -0
- data/vendor/assets/javascripts/mercury/locales/fr.locale.js.coffee +211 -0
- data/vendor/assets/javascripts/mercury/locales/it.locale.js.coffee +208 -0
- data/vendor/assets/javascripts/mercury/locales/ko.local.js.coffee +206 -0
- data/vendor/assets/javascripts/mercury/locales/nl.locale.js.coffee +206 -0
- data/vendor/assets/javascripts/mercury/locales/pt.locale.js.coffee +211 -0
- data/vendor/assets/javascripts/mercury/locales/sv.local.js.coffee +209 -0
- data/vendor/assets/javascripts/mercury/locales/swedish_chef.locale.js.coffee +213 -0
- data/vendor/assets/javascripts/mercury/mercury.js.coffee +109 -0
- data/vendor/assets/javascripts/mercury/modal.js.coffee +204 -0
- data/vendor/assets/javascripts/mercury/modals/htmleditor.js.coffee +11 -0
- data/vendor/assets/javascripts/mercury/modals/insertcharacter.js.coffee +4 -0
- data/vendor/assets/javascripts/mercury/modals/insertlink.js.coffee +95 -0
- data/vendor/assets/javascripts/mercury/modals/insertmedia.js.coffee +107 -0
- data/vendor/assets/javascripts/mercury/modals/insertsnippet.js.coffee +12 -0
- data/vendor/assets/javascripts/mercury/modals/inserttable.js.coffee +54 -0
- data/vendor/assets/javascripts/mercury/native_extensions.js.coffee +55 -0
- data/vendor/assets/javascripts/mercury/page_editor.js.coffee +241 -0
- data/vendor/assets/javascripts/mercury/palette.js.coffee +29 -0
- data/vendor/assets/javascripts/mercury/panel.js.coffee +115 -0
- data/vendor/assets/javascripts/mercury/plugins/save_as_xml/mercury/page_editor.js.coffee +28 -0
- data/vendor/assets/javascripts/mercury/plugins/save_as_xml/plugin.js +9 -0
- data/vendor/assets/javascripts/mercury/region.js.coffee +107 -0
- data/vendor/assets/javascripts/mercury/regions/editable.js.coffee +600 -0
- data/vendor/assets/javascripts/mercury/regions/markupable.js.coffee +398 -0
- data/vendor/assets/javascripts/mercury/regions/simple.js.coffee +339 -0
- data/vendor/assets/javascripts/mercury/regions/snippetable.js.coffee +124 -0
- data/vendor/assets/javascripts/mercury/select.js.coffee +44 -0
- data/vendor/assets/javascripts/mercury/snippet.js.coffee +104 -0
- data/vendor/assets/javascripts/mercury/snippet_toolbar.js.coffee +72 -0
- data/vendor/assets/javascripts/mercury/statusbar.js.coffee +51 -0
- data/vendor/assets/javascripts/mercury/support/history.js +1 -0
- data/vendor/assets/javascripts/mercury/table_editor.js.coffee +265 -0
- data/vendor/assets/javascripts/mercury/toolbar.button.js.coffee +173 -0
- data/vendor/assets/javascripts/mercury/toolbar.button_group.js.coffee +42 -0
- data/vendor/assets/javascripts/mercury/toolbar.expander.js.coffee +56 -0
- data/vendor/assets/javascripts/mercury/toolbar.js.coffee +86 -0
- data/vendor/assets/javascripts/mercury/tooltip.js.coffee +74 -0
- data/vendor/assets/javascripts/mercury/uploader.js.coffee +227 -0
- data/vendor/assets/javascripts/mercury.js +479 -0
- data/vendor/assets/javascripts/mercury_loader.js +193 -0
- data/vendor/assets/javascripts/mercury_overrides.js +6 -0
- data/vendor/assets/javascripts/popup.js +8 -0
- data/vendor/assets/stylesheets/mercury/all_images.css.erb +89 -0
- data/vendor/assets/stylesheets/mercury/dialog.css +208 -0
- data/vendor/assets/stylesheets/mercury/lightview.css +151 -0
- data/vendor/assets/stylesheets/mercury/mercury.css +151 -0
- data/vendor/assets/stylesheets/mercury/modal.css +183 -0
- data/vendor/assets/stylesheets/mercury/statusbar.css +32 -0
- data/vendor/assets/stylesheets/mercury/toolbar.css +304 -0
- data/vendor/assets/stylesheets/mercury/tooltip.css +26 -0
- data/vendor/assets/stylesheets/mercury/uploader.css +111 -0
- data/vendor/assets/stylesheets/mercury.css +28 -0
- data/vendor/assets/stylesheets/mercury_overrides.css +17 -0
- data/vendor/assets/stylesheets/popup.css.erb +37 -0
- metadata +634 -0
@@ -0,0 +1,206 @@
|
|
1
|
+
/*
|
2
|
+
* jQuery serializeObject Plugin
|
3
|
+
*
|
4
|
+
*/
|
5
|
+
(function($) {
|
6
|
+
$.fn.serializeObject = function() {
|
7
|
+
var o = {};
|
8
|
+
var a = this.serializeArray();
|
9
|
+
jQuery.each(a, function() {
|
10
|
+
if (o[this.name] !== undefined) {
|
11
|
+
if (!o[this.name].push) o[this.name] = [o[this.name]];
|
12
|
+
o[this.name].push(this.value || '');
|
13
|
+
} else {
|
14
|
+
o[this.name] = this.value || '';
|
15
|
+
}
|
16
|
+
});
|
17
|
+
return o;
|
18
|
+
};
|
19
|
+
})(jQuery);
|
20
|
+
|
21
|
+
/*
|
22
|
+
* jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
|
23
|
+
*
|
24
|
+
* Uses the built in easing capabilities added In jQuery 1.1 to offer multiple easing options
|
25
|
+
*
|
26
|
+
* TERMS OF USE - jQuery Easing
|
27
|
+
*
|
28
|
+
* Open source under the BSD License.
|
29
|
+
*
|
30
|
+
* Copyright © 2008 George McGinley Smith
|
31
|
+
* All rights reserved.
|
32
|
+
*
|
33
|
+
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
34
|
+
* following conditions are met:
|
35
|
+
*
|
36
|
+
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following
|
37
|
+
* disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
38
|
+
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
39
|
+
*
|
40
|
+
* Neither the name of the author nor the names of contributors may be used to endorse or promote products derived from
|
41
|
+
* this software without specific prior written permission.
|
42
|
+
*
|
43
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
44
|
+
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
45
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
46
|
+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
47
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
48
|
+
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
49
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
50
|
+
*/
|
51
|
+
jQuery.extend(jQuery.easing, {
|
52
|
+
easeInSine: function (x, t, b, c, d) {
|
53
|
+
return -c * Math.cos(t / d * (Math.PI / 2)) + c + b
|
54
|
+
},
|
55
|
+
easeOutSine: function (x, t, b, c, d) {
|
56
|
+
return c * Math.sin(t / d * (Math.PI / 2)) + b
|
57
|
+
},
|
58
|
+
easeInOutSine: function (x, t, b, c, d) {
|
59
|
+
return -c / 2 * (Math.cos(Math.PI * t / d) - 1) + b
|
60
|
+
}
|
61
|
+
});
|
62
|
+
|
63
|
+
/*
|
64
|
+
* jQuery JSON Plugin version: 2.1 (2009-08-14)
|
65
|
+
*
|
66
|
+
* This document is licensed as free software under the terms of the MIT License:
|
67
|
+
* http://www.opensource.org/licenses/mit-license.php
|
68
|
+
*
|
69
|
+
* Brantley Harris wrote this plugin. It is based somewhat on the JSON.org website's http://www.json.org/json2.js,
|
70
|
+
* which proclaims: "NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.", a sentiment that I uphold.
|
71
|
+
*
|
72
|
+
* It is also influenced heavily by MochiKit's serializeJSON, which is copyrighted 2005 by Bob Ippolito.
|
73
|
+
*/
|
74
|
+
(function($) {
|
75
|
+
$.toJSON = function(o) {
|
76
|
+
if (typeof(JSON) == 'object' && JSON.stringify) return JSON.stringify(o);
|
77
|
+
|
78
|
+
var type = typeof(o);
|
79
|
+
|
80
|
+
if (o === null) return "null";
|
81
|
+
if (type == "undefined") return undefined;
|
82
|
+
if (type == "number" || type == "boolean") return o + "";
|
83
|
+
if (type == "string") return $.quoteString(o);
|
84
|
+
|
85
|
+
if (type == 'object') {
|
86
|
+
if (typeof(o.toJSON) == "function") return $.toJSON(o.toJSON());
|
87
|
+
|
88
|
+
if (o.constructor === Date) {
|
89
|
+
var year = o.getUTCFullYear();
|
90
|
+
|
91
|
+
var month = o.getUTCMonth() + 1;
|
92
|
+
if (month < 10) month = '0' + month;
|
93
|
+
|
94
|
+
var day = o.getUTCDate();
|
95
|
+
if (day < 10) day = '0' + day;
|
96
|
+
|
97
|
+
var hours = o.getUTCHours();
|
98
|
+
if (hours < 10) hours = '0' + hours;
|
99
|
+
|
100
|
+
var minutes = o.getUTCMinutes();
|
101
|
+
if (minutes < 10) minutes = '0' + minutes;
|
102
|
+
|
103
|
+
var seconds = o.getUTCSeconds();
|
104
|
+
if (seconds < 10) seconds = '0' + seconds;
|
105
|
+
|
106
|
+
var milli = o.getUTCMilliseconds();
|
107
|
+
if (milli < 100) milli = '0' + milli;
|
108
|
+
if (milli < 10) milli = '0' + milli;
|
109
|
+
|
110
|
+
return '"' + year + '-' + month + '-' + day + 'T' + hours + ':' + minutes + ':' + seconds + '.' + milli + 'Z"';
|
111
|
+
}
|
112
|
+
|
113
|
+
if (o.constructor === Array) {
|
114
|
+
var ret = [];
|
115
|
+
for (var i = 0; i < o.length; i++) ret.push($.toJSON(o[i]) || "null");
|
116
|
+
return "[" + ret.join(",") + "]";
|
117
|
+
}
|
118
|
+
|
119
|
+
var pairs = [];
|
120
|
+
for (var k in o) {
|
121
|
+
var name;
|
122
|
+
type = typeof(k);
|
123
|
+
|
124
|
+
if (type == "number") name = '"' + k + '"';
|
125
|
+
else if (type == "string") name = $.quoteString(k);
|
126
|
+
else continue; //skip non-string or number keys
|
127
|
+
|
128
|
+
if (typeof o[k] == "function") continue; //skip pairs where the value is a function.
|
129
|
+
var val = $.toJSON(o[k]);
|
130
|
+
pairs.push(name + ":" + val);
|
131
|
+
}
|
132
|
+
|
133
|
+
return "{" + pairs.join(", ") + "}";
|
134
|
+
}
|
135
|
+
};
|
136
|
+
|
137
|
+
$.quoteString = function(string) {
|
138
|
+
if (string.match(_escapeable)) {
|
139
|
+
return '"' + string.replace(_escapeable, function (a) {
|
140
|
+
var c = _meta[a];
|
141
|
+
if (typeof c === 'string') return c;
|
142
|
+
c = a.charCodeAt();
|
143
|
+
return '\\u00' + Math.floor(c / 16).toString(16) + (c % 16).toString(16);
|
144
|
+
}) + '"';
|
145
|
+
}
|
146
|
+
return '"' + string + '"';
|
147
|
+
};
|
148
|
+
|
149
|
+
var _escapeable = /["\\\x00-\x1f\x7f-\x9f]/g;
|
150
|
+
var _meta = {'\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '"' : '\\"', '\\': '\\\\'};
|
151
|
+
})(jQuery);
|
152
|
+
|
153
|
+
/*
|
154
|
+
* jQuery Localizer Plugin
|
155
|
+
*
|
156
|
+
* Copyright (c) 2011 Sagi Mann (with a basic reworking by Jeremy Jackson)
|
157
|
+
* All rights reserved.
|
158
|
+
*
|
159
|
+
* Redistribution and use in source and binary forms are permitted provided that the above copyright notice and this
|
160
|
+
* paragraph are duplicated in all such forms and that any documentation, advertising materials, and other materials
|
161
|
+
* related to such distribution and use acknowledge that the software was developed by the <organization>. The name of
|
162
|
+
* the University may not be used to endorse or promote products derived from this software without specific prior
|
163
|
+
* written permission.
|
164
|
+
*
|
165
|
+
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE
|
166
|
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
167
|
+
*/
|
168
|
+
(function($) {
|
169
|
+
$.fn.localize = function(locale) {
|
170
|
+
this.find('*').contents().each(function() {
|
171
|
+
var translated = false;
|
172
|
+
var source = '';
|
173
|
+
if (typeof(this.data) == 'string') {
|
174
|
+
source = $.trim(this.data);
|
175
|
+
if (source && (translated = (locale.sub[source] || locale.top[source]))) {
|
176
|
+
this.data = translated;
|
177
|
+
}
|
178
|
+
}
|
179
|
+
|
180
|
+
if (this.nodeName == 'IMG' && this.attributes['src']) {
|
181
|
+
source = this.attributes['src'].nodeValue;
|
182
|
+
if (source && (translated = (locale.sub[source] || locale.top[source]))) {
|
183
|
+
$(this).attr('src', translated);
|
184
|
+
}
|
185
|
+
}
|
186
|
+
|
187
|
+
if (this.nodeName == "A" && this.attributes['href']) {
|
188
|
+
source = $.trim(this.attributes['href'].nodeValue);
|
189
|
+
if (source && (translated = (locale.sub[source] || locale.top[source]))) {
|
190
|
+
$(this).attr('href', translated);
|
191
|
+
}
|
192
|
+
}
|
193
|
+
|
194
|
+
if (this.nodeName == "INPUT" && this.attributes['type']) {
|
195
|
+
if (this.attributes['value'] && ['submit', 'reset', 'button'].indexOf(this.attributes['type'].nodeValue.toLowerCase()) > -1) {
|
196
|
+
source = $.trim(this.attributes['value'].nodeValue);
|
197
|
+
if (source && (translated = (locale.sub[source] || locale.top[source]))) {
|
198
|
+
$(this).attr('value', translated);
|
199
|
+
}
|
200
|
+
}
|
201
|
+
}
|
202
|
+
|
203
|
+
return this;
|
204
|
+
});
|
205
|
+
};
|
206
|
+
})(jQuery);
|