muck-engine 3.2.10 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/app/views/forms/_color_picker_field.erb +2 -0
- data/app/views/layouts/admin.html.erb +1 -0
- data/app/views/layouts/admin/_footer.html.erb +1 -5
- data/app/views/layouts/admin/_head.html.erb +9 -17
- data/app/views/layouts/global/_head.html.erb +4 -21
- data/app/views/scripts/_country_scripts.html.erb +2 -2
- data/app/views/scripts/_parse_uri.html.erb +4 -2
- data/app/views/shared/_growl.erb +3 -1
- data/app/views/shared/_growl_box.erb +2 -0
- data/lib/muck-engine/config.rb +0 -9
- data/muck-engine.gemspec +3 -4
- data/public/javascripts/muck.js +149 -5
- data/public/javascripts/muck_admin.js +0 -13
- data/public/javascripts/{muck-countries.js → muck_countries.js} +0 -0
- metadata +6 -7
- data/public/javascripts/muck-src.js +0 -149
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.3.0
|
@@ -5,6 +5,7 @@
|
|
5
5
|
<div id="colorSelector<%=html_id%>" class="color-selector">
|
6
6
|
<div id="colorSelectorDisplay<%=html_id%>" style="background-color:#<%=color%>;"></div>
|
7
7
|
</div>
|
8
|
+
<% content_for :javascript do -%>
|
8
9
|
<script type="text/javascript" language="JavaScript">
|
9
10
|
jQuery(document).ready(function() {
|
10
11
|
jQuery('#colorSelector<%=html_id%>').ColorPicker({
|
@@ -24,4 +25,5 @@
|
|
24
25
|
});
|
25
26
|
});
|
26
27
|
</script>
|
28
|
+
<% end -%>
|
27
29
|
</div>
|
@@ -1,20 +1,12 @@
|
|
1
1
|
<title><%= @page_title || MuckEngine.configuration.application_name %></title>
|
2
2
|
<meta http-equiv="content-type" content="text/xhtml; charset=utf-8" />
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
<%=
|
9
|
-
<%=
|
10
|
-
<%= javascript_include_tag %w{
|
11
|
-
jquery/jquery.form.js
|
12
|
-
jquery/jquery.jgrowl.js
|
13
|
-
jquery/jquery.tips.js
|
14
|
-
jquery/jquery.fancybox.js
|
15
|
-
rails.js
|
16
|
-
muck_admin.js
|
17
|
-
muck.js
|
18
|
-
application.js }, :cache => 'admin_js_cached' %>
|
3
|
+
<meta http-equiv="imagetoolbar" content="no" />
|
4
|
+
<meta name="distribution" content="all" />
|
5
|
+
<meta name="robots" content="all" />
|
6
|
+
<meta name="resource-type" content="document" />
|
7
|
+
<meta name="MSSmartTagsPreventParsing" content="true" />
|
8
|
+
<%= include_stylesheets :admin -%>
|
9
|
+
<%= include_javascripts :admin -%>
|
19
10
|
<%= javascript_tag %[const AUTH_TOKEN = #{form_authenticity_token.inspect};] if protect_against_forgery? %>
|
20
|
-
<%= yield :head -%>
|
11
|
+
<%= yield :head -%>
|
12
|
+
<%= csrf_meta_tag %>
|
@@ -5,25 +5,8 @@
|
|
5
5
|
<meta name="robots" content="all" />
|
6
6
|
<meta name="resource-type" content="document" />
|
7
7
|
<meta name="MSSmartTagsPreventParsing" content="true" />
|
8
|
-
<%=
|
9
|
-
|
10
|
-
<% if MuckEngine.configuration.local_jquery -%>
|
11
|
-
<link rel="stylesheet" href="/stylesheets/jquery/smoothness/jquery-ui-1.8.4.custom.css" type="text/css" />
|
12
|
-
<script src="/javascripts/jquery/jquery.js" type="text/javascript"></script>
|
13
|
-
<script src="/javascripts/jquery/jquery-ui-1.8.4.custom.min.js" type="text/javascript"></script>
|
14
|
-
<% else -%>
|
15
|
-
<%= google_load_jquery_ui_css(http_protocol, 'smoothness', '1.8.4') %>
|
16
|
-
<%= google_load_jquery(http_protocol, '1.4.2') %>
|
17
|
-
<%= google_load_jquery_ui(http_protocol, '1.8.4') %>
|
18
|
-
<% end -%>
|
19
|
-
<%= stylesheet_link_tag %W{ reset styles blueprint/screen.css default }, :cache => true %>
|
20
|
-
<%= javascript_include_tag %w{
|
21
|
-
jquery/jquery.form.js
|
22
|
-
jquery/jquery.jgrowl.js
|
23
|
-
jquery/jquery.tips.js
|
24
|
-
jquery/jquery.easing.js
|
25
|
-
jquery/jquery.fancybox.js
|
26
|
-
muck.js
|
27
|
-
application.js }, :cache => 'all_js_cached' %>
|
8
|
+
<%= include_stylesheets :common %>
|
9
|
+
<%= include_javascripts :common, :site %>
|
28
10
|
<%= javascript_tag %[const AUTH_TOKEN = #{form_authenticity_token.inspect};] if protect_against_forgery? %>
|
29
|
-
<%= yield :head -%>
|
11
|
+
<%= yield :head -%>
|
12
|
+
<%= csrf_meta_tag %>
|
@@ -1,3 +1,3 @@
|
|
1
|
-
<% content_for :
|
2
|
-
<%= javascript_include_tag '
|
1
|
+
<% content_for :javascript do -%>
|
2
|
+
<%= javascript_include_tag 'muck_countries' %>
|
3
3
|
<% end -%>
|
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
<% content_for :javascript do -%>
|
2
|
+
<script type="text/javascript" language="JavaScript">
|
2
3
|
// parseUri 1.2.2
|
3
4
|
// (c) Steven Levithan <stevenlevithan.com>
|
4
5
|
// MIT License
|
@@ -27,4 +28,5 @@ parseUri.options = {
|
|
27
28
|
loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/
|
28
29
|
}
|
29
30
|
};
|
30
|
-
</script>
|
31
|
+
</script>
|
32
|
+
<% end -%>
|
data/app/views/shared/_growl.erb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
<% if MuckEngine.configuration.growl_enabled -%>
|
2
|
-
|
2
|
+
<% content_for :javascript do -%>
|
3
|
+
<script type="text/javascript" language="JavaScript">
|
3
4
|
jQuery(document).ready(function() {
|
4
5
|
jQuery('#errorExplanation').hide();
|
5
6
|
var message = jQuery('#errorExplanation').html();
|
@@ -13,4 +14,5 @@
|
|
13
14
|
}
|
14
15
|
});
|
15
16
|
</script>
|
17
|
+
<% end -%>
|
16
18
|
<% end -%>
|
data/lib/muck-engine/config.rb
CHANGED
@@ -69,15 +69,6 @@ module MuckEngine
|
|
69
69
|
muck_dashboard_items << OpenStruct.new(:path => path,
|
70
70
|
:locals => locals)
|
71
71
|
end
|
72
|
-
|
73
|
-
def muck_admin_css
|
74
|
-
@@muck_admin_css ||= []
|
75
|
-
end
|
76
|
-
|
77
|
-
# Add css for the admin UI
|
78
|
-
def add_muck_admin_css(css_file)
|
79
|
-
muck_admin_css << css_file
|
80
|
-
end
|
81
72
|
|
82
73
|
def initialize
|
83
74
|
self.application_url = 'localhost:3000'
|
data/muck-engine.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{muck-engine}
|
8
|
-
s.version = "3.
|
8
|
+
s.version = "3.3.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Justin Ball", "Joel Duffin"]
|
12
|
-
s.date = %q{2011-03-
|
12
|
+
s.date = %q{2011-03-19}
|
13
13
|
s.description = %q{The base engine for the muck system. Contains common tables, custom for, css and javascript.}
|
14
14
|
s.email = %q{justin@tatemae.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -151,10 +151,9 @@ Gem::Specification.new do |s|
|
|
151
151
|
"lib/test/shoulda_macros/plugins.rb",
|
152
152
|
"lib/test/shoulda_macros/scopes.rb",
|
153
153
|
"muck-engine.gemspec",
|
154
|
-
"public/javascripts/muck-countries.js",
|
155
|
-
"public/javascripts/muck-src.js",
|
156
154
|
"public/javascripts/muck.js",
|
157
155
|
"public/javascripts/muck_admin.js",
|
156
|
+
"public/javascripts/muck_countries.js",
|
158
157
|
"public/javascripts/muck_time/en.js",
|
159
158
|
"public/stylesheets/admin.css",
|
160
159
|
"public/stylesheets/reset.css",
|
data/public/javascripts/muck.js
CHANGED
@@ -1,5 +1,149 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
jQuery(document).
|
4
|
-
|
5
|
-
|
1
|
+
// compress with http://closure-compiler.appspot.com/home
|
2
|
+
//jQuery.noConflict();
|
3
|
+
jQuery(document).ajaxSend(function(event, request, settings) {
|
4
|
+
add_headers(request);
|
5
|
+
if (settings.type.toUpperCase() == 'GET' || typeof(AUTH_TOKEN) == "undefined") return; // for details see: http://www.justinball.com/2009/07/08/jquery-ajax-get-in-firefox-post-in-internet-explorer/
|
6
|
+
// settings.data is a serialized string like "foo=bar&baz=boink" (or null)
|
7
|
+
settings.data = settings.data || "";
|
8
|
+
if (typeof(AUTH_TOKEN) != "undefined")
|
9
|
+
settings.data += (settings.data ? "&" : "") + "authenticity_token=" + encodeURIComponent(AUTH_TOKEN);
|
10
|
+
});
|
11
|
+
|
12
|
+
function apply_ajax_forms() {
|
13
|
+
jQuery('form.ajax').ajaxForm({
|
14
|
+
dataType: 'script',
|
15
|
+
beforeSend: add_headers
|
16
|
+
});
|
17
|
+
jQuery('form.ajax').append('<input type="hidden" name="format" value="js" />');
|
18
|
+
}
|
19
|
+
|
20
|
+
function add_headers(xhr){
|
21
|
+
xhr.setRequestHeader("Accept", "text/javascript");
|
22
|
+
xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
|
23
|
+
}
|
24
|
+
|
25
|
+
jQuery(document).ready(function() {
|
26
|
+
|
27
|
+
jQuery('a.ajax-delete').live('click', function() {
|
28
|
+
var title = jQuery(this).attr('title');
|
29
|
+
var do_delete = true;
|
30
|
+
if(title.length > 0){
|
31
|
+
do_delete = confirm(title);
|
32
|
+
}
|
33
|
+
if (do_delete){
|
34
|
+
jQuery.post(this.href, { _method: 'delete', format: 'js' }, null, "script");
|
35
|
+
}
|
36
|
+
return false;
|
37
|
+
});
|
38
|
+
|
39
|
+
jQuery('a.ajax-update').live('click', function() {
|
40
|
+
jQuery.post(this.href, { _method: 'put', format: 'js' }, null, "script");
|
41
|
+
return false;
|
42
|
+
});
|
43
|
+
|
44
|
+
jQuery(".submit-form").click(function() {
|
45
|
+
jQuery(this).parent('form').submit();
|
46
|
+
});
|
47
|
+
|
48
|
+
//jQuery("ul.drop-menu").menu();
|
49
|
+
|
50
|
+
apply_ajax_forms();
|
51
|
+
|
52
|
+
jQuery('a.dialog-pop').live('click', function() {
|
53
|
+
var d = jQuery('<div class="dialog"></div>').appendTo("body");
|
54
|
+
d.dialog({ modal: true, autoOpen: false, width: 'auto', title: jQuery(this).attr('title') });
|
55
|
+
d.load(jQuery(this).attr('href'), '', function(){
|
56
|
+
d.dialog("open");
|
57
|
+
apply_ajax_forms();
|
58
|
+
});
|
59
|
+
return false;
|
60
|
+
});
|
61
|
+
|
62
|
+
jQuery(".submit-delete").live('click', function() {
|
63
|
+
jQuery(this).parents('.delete-container').fadeOut();
|
64
|
+
var form = jQuery(this).parents('form');
|
65
|
+
jQuery.post(form.attr('action') + '.json', form.serialize(),
|
66
|
+
function(data){
|
67
|
+
var json = eval('(' + data + ')');
|
68
|
+
if(!json.success){
|
69
|
+
jQuery.jGrowl.info(json.message);
|
70
|
+
}
|
71
|
+
});
|
72
|
+
return false;
|
73
|
+
});
|
74
|
+
|
75
|
+
jQuery(".submit-delete-js").live('click', function() {
|
76
|
+
jQuery(this).parents('.delete-container').fadeOut();
|
77
|
+
var form = jQuery(this).parents('form');
|
78
|
+
jQuery.post(form.attr('action') + '.js', form.serialize(),
|
79
|
+
function(data){
|
80
|
+
});
|
81
|
+
return false;
|
82
|
+
});
|
83
|
+
|
84
|
+
jQuery(document).ready(function() {
|
85
|
+
jQuery('.waiting').hide();
|
86
|
+
jQuery(".wait-button").live('click', function() {
|
87
|
+
jQuery(this).siblings('.waiting').show();
|
88
|
+
jQuery(this).hide();
|
89
|
+
});
|
90
|
+
});
|
91
|
+
|
92
|
+
});
|
93
|
+
|
94
|
+
// String list methods. These are handy for dealing with comma delimited lists
|
95
|
+
// in text boxes such as a list of emails or tags.
|
96
|
+
// Given a comma delimited string add a new item if it isn't in the string
|
97
|
+
function add_to_list(items_string, new_item){
|
98
|
+
var items = split_list(items_string);
|
99
|
+
var add = true;
|
100
|
+
for(i=0;i<items.length;i++){
|
101
|
+
if(items[i] == new_item){ add = false; }
|
102
|
+
}
|
103
|
+
if(add){
|
104
|
+
items.push(new_item);
|
105
|
+
}
|
106
|
+
return items.join(', ');
|
107
|
+
}
|
108
|
+
|
109
|
+
// Given a comma delimited list remove an item from the string
|
110
|
+
function remove_from_list(items_string, remove_item){
|
111
|
+
var items = split_list(items_string);
|
112
|
+
var cleaned = [];
|
113
|
+
for(i=0;i<items.length;i++){
|
114
|
+
if(items[i] != remove_item){
|
115
|
+
cleaned.push(items[i]);
|
116
|
+
}
|
117
|
+
}
|
118
|
+
return cleaned.join(', ');
|
119
|
+
}
|
120
|
+
|
121
|
+
// Split a string on commas
|
122
|
+
function split_list(items_string){
|
123
|
+
if(undefined != items_string && items_string.length > 0){
|
124
|
+
var items = items_string.split(',');
|
125
|
+
} else {
|
126
|
+
var items = [];
|
127
|
+
}
|
128
|
+
var cleaned = [];
|
129
|
+
for(i=0;i<items.length;i++){
|
130
|
+
var cleaned_item = jQuery.trim(items[i]);
|
131
|
+
if(cleaned_item.length > 0){
|
132
|
+
cleaned.push(cleaned_item);
|
133
|
+
}
|
134
|
+
}
|
135
|
+
return cleaned;
|
136
|
+
}
|
137
|
+
|
138
|
+
function isEncodedHtml(str) {
|
139
|
+
if(str.search(/&/g) != -1 || str.search(/</g) != -1 || str.search(/>/g) != -1)
|
140
|
+
return true;
|
141
|
+
else
|
142
|
+
return false;
|
143
|
+
};
|
144
|
+
|
145
|
+
function decodeHtml(str){
|
146
|
+
if(isEncodedHtml(str))
|
147
|
+
return str.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
148
|
+
return str;
|
149
|
+
}
|
@@ -1,13 +0,0 @@
|
|
1
|
-
jQuery(function(){
|
2
|
-
// BUTTONS
|
3
|
-
jQuery('.fg-button').hover(
|
4
|
-
function(){ jQuery(this).removeClass('ui-state-default').addClass('ui-state-focus'); },
|
5
|
-
function(){ jQuery(this).removeClass('ui-state-focus').addClass('ui-state-default'); }
|
6
|
-
);
|
7
|
-
jQuery('.flat').each(function() {
|
8
|
-
jQuery(this).menu({
|
9
|
-
content: jQuery(this).next().html(), // grab content from this page
|
10
|
-
showSpeed: 200
|
11
|
-
});
|
12
|
-
});
|
13
|
-
});
|
File without changes
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: muck-engine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 11
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 3
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 3.
|
8
|
+
- 3
|
9
|
+
- 0
|
10
|
+
version: 3.3.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Justin Ball
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-03-
|
19
|
+
date: 2011-03-19 00:00:00 -06:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -418,10 +418,9 @@ files:
|
|
418
418
|
- lib/test/shoulda_macros/plugins.rb
|
419
419
|
- lib/test/shoulda_macros/scopes.rb
|
420
420
|
- muck-engine.gemspec
|
421
|
-
- public/javascripts/muck-countries.js
|
422
|
-
- public/javascripts/muck-src.js
|
423
421
|
- public/javascripts/muck.js
|
424
422
|
- public/javascripts/muck_admin.js
|
423
|
+
- public/javascripts/muck_countries.js
|
425
424
|
- public/javascripts/muck_time/en.js
|
426
425
|
- public/stylesheets/admin.css
|
427
426
|
- public/stylesheets/reset.css
|
@@ -1,149 +0,0 @@
|
|
1
|
-
// compress with http://closure-compiler.appspot.com/home
|
2
|
-
//jQuery.noConflict();
|
3
|
-
jQuery(document).ajaxSend(function(event, request, settings) {
|
4
|
-
add_headers(request);
|
5
|
-
if (settings.type.toUpperCase() == 'GET' || typeof(AUTH_TOKEN) == "undefined") return; // for details see: http://www.justinball.com/2009/07/08/jquery-ajax-get-in-firefox-post-in-internet-explorer/
|
6
|
-
// settings.data is a serialized string like "foo=bar&baz=boink" (or null)
|
7
|
-
settings.data = settings.data || "";
|
8
|
-
if (typeof(AUTH_TOKEN) != "undefined")
|
9
|
-
settings.data += (settings.data ? "&" : "") + "authenticity_token=" + encodeURIComponent(AUTH_TOKEN);
|
10
|
-
});
|
11
|
-
|
12
|
-
function apply_ajax_forms() {
|
13
|
-
jQuery('form.ajax').ajaxForm({
|
14
|
-
dataType: 'script',
|
15
|
-
beforeSend: add_headers
|
16
|
-
});
|
17
|
-
jQuery('form.ajax').append('<input type="hidden" name="format" value="js" />');
|
18
|
-
}
|
19
|
-
|
20
|
-
function add_headers(xhr){
|
21
|
-
xhr.setRequestHeader("Accept", "text/javascript");
|
22
|
-
xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
|
23
|
-
}
|
24
|
-
|
25
|
-
jQuery(document).ready(function() {
|
26
|
-
|
27
|
-
jQuery('a.ajax-delete').live('click', function() {
|
28
|
-
var title = jQuery(this).attr('title');
|
29
|
-
var do_delete = true;
|
30
|
-
if(title.length > 0){
|
31
|
-
do_delete = confirm(title);
|
32
|
-
}
|
33
|
-
if (do_delete){
|
34
|
-
jQuery.post(this.href, { _method: 'delete', format: 'js' }, null, "script");
|
35
|
-
}
|
36
|
-
return false;
|
37
|
-
});
|
38
|
-
|
39
|
-
jQuery('a.ajax-update').live('click', function() {
|
40
|
-
jQuery.post(this.href, { _method: 'put', format: 'js' }, null, "script");
|
41
|
-
return false;
|
42
|
-
});
|
43
|
-
|
44
|
-
jQuery(".submit-form").click(function() {
|
45
|
-
jQuery(this).parent('form').submit();
|
46
|
-
});
|
47
|
-
|
48
|
-
//jQuery("ul.drop-menu").menu();
|
49
|
-
|
50
|
-
apply_ajax_forms();
|
51
|
-
|
52
|
-
jQuery('a.dialog-pop').live('click', function() {
|
53
|
-
var d = jQuery('<div class="dialog"></div>').appendTo("body");
|
54
|
-
d.dialog({ modal: true, autoOpen: false, width: 'auto', title: jQuery(this).attr('title') });
|
55
|
-
d.load(jQuery(this).attr('href'), '', function(){
|
56
|
-
d.dialog("open");
|
57
|
-
apply_ajax_forms();
|
58
|
-
});
|
59
|
-
return false;
|
60
|
-
});
|
61
|
-
|
62
|
-
jQuery(".submit-delete").live('click', function() {
|
63
|
-
jQuery(this).parents('.delete-container').fadeOut();
|
64
|
-
var form = jQuery(this).parents('form');
|
65
|
-
jQuery.post(form.attr('action') + '.json', form.serialize(),
|
66
|
-
function(data){
|
67
|
-
var json = eval('(' + data + ')');
|
68
|
-
if(!json.success){
|
69
|
-
jQuery.jGrowl.info(json.message);
|
70
|
-
}
|
71
|
-
});
|
72
|
-
return false;
|
73
|
-
});
|
74
|
-
|
75
|
-
jQuery(".submit-delete-js").live('click', function() {
|
76
|
-
jQuery(this).parents('.delete-container').fadeOut();
|
77
|
-
var form = jQuery(this).parents('form');
|
78
|
-
jQuery.post(form.attr('action') + '.js', form.serialize(),
|
79
|
-
function(data){
|
80
|
-
});
|
81
|
-
return false;
|
82
|
-
});
|
83
|
-
|
84
|
-
jQuery(document).ready(function() {
|
85
|
-
jQuery('.waiting').hide();
|
86
|
-
jQuery(".wait-button").live('click', function() {
|
87
|
-
jQuery(this).siblings('.waiting').show();
|
88
|
-
jQuery(this).hide();
|
89
|
-
});
|
90
|
-
});
|
91
|
-
|
92
|
-
});
|
93
|
-
|
94
|
-
// String list methods. These are handy for dealing with comma delimited lists
|
95
|
-
// in text boxes such as a list of emails or tags.
|
96
|
-
// Given a comma delimited string add a new item if it isn't in the string
|
97
|
-
function add_to_list(items_string, new_item){
|
98
|
-
var items = split_list(items_string);
|
99
|
-
var add = true;
|
100
|
-
for(i=0;i<items.length;i++){
|
101
|
-
if(items[i] == new_item){ add = false; }
|
102
|
-
}
|
103
|
-
if(add){
|
104
|
-
items.push(new_item);
|
105
|
-
}
|
106
|
-
return items.join(', ');
|
107
|
-
}
|
108
|
-
|
109
|
-
// Given a comma delimited list remove an item from the string
|
110
|
-
function remove_from_list(items_string, remove_item){
|
111
|
-
var items = split_list(items_string);
|
112
|
-
var cleaned = [];
|
113
|
-
for(i=0;i<items.length;i++){
|
114
|
-
if(items[i] != remove_item){
|
115
|
-
cleaned.push(items[i]);
|
116
|
-
}
|
117
|
-
}
|
118
|
-
return cleaned.join(', ');
|
119
|
-
}
|
120
|
-
|
121
|
-
// Split a string on commas
|
122
|
-
function split_list(items_string){
|
123
|
-
if(undefined != items_string && items_string.length > 0){
|
124
|
-
var items = items_string.split(',');
|
125
|
-
} else {
|
126
|
-
var items = [];
|
127
|
-
}
|
128
|
-
var cleaned = [];
|
129
|
-
for(i=0;i<items.length;i++){
|
130
|
-
var cleaned_item = jQuery.trim(items[i]);
|
131
|
-
if(cleaned_item.length > 0){
|
132
|
-
cleaned.push(cleaned_item);
|
133
|
-
}
|
134
|
-
}
|
135
|
-
return cleaned;
|
136
|
-
}
|
137
|
-
|
138
|
-
function isEncodedHtml(str) {
|
139
|
-
if(str.search(/&/g) != -1 || str.search(/</g) != -1 || str.search(/>/g) != -1)
|
140
|
-
return true;
|
141
|
-
else
|
142
|
-
return false;
|
143
|
-
};
|
144
|
-
|
145
|
-
function decodeHtml(str){
|
146
|
-
if(isEncodedHtml(str))
|
147
|
-
return str.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
148
|
-
return str;
|
149
|
-
}
|