Ticket #4120: admin-js.2.diff
File admin-js.2.diff, 4.0 KB (added by , 18 years ago) |
---|
-
js/core.js
25 25 } 26 26 } 27 27 28 function cancelEventPropagation(e) { 29 if (!e) e = window.event; 30 e.cancelBubble = true; 31 if (e.stopPropagation) e.stopPropagation(); 32 } 33 28 34 // quickElement(tagType, parentReference, textInChildNode, [, attribute, attributeValue ...]); 29 35 function quickElement() { 30 36 var obj = document.createElement(arguments[0]); … … 40 46 return obj; 41 47 } 42 48 49 // "a" is reference to an object 50 function removeChildren(a) { 51 while (a.hasChildNodes()) a.removeChild(a.lastChild); 52 } 53 43 54 // ---------------------------------------------------------------------------- 44 55 // Cross-browser xmlhttp object 45 56 // from http://jibbering.com/2002/4/httprequest.html -
js/calendar.js
2 2 calendar.js - Calendar functions by Adrian Holovaty 3 3 */ 4 4 5 function removeChildren(a) { // "a" is reference to an object6 while (a.hasChildNodes()) a.removeChild(a.lastChild);7 }8 9 // quickElement(tagType, parentReference, textInChildNode, [, attribute, attributeValue ...]);10 function quickElement() {11 var obj = document.createElement(arguments[0]);12 if (arguments[2] != '' && arguments[2] != null) {13 var textNode = document.createTextNode(arguments[2]);14 obj.appendChild(textNode);15 }16 var len = arguments.length;17 for (var i = 3; i < len; i += 2) {18 obj.setAttribute(arguments[i], arguments[i+1]);19 }20 arguments[1].appendChild(obj);21 return obj;22 }23 24 5 // CalendarNamespace -- Provides a collection of HTML calendar-related helper functions 25 6 var CalendarNamespace = { 26 7 monthsOfYear: gettext('January February March April May June July August September October November December').split(' '), -
js/admin/ordering.js
119 119 lis = temp_lis; 120 120 draw(); 121 121 } 122 123 function addEvent(elm, evType, fn, useCapture)124 // addEvent and removeEvent125 // cross-browser event handling for IE5+, NS6 and Mozilla126 // By Scott Andrew127 {128 if (elm.addEventListener){129 elm.addEventListener(evType, fn, useCapture);130 return true;131 } else if (elm.attachEvent){132 var r = elm.attachEvent("on"+evType, fn);133 return r;134 } else {135 elm['on'+evType] = fn;136 }137 } -
js/admin/DateTimeShortcuts.js
75 75 clock_box.className = 'clockbox module'; 76 76 clock_box.setAttribute('id', DateTimeShortcuts.clockDivName + num); 77 77 document.body.appendChild(clock_box); 78 addEvent(clock_box, 'click', DateTimeShortcuts.cancelEventPropagation);78 addEvent(clock_box, 'click', cancelEventPropagation); 79 79 80 80 quickElement('h2', clock_box, gettext('Choose a time')); 81 81 time_list = quickElement('ul', clock_box, ''); … … 163 163 cal_box.className = 'calendarbox module'; 164 164 cal_box.setAttribute('id', DateTimeShortcuts.calendarDivName1 + num); 165 165 document.body.appendChild(cal_box); 166 addEvent(cal_box, 'click', DateTimeShortcuts.cancelEventPropagation);166 addEvent(cal_box, 'click', cancelEventPropagation); 167 167 168 168 // next-prev links 169 169 var cal_nav = quickElement('div', cal_box, ''); … … 230 230 d.setDate(d.getDate() + offset) 231 231 DateTimeShortcuts.calendarInputs[num].value = d.getISODate(); 232 232 DateTimeShortcuts.dismissCalendar(num); 233 },234 cancelEventPropagation: function(e) {235 if (!e) e = window.event;236 e.cancelBubble = true;237 if (e.stopPropagation) e.stopPropagation();238 233 } 239 234 } 240 235