Ticket #4120: admin-js.2.diff

File admin-js.2.diff, 4.0 KB (added by arvin, 18 years ago)
  • js/core.js

     
    2525    }
    2626}
    2727
     28function cancelEventPropagation(e) {
     29    if (!e) e = window.event;
     30    e.cancelBubble = true;
     31    if (e.stopPropagation) e.stopPropagation();
     32}
     33
    2834// quickElement(tagType, parentReference, textInChildNode, [, attribute, attributeValue ...]);
    2935function quickElement() {
    3036    var obj = document.createElement(arguments[0]);
     
    4046    return obj;
    4147}
    4248
     49// "a" is reference to an object
     50function removeChildren(a) {
     51    while (a.hasChildNodes()) a.removeChild(a.lastChild);
     52}
     53
    4354// ----------------------------------------------------------------------------
    4455// Cross-browser xmlhttp object
    4556// from http://jibbering.com/2002/4/httprequest.html
  • js/calendar.js

     
    22calendar.js - Calendar functions by Adrian Holovaty
    33*/
    44
    5 function removeChildren(a) { // "a" is reference to an object
    6     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 
    245// CalendarNamespace -- Provides a collection of HTML calendar-related helper functions
    256var CalendarNamespace = {
    267    monthsOfYear: gettext('January February March April May June July August September October November December').split(' '),
  • js/admin/ordering.js

     
    119119    lis = temp_lis;
    120120    draw();
    121121}
    122 
    123 function addEvent(elm, evType, fn, useCapture)
    124 // addEvent and removeEvent
    125 // cross-browser event handling for IE5+,  NS6 and Mozilla
    126 // By Scott Andrew
    127 {
    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

     
    7575        clock_box.className = 'clockbox module';
    7676        clock_box.setAttribute('id', DateTimeShortcuts.clockDivName + num);
    7777        document.body.appendChild(clock_box);
    78         addEvent(clock_box, 'click', DateTimeShortcuts.cancelEventPropagation);
     78        addEvent(clock_box, 'click', cancelEventPropagation);
    7979
    8080        quickElement('h2', clock_box, gettext('Choose a time'));
    8181        time_list = quickElement('ul', clock_box, '');
     
    163163        cal_box.className = 'calendarbox module';
    164164        cal_box.setAttribute('id', DateTimeShortcuts.calendarDivName1 + num);
    165165        document.body.appendChild(cal_box);
    166         addEvent(cal_box, 'click', DateTimeShortcuts.cancelEventPropagation);
     166        addEvent(cal_box, 'click', cancelEventPropagation);
    167167
    168168        // next-prev links
    169169        var cal_nav = quickElement('div', cal_box, '');
     
    230230       d.setDate(d.getDate() + offset)
    231231       DateTimeShortcuts.calendarInputs[num].value = d.getISODate();
    232232       DateTimeShortcuts.dismissCalendar(num);
    233     },
    234     cancelEventPropagation: function(e) {
    235         if (!e) e = window.event;
    236         e.cancelBubble = true;
    237         if (e.stopPropagation) e.stopPropagation();
    238233    }
    239234}
    240235
Back to Top