aboutsummaryrefslogtreecommitdiffstats
path: root/data/lib/util.js
diff options
context:
space:
mode:
Diffstat (limited to 'data/lib/util.js')
-rw-r--r--data/lib/util.js66
1 files changed, 33 insertions, 33 deletions
diff --git a/data/lib/util.js b/data/lib/util.js
index 1c3e607..92b9436 100644
--- a/data/lib/util.js
+++ b/data/lib/util.js
@@ -1,5 +1,5 @@
-/*global console: false */
-/*jslint onevar: false */
+/* global console: false */
+/* jslint onevar: false */
// Released under the MIT/X11 license
// http://www.opensource.org/licenses/mit-license.php
"use strict";
@@ -7,14 +7,14 @@
/**
* parse URL to get its parts.
- *
+ *
* @param url
* @return object with all parsed parts of URL as properties
- *
+ *
* Originally from
* http://james.padolsey.com/javascript/parsing-urls-with-the-dom/ Copyright
* February 19th, 2009, James Padolsey, <license undeclared>
- *
+ *
* This function creates a new anchor element and uses location properties
* (inherent) to get the desired URL data. Some String operations are used (to
* normalize results across browsers).
@@ -30,8 +30,8 @@ function parseURL(url) {
query: a.search,
params: (function(){
var ret = {},
- seg = a.search.replace(/^\?/,'').split('&'),
- len = seg.length, i = 0, s;
+ seg = a.search.replace(/^\?/,'').split('&'),
+ len = seg.length, i = 0, s;
for (;i<len;i++) {
if (!seg[i]) { continue; }
s = seg[i].split('=');
@@ -50,7 +50,7 @@ function parseURL(url) {
/**
* parse XML object out of string working around various bugs in Gecko
* implementation see https://developer.mozilla.org/en/E4X for more information
- *
+ *
* @param inStr
* String with unparsed XML string
* @return XML object
@@ -60,7 +60,7 @@ function parseXMLfromString (inStuff) {
// this.response
// and get just .text property out of it. TODO
var respStr = inStuff.replace(/^<\?xml\s+version\s*=\s*(["'])[^\1]+\1[^?]*\?>/, ""); // bug
- // 336551
+ // 336551
return new XML(respStr);
}
@@ -74,7 +74,7 @@ function getBugNo() {
/**
* Get a bug no from URL ... fails with aliases
- *
+ *
* @param url
* String with URL to be analyzed
* @return String with the bug ID
@@ -88,7 +88,7 @@ function getBugNoFromURL(url) {
/**
* Send mouse click to the specified element
- *
+ *
* @param String
* ID of the element to send mouseclick to
* @return None
@@ -103,7 +103,7 @@ function clickMouse (targetID) {
/**
* Create a A element leadink nowhere, but with listener running a callback on
* the click
- *
+ *
* @param id
* String with a id to be added to the element
* @param text
@@ -173,10 +173,10 @@ function createDeadLink (id, text, parent, callback, params, before, covered, ac
* From <a> element diggs out just plain email address Note that
* bugzilla.gnome.org doesn't have mailto: url but
* https://bugzilla.gnome.org/page.cgi?id=describeuser.html&login=mcepl%40redhat.com
- *
+ *
* @param aElement Element with href attribute or something else @return String
* with the address or null
- *
+ *
*/
function parseMailto(aElement) {
var emailStr = "", hrefStr = "";
@@ -196,7 +196,7 @@ function parseMailto(aElement) {
/**
* format date to be in ISO format (just day part)
- *
+ *
* @param date
* @return string with the formatted date
*/
@@ -206,13 +206,13 @@ function getISODate(dateStr) {
}
var date = new Date(dateStr);
return date.getFullYear() + '-' + pad(date.getMonth() + 1) + '-' +
- pad(date.getDate());
+ pad(date.getDate());
}
/**
* Check whether an item is member of the list. Idea is just to make long if
* commands slightly more readable.
- *
+ *
* @param mbr
* string to be searched in the list
* @param list
@@ -228,23 +228,23 @@ function isInList(mbr, list) {
/**
* Make sure value returned is Array
- *
+ *
* @param Array/String
* @return Array
- *
+ *
* If something else than Array or String is passed to the function the result
* will be untouched actual argument of the call.
*/
function valToArray(val) {
var isArr = val &&
- val.constructor &&
- val.constructor.name === "Array";
+ val.constructor &&
+ val.constructor.name === "Array";
return isArr ? val : [val];
}
/**
* Merges two comma separated string as a list and returns new string
- *
+ *
* @param str
* String with old values
* @param value
@@ -268,7 +268,7 @@ function addCSVValue(str, value) {
/**
* Treats comma separated string as a list and removes one item from it
- *
+ *
* @param str
* String treated as a list
* @param value
@@ -288,7 +288,7 @@ function removeCSVValue(str, value) {
/**
* select element of the array where regexp in the first element matches second
* parameter of this function
- *
+ *
* @param list
* Array with regexps and return values
* @param chosingMark
@@ -312,7 +312,7 @@ function filterByRegexp(list, chosingMark) {
/**
* remove elements from the page based on their IDs
- *
+ *
* @param doc
* Document object
* @param target
@@ -339,19 +339,19 @@ function killNodes(doc, target, remove) {
/**
* Remove duplicate elements from array
- *
+ *
* @param arr
* Array which needs to be cleaned up
* @return cleaned up array
*/
function removeDuplicates (arr) {
for (var i = 0; i < arr.length; i++) {
- for (var j = i + 1; j < arr.length; j++) {
- if (arr[i] == arr[j]) {
- arr.splice (j, 1);
+ for (var j = i + 1; j < arr.length; j++) {
+ if (arr[i] == arr[j]) {
+ arr.splice (j, 1);
+ }
}
}
- }
return arr;
}
@@ -361,12 +361,12 @@ function removeDuplicates (arr) {
* Message("GetPassword", { login: login, hostname: location.hostname }));
*/
function Message(cmd, data) {
- this.cmd = cmd;
- this.data = data;
+ this.cmd = cmd;
+ this.data = data;
}
function log(msg) {
- self.postMessage(new Message("LogMessage", msg));
+ self.postMessage(new Message("LogMessage", msg));
}
var NotLoggedinException = function NotLoggedinException (message) {