author | Dan |
Tue, 25 Aug 2009 01:43:11 -0400 | |
changeset 1102 | faef5e62e1e0 |
parent 1039 | 4226cedb3bc4 |
child 1274 | 673a1b6712fa |
permissions | -rw-r--r-- |
1039
4226cedb3bc4
Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents:
943
diff
changeset
|
1 |
var sbedit_load = function() |
885
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
2 |
{ |
1039
4226cedb3bc4
Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents:
943
diff
changeset
|
3 |
if ( !window.jQuery ) |
4226cedb3bc4
Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents:
943
diff
changeset
|
4 |
{ |
4226cedb3bc4
Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents:
943
diff
changeset
|
5 |
load_component(['jquery', 'jquery-ui']); |
4226cedb3bc4
Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents:
943
diff
changeset
|
6 |
// this seems to be the only way to make the sortables init properly |
4226cedb3bc4
Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents:
943
diff
changeset
|
7 |
// FIXME find out what we're waiting for here, and wait on it the right way |
4226cedb3bc4
Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents:
943
diff
changeset
|
8 |
window.setTimeout(sbedit_load, 200); |
4226cedb3bc4
Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents:
943
diff
changeset
|
9 |
return true; |
4226cedb3bc4
Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents:
943
diff
changeset
|
10 |
} |
885
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
11 |
$('.sbedit-column').sortable({ |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
12 |
handle: '.sbedit-handle', |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
13 |
connectWith: '.sbedit-column', |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
14 |
stop: function() |
1 | 15 |
{ |
885
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
16 |
ajaxUpdateSidebarOrder(); |
1 | 17 |
} |
18 |
}); |
|
1039
4226cedb3bc4
Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents:
943
diff
changeset
|
19 |
}; |
4226cedb3bc4
Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents:
943
diff
changeset
|
20 |
|
4226cedb3bc4
Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents:
943
diff
changeset
|
21 |
addOnloadHook(sbedit_load); |
885
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
22 |
|
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
23 |
function serialize_sidebar() |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
24 |
{ |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
25 |
var columns = {}; |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
26 |
var i = 0; |
1039
4226cedb3bc4
Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents:
943
diff
changeset
|
27 |
try |
4226cedb3bc4
Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents:
943
diff
changeset
|
28 |
{ |
4226cedb3bc4
Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents:
943
diff
changeset
|
29 |
$('.sbedit-column').each(function(i, e) |
4226cedb3bc4
Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents:
943
diff
changeset
|
30 |
{ |
4226cedb3bc4
Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents:
943
diff
changeset
|
31 |
// console.debug(e, ' TOARRAY: ', $(e).sortable('toArray')); |
4226cedb3bc4
Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents:
943
diff
changeset
|
32 |
var arr = $(e).sortable('toArray'); |
4226cedb3bc4
Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents:
943
diff
changeset
|
33 |
if ( !arr ) |
4226cedb3bc4
Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents:
943
diff
changeset
|
34 |
{ |
4226cedb3bc4
Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents:
943
diff
changeset
|
35 |
console.error('Retrieving order failed!'); |
4226cedb3bc4
Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents:
943
diff
changeset
|
36 |
throw new Exception(); |
4226cedb3bc4
Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents:
943
diff
changeset
|
37 |
} |
4226cedb3bc4
Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents:
943
diff
changeset
|
38 |
|
4226cedb3bc4
Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents:
943
diff
changeset
|
39 |
for ( var j = 0; j < arr.length; j++ ) |
4226cedb3bc4
Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents:
943
diff
changeset
|
40 |
arr[j] = parseInt(arr[j].replace(/^block:/, '')); |
4226cedb3bc4
Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents:
943
diff
changeset
|
41 |
|
4226cedb3bc4
Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents:
943
diff
changeset
|
42 |
i++; |
4226cedb3bc4
Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents:
943
diff
changeset
|
43 |
columns[i] = arr; |
4226cedb3bc4
Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents:
943
diff
changeset
|
44 |
}); |
4226cedb3bc4
Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents:
943
diff
changeset
|
45 |
} |
4226cedb3bc4
Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents:
943
diff
changeset
|
46 |
catch ( e ) |
4226cedb3bc4
Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents:
943
diff
changeset
|
47 |
{ |
4226cedb3bc4
Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents:
943
diff
changeset
|
48 |
return false; |
4226cedb3bc4
Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents:
943
diff
changeset
|
49 |
} |
885
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
50 |
return toJSONString(columns); |
1 | 51 |
} |
52 |
||
885
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
53 |
function sbedit_open_editor(a) |
1 | 54 |
{ |
885
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
55 |
if ( auth_level < USER_LEVEL_ADMIN ) |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
56 |
{ |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
57 |
load_component('login'); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
58 |
ajaxDynamicReauth(function(sid) |
1 | 59 |
{ |
885
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
60 |
sbedit_open_editor(a); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
61 |
}, USER_LEVEL_ADMIN); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
62 |
return false; |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
63 |
} |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
64 |
load_component(['fadefilter', 'l10n']); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
65 |
var shade = darken(true, 50, 'sbedit-shade'); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
66 |
$(shade).css('z-index', 0); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
67 |
var parent = sbedit_get_parent(a); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
68 |
var offset = $(parent).offset(); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
69 |
var top = (( getHeight() ) / 2) - 200 + getScrollOffset(); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
70 |
var box = $(parent) |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
71 |
.clone() |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
72 |
.empty() |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
73 |
.attr('id', 'sb_blockedit') |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
74 |
.addClass('sbedit-float') |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
75 |
.css('height', $(parent).height()) |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
76 |
.css('top', offset.top) |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
77 |
.css('left', offset.left) |
943
6eab82abc952
Fixed sidebar editor not closing floating windows properly when FX off
Dan
parents:
886
diff
changeset
|
78 |
.appendTo('body'); |
6eab82abc952
Fixed sidebar editor not closing floating windows properly when FX off
Dan
parents:
886
diff
changeset
|
79 |
var item_id = parseInt($(parent).attr('id').replace(/^block:/, '')); |
6eab82abc952
Fixed sidebar editor not closing floating windows properly when FX off
Dan
parents:
886
diff
changeset
|
80 |
|
6eab82abc952
Fixed sidebar editor not closing floating windows properly when FX off
Dan
parents:
886
diff
changeset
|
81 |
$(box) |
885
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
82 |
.animate({ width: 500, height: 400, top: top, left: (getWidth() / 2) - 250 }, 400, function() |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
83 |
{ |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
84 |
var whitey = whiteOutElement(this); |
943
6eab82abc952
Fixed sidebar editor not closing floating windows properly when FX off
Dan
parents:
886
diff
changeset
|
85 |
$(this).append('<textarea style="width: 98%; height: 360px; margin: 0 auto; display: block;" rows="20" cols="80"></textarea>'); |
885
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
86 |
$(this).append('<p style="text-align: center;"><a href="#" onclick="sbedit_edit_save(this); return false;">' + $lang.get('etc_save_changes') + '</a> | <a href="#" onclick="sbedit_edit_cancel(this); return false;">' + $lang.get('etc_cancel') + '</a></p>'); |
943
6eab82abc952
Fixed sidebar editor not closing floating windows properly when FX off
Dan
parents:
886
diff
changeset
|
87 |
$.get(makeUrlNS('Special', 'EditSidebar', 'action=getsource&noheaders&id=' + item_id), {}, function(response, statustext) |
885
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
88 |
{ |
943
6eab82abc952
Fixed sidebar editor not closing floating windows properly when FX off
Dan
parents:
886
diff
changeset
|
89 |
$('textarea', box).val(response); |
885
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
90 |
$(whitey).remove(); |
943
6eab82abc952
Fixed sidebar editor not closing floating windows properly when FX off
Dan
parents:
886
diff
changeset
|
91 |
|
6eab82abc952
Fixed sidebar editor not closing floating windows properly when FX off
Dan
parents:
886
diff
changeset
|
92 |
$(box).attr('enano:item_id', item_id); |
885
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
93 |
}, 'html'); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
94 |
}) |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
95 |
.get(0); |
1 | 96 |
} |
97 |
||
885
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
98 |
function sbedit_edit_save(a) |
1 | 99 |
{ |
885
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
100 |
var box = a.parentNode.parentNode; |
943
6eab82abc952
Fixed sidebar editor not closing floating windows properly when FX off
Dan
parents:
886
diff
changeset
|
101 |
var parent = document.getElementById('block:' + $(box).attr('enano:item_id')); |
885
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
102 |
var whitey = whiteOutElement(box); |
943
6eab82abc952
Fixed sidebar editor not closing floating windows properly when FX off
Dan
parents:
886
diff
changeset
|
103 |
$.post(makeUrlNS('Special', 'EditSidebar', 'noheaders&action=save&id=' + $(box).attr('enano:item_id')), { content: $('textarea', box).attr('value') }, function(response, statustext) |
1 | 104 |
{ |
885
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
105 |
whiteOutReportSuccess(whitey); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
106 |
setTimeout(function() |
1 | 107 |
{ |
885
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
108 |
sbedit_close_editor(parent, box); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
109 |
}, 1250); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
110 |
}, 'html'); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
111 |
} |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
112 |
|
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
113 |
function sbedit_edit_cancel(a) |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
114 |
{ |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
115 |
var box = a.parentNode.parentNode; |
943
6eab82abc952
Fixed sidebar editor not closing floating windows properly when FX off
Dan
parents:
886
diff
changeset
|
116 |
var parent = document.getElementById('block:' + $(box).attr('enano:item_id')); |
885
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
117 |
|
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
118 |
sbedit_close_editor(parent, box); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
119 |
} |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
120 |
|
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
121 |
function sbedit_close_editor(parent, box) |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
122 |
{ |
943
6eab82abc952
Fixed sidebar editor not closing floating windows properly when FX off
Dan
parents:
886
diff
changeset
|
123 |
if ( !parent ) |
6eab82abc952
Fixed sidebar editor not closing floating windows properly when FX off
Dan
parents:
886
diff
changeset
|
124 |
{ |
6eab82abc952
Fixed sidebar editor not closing floating windows properly when FX off
Dan
parents:
886
diff
changeset
|
125 |
console.warn('Failed to get DOM object for parent, skipping transition effect'); |
6eab82abc952
Fixed sidebar editor not closing floating windows properly when FX off
Dan
parents:
886
diff
changeset
|
126 |
} |
6eab82abc952
Fixed sidebar editor not closing floating windows properly when FX off
Dan
parents:
886
diff
changeset
|
127 |
|
6eab82abc952
Fixed sidebar editor not closing floating windows properly when FX off
Dan
parents:
886
diff
changeset
|
128 |
if ( jQuery.fx.off || !parent ) |
6eab82abc952
Fixed sidebar editor not closing floating windows properly when FX off
Dan
parents:
886
diff
changeset
|
129 |
{ |
6eab82abc952
Fixed sidebar editor not closing floating windows properly when FX off
Dan
parents:
886
diff
changeset
|
130 |
enlighten(true, 'sbedit-shade'); |
6eab82abc952
Fixed sidebar editor not closing floating windows properly when FX off
Dan
parents:
886
diff
changeset
|
131 |
$('body').get(0).removeChild(box); |
6eab82abc952
Fixed sidebar editor not closing floating windows properly when FX off
Dan
parents:
886
diff
changeset
|
132 |
return true; |
6eab82abc952
Fixed sidebar editor not closing floating windows properly when FX off
Dan
parents:
886
diff
changeset
|
133 |
} |
6eab82abc952
Fixed sidebar editor not closing floating windows properly when FX off
Dan
parents:
886
diff
changeset
|
134 |
|
885
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
135 |
var offset = $(parent).offset(); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
136 |
$(box).empty().animate( |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
137 |
{ |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
138 |
width: $(parent).width(), |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
139 |
height: $(parent).height(), |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
140 |
top: offset.top, |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
141 |
left: offset.left, |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
142 |
}, 400, function() |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
143 |
{ |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
144 |
$(this).css('background-color', '#f70').fadeOut(1000, function() { $(this).remove(); }); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
145 |
enlighten(true, 'sbedit-shade'); |
1 | 146 |
}); |
147 |
} |
|
148 |
||
885
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
149 |
function sbedit_delete_block(a) |
1 | 150 |
{ |
885
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
151 |
var parent = sbedit_get_parent(a); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
152 |
load_component(['messagebox', 'fadefilter', 'flyin', 'l10n']); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
153 |
var mp = miniPromptMessage({ |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
154 |
title: $lang.get('sbedit_msg_delete_confirm_title'), |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
155 |
message: $lang.get('sbedit_msg_delete_confirm_body'), |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
156 |
buttons: [ |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
157 |
{ |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
158 |
text: $lang.get('sbedit_btn_delete_confirm'), |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
159 |
color: 'red', |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
160 |
onclick: function() |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
161 |
{ |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
162 |
var mp = miniPromptGetParent(this); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
163 |
sbedit_delete_block_s2(mp.target_block); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
164 |
miniPromptDestroy(this); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
165 |
return false; |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
166 |
}, |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
167 |
style: { |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
168 |
fontWeight: 'bold' |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
169 |
} |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
170 |
}, |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
171 |
{ |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
172 |
text: $lang.get('etc_cancel'), |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
173 |
onclick: function() |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
174 |
{ |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
175 |
miniPromptDestroy(this); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
176 |
return false; |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
177 |
} |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
178 |
} |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
179 |
] |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
180 |
}); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
181 |
mp.target_block = parent; |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
182 |
} |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
183 |
|
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
184 |
function sbedit_delete_block_s2(box) |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
185 |
{ |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
186 |
var parent = box; |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
187 |
var id = parseInt($(parent).attr('id').replace(/^block:/, '')); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
188 |
var whitey = whiteOutElement(parent); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
189 |
|
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
190 |
$.get(makeUrlNS('Special', 'EditSidebar', 'action=delete&ajax=true&noheaders&id=' + id), function(response, statustext) |
1 | 191 |
{ |
885
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
192 |
if ( response == 'GOOD' ) |
1 | 193 |
{ |
885
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
194 |
whiteOutReportSuccess(whitey); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
195 |
setTimeout(function() |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
196 |
{ |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
197 |
$(parent) |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
198 |
.hide('blind', { duration: 500 }, function() |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
199 |
{ |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
200 |
$(this).remove(); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
201 |
ajaxUpdateSidebarOrder(); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
202 |
}); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
203 |
}, 1250); |
1 | 204 |
} |
885
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
205 |
else |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
206 |
{ |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
207 |
whiteOutReportFailure(whitey); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
208 |
alert(response); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
209 |
} |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
210 |
}, 'html'); |
1 | 211 |
} |
212 |
||
885
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
213 |
function sbedit_rename_block(a) |
190
e858bacb5cfa
Sidebar blocks can be renamed now (untested except in Fx2)
Dan
parents:
80
diff
changeset
|
214 |
{ |
885
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
215 |
var parent = sbedit_get_parent(a); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
216 |
$('div.sbedit-handle > span', parent).hide(); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
217 |
var input = $('div.sbedit-handle > input', parent).show().focus().select().keyup(function(e) |
190
e858bacb5cfa
Sidebar blocks can be renamed now (untested except in Fx2)
Dan
parents:
80
diff
changeset
|
218 |
{ |
885
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
219 |
switch(e.keyCode) |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
220 |
{ |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
221 |
case 13: |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
222 |
// enter |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
223 |
var whitey = whiteOutElement(this.parentNode); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
224 |
var me = this; |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
225 |
var id = parseInt($(parent).attr('id').replace(/^block:/, '')); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
226 |
$.post(makeUrlNS('Special', 'EditSidebar', 'ajax&noheaders&action=rename&id='+id), { newname: $(this).attr('value') }, function(response, statustext) |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
227 |
{ |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
228 |
if ( response == 'GOOD' ) |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
229 |
{ |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
230 |
whiteOutReportSuccess(whitey); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
231 |
setTimeout(function() |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
232 |
{ |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
233 |
$(me).hide(); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
234 |
$('span', me.parentNode).show().text(me.value); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
235 |
}, 1250); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
236 |
} |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
237 |
else |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
238 |
{ |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
239 |
alert(response); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
240 |
whiteOutReportFailure(whitey); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
241 |
} |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
242 |
}, 'html'); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
243 |
break; |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
244 |
case 27: |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
245 |
// escape |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
246 |
this.value = this.origvalue; |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
247 |
$(this).hide(); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
248 |
$('span', this.parentNode).show(); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
249 |
break; |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
250 |
} |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
251 |
}).get(0); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
252 |
input.origvalue = input.value; |
190
e858bacb5cfa
Sidebar blocks can be renamed now (untested except in Fx2)
Dan
parents:
80
diff
changeset
|
253 |
} |
e858bacb5cfa
Sidebar blocks can be renamed now (untested except in Fx2)
Dan
parents:
80
diff
changeset
|
254 |
|
885
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
255 |
function sbedit_disenable_block(a) |
190
e858bacb5cfa
Sidebar blocks can be renamed now (untested except in Fx2)
Dan
parents:
80
diff
changeset
|
256 |
{ |
885
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
257 |
var parent = sbedit_get_parent(a); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
258 |
var whitey = whiteOutElement(parent); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
259 |
$.get(makeUrlNS('Special', 'EditSidebar', 'action=disenable&ajax=true&noheaders&id=' + parseInt($(parent).attr('id').replace(/^block:/, ''))), {}, function(response, statustext) |
190
e858bacb5cfa
Sidebar blocks can be renamed now (untested except in Fx2)
Dan
parents:
80
diff
changeset
|
260 |
{ |
885
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
261 |
if ( response == 'GOOD' ) |
190
e858bacb5cfa
Sidebar blocks can be renamed now (untested except in Fx2)
Dan
parents:
80
diff
changeset
|
262 |
{ |
885
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
263 |
whiteOutReportSuccess(whitey); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
264 |
$(parent).toggleClass('disabled'); |
190
e858bacb5cfa
Sidebar blocks can be renamed now (untested except in Fx2)
Dan
parents:
80
diff
changeset
|
265 |
} |
885
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
266 |
else |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
267 |
{ |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
268 |
whiteOutReportFailure(whitey); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
269 |
alert(response); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
270 |
} |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
271 |
}, 'html'); |
190
e858bacb5cfa
Sidebar blocks can be renamed now (untested except in Fx2)
Dan
parents:
80
diff
changeset
|
272 |
} |
e858bacb5cfa
Sidebar blocks can be renamed now (untested except in Fx2)
Dan
parents:
80
diff
changeset
|
273 |
|
885
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
274 |
function sbedit_get_parent(a) |
190
e858bacb5cfa
Sidebar blocks can be renamed now (untested except in Fx2)
Dan
parents:
80
diff
changeset
|
275 |
{ |
885
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
276 |
var o = a.parentNode; |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
277 |
while ( !$(o).hasClass('sbedit-block') ) |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
278 |
o = o.parentNode; |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
279 |
|
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
280 |
return o; |
190
e858bacb5cfa
Sidebar blocks can be renamed now (untested except in Fx2)
Dan
parents:
80
diff
changeset
|
281 |
} |
e858bacb5cfa
Sidebar blocks can be renamed now (untested except in Fx2)
Dan
parents:
80
diff
changeset
|
282 |
|
885
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
283 |
function ajaxUpdateSidebarOrder() |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
284 |
{ |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
285 |
setAjaxLoading(); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
286 |
var ser = serialize_sidebar(); |
1039
4226cedb3bc4
Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents:
943
diff
changeset
|
287 |
if ( !ser ) |
4226cedb3bc4
Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents:
943
diff
changeset
|
288 |
{ |
4226cedb3bc4
Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents:
943
diff
changeset
|
289 |
var msg = document.createElement('div'); |
4226cedb3bc4
Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents:
943
diff
changeset
|
290 |
$(msg) |
4226cedb3bc4
Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents:
943
diff
changeset
|
291 |
.addClass('error-box-mini') |
4226cedb3bc4
Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents:
943
diff
changeset
|
292 |
.text('jQuery failure: returned invalid serialized sidebar data') |
4226cedb3bc4
Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents:
943
diff
changeset
|
293 |
.css('position', 'fixed') |
4226cedb3bc4
Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents:
943
diff
changeset
|
294 |
.css('bottom', 1) |
4226cedb3bc4
Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents:
943
diff
changeset
|
295 |
.appendTo('body') |
4226cedb3bc4
Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents:
943
diff
changeset
|
296 |
.css('left', ( getWidth() / 2 ) - ( $(msg).width() / 2 )); |
4226cedb3bc4
Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents:
943
diff
changeset
|
297 |
setTimeout(function() |
4226cedb3bc4
Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents:
943
diff
changeset
|
298 |
{ |
4226cedb3bc4
Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents:
943
diff
changeset
|
299 |
$(msg).fadeOut(500, function() { $(this).remove(); }); |
4226cedb3bc4
Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents:
943
diff
changeset
|
300 |
}, 1000); |
4226cedb3bc4
Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents:
943
diff
changeset
|
301 |
unsetAjaxLoading(); |
4226cedb3bc4
Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents:
943
diff
changeset
|
302 |
return false; |
4226cedb3bc4
Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents:
943
diff
changeset
|
303 |
} |
885
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
304 |
$.post(makeUrlNS('Special', 'EditSidebar', 'update_order'), { order: ser }, function(response, statustext) |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
305 |
{ |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
306 |
var msg = document.createElement('div'); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
307 |
$(msg) |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
308 |
.addClass('info-box-mini') |
1039
4226cedb3bc4
Fixed one unlocalized string in sidebar editor; fixed sidebar editor jQuery init race condition seen under Firefox and Chromium on 64-bit
Dan
parents:
943
diff
changeset
|
309 |
.text($lang.get('sbedit_msg_order_saved')) |
885
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
310 |
.css('position', 'fixed') |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
311 |
.css('bottom', 1) |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
312 |
.appendTo('body') |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
313 |
.css('left', ( getWidth() / 2 ) - ( $(msg).width() / 2 )); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
314 |
setTimeout(function() |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
315 |
{ |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
316 |
$(msg).fadeOut(500, function() { $(this).remove(); }); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
317 |
}, 1000); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
318 |
unsetAjaxLoading(); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
319 |
}, 'json'); |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
320 |
} |
a86a69394a95
Major revamp to sidebar editor. Some behavioral changes as well as being based on jQuery UI Sortables. Creation interface remains the same, but better strings merged in from stable.
Dan
parents:
407
diff
changeset
|
321 |