Index: trunk/extensions/UploadWizard/loader.js |
— | — | @@ -32,10 +32,10 @@ |
33 | 33 | |
34 | 34 | "$j.fn.arrowSteps" : "js/jquery/plugins/jquery.arrowSteps.js", |
35 | 35 | |
36 | | - "$j.fn.tags" : "js/jquery/plugins/jquery.tags.js", |
| 36 | + "$j.fn.mwCoolCats" : "js/jquery/plugins/jquery.mwCoolCats.js", |
37 | 37 | |
38 | 38 | "mw.style.arrowSteps" : "styles/jquery.arrowSteps.css", |
39 | | - "mw.style.tags" : "styles/jquery.tags.css" |
| 39 | + "mw.style.mwCoolCats" : "styles/jquery.mwCoolCats.css" |
40 | 40 | }); |
41 | 41 | |
42 | 42 | //Set a variable for the base upload interface for easy inclution |
— | — | @@ -74,10 +74,10 @@ |
75 | 75 | '$j.fn.morphCrossfade', |
76 | 76 | '$j.fn.validate', |
77 | 77 | '$j.fn.arrowSteps', |
78 | | - '$j.fn.tags', |
| 78 | + '$j.fn.mwCoolCats', |
79 | 79 | 'mw.style.arrowSteps', |
80 | 80 | 'mw.style.autocomplete', |
81 | | - 'mw.style.tags' |
| 81 | + 'mw.style.mwCoolCats' |
82 | 82 | ], |
83 | 83 | [ |
84 | 84 | 'mw.LanguageUpWiz', |
Index: trunk/extensions/UploadWizard/styles/jquery.tags.css |
— | — | @@ -1,58 +0,0 @@ |
2 | | -.tag-widget { |
3 | | - clear: both; |
4 | | - position: relative; |
5 | | -} |
6 | | -.tag-widget ul { |
7 | | - list-style: none; |
8 | | - padding-left: 0; |
9 | | - margin-top: 0; |
10 | | -} |
11 | | -.tag-widget li { |
12 | | - float: left; |
13 | | - margin-right: 10px; |
14 | | - padding: 3px; |
15 | | -} |
16 | | -.tag-widget li a { |
17 | | - text-decoration: none; |
18 | | -} |
19 | | -.tag-widget li:hover a { |
20 | | - text-decoration: none; |
21 | | - color: white; |
22 | | -} |
23 | | -.tag-widget li { |
24 | | - background-color: #fff; |
25 | | - border-radius: 4px; |
26 | | - -moz-border-radius: 4px; |
27 | | - -webkit-border-radius: 4px; |
28 | | - border-top: 1px solid #fff; |
29 | | - border: 1px solid #fff; |
30 | | - color: black; |
31 | | - font-size: 12px; |
32 | | - |
33 | | -} |
34 | | -.tag-widget li:hover { |
35 | | - background-color: #444; |
36 | | - border-radius: 4px; |
37 | | - -moz-border-radius: 4px; |
38 | | - -webkit-border-radius: 4px; |
39 | | - border-top: 1px solid #111; |
40 | | - border: 1px solid #222; |
41 | | - color:white; |
42 | | -} |
43 | | - |
44 | | - |
45 | | -/* Utilities */ |
46 | | -.pkg:after, #content-inner:after { |
47 | | - content: " "; |
48 | | - display: block; |
49 | | - visibility: hidden; |
50 | | - clear: both; |
51 | | - height: 0.1px; |
52 | | - font-size: 0.1em; |
53 | | - line-height: 0; |
54 | | -} |
55 | | -.pkg, #content-inner { display: inline-block; } |
56 | | -/* no ie mac \*/ |
57 | | -* html .pkg, * html #content-inner { height: 1%; } |
58 | | -.pkg, #content-inner { display: block; } |
59 | | -/* */ |
Index: trunk/extensions/UploadWizard/styles/jquery.mwCoolCats.js |
— | — | @@ -0,0 +1,58 @@ |
| 2 | +.tag-widget { |
| 3 | + clear: both; |
| 4 | + position: relative; |
| 5 | +} |
| 6 | +.tag-widget ul { |
| 7 | + list-style: none; |
| 8 | + padding-left: 0; |
| 9 | + margin-top: 0; |
| 10 | +} |
| 11 | +.tag-widget li { |
| 12 | + float: left; |
| 13 | + margin-right: 10px; |
| 14 | + padding: 3px; |
| 15 | +} |
| 16 | +.tag-widget li a { |
| 17 | + text-decoration: none; |
| 18 | +} |
| 19 | +.tag-widget li:hover a { |
| 20 | + text-decoration: none; |
| 21 | + color: white; |
| 22 | +} |
| 23 | +.tag-widget li { |
| 24 | + background-color: #fff; |
| 25 | + border-radius: 4px; |
| 26 | + -moz-border-radius: 4px; |
| 27 | + -webkit-border-radius: 4px; |
| 28 | + border-top: 1px solid #fff; |
| 29 | + border: 1px solid #fff; |
| 30 | + color: black; |
| 31 | + font-size: 12px; |
| 32 | + |
| 33 | +} |
| 34 | +.tag-widget li:hover { |
| 35 | + background-color: #444; |
| 36 | + border-radius: 4px; |
| 37 | + -moz-border-radius: 4px; |
| 38 | + -webkit-border-radius: 4px; |
| 39 | + border-top: 1px solid #111; |
| 40 | + border: 1px solid #222; |
| 41 | + color:white; |
| 42 | +} |
| 43 | + |
| 44 | + |
| 45 | +/* Utilities */ |
| 46 | +.pkg:after, #content-inner:after { |
| 47 | + content: " "; |
| 48 | + display: block; |
| 49 | + visibility: hidden; |
| 50 | + clear: both; |
| 51 | + height: 0.1px; |
| 52 | + font-size: 0.1em; |
| 53 | + line-height: 0; |
| 54 | +} |
| 55 | +.pkg, #content-inner { display: inline-block; } |
| 56 | +/* no ie mac \*/ |
| 57 | +* html .pkg, * html #content-inner { height: 1%; } |
| 58 | +.pkg, #content-inner { display: block; } |
| 59 | +/* */ |
Property changes on: trunk/extensions/UploadWizard/styles/jquery.mwCoolCats.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 60 | + native |
Index: trunk/extensions/UploadWizard/js/jquery/plugins/jquery.tags.js |
— | — | @@ -1,123 +0,0 @@ |
2 | | -RegExp.escape = (function() { |
3 | | - var specials = [ |
4 | | - '/', '.', '*', '+', '?', '|', |
5 | | - '(', ')', '[', ']', '{', '}', '\\' |
6 | | - ]; |
7 | | - |
8 | | - sRE = new RegExp( |
9 | | - '(\\' + specials.join('|\\') + ')', 'g' |
10 | | - ); |
11 | | - |
12 | | - return function(text) { |
13 | | - return text.replace(sRE, '\\$1'); |
14 | | - } |
15 | | -})(); |
16 | | -(function($){ |
17 | | - $.fn.tags = function(options) { |
18 | | - var defaults = { |
19 | | - showform: false, |
20 | | - formlabel: 'Add tag(s):', |
21 | | - buttontext: 'Add', |
22 | | - listlabel: 'Tags:', |
23 | | - deletetext: 'x', |
24 | | - delimitter: ',', |
25 | | - linkformat: '', |
26 | | - //submitstyle: 'string', |
27 | | - /* Events and Callbacks */ |
28 | | - addtag: function(e){ }, |
29 | | - removetag: function(e){ } |
30 | | - }; |
31 | | - var tagList = Array(); |
32 | | - var self; |
33 | | - var orig; |
34 | | - var origname; |
35 | | - var settings = $.extend( {}, defaults, options); |
36 | | - return this.each( function() { |
37 | | - orig = $(this); |
38 | | - $(this).wrap('<div class="tag-widget"></div>'); |
39 | | - $(this).parent().append('<button>'+settings.buttontext+'</button>'); |
40 | | - $(this).find('button').click( function(e) { |
41 | | - _processInput(); |
42 | | - e.preventDefault(); |
43 | | - return false; |
44 | | - }); |
45 | | - $(this).parent().append('<ul class="tag-list pkg"></ul>'); |
46 | | - $(this).parent().append( $(this).clone().attr('type','hidden').removeAttr('class').val('') ); |
47 | | - $(this).parents('form').submit( function() { |
48 | | - _processInput(); |
49 | | - }); |
50 | | - $(this).parents('form').keydown( function(e) { |
51 | | - if(e.keyCode == 13) { |
52 | | - e.preventDefault(); |
53 | | - return false; |
54 | | - } |
55 | | - }); |
56 | | - origname = $(this).attr('name'); |
57 | | - $(this).removeAttr('name'); |
58 | | - $(this).keyup(function(e) { |
59 | | - if(e.keyCode == 13) { |
60 | | - e.stopPropagation(); |
61 | | - e.preventDefault(); |
62 | | - _processInput(); |
63 | | - } |
64 | | - }); |
65 | | - obj = $(this).parent(); // set to the tag-widget class we just wrapped |
66 | | - self = obj; |
67 | | - _processInput(); |
68 | | - }); |
69 | | - function _split( str ) { |
70 | | - var delim = RegExp.escape(settings.delimitter); |
71 | | - var delim_scan = new RegExp('^((([\'"])(.*?)\\3|.*?)(' + delim + '\\s*|$))', ''); |
72 | | - str = str.replace(/(^\s+|\s+$)/g, ''); |
73 | | - var tags = []; |
74 | | - while (str.length && str.match(delim_scan)) { |
75 | | - str = str.substr(RegExp.$1.length); |
76 | | - orig.val(str); |
77 | | - var tag = RegExp.$4 ? RegExp.$4 : RegExp.$2; |
78 | | - tag = tag.replace(/(^\s+|\s+$)/g, ''); |
79 | | - tag = tag.replace(/\s+/g, ' '); |
80 | | - if (tag != '') tags.push(tag); |
81 | | - } |
82 | | - return tags; |
83 | | - }; |
84 | | - function _processInput() { |
85 | | - var newtags = _split( self.find('input').val() ); |
86 | | - for(i = 0; i < newtags.length; i++) { |
87 | | - _insertTag( newtags[i] ); |
88 | | - }; |
89 | | - self.find('ul li a.delete').click( function() { |
90 | | - var tag = $(this).parent().find('a.tag').html(); |
91 | | - $(this).parent().remove(); |
92 | | - _removeTag( tag ); |
93 | | - }); |
94 | | - }; |
95 | | - function _removeTag( tag ) { |
96 | | - var str = ''; |
97 | | - for (var i=0;i < tagList.length;i++) { |
98 | | - if (tagList[i] == tag) { |
99 | | - tagList.splice(i,1); |
100 | | - i--; |
101 | | - } else { |
102 | | - if (str != '') { str = str + settings.delimitter; } |
103 | | - str = str + tagList[i]; |
104 | | - } |
105 | | - } |
106 | | - self.find('input[name='+origname+']').val( str ); |
107 | | - |
108 | | - }; |
109 | | - function _insertTag( tag ) { |
110 | | - if ( _containsTag( tag ) ) { return; } |
111 | | - var tag_esc = escape(tag).replace(/\+/g, '%2B').replace(/\"/g,'%22').replace(/\'/g, '%27').replace(/ /g,'+'); |
112 | | - self.find('ul').append('<li class="tag"><a class="tag" href="'+settings.linkformat + tag_esc+'">'+tag+'</a> <a href="javascript:void(0)" class="delete">'+settings.deletetext+'</a></li>'); |
113 | | - tagList.push(tag); |
114 | | - var v = self.find('input[name='+origname+']').val(); |
115 | | - if (v != '') { v = v + settings.delimitter; } |
116 | | - self.find('input[name='+origname+']').val( v + tag ); |
117 | | - }; |
118 | | - function _containsTag( tag ) { |
119 | | - for (var i = 0; i < tagList.length; i++) { |
120 | | - if (tag == tagList[i]) { return 1; } |
121 | | - } |
122 | | - return 0; |
123 | | - }; |
124 | | - }})(jQuery); |
Index: trunk/extensions/UploadWizard/js/jquery/plugins/jquery.mwCoolCats.js |
— | — | @@ -0,0 +1,123 @@ |
| 2 | +RegExp.escape = (function() { |
| 3 | + var specials = [ |
| 4 | + '/', '.', '*', '+', '?', '|', |
| 5 | + '(', ')', '[', ']', '{', '}', '\\' |
| 6 | + ]; |
| 7 | + |
| 8 | + sRE = new RegExp( |
| 9 | + '(\\' + specials.join('|\\') + ')', 'g' |
| 10 | + ); |
| 11 | + |
| 12 | + return function(text) { |
| 13 | + return text.replace(sRE, '\\$1'); |
| 14 | + } |
| 15 | +})(); |
| 16 | +(function($){ |
| 17 | + $.fn.tags = function(options) { |
| 18 | + var defaults = { |
| 19 | + showform: false, |
| 20 | + formlabel: 'Add tag(s):', |
| 21 | + buttontext: 'Add', |
| 22 | + listlabel: 'Tags:', |
| 23 | + deletetext: 'x', |
| 24 | + delimitter: ',', |
| 25 | + linkformat: '', |
| 26 | + //submitstyle: 'string', |
| 27 | + /* Events and Callbacks */ |
| 28 | + addtag: function(e){ }, |
| 29 | + removetag: function(e){ } |
| 30 | + }; |
| 31 | + var tagList = Array(); |
| 32 | + var self; |
| 33 | + var orig; |
| 34 | + var origname; |
| 35 | + var settings = $.extend( {}, defaults, options); |
| 36 | + return this.each( function() { |
| 37 | + orig = $(this); |
| 38 | + $(this).wrap('<div class="tag-widget"></div>'); |
| 39 | + $(this).parent().append('<button>'+settings.buttontext+'</button>'); |
| 40 | + $(this).find('button').click( function(e) { |
| 41 | + _processInput(); |
| 42 | + e.preventDefault(); |
| 43 | + return false; |
| 44 | + }); |
| 45 | + $(this).parent().append('<ul class="tag-list pkg"></ul>'); |
| 46 | + $(this).parent().append( $(this).clone().attr('type','hidden').removeAttr('class').val('') ); |
| 47 | + $(this).parents('form').submit( function() { |
| 48 | + _processInput(); |
| 49 | + }); |
| 50 | + $(this).parents('form').keydown( function(e) { |
| 51 | + if(e.keyCode == 13) { |
| 52 | + e.preventDefault(); |
| 53 | + return false; |
| 54 | + } |
| 55 | + }); |
| 56 | + origname = $(this).attr('name'); |
| 57 | + $(this).removeAttr('name'); |
| 58 | + $(this).keyup(function(e) { |
| 59 | + if(e.keyCode == 13) { |
| 60 | + e.stopPropagation(); |
| 61 | + e.preventDefault(); |
| 62 | + _processInput(); |
| 63 | + } |
| 64 | + }); |
| 65 | + obj = $(this).parent(); // set to the tag-widget class we just wrapped |
| 66 | + self = obj; |
| 67 | + _processInput(); |
| 68 | + }); |
| 69 | + function _split( str ) { |
| 70 | + var delim = RegExp.escape(settings.delimitter); |
| 71 | + var delim_scan = new RegExp('^((([\'"])(.*?)\\3|.*?)(' + delim + '\\s*|$))', ''); |
| 72 | + str = str.replace(/(^\s+|\s+$)/g, ''); |
| 73 | + var tags = []; |
| 74 | + while (str.length && str.match(delim_scan)) { |
| 75 | + str = str.substr(RegExp.$1.length); |
| 76 | + orig.val(str); |
| 77 | + var tag = RegExp.$4 ? RegExp.$4 : RegExp.$2; |
| 78 | + tag = tag.replace(/(^\s+|\s+$)/g, ''); |
| 79 | + tag = tag.replace(/\s+/g, ' '); |
| 80 | + if (tag != '') tags.push(tag); |
| 81 | + } |
| 82 | + return tags; |
| 83 | + }; |
| 84 | + function _processInput() { |
| 85 | + var newtags = _split( self.find('input').val() ); |
| 86 | + for(i = 0; i < newtags.length; i++) { |
| 87 | + _insertTag( newtags[i] ); |
| 88 | + }; |
| 89 | + self.find('ul li a.delete').click( function() { |
| 90 | + var tag = $(this).parent().find('a.tag').html(); |
| 91 | + $(this).parent().remove(); |
| 92 | + _removeTag( tag ); |
| 93 | + }); |
| 94 | + }; |
| 95 | + function _removeTag( tag ) { |
| 96 | + var str = ''; |
| 97 | + for (var i=0;i < tagList.length;i++) { |
| 98 | + if (tagList[i] == tag) { |
| 99 | + tagList.splice(i,1); |
| 100 | + i--; |
| 101 | + } else { |
| 102 | + if (str != '') { str = str + settings.delimitter; } |
| 103 | + str = str + tagList[i]; |
| 104 | + } |
| 105 | + } |
| 106 | + self.find('input[name='+origname+']').val( str ); |
| 107 | + |
| 108 | + }; |
| 109 | + function _insertTag( tag ) { |
| 110 | + if ( _containsTag( tag ) ) { return; } |
| 111 | + var tag_esc = escape(tag).replace(/\+/g, '%2B').replace(/\"/g,'%22').replace(/\'/g, '%27').replace(/ /g,'+'); |
| 112 | + self.find('ul').append('<li class="tag"><a class="tag" href="'+settings.linkformat + tag_esc+'">'+tag+'</a> <a href="javascript:void(0)" class="delete">'+settings.deletetext+'</a></li>'); |
| 113 | + tagList.push(tag); |
| 114 | + var v = self.find('input[name='+origname+']').val(); |
| 115 | + if (v != '') { v = v + settings.delimitter; } |
| 116 | + self.find('input[name='+origname+']').val( v + tag ); |
| 117 | + }; |
| 118 | + function _containsTag( tag ) { |
| 119 | + for (var i = 0; i < tagList.length; i++) { |
| 120 | + if (tag == tagList[i]) { return 1; } |
| 121 | + } |
| 122 | + return 0; |
| 123 | + }; |
| 124 | + }})(jQuery); |
Property changes on: trunk/extensions/UploadWizard/js/jquery/plugins/jquery.mwCoolCats.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 125 | + native |