Fixed JavaScript "strict" violations.
This commit is contained in:
parent
3c0770f23d
commit
fbb4f0797c
|
@ -1,4 +1,6 @@
|
|||
/*eslint no-cond-assign:1*/
|
||||
(function() {
|
||||
'use strict';
|
||||
var SelectBox = {
|
||||
cache: {},
|
||||
init: function(id) {
|
||||
|
@ -115,3 +117,5 @@ var SelectBox = {
|
|||
}
|
||||
}
|
||||
};
|
||||
window.SelectBox = SelectBox;
|
||||
})();
|
||||
|
|
|
@ -5,6 +5,7 @@ SelectFilter2 - Turns a multiple-select box into a filter interface.
|
|||
Requires core.js, SelectBox.js and addevent.js.
|
||||
*/
|
||||
(function($) {
|
||||
'use strict';
|
||||
function findForm(node) {
|
||||
// returns the node of the form containing the given node
|
||||
if (node.tagName.toLowerCase() !== 'form') {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*global _actions_icnt, gettext, interpolate, ngettext*/
|
||||
(function($) {
|
||||
'use strict';
|
||||
var lastChecked;
|
||||
|
||||
$.fn.actions = function(opts) {
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
// Inserts shortcut buttons after all of the following:
|
||||
// <input type="text" class="vDateField">
|
||||
// <input type="text" class="vTimeField">
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
var DateTimeShortcuts = {
|
||||
calendars: [],
|
||||
calendarInputs: [],
|
||||
|
@ -359,3 +360,5 @@ var DateTimeShortcuts = {
|
|||
};
|
||||
|
||||
addEvent(window, 'load', DateTimeShortcuts.init);
|
||||
window.DateTimeShortcuts = DateTimeShortcuts;
|
||||
})();
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
// Handles related-objects functionality: lookup link for raw_id_fields
|
||||
// and Add Another links.
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
function html_unescape(text) {
|
||||
// Unescape a string that was escaped using django.utils.html.escape.
|
||||
text = text.replace(/</g, '<');
|
||||
|
@ -137,6 +140,21 @@ function dismissDeleteRelatedObjectPopup(win, objId) {
|
|||
win.close();
|
||||
}
|
||||
|
||||
// Global for testing purposes
|
||||
window.html_unescape = html_unescape;
|
||||
window.id_to_windowname = id_to_windowname;
|
||||
window.windowname_to_id = windowname_to_id;
|
||||
|
||||
window.showRelatedObjectLookupPopup = showRelatedObjectLookupPopup;
|
||||
window.dismissRelatedLookupPopup = dismissRelatedLookupPopup;
|
||||
window.showRelatedObjectPopup = showRelatedObjectPopup;
|
||||
window.updateRelatedObjectLinks = updateRelatedObjectLinks;
|
||||
window.dismissAddRelatedObjectPopup = dismissAddRelatedObjectPopup;
|
||||
window.dismissChangeRelatedObjectPopup = dismissChangeRelatedObjectPopup;
|
||||
window.dismissDeleteRelatedObjectPopup = dismissDeleteRelatedObjectPopup;
|
||||
|
||||
// Kept for backward compatibility
|
||||
var showAddAnotherPopup = showRelatedObjectPopup;
|
||||
var dismissAddAnotherPopup = dismissAddRelatedObjectPopup;
|
||||
window.showAddAnotherPopup = showRelatedObjectPopup;
|
||||
window.dismissAddAnotherPopup = dismissAddRelatedObjectPopup;
|
||||
|
||||
})();
|
||||
|
|
|
@ -4,6 +4,8 @@ calendar.js - Calendar functions by Adrian Holovaty
|
|||
depends on core.js for utility functions like removeChildren or quickElement
|
||||
*/
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
// CalendarNamespace -- Provides a collection of HTML calendar-related helper functions
|
||||
var CalendarNamespace = {
|
||||
monthsOfYear: gettext('January February March April May June July August September October November December').split(' '),
|
||||
|
@ -172,3 +174,5 @@ Calendar.prototype = {
|
|||
this.drawCurrent();
|
||||
}
|
||||
};
|
||||
window.Calendar = Calendar;
|
||||
})();
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*global gettext*/
|
||||
(function($) {
|
||||
'use strict';
|
||||
$(document).ready(function() {
|
||||
// Add anchor tag for Show/Hide link
|
||||
$("fieldset.collapse").each(function(i, elem) {
|
||||
|
|
|
@ -6,6 +6,7 @@ var isIE = ((document.all) && (!isOpera)) && parseFloat(navigator.appVersion.spl
|
|||
|
||||
// Cross-browser event handlers.
|
||||
function addEvent(obj, evType, fn) {
|
||||
'use strict';
|
||||
if (obj.addEventListener) {
|
||||
obj.addEventListener(evType, fn, false);
|
||||
return true;
|
||||
|
@ -18,6 +19,7 @@ function addEvent(obj, evType, fn) {
|
|||
}
|
||||
|
||||
function removeEvent(obj, evType, fn) {
|
||||
'use strict';
|
||||
if (obj.removeEventListener) {
|
||||
obj.removeEventListener(evType, fn, false);
|
||||
return true;
|
||||
|
@ -30,6 +32,7 @@ function removeEvent(obj, evType, fn) {
|
|||
}
|
||||
|
||||
function cancelEventPropagation(e) {
|
||||
'use strict';
|
||||
if (!e) {
|
||||
e = window.event;
|
||||
}
|
||||
|
@ -41,6 +44,7 @@ function cancelEventPropagation(e) {
|
|||
|
||||
// quickElement(tagType, parentReference [, textInChildNode, attribute, attributeValue ...]);
|
||||
function quickElement() {
|
||||
'use strict';
|
||||
var obj = document.createElement(arguments[0]);
|
||||
if (arguments[2]) {
|
||||
var textNode = document.createTextNode(arguments[2]);
|
||||
|
@ -56,6 +60,7 @@ function quickElement() {
|
|||
|
||||
// "a" is reference to an object
|
||||
function removeChildren(a) {
|
||||
'use strict';
|
||||
while (a.hasChildNodes()) {
|
||||
a.removeChild(a.lastChild);
|
||||
}
|
||||
|
@ -89,6 +94,7 @@ if (!xmlhttp && typeof XMLHttpRequest !== 'undefined') {
|
|||
// See http://www.quirksmode.org/js/findpos.html
|
||||
// ----------------------------------------------------------------------------
|
||||
function findPosX(obj) {
|
||||
'use strict';
|
||||
var curleft = 0;
|
||||
if (obj.offsetParent) {
|
||||
while (obj.offsetParent) {
|
||||
|
@ -106,6 +112,7 @@ function findPosX(obj) {
|
|||
}
|
||||
|
||||
function findPosY(obj) {
|
||||
'use strict';
|
||||
var curtop = 0;
|
||||
if (obj.offsetParent) {
|
||||
while (obj.offsetParent) {
|
||||
|
@ -125,7 +132,8 @@ function findPosY(obj) {
|
|||
//-----------------------------------------------------------------------------
|
||||
// Date object extensions
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
Date.prototype.getTwelveHours = function() {
|
||||
var hours = this.getHours();
|
||||
if (hours === 0) {
|
||||
|
@ -235,10 +243,12 @@ String.prototype.strptime = function(format) {
|
|||
return new Date(year, month, day);
|
||||
};
|
||||
|
||||
})();
|
||||
// ----------------------------------------------------------------------------
|
||||
// Get the computed style for and element
|
||||
// ----------------------------------------------------------------------------
|
||||
function getStyle(oElm, strCssRule) {
|
||||
'use strict';
|
||||
var strValue = "";
|
||||
if(document.defaultView && document.defaultView.getComputedStyle) {
|
||||
strValue = document.defaultView.getComputedStyle(oElm, "").getPropertyValue(strCssRule);
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
* See: http://www.opensource.org/licenses/bsd-license.php
|
||||
*/
|
||||
(function($) {
|
||||
'use strict';
|
||||
$.fn.formset = function(opts) {
|
||||
var options = $.extend({}, $.fn.formset.defaults, opts);
|
||||
var $this = $(this);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*global URLify*/
|
||||
(function($) {
|
||||
'use strict';
|
||||
$.fn.prepopulate = function(dependencies, maxLength, allowUnicode) {
|
||||
/*
|
||||
Depends on urlify.js
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
(function() {
|
||||
'use strict';
|
||||
var timeParsePatterns = [
|
||||
// 9
|
||||
{
|
||||
|
@ -99,3 +101,6 @@ function parseTimeString(s) {
|
|||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
window.parseTimeString = parseTimeString;
|
||||
})();
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
/*global XRegExp*/
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
var LATIN_MAP = {
|
||||
'À': 'A', 'Á': 'A', 'Â': 'A', 'Ã': 'A', 'Ä': 'A', 'Å': 'A', 'Æ': 'AE',
|
||||
'Ç': 'C', 'È': 'E', 'É': 'E', 'Ê': 'E', 'Ë': 'E', 'Ì': 'I', 'Í': 'I',
|
||||
|
@ -47,8 +50,8 @@ var RUSSIAN_MAP = {
|
|||
'Ы': 'Y', 'Ь': '', 'Э': 'E', 'Ю': 'Yu', 'Я': 'Ya'
|
||||
};
|
||||
var UKRAINIAN_MAP = {
|
||||
'Є': 'Ye', 'І': 'I', 'Ї': 'Yi', 'Ґ': 'G', 'є': 'ye', 'і': 'i', 'ї': 'yi',
|
||||
'ґ': 'g'
|
||||
'Є': 'Ye', 'І': 'I', 'Ї': 'Yi', 'Ґ': 'G', 'є': 'ye', 'і': 'i',
|
||||
'ї': 'yi', 'ґ': 'g'
|
||||
};
|
||||
var CZECH_MAP = {
|
||||
'č': 'c', 'ď': 'd', 'ě': 'e', 'ň': 'n', 'ř': 'r', 'š': 's', 'ť': 't',
|
||||
|
@ -80,8 +83,9 @@ var LITHUANIAN_MAP = {
|
|||
'Ū': 'U', 'Ž': 'Z'
|
||||
};
|
||||
var SERBIAN_MAP = {
|
||||
'ђ': 'dj', 'ј': 'j', 'љ': 'lj', 'њ': 'nj', 'ћ': 'c', 'џ': 'dz', 'đ': 'dj',
|
||||
'Ђ': 'Dj', 'Ј': 'j', 'Љ': 'Lj', 'Њ': 'Nj', 'Ћ': 'C', 'Џ': 'Dz', 'Đ': 'Dj'
|
||||
'ђ': 'dj', 'ј': 'j', 'љ': 'lj', 'њ': 'nj', 'ћ': 'c', 'џ': 'dz',
|
||||
'đ': 'dj', 'Ђ': 'Dj', 'Ј': 'j', 'Љ': 'Lj', 'Њ': 'Nj', 'Ћ': 'C',
|
||||
'Џ': 'Dz', 'Đ': 'Dj'
|
||||
};
|
||||
var AZERBAIJANI_MAP = {
|
||||
'ç': 'c', 'ə': 'e', 'ğ': 'g', 'ı': 'i', 'ö': 'o', 'ş': 's', 'ü': 'u',
|
||||
|
@ -163,3 +167,5 @@ function URLify(s, num_chars, allowUnicode) {
|
|||
s = s.toLowerCase(); // convert to lowercase
|
||||
return s.substring(0, num_chars);// trim to first num_chars chars
|
||||
}
|
||||
window.URLify = URLify;
|
||||
})();
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*global OpenLayers*/
|
||||
(function() {
|
||||
'use strict';
|
||||
/**
|
||||
* Transforms an array of features to a single feature with the merged
|
||||
* geometry of geom_type
|
||||
|
|
Loading…
Reference in New Issue