Jeremy D commited on 2013-04-22 19:47:18
Showing 2 changed files, with 89 additions and 90 deletions.
... | ... |
@@ -14,8 +14,8 @@ $j(document).ready(function($){ |
14 | 14 |
instruct_count[action_count] = 1; |
15 | 15 |
|
16 | 16 |
/* Bind some stuff to our actions, using live so they auto update as new stuff is added. */ |
17 |
-// $j(document).on('click', '.collapse_action', collapse_action); |
|
18 |
- $j('.collapse_action').live('click', collapse_action); |
|
17 |
+ $j(document).on('click', '.collapse_action', collapse_action); |
|
18 |
+// $j('.collapse_action').live('click', collapse_action); |
|
19 | 19 |
$j('.expand_action').live('click', expand_action); |
20 | 20 |
$j('.delete_action').live('click', delete_action); |
21 | 21 |
$j('.restore_action').live('click', restore_action); |
... | ... |
@@ -4,8 +4,7 @@ |
4 | 4 |
* Repository: https://github.com/jdarwood007/smf_package_maker |
5 | 5 |
* License: BSD 3 Clause; See license.txt |
6 | 6 |
*/ |
7 |
- |
|
8 |
-$ = jQuery.noConflict(); |
|
7 |
+$j = jQuery.noConflict(); |
|
9 | 8 |
|
10 | 9 |
/* This gets things going once the document has loaded, also makes sure JQuery is here. */ |
11 | 10 |
jQuery(document).ready(function(){ |
... | ... |
@@ -15,27 +14,27 @@ jQuery(document).ready(function(){ |
15 | 14 |
edit_count[file_count] = 1; |
16 | 15 |
|
17 | 16 |
/* Bind some stuff to our files, using live so they auto update as new stuff is added. */ |
18 |
- $('.collapse_file').live('click', collapse_file); |
|
19 |
- $('.expand_file').live('click', expand_file); |
|
20 |
- $('.delete_file').live('click', delete_file); |
|
21 |
- $('.restore_file').live('click', restore_file); |
|
17 |
+ $j('.collapse_file').live('click', collapse_file); |
|
18 |
+ $j('.expand_file').live('click', expand_file); |
|
19 |
+ $j('.delete_file').live('click', delete_file); |
|
20 |
+ $j('.restore_file').live('click', restore_file); |
|
22 | 21 |
|
23 | 22 |
/* Now we will bind to the actual edits, again using live. */ |
24 |
- $('.collapse_change').live('click', collapse_edit); |
|
25 |
- $('.expand_change').live('click', expand_edit); |
|
26 |
- $('.delete_change').live('click', delete_edit); |
|
27 |
- $('.restore_change').live('click', restore_edit); |
|
23 |
+ $j('.collapse_change').live('click', collapse_edit); |
|
24 |
+ $j('.expand_change').live('click', expand_edit); |
|
25 |
+ $j('.delete_change').live('click', delete_edit); |
|
26 |
+ $j('.restore_change').live('click', restore_edit); |
|
28 | 27 |
|
29 | 28 |
/* Give our buttons some actions. */ |
30 |
- $('#add_file').click(create_new_file); |
|
31 |
- $('.add_edit').live('click', create_new_edit); |
|
32 |
- $('#show_preview').click(show_edit_preview); |
|
29 |
+ $j('#add_file').click(create_new_file); |
|
30 |
+ $j('.add_edit').live('click', create_new_edit); |
|
31 |
+ $j('#show_preview').click(show_edit_preview); |
|
33 | 32 |
|
34 | 33 |
/* The details and basic buttons. */ |
35 |
- $('#collapse_basic').click(function(){$('#basic_info .info').hide(); $('#collapse_basic').hide(); $('#restore_basic').show();}); |
|
36 |
- $('#restore_basic').click(function(){$('#basic_info .info').show(); $('#restore_basic').hide(); $('#collapse_basic').show();}); |
|
37 |
- $('#collapse_details').click(function(){$('#details_info .info').hide(); $('#collapse_details').hide(); $('#restore_details').show();}); |
|
38 |
- $('#restore_details').click(function(){$('#details_info .info').show(); $('#restore_details').hide(); $('#collapse_details').show();}); |
|
34 |
+ $j('#collapse_basic').click(function(){$j('#basic_info .info').hide(); $j('#collapse_basic').hide(); $j('#restore_basic').show();}); |
|
35 |
+ $j('#restore_basic').click(function(){$j('#basic_info .info').show(); $j('#restore_basic').hide(); $j('#collapse_basic').show();}); |
|
36 |
+ $j('#collapse_details').click(function(){$j('#details_info .info').hide(); $j('#collapse_details').hide(); $j('#restore_details').show();}); |
|
37 |
+ $j('#restore_details').click(function(){$j('#details_info .info').show(); $j('#restore_details').hide(); $j('#collapse_details').show();}); |
|
39 | 38 |
|
40 | 39 |
/* Kick things off by creating a file. */ |
41 | 40 |
create_new_file(); |
... | ... |
@@ -45,10 +44,10 @@ jQuery(document).ready(function(){ |
45 | 44 |
function create_new_file() |
46 | 45 |
{ |
47 | 46 |
/* We have been through this before */ |
48 |
- $('#file_container').append($('#file_template').html().replace(/#FILEINDEX#/g, file_count)); |
|
47 |
+ $j('#file_container').append($j('#file_template').html().replace(/#FILEINDEX#/g, file_count)); |
|
49 | 48 |
|
50 | 49 |
/* Now we pretend to click said element */ |
51 |
- $('#file-' + file_count).find('.add_edit').click(); |
|
50 |
+ $j('#file-' + file_count).find('.add_edit').click(); |
|
52 | 51 |
|
53 | 52 |
/* Move the index and add defaults */ |
54 | 53 |
file_count++; |
... | ... |
@@ -60,9 +59,9 @@ function create_new_file() |
60 | 59 |
/* Handles adding of edits */ |
61 | 60 |
function create_new_edit() |
62 | 61 |
{ |
63 |
- file_index = $(this).attr('data-file'); |
|
62 |
+ file_index = $j(this).attr('data-file'); |
|
64 | 63 |
|
65 |
- $('#file-' + file_index + '-edit_container').append($('#edit_template').html().replace(/#FILEINDEX#/g, file_index).replace(/#EDITINDEX#/g, edit_count[file_index])); |
|
64 |
+ $j('#file-' + file_index + '-edit_container').append($j('#edit_template').html().replace(/#FILEINDEX#/g, file_index).replace(/#EDITINDEX#/g, edit_count[file_index])); |
|
66 | 65 |
edit_count[file_index]++; |
67 | 66 |
|
68 | 67 |
update_counter(); |
... | ... |
@@ -71,13 +70,13 @@ function create_new_edit() |
71 | 70 |
/* Handles collapsing of the edit */ |
72 | 71 |
function collapse_edit() |
73 | 72 |
{ |
74 |
- file_index = $(this).attr('data-file'); |
|
75 |
- edit_index = $(this).attr('data-edit'); |
|
73 |
+ file_index = $j(this).attr('data-file'); |
|
74 |
+ edit_index = $j(this).attr('data-edit'); |
|
76 | 75 |
|
77 | 76 |
/* Simply hide the edit, and give a expand button */ |
78 |
- $('#file-' + file_index + '-edit-' + edit_index + ' .edits').hide(); |
|
79 |
- $('#file-' + file_index + '-edit-' + edit_index + ' .expand_change').show(); |
|
80 |
- $(this).hide(); |
|
77 |
+ $j('#file-' + file_index + '-edit-' + edit_index + ' .edits').hide(); |
|
78 |
+ $j('#file-' + file_index + '-edit-' + edit_index + ' .expand_change').show(); |
|
79 |
+ $j(this).hide(); |
|
81 | 80 |
|
82 | 81 |
return false; |
83 | 82 |
} |
... | ... |
@@ -85,13 +84,13 @@ function collapse_edit() |
85 | 84 |
/* Handles expanding of the edit */ |
86 | 85 |
function expand_edit() |
87 | 86 |
{ |
88 |
- file_index = $(this).attr('data-file'); |
|
89 |
- edit_index = $(this).attr('data-edit'); |
|
87 |
+ file_index = $j(this).attr('data-file'); |
|
88 |
+ edit_index = $j(this).attr('data-edit'); |
|
90 | 89 |
|
91 | 90 |
/* Simply show the edit, and return to the original collapse button */ |
92 |
- $('#file-' + file_index + '-edit-' + edit_index + ' .edits').show(); |
|
93 |
- $('#file-' + file_index + '-edit-' + edit_index + ' .collapse_change').show(); |
|
94 |
- $(this).hide(); |
|
91 |
+ $j('#file-' + file_index + '-edit-' + edit_index + ' .edits').show(); |
|
92 |
+ $j('#file-' + file_index + '-edit-' + edit_index + ' .collapse_change').show(); |
|
93 |
+ $j(this).hide(); |
|
95 | 94 |
|
96 | 95 |
return false; |
97 | 96 |
} |
... | ... |
@@ -99,16 +98,16 @@ function expand_edit() |
99 | 98 |
/* Handles deleting a edit */ |
100 | 99 |
function delete_edit() |
101 | 100 |
{ |
102 |
- file_index = $(this).attr('data-file'); |
|
103 |
- edit_index = $(this).attr('data-edit'); |
|
101 |
+ file_index = $j(this).attr('data-file'); |
|
102 |
+ edit_index = $j(this).attr('data-edit'); |
|
104 | 103 |
|
105 | 104 |
/* First we let the data know its deleted. */ |
106 |
- $('#file-' + file_index + '-edit-' + edit_index + '-delete').val('1'); |
|
105 |
+ $j('#file-' + file_index + '-edit-' + edit_index + '-delete').val('1'); |
|
107 | 106 |
|
108 | 107 |
/* Then we hide this header, collapse the edit and show the restore button */ |
109 |
- $('#file-' + file_index + '-edit-' + edit_index + ' .edits').hide(); |
|
110 |
- $('#file-' + file_index + '-edit-' + edit_index + ' .restore_change').show(); |
|
111 |
- $(this).hide(); |
|
108 |
+ $j('#file-' + file_index + '-edit-' + edit_index + ' .edits').hide(); |
|
109 |
+ $j('#file-' + file_index + '-edit-' + edit_index + ' .restore_change').show(); |
|
110 |
+ $j(this).hide(); |
|
112 | 111 |
|
113 | 112 |
update_counter(); |
114 | 113 |
return false; |
... | ... |
@@ -117,16 +116,16 @@ function delete_edit() |
117 | 116 |
/* Handles restoring a edit */ |
118 | 117 |
function restore_edit() |
119 | 118 |
{ |
120 |
- file_index = $(this).attr('data-file'); |
|
121 |
- edit_index = $(this).attr('data-edit'); |
|
119 |
+ file_index = $j(this).attr('data-file'); |
|
120 |
+ edit_index = $j(this).attr('data-edit'); |
|
122 | 121 |
|
123 | 122 |
/* First we let the data know its deleted. */ |
124 |
- $('#file-' + file_index + '-edit-' + edit_index + '-delete').val('0'); |
|
123 |
+ $j('#file-' + file_index + '-edit-' + edit_index + '-delete').val('0'); |
|
125 | 124 |
|
126 | 125 |
/* Then we hide this header, collapse the edit and show the restore button */ |
127 |
- $('#file-' + file_index + '-edit-' + edit_index + ' .edits').show(); |
|
128 |
- $('#file-' + file_index + '-edit-' + edit_index + ' .delete_change').show(); |
|
129 |
- $(this).hide(); |
|
126 |
+ $j('#file-' + file_index + '-edit-' + edit_index + ' .edits').show(); |
|
127 |
+ $j('#file-' + file_index + '-edit-' + edit_index + ' .delete_change').show(); |
|
128 |
+ $j(this).hide(); |
|
130 | 129 |
|
131 | 130 |
update_counter(); |
132 | 131 |
return false; |
... | ... |
@@ -135,12 +134,12 @@ function restore_edit() |
135 | 134 |
/* Handles collapsing of the file */ |
136 | 135 |
function collapse_file() |
137 | 136 |
{ |
138 |
- file_index = $(this).attr('data-file'); |
|
137 |
+ file_index = $j(this).attr('data-file'); |
|
139 | 138 |
|
140 | 139 |
/* Simply hide the file, and give a expand button */ |
141 |
- $('#file-' + file_index + '-edit_container').hide(); |
|
142 |
- $('#file-' + file_index + ' .expand_file').show(); |
|
143 |
- $(this).hide(); |
|
140 |
+ $j('#file-' + file_index + '-edit_container').hide(); |
|
141 |
+ $j('#file-' + file_index + ' .expand_file').show(); |
|
142 |
+ $j(this).hide(); |
|
144 | 143 |
|
145 | 144 |
return false; |
146 | 145 |
} |
... | ... |
@@ -148,12 +147,12 @@ function collapse_file() |
148 | 147 |
/* Handles expanding of the file */ |
149 | 148 |
function expand_file() |
150 | 149 |
{ |
151 |
- file_index = $(this).attr('data-file'); |
|
150 |
+ file_index = $j(this).attr('data-file'); |
|
152 | 151 |
|
153 | 152 |
/* Simply show the file, and return to the original collapse button */ |
154 |
- $('#file-' + file_index + '-edit_container').show(); |
|
155 |
- $('#file-' + file_index + ' .collapse_file').show(); |
|
156 |
- $(this).hide(); |
|
153 |
+ $j('#file-' + file_index + '-edit_container').show(); |
|
154 |
+ $j('#file-' + file_index + ' .collapse_file').show(); |
|
155 |
+ $j(this).hide(); |
|
157 | 156 |
|
158 | 157 |
return false; |
159 | 158 |
} |
... | ... |
@@ -161,15 +160,15 @@ function expand_file() |
161 | 160 |
/* Handles deleting a file */ |
162 | 161 |
function delete_file() |
163 | 162 |
{ |
164 |
- file_index = $(this).attr('data-file'); |
|
163 |
+ file_index = $j(this).attr('data-file'); |
|
165 | 164 |
|
166 | 165 |
/* First we let the data know its deleted. */ |
167 |
- $('#file-' + file_index + '-delete').val('1'); |
|
166 |
+ $j('#file-' + file_index + '-delete').val('1'); |
|
168 | 167 |
|
169 | 168 |
/* Then we hide this header, collapse the edit and show the restore button */ |
170 |
- $('#file-' + file_index + '-edit_container').hide(); |
|
171 |
- $('#file-' + file_index + ' .restore_file').show(); |
|
172 |
- $(this).hide(); |
|
169 |
+ $j('#file-' + file_index + '-edit_container').hide(); |
|
170 |
+ $j('#file-' + file_index + ' .restore_file').show(); |
|
171 |
+ $j(this).hide(); |
|
173 | 172 |
|
174 | 173 |
update_counter(); |
175 | 174 |
return false; |
... | ... |
@@ -178,15 +177,15 @@ function delete_file() |
178 | 177 |
/* Handles restoring a file */ |
179 | 178 |
function restore_file() |
180 | 179 |
{ |
181 |
- file_index = $(this).attr('data-file'); |
|
180 |
+ file_index = $j(this).attr('data-file'); |
|
182 | 181 |
|
183 | 182 |
/* First we let the data know its deleted. */ |
184 |
- $('#file-' + file_index + '-delete').val('0'); |
|
183 |
+ $j('#file-' + file_index + '-delete').val('0'); |
|
185 | 184 |
|
186 | 185 |
/* Then we hide this header, collapse the edit and show the restore button */ |
187 |
- $('#file-' + file_index + '-edit_container').show(); |
|
188 |
- $('#file-' + file_index + ' .delete_file').show(); |
|
189 |
- $(this).hide(); |
|
186 |
+ $j('#file-' + file_index + '-edit_container').show(); |
|
187 |
+ $j('#file-' + file_index + ' .delete_file').show(); |
|
188 |
+ $j(this).hide(); |
|
190 | 189 |
|
191 | 190 |
update_counter(); |
192 | 191 |
return false; |
... | ... |
@@ -195,11 +194,11 @@ function restore_file() |
195 | 194 |
/* This is the nasty guy */ |
196 | 195 |
function show_edit_preview() |
197 | 196 |
{ |
198 |
- $('#preview_container').show(); |
|
197 |
+ $j('#preview_container').show(); |
|
199 | 198 |
|
200 |
- author = $('#basic_info_name').val().replace(/ /g,'_'); |
|
201 |
- name = $('#basic_info_mod').val().replace(/ /g,'_'); |
|
202 |
- version = $('#basic_info_version').val().replace(/ /g,'_'); |
|
199 |
+ author = $j('#basic_info_name').val().replace(/ /g,'_'); |
|
200 |
+ name = $j('#basic_info_mod').val().replace(/ /g,'_'); |
|
201 |
+ version = $j('#basic_info_version').val().replace(/ /g,'_'); |
|
203 | 202 |
|
204 | 203 |
preview = '<' + '?xml version="1.0"?' + '>' + "\n" + '\ |
205 | 204 |
<!DOCTYPE modification SYSTEM "http://www.simplemachines.org/xml/modification">' + "\n" + '\ |
... | ... |
@@ -212,7 +211,7 @@ function show_edit_preview() |
212 | 211 |
for (i = 1; i < file_count; i++) |
213 | 212 |
{ |
214 | 213 |
/* Skip this edit if we deleted it. */ |
215 |
- if ($('#file-' + i + '-delete').val() == '1') |
|
214 |
+ if ($j('#file-' + i + '-delete').val() == '1') |
|
216 | 215 |
{ |
217 | 216 |
continue; |
218 | 217 |
} |
... | ... |
@@ -221,9 +220,9 @@ function show_edit_preview() |
221 | 220 |
ecount = edit_count[i]; |
222 | 221 |
|
223 | 222 |
/* Get the file info */ |
224 |
- file_type = $('#file-' + i + '-file_type').val(); |
|
225 |
- file_name = $('#file-' + i + '-file_name').val(); |
|
226 |
- file_fail = $('#file-' + i + '-file_fail').val(); |
|
223 |
+ file_type = $j('#file-' + i + '-file_type').val(); |
|
224 |
+ file_name = $j('#file-' + i + '-file_name').val(); |
|
225 |
+ file_fail = $j('#file-' + i + '-file_fail').val(); |
|
227 | 226 |
|
228 | 227 |
/* Start off with the file attribute */ |
229 | 228 |
preview += "\n" + '\ |
... | ... |
@@ -240,17 +239,17 @@ function show_edit_preview() |
240 | 239 |
for (j = 1; j < ecount; j++) |
241 | 240 |
{ |
242 | 241 |
/* Skip this edit if we deleted it. */ |
243 |
- if ($('#file-' + i + '-edit-' + j + '-delete').val() == '1') |
|
242 |
+ if ($j('#file-' + i + '-edit-' + j + '-delete').val() == '1') |
|
244 | 243 |
{ |
245 | 244 |
continue; |
246 | 245 |
} |
247 | 246 |
|
248 | 247 |
/* Get our edit info */ |
249 |
- edit_action = $('#file-' + i + '-edit-' + j + '-action').val(); |
|
250 |
- edit_error = $('#file-' + i + '-edit-' + j + '-error').val(); |
|
251 |
- edit_whitespace = $('#file-' + i + '-edit-' + j + '-action').is(':checked'); |
|
252 |
- edit_search = $('#file-' + i + '-edit-' + j + '-search').val(); |
|
253 |
- edit_replace = $('#file-' + i + '-edit-' + j + '-replace').val(); |
|
248 |
+ edit_action = $j('#file-' + i + '-edit-' + j + '-action').val(); |
|
249 |
+ edit_error = $j('#file-' + i + '-edit-' + j + '-error').val(); |
|
250 |
+ edit_whitespace = $j('#file-' + i + '-edit-' + j + '-action').is(':checked'); |
|
251 |
+ edit_search = $j('#file-' + i + '-edit-' + j + '-search').val(); |
|
252 |
+ edit_replace = $j('#file-' + i + '-edit-' + j + '-replace').val(); |
|
254 | 253 |
|
255 | 254 |
/* Start off our editing */ |
256 | 255 |
preview += "\n\ |
... | ... |
@@ -300,7 +299,7 @@ function show_edit_preview() |
300 | 299 |
preview += "\n" + '\ |
301 | 300 |
</modification>'; |
302 | 301 |
|
303 |
- $('#preview').text(preview); |
|
302 |
+ $j('#preview').text(preview); |
|
304 | 303 |
} |
305 | 304 |
|
306 | 305 |
function download_file_generate() |
... | ... |
@@ -309,8 +308,8 @@ function download_file_generate() |
309 | 308 |
|
310 | 309 |
$.generateFile({ |
311 | 310 |
filename : 'install.xml', |
312 |
- content : $('#preview').text(), |
|
313 |
- script : $('#downloadername').val() + '?download' |
|
311 |
+ content : $j('#preview').text(), |
|
312 |
+ script : $j('#downloadername').val() + '?download' |
|
314 | 313 |
}); |
315 | 314 |
} |
316 | 315 |
|
... | ... |
@@ -318,7 +317,7 @@ function download_file_data() |
318 | 317 |
{ |
319 | 318 |
show_edit_preview(); |
320 | 319 |
|
321 |
- data = $.base64.encode($('#preview').text()); |
|
320 |
+ data = $.base64.encode($j('#preview').text()); |
|
322 | 321 |
|
323 | 322 |
/* No filename can be specified by a data URI */ |
324 | 323 |
window.location = 'data:application/octet-stream;charset=utf-8;base64,' + data; |
... | ... |
@@ -335,7 +334,7 @@ function update_counter() |
335 | 334 |
for (i = 1; i < file_count; i++) |
336 | 335 |
{ |
337 | 336 |
/* Skip this edit if we deleted it. */ |
338 |
- if ($('#file-' + i + '-delete').val() == '1') |
|
337 |
+ if ($j('#file-' + i + '-delete').val() == '1') |
|
339 | 338 |
continue; |
340 | 339 |
|
341 | 340 |
temp_file_count++; |
... | ... |
@@ -343,7 +342,7 @@ function update_counter() |
343 | 342 |
for (j = 1; j < edit_count[i]; j++) |
344 | 343 |
{ |
345 | 344 |
/* Skip this edit if we deleted it. */ |
346 |
- if ($('#file-' + i + '-edit-' + j + '-delete').val() == '1') |
|
345 |
+ if ($j('#file-' + i + '-edit-' + j + '-delete').val() == '1') |
|
347 | 346 |
{ |
348 | 347 |
continue; |
349 | 348 |
} |
... | ... |
@@ -351,22 +350,22 @@ function update_counter() |
351 | 350 |
temp_edit_count++; |
352 | 351 |
|
353 | 352 |
/* Find out what action we have */ |
354 |
- if ($('#file-' + i + '-edit-' + j + '-action').val() == 'replace') |
|
353 |
+ if ($j('#file-' + i + '-edit-' + j + '-action').val() == 'replace') |
|
355 | 354 |
{ |
356 |
- search = $('#file-' + i + '-edit-' + j + '-search').val().split("\n").length; |
|
357 |
- replace = $('#file-' + i + '-edit-' + j + '-replace').val().split("\n").length; |
|
355 |
+ search = $j('#file-' + i + '-edit-' + j + '-search').val().split("\n").length; |
|
356 |
+ replace = $j('#file-' + i + '-edit-' + j + '-replace').val().split("\n").length; |
|
358 | 357 |
|
359 | 358 |
if (replace > search) |
360 | 359 |
temp_line_count += (replace - search); |
361 | 360 |
} |
362 | 361 |
else |
363 | 362 |
{ |
364 |
- temp_line_count += $('#file-' + i + '-edit-' + j + '-replace').val().split("\n").length; |
|
363 |
+ temp_line_count += $j('#file-' + i + '-edit-' + j + '-replace').val().split("\n").length; |
|
365 | 364 |
} |
366 | 365 |
} |
367 | 366 |
} |
368 | 367 |
|
369 |
- $('#detail_files').val(temp_file_count); |
|
370 |
- $('#detail_edits').val(temp_edit_count); |
|
371 |
- $('#detail_lines').val(temp_line_count); |
|
368 |
+ $j('#detail_files').val(temp_file_count); |
|
369 |
+ $j('#detail_edits').val(temp_edit_count); |
|
370 |
+ $j('#detail_lines').val(temp_line_count); |
|
372 | 371 |
} |
373 | 372 |
\ No newline at end of file |
374 | 373 |