Commit 2aaacd10 authored by Ivan Tyagov's avatar Ivan Tyagov

jslint sanitize code.

parent 3f1b27e6
/*! RenderJs v0.2 */ /*! RenderJs v0.2 */
/*global console, require, $, localStorage, document */ /*global console, require, $, localStorage, document, jIO */
/*jslint evil: true, white: true */
"use strict"; "use strict";
/* /*
...@@ -17,8 +19,8 @@ var RENDERJS_ENABLE_IMPLICIT_INTERACTION_BIND = true; ...@@ -17,8 +19,8 @@ var RENDERJS_ENABLE_IMPLICIT_INTERACTION_BIND = true;
// fallback for IE // fallback for IE
if (typeof console === "undefined" || typeof console.log === "undefined") { if (typeof console === "undefined" || typeof console.log === "undefined") {
console = {}; var console = {};
console.log = function () {}; console.log = function () {};
} }
var RenderJs = (function () { var RenderJs = (function () {
...@@ -43,7 +45,7 @@ var RenderJs = (function () { ...@@ -43,7 +45,7 @@ var RenderJs = (function () {
RenderJs.bindReady( RenderJs.bindReady(
function () { function () {
// examine all Intaction Gadgets and bind accordingly // examine all Intaction Gadgets and bind accordingly
$("div[data-gadget-connection]").each( function (index, element) { $("div[data-gadget-connection]").each(function (index, element) {
RenderJs.InteractionGadget.bind($(element)); RenderJs.InteractionGadget.bind($(element));
}); });
}); });
...@@ -354,12 +356,10 @@ var RenderJs = (function () { ...@@ -354,12 +356,10 @@ var RenderJs = (function () {
return { return {
get: function (cache_id, default_value) { get: function (cache_id, default_value) {
/* Get cache key value */ /* Get cache key value */
if (cache_id in localStorage) { if (localStorage.getItem(cache_id) !== null) {
return JSON.parse(localStorage.getItem(cache_id)); return JSON.parse(localStorage.getItem(cache_id));
} }
else { return default_value;
return default_value;
}
}, },
set: function (cache_id, data) { set: function (cache_id, data) {
...@@ -390,7 +390,7 @@ var RenderJs = (function () { ...@@ -390,7 +390,7 @@ var RenderJs = (function () {
}; };
}()), }()),
Gadget: (function (gadget_id, dom) { Gadget: function (gadget_id, dom) {
/* /*
* Javascript Gadget representation * Javascript Gadget representation
*/ */
...@@ -429,7 +429,7 @@ var RenderJs = (function () { ...@@ -429,7 +429,7 @@ var RenderJs = (function () {
// remove its DOM element // remove its DOM element
$(this.getDom()).remove(); $(this.getDom()).remove();
}; };
}), },
TabbularGadget: (function () { TabbularGadget: (function () {
/* /*
...@@ -562,9 +562,9 @@ var RenderJs = (function () { ...@@ -562,9 +562,9 @@ var RenderJs = (function () {
function updateGadgetIndexFromURL(url) { function updateGadgetIndexFromURL(url) {
// split to base and document url // split to base and document url
var url_list = url.split('/'), var url_list = url.split('/'),
document_url = url_list[url_list.length-1]; document_url = url_list[url_list.length-1],
url_list.splice($.inArray(document_url, url_list), 1); d = url_list.splice($.inArray(document_url, url_list), 1),
var base_url = url_list.join('/'), base_url = url_list.join('/'),
web_dav = jIO.newJio({ web_dav = jIO.newJio({
"type": "dav", "type": "dav",
"username": "", "username": "",
...@@ -574,7 +574,7 @@ var RenderJs = (function () { ...@@ -574,7 +574,7 @@ var RenderJs = (function () {
function (err, response) { function (err, response) {
RenderJs.Cache.set(url, response); RenderJs.Cache.set(url, response);
}); });
}; }
return { return {
updateGadgetIndex: function () { updateGadgetIndex: function () {
...@@ -592,7 +592,7 @@ var RenderJs = (function () { ...@@ -592,7 +592,7 @@ var RenderJs = (function () {
* Set list of Gadget Index repositories. * Set list of Gadget Index repositories.
*/ */
// store in Cache (html5 storage) // store in Cache (html5 storage)
RenderJs.Cache.set(cache_id, url_list) RenderJs.Cache.set(cache_id, url_list);
}, },
getGadgetIndexUrlList: function () { getGadgetIndexUrlList: function () {
...@@ -600,7 +600,7 @@ var RenderJs = (function () { ...@@ -600,7 +600,7 @@ var RenderJs = (function () {
* Get list of Gadget Index repositories. * Get list of Gadget Index repositories.
*/ */
// get from Cache (html5 storage) // get from Cache (html5 storage)
return RenderJs.Cache.get(cache_id, undefined) return RenderJs.Cache.get(cache_id, undefined);
}, },
getGadgetListThatProvide: function (service) { getGadgetListThatProvide: function (service) {
...@@ -611,19 +611,19 @@ var RenderJs = (function () { ...@@ -611,19 +611,19 @@ var RenderJs = (function () {
*/ */
// XXX: get from Cache stored index and itterate over it // XXX: get from Cache stored index and itterate over it
// to find matching ones // to find matching ones
var gadget_list = new Array(); var gadget_list = [];
$.each(RenderJs.GadgetCatalog.getGadgetIndexUrlList(), $.each(RenderJs.GadgetCatalog.getGadgetIndexUrlList(),
function(index, url) { function(index, url) {
// get repos from cache // get repos from cache
var cached_repo = RenderJs.Cache.get(url); var cached_repo = RenderJs.Cache.get(url);
$.each(cached_repo['gadget_list'], $.each(cached_repo.gadget_list,
function(index, gadget) { function(index, gadget) {
if (jQuery.inArray(service, gadget["service_list"]) > -1) { if ($.inArray(service, gadget.service_list) > -1) {
// gadget provides a service, add to list // gadget provides a service, add to list
gadget_list.push(gadget); gadget_list.push(gadget);
} }
} }
) );
}); });
return gadget_list; return gadget_list;
}, },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment