Ticket #1426: admin-js-fixes.diff

File admin-js-fixes.diff, 5.8 KB (added by anonymous, 19 years ago)
  • django/django/contrib/admin/media/js/admin/RelatedObjectLookups.js

     
    33
    44function showRelatedObjectLookupPopup(triggeringLink) {
    55    var name = triggeringLink.id.replace(/^lookup_/, '');
    6     var href
     6    var href;
    77    if (triggeringLink.href.search(/\?/) >= 0) {
    88        href = triggeringLink.href + '&pop=1';
    99    } else {
    10         href = triggeringLink.href + '?pop=1'
     10        href = triggeringLink.href + '?pop=1';
    1111    }
    1212    var win = window.open(href, name, 'height=500,width=740,resizable=yes,scrollbars=yes');
    1313    win.focus();
     
    3333}
    3434
    3535function dismissAddAnotherPopup(win, newId, newRepr) {
    36     var name = win.name.replace(/___/g, '.')
     36    var name = win.name.replace(/___/g, '.');
    3737    var elem = document.getElementById(name);
    3838    if (elem) {
    3939        if (elem.nodeName == 'SELECT') {
     
    3838    if (elem) {
    3939        if (elem.nodeName == 'SELECT') {
    4040            var o = new Option(newRepr, newId);
    41             elem.options[elem.options.length] = o
     41            elem.options[elem.options.length] = o;
    4242            elem.selectedIndex = elem.length - 1;
    4343        } else if (elem.nodeName == 'INPUT') {
    4444            elem.value = newId;
  • django/django/contrib/admin/media/js/calendar.js

     
    102102    this.today = new Date();
    103103    this.currentMonth = this.today.getMonth() + 1;
    104104    this.currentYear = this.today.getFullYear();
    105     this.drawCurrent = function() {
     105}
     106Calendar.prototype = {
     107    drawCurrent: function() {
    106108        CalendarNamespace.draw(this.currentMonth, this.currentYear, this.div_id, this.callback);
    107     }
    108     this.drawDate = function(month, year) {
     109    },
     110    drawDate: function(month, year) {
    109111        this.currentMonth = month;
    110112        this.currentYear = year;
    111113        this.drawCurrent();
    112     }
    113     this.drawPreviousMonth = function() {
     114    },
     115    drawPreviousMonth: function() {
    114116        if (this.currentMonth == 1) {
    115117            this.currentMonth = 12;
    116118            this.currentYear--;
     
    119121            this.currentMonth--;
    120122        }
    121123        this.drawCurrent();
    122     }
    123     this.drawNextMonth = function() {
     124    },
     125    drawNextMonth: function() {
    124126        if (this.currentMonth == 12) {
    125127            this.currentMonth = 1;
    126128            this.currentYear++;
     
    129131            this.currentMonth++;
    130132        }
    131133        this.drawCurrent();
    132     }
    133     this.drawPreviousYear = function() {
     134    },
     135    drawPreviousYear: function() {
    134136        this.currentYear--;
    135137        this.drawCurrent();
    136     }
    137     this.drawNextYear = function() {
     138    },
     139    drawNextYear: function() {
    138140        this.currentYear++;
    139141        this.drawCurrent();
    140142    }
  • django/django/contrib/admin/media/js/core.js

     
    7070    var curleft = 0;
    7171    if (obj.offsetParent) {
    7272        while (obj.offsetParent) {
    73             curleft += obj.offsetLeft
     73            curleft += obj.offsetLeft;
    7474            obj = obj.offsetParent;
    7575        }
    7676    } else if (obj.x) {
     
    8383    var curtop = 0;
    8484    if (obj.offsetParent) {
    8585        while (obj.offsetParent) {
    86             curtop += obj.offsetTop
     86            curtop += obj.offsetTop;
    8787            obj = obj.offsetParent;
    8888        }
    8989    } else if (obj.y) {
     
    130130// String object extensions
    131131// ----------------------------------------------------------------------------
    132132String.prototype.pad_left = function(pad_length, pad_string) {
    133     new_string = this;
     133    var new_string = this;
    134134    for (var i = 0; new_string.length < pad_length; i++) {
    135135        new_string = pad_string + new_string;
    136136    }
  • django/django/contrib/admin/media/js/dateparse.js

     
    44*/
    55
    66/* Finds the index of the first occurence of item in the array, or -1 if not found */
    7 Array.prototype.indexOf = function(item) {
    8     for (var i = 0; i < this.length; i++) {
    9         if (this[i] == item) {
    10             return i;
     7if (typeof Array.prototype.indexOf == 'undefined') {
     8    Array.prototype.indexOf = function(item) {
     9        var len = this.length;
     10        for (var i = 0; i < len; i++) {
     11            if (this[i] == item) {
     12                return i;
     13            }
    1114        }
    12     }
    13     return -1;
    14 };
     15        return -1;
     16    };
     17}
    1518/* Returns an array of items judged 'true' by the passed in test function */
    16 Array.prototype.filter = function(test) {
    17     var matches = [];
    18     for (var i = 0; i < this.length; i++) {
    19         if (test(this[i])) {
    20             matches[matches.length] = this[i];
     19if (typeof Array.prototype.filter == 'undefined') {
     20    Array.prototype.filter = function(test) {
     21        var matches = [];
     22        var len = this.length;
     23        for (var i = 0; i < len; i++) {
     24            if (test(this[i])) {
     25                matches[matches.length] = this[i];
     26            }
    2127        }
    22     }
    23     return matches;
    24 };
     28        return matches;
     29    };
     30}
    2531
    2632var monthNames = gettext("January February March April May June July August September October November December").split(" ");
    2733var weekdayNames = gettext("Sunday Monday Tuesday Wednesday Thursday Friday Saturday").split(" ");
Back to Top