diff --git a/src/main/webapp/js/admin/dashboard.js b/src/main/webapp/js/admin/dashboard.js index fcc46e083..32f96588a 100644 --- a/src/main/webapp/js/admin/dashboard.js +++ b/src/main/webapp/js/admin/dashboard.js @@ -1,6 +1,6 @@ $(function() { - var $content = $("#content"); - var $contentFrame = $("#contentFrame"); + var $content = $("#content"), + $contentFrame = $("#contentFrame"); $contentFrame.on("load", function() { $(this).height($content.height()); }); diff --git a/src/main/webapp/js/admin/searchlist.js b/src/main/webapp/js/admin/searchlist.js index 1a0f26193..64612fd9b 100644 --- a/src/main/webapp/js/admin/searchlist.js +++ b/src/main/webapp/js/admin/searchlist.js @@ -1,7 +1,7 @@ $(function() { - var SEP_CHAR = "-"; - var langCode; - var browserLang = + var SEP_CHAR = "-", + langCode, + browserLang = (window.navigator.languages && window.navigator.languages[0]) || window.navigator.language || window.navigator.userLanguage || diff --git a/src/main/webapp/js/advance.js b/src/main/webapp/js/advance.js index fec021de8..f014c784f 100644 --- a/src/main/webapp/js/advance.js +++ b/src/main/webapp/js/advance.js @@ -1,6 +1,6 @@ $(function() { - var $searchButton = $("#searchButton"); - var contextPath = $("#contextPath").val(); + var $searchButton = $("#searchButton"), + contextPath = $("#contextPath").val(); $("#searchForm").on("submit", function(e) { $searchButton.attr("disabled", true); diff --git a/src/main/webapp/js/help.js b/src/main/webapp/js/help.js index e7deb6cfe..02a9ce947 100644 --- a/src/main/webapp/js/help.js +++ b/src/main/webapp/js/help.js @@ -1,6 +1,6 @@ $(function() { - var $searchButton = $("#searchButton"); - var contextPath = $("#contextPath").val(); + var $searchButton = $("#searchButton"), + contextPath = $("#contextPath").val(); $("#searchForm").on("submit", function(e) { $searchButton.attr("disabled", true); diff --git a/src/main/webapp/js/index.js b/src/main/webapp/js/index.js index 6a25cdf93..1f1c54ae5 100644 --- a/src/main/webapp/js/index.js +++ b/src/main/webapp/js/index.js @@ -1,8 +1,8 @@ $(function() { $("#contentQuery").focus(); - var $searchButton = $("#searchButton"); - var contextPath = $("#contextPath").val(); + var $searchButton = $("#searchButton"), + contextPath = $("#contextPath").val(); $("#searchForm").on("submit", function(e) { $searchButton.attr("disabled", true); diff --git a/src/main/webapp/js/login.js b/src/main/webapp/js/login.js index 123c51890..9f40a7fec 100644 --- a/src/main/webapp/js/login.js +++ b/src/main/webapp/js/login.js @@ -8,8 +8,9 @@ $(function() { .focus(); $("section.content input").keypress(function(e) { + var $submitButton; if (e.which === 13) { - var $submitButton = $("input#submit, button#submit"); + $submitButton = $("input#submit, button#submit"); if ($submitButton.length > 0) { $submitButton[0].submit(); } @@ -35,10 +36,10 @@ $(function() { }); $("#confirmToDelete").on("show.bs.modal", function(event) { - var button = $(event.relatedTarget); - var docId = button.data("docid"); - var title = button.data("title"); - var url = button.data("url"); + var button = $(event.relatedTarget), + docId = button.data("docid"), + title = button.data("title"), + url = button.data("url"); $(this) .find(".modal-body #delete-doc-title") diff --git a/src/main/webapp/js/profile.js b/src/main/webapp/js/profile.js index 123c51890..9f40a7fec 100644 --- a/src/main/webapp/js/profile.js +++ b/src/main/webapp/js/profile.js @@ -8,8 +8,9 @@ $(function() { .focus(); $("section.content input").keypress(function(e) { + var $submitButton; if (e.which === 13) { - var $submitButton = $("input#submit, button#submit"); + $submitButton = $("input#submit, button#submit"); if ($submitButton.length > 0) { $submitButton[0].submit(); } @@ -35,10 +36,10 @@ $(function() { }); $("#confirmToDelete").on("show.bs.modal", function(event) { - var button = $(event.relatedTarget); - var docId = button.data("docid"); - var title = button.data("title"); - var url = button.data("url"); + var button = $(event.relatedTarget), + docId = button.data("docid"), + title = button.data("title"), + url = button.data("url"); $(this) .find(".modal-body #delete-doc-title") diff --git a/src/main/webapp/js/search.js b/src/main/webapp/js/search.js index 54e6724cf..f00c89c78 100644 --- a/src/main/webapp/js/search.js +++ b/src/main/webapp/js/search.js @@ -1,9 +1,10 @@ $(function() { - var $result = $("#result"); - var $queryId = $("#queryId"); - var $favorites = $(".favorite", $result); - var $searchButton = $("#searchButton"); - var contextPath = $("#contextPath").val(); + var $result = $("#result"), + $queryId = $("#queryId"), + $favorites = $(".favorite", $result), + $searchButton = $("#searchButton"), + contextPath = $("#contextPath").val(), + loadImage; $("#searchForm").on("submit", function(e) { $searchButton.attr("disabled", true); @@ -44,7 +45,9 @@ $(function() { queryId = $("#queryId").val(), order = $(this).attr("data-order"), url = $(this).attr("href"), - buf = []; + buf = [], + hashIndex, + hashStr; buf.push(contextPath); buf.push("/go/?rt="); buf.push(rt); @@ -55,9 +58,9 @@ $(function() { buf.push("&order="); buf.push(order); - var hashIndex = url.indexOf("#"); + hashIndex = url.indexOf("#"); if (hashIndex >= 0) { - var hashStr = url.substring(hashIndex); + hashStr = url.substring(hashIndex); buf.push("&hash="); buf.push(encodeURIComponent(hashStr)); } @@ -69,16 +72,18 @@ $(function() { var docId = $(this).attr("data-id"), rt = $("#rt").val(), url = $(this).attr("href"), - buf = []; + buf = [], + hashIndex, + hashStr; buf.push(contextPath); buf.push("/go/?rt="); buf.push(rt); buf.push("&docId="); buf.push(docId); - var hashIndex = url.indexOf("#"); + hashIndex = url.indexOf("#"); if (hashIndex >= 0) { - var hashStr = url.substring(hashIndex); + hashStr = url.substring(hashIndex); buf.push("&hash="); buf.push(encodeURIComponent(hashStr)); buf.push(hashStr); @@ -86,11 +91,13 @@ $(function() { }); $result.on("click", "a.favorite", function(e) { - var $favorite = $(this); - var values = $favorite.attr("href").split("#"); + var $favorite = $(this), + values = $favorite.attr("href").split("#"), + actionUrl, + docId; if (values.length === 2 && $queryId.length > 0) { - var actionUrl = contextPath + "/json"; - var docId = values[1]; + actionUrl = contextPath + "/json"; + docId = values[1]; $.ajax({ dataType: "json", cache: false, @@ -104,13 +111,15 @@ $(function() { } }) .done(function(data) { + var $favorited, + $favoritedCount; if ( data.response.status === 0 && typeof data.response.result !== "undefined" && data.response.result === "ok" ) { - var $favorited = $favorite.siblings(".favorited"); - var $favoritedCount = $(".favorited-count", $favorited); + $favorited = $favorite.siblings(".favorited"); + $favoritedCount = $(".favorited-count", $favorited); $favoritedCount.css("display", "none"); $favorite.fadeOut(1000, function() { $favorited.fadeIn(1000); @@ -139,27 +148,31 @@ $(function() { } }) .done(function(data) { + var docIds, + i; if ( data.response.status === 0 && typeof data.response.num !== "undefined" && data.response.num > 0 ) { - var docIds = data.response.doc_ids; - for (var i = 0; i < docIds.length; i++) { + docIds = data.response.doc_ids; + for (i = 0; i < docIds.length; i++) { docIds[i] = "#" + docIds[i]; } $favorites.each(function(index) { - var $favorite = $(this); - var url = $favorite.attr("href"); - var found = false; - for (var i = 0; i < docIds.length; i++) { + var $favorite = $(this), + url = $favorite.attr("href"), + found = false, + $favorited, + i; + for (i = 0; i < docIds.length; i++) { if (url === docIds[i]) { found = true; break; } } if (found) { - var $favorited = $favorite.siblings(".favorited"); + $favorited = $favorite.siblings(".favorited"); $favorite.fadeOut(1000, function() { $favorited.fadeIn(1000); }); @@ -173,10 +186,11 @@ $(function() { } $result.on("click", ".more a", function(e) { - var $moreLink = $(this); - var value = $moreLink.attr("href"); + var $moreLink = $(this), + value = $moreLink.attr("href"), + $info; if (value !== "") { - var $info = $(value + " .info"); + $info = $(value + " .info"); if ($info.length > 0) { $moreLink.fadeOut(500, function() { $info.slideDown("slow"); @@ -219,7 +233,7 @@ $(function() { IMG_LOADING_DELAY = 200; IMG_LOADING_MAX = 0; - var loadImage = function(img, url, limit) { + loadImage = function(img, url, limit) { var imgData = new Image(); $(imgData).on("load", function() { $(img).css("background-image", ""); diff --git a/src/main/webapp/js/suggestor.js b/src/main/webapp/js/suggestor.js index 8d1e32543..dcc25f419 100644 --- a/src/main/webapp/js/suggestor.js +++ b/src/main/webapp/js/suggestor.js @@ -1,200 +1,236 @@ (function($) { $.fn.suggestor = function(setting) { - var $boxElement; - var $textArea; - var inputText = ""; - var isFocusList = false; - var listNum = 0; - var listSelNum = 0; - var isMouseHover = false; - var started = false; - var interval = 5; + var $boxElement, + $textArea, + inputText = "", + isFocusList = false, + listNum = 0, + listSelNum = 0, + isMouseHover = false, + started = false, + interval = 5, - var settingMinTerm = 1; - var settingAjaxInfo; - var settingAdjustWidthVal; - var $settingSearchForm; - var listSelectedCssInfo; - var listDeselectedCssInfo; - var boxCssInfo; + settingMinTerm = 1, + settingAjaxInfo, + settingAdjustWidthVal, + $settingSearchForm, + listSelectedCssInfo, + listDeselectedCssInfo, + boxCssInfo, - var suggestingSts = false; + suggestingSts = false, - var suggestor = { - init: function($element, setting) { - suggestingSts = false; - $boxElement = $("
"); - $boxElement.addClass("suggestorBox"); + suggestor = { + init: function($element, setting) { + var suggestor; - //style sheet - $boxElement.css("display", "none"); - $boxElement.css("position", "absolute"); - $boxElement.css("text-align", "left"); - $boxElement.css("font-size", $element.css("font-size")); - if (typeof setting.boxCssInfo === "undefined") { - $boxElement.css("border", "1px solid #cccccc"); - $boxElement.css( - "-webkit-box-shadow", - "0 3px 2px 0px rgba(0, 0, 0, 0.1), 0 3px 2px 0px rgba(236, 236, 236, 0.6)" - ); - $boxElement.css( - "-moz-box-shadow", - "0 3px 2px 0px rgba(0, 0, 0, 0.1), 0 3px 2px 0px rgba(236, 236, 236, 0.6)" - ); - $boxElement.css( - "box-shadow", - "0 3px 2px 0px rgba(0, 0, 0, 0.1), 0 3px 2px 0px rgba(236, 236, 236, 0.6)" - ); - $boxElement.css("background-color", "#fff"); - } else { - $boxElement.css(setting.boxCssInfo); - } - - $textArea = $element; - $textArea.attr("autocomplete", "off"); - - isFocusList = false; - inputText = $textArea.val(); - - //settings - settingAjaxInfo = setting.ajaxinfo; - settingMinTerm = setting.minterm; - $settingSearchForm = setting.searchForm; - listSelectedCssInfo = setting.listSelectedCssInfo; - listDeselectedCssInfo = setting.listDeselectedCssInfo; - settingAdjustWidthVal = setting.adjustWidthVal; - - boxCssInfo = setting.boxCssInfo; - - $boxElement.hover( - function() { - isMouseHover = true; - }, - function() { - isMouseHover = false; - } - ); - - this.resize(); - var suggestor = this; - $(window).resize(function() { - suggestor.resize(); - }); - - $("body").append($boxElement); - }, - - suggest: function() { - suggestingSts = true; - - this.resize(); - - var suggestor = this; - inputText = $textArea.val(); - - listNum = 0; - listSelNum = 0; - - if (inputText.length < settingMinTerm) { - $boxElement.css("display", "none"); - suggestingSts = false; - return; - } - - $.ajax({ - url: settingAjaxInfo.url, - type: "get", - dataType: "jsonp", - cache: false, - data: { - query: $textArea.val(), - fields: settingAjaxInfo.fn, - num: settingAjaxInfo.num * 2, - lang: settingAjaxInfo.lang - }, - traditional: true - }) - .done(function(obj) { - suggestor.createAutoCompleteList(obj); - }) - .fail(function(a, obj, b) { suggestingSts = false; - return; - }); - }, + $boxElement = $("
"); + $boxElement.addClass("suggestorBox"); - createAutoCompleteList: function(obj) { - if (obj.response.status !== 0) { - $boxElement.css("display", "none"); - return; - } - - var hits = obj.response.result.hits; - var suggestor = this; - - listNum = 0; - if (typeof hits !== "undefined") { - var reslist = []; - for (var i = 0; i < hits.length; i++) { - reslist.push(hits[i].text); - } - var $olEle = $("
    "); - $olEle.css("list-style", "none"); - $olEle.css("padding", "0"); - $olEle.css("margin", "2px"); - - for ( - var j = 0; - j < reslist.length && listNum < settingAjaxInfo.num; - j++ - ) { - var str = reslist[j]; - var chkCorrectWord = true; - - var $tmpli = $($olEle.children("li")); - for (var k = 0; k < $tmpli.length; k++) { - if (str === $($tmpli.get(k)).html()) { - chkCorrectWord = false; - } + //style sheet + $boxElement.css("display", "none"); + $boxElement.css("position", "absolute"); + $boxElement.css("text-align", "left"); + $boxElement.css("font-size", $element.css("font-size")); + if (typeof setting.boxCssInfo === "undefined") { + $boxElement.css("border", "1px solid #cccccc"); + $boxElement.css( + "-webkit-box-shadow", + "0 3px 2px 0px rgba(0, 0, 0, 0.1), 0 3px 2px 0px rgba(236, 236, 236, 0.6)" + ); + $boxElement.css( + "-moz-box-shadow", + "0 3px 2px 0px rgba(0, 0, 0, 0.1), 0 3px 2px 0px rgba(236, 236, 236, 0.6)" + ); + $boxElement.css( + "box-shadow", + "0 3px 2px 0px rgba(0, 0, 0, 0.1), 0 3px 2px 0px rgba(236, 236, 236, 0.6)" + ); + $boxElement.css("background-color", "#fff"); + } else { + $boxElement.css(setting.boxCssInfo); } - if (chkCorrectWord) { - var $liEle = $("
  1. "); - $liEle.html(str); - $liEle.click(function() { - var str = $(this).html(); - suggestor.fixList(); - $textArea.val(str); - if (typeof $settingSearchForm !== "undefined") { - $settingSearchForm.submit(); - //$settingSearchForm.trigger("submit"); - } + $textArea = $element; + $textArea.attr("autocomplete", "off"); + + isFocusList = false; + inputText = $textArea.val(); + + //settings + settingAjaxInfo = setting.ajaxinfo; + settingMinTerm = setting.minterm; + $settingSearchForm = setting.searchForm; + listSelectedCssInfo = setting.listSelectedCssInfo; + listDeselectedCssInfo = setting.listDeselectedCssInfo; + settingAdjustWidthVal = setting.adjustWidthVal; + + boxCssInfo = setting.boxCssInfo; + + $boxElement.hover( + function() { + isMouseHover = true; + }, + function() { + isMouseHover = false; + } + ); + + this.resize(); + suggestor = this; + $(window).resize(function() { + suggestor.resize(); + }); + + $("body").append($boxElement); + }, + + suggest: function() { + suggestingSts = true; + + this.resize(); + + var suggestor = this; + inputText = $textArea.val(); + + listNum = 0; + listSelNum = 0; + + if (inputText.length < settingMinTerm) { + $boxElement.css("display", "none"); + suggestingSts = false; + return; + } + + $.ajax({ + url: settingAjaxInfo.url, + type: "get", + dataType: "jsonp", + cache: false, + data: { + query: $textArea.val(), + fields: settingAjaxInfo.fn, + num: settingAjaxInfo.num * 2, + lang: settingAjaxInfo.lang + }, + traditional: true + }) + .done(function(obj) { + suggestor.createAutoCompleteList(obj); + }) + .fail(function(a, obj, b) { + suggestingSts = false; + return; }); - $liEle.hover( - function() { - listSelNum = - $(this) - .closest("ol") - .children("li") - .index(this) + 1; - $(this) - .closest("ol") - .children("li") - .each(function(i) { - if (i === listSelNum - 1) { - if (typeof listSelectedCssInfo === "undefined") { - $(this).css("background-color", "#e5e5e5"); - } else { - $(this).css(listSelectedCssInfo); - } - } else { + }, + + createAutoCompleteList: function(obj) { + if (obj.response.status !== 0) { + $boxElement.css("display", "none"); + return; + } + + var hits = obj.response.result.hits, + suggestor = this, + reslist, + $olEle, + str, + chkCorrectWord, + $tmpli, + $liEle, + i, j, k; + + listNum = 0; + if (typeof hits !== "undefined") { + reslist = []; + for (i = 0; i < hits.length; i++) { + reslist.push(hits[i].text); + } + $olEle = $("
      "); + $olEle.css("list-style", "none"); + $olEle.css("padding", "0"); + $olEle.css("margin", "2px"); + + for ( + j = 0; + j < reslist.length && listNum < settingAjaxInfo.num; + j++ + ) { + str = reslist[j]; + chkCorrectWord = true; + + $tmpli = $($olEle.children("li")); + for (k = 0; k < $tmpli.length; k++) { + if (str === $($tmpli.get(k)).html()) { + chkCorrectWord = false; + } + } + + if (chkCorrectWord) { + $liEle = $("
    1. "); + $liEle.html(str); + $liEle.click(function() { + var str = $(this).html(); + suggestor.fixList(); + $textArea.val(str); + if (typeof $settingSearchForm !== "undefined") { + $settingSearchForm.submit(); + //$settingSearchForm.trigger("submit"); + } + }); + $liEle.hover( + function() { + listSelNum = + $(this) + .closest("ol") + .children("li") + .index(this) + 1; + $(this) + .closest("ol") + .children("li") + .each(function(i) { + if (i === listSelNum - 1) { + if (typeof listSelectedCssInfo === "undefined") { + $(this).css("background-color", "#e5e5e5"); + } else { + $(this).css(listSelectedCssInfo); + } + } else { + if (typeof listDeselectedCssInfo !== "undefined") { + $(this).css(listDeselectedCssInfo); + } else { + if ( + typeof boxCssInfo === "undefined" || + typeof boxCssInfo["background-color"] === + "undefined" + ) { + $(this).css("background-color", "#ffffff"); + } else { + $(this).css( + "background-color", + boxCssInfo["background-color"] + ); + } + } + } + }); + }, + function() { + if ( + listSelNum === + $(this) + .closest("ol") + .children("li") + .index(this) + + 1 + ) { if (typeof listDeselectedCssInfo !== "undefined") { $(this).css(listDeselectedCssInfo); } else { if ( typeof boxCssInfo === "undefined" || - typeof boxCssInfo["background-color"] === - "undefined" + typeof boxCssInfo["background-color"] === "undefined" ) { $(this).css("background-color", "#ffffff"); } else { @@ -204,143 +240,116 @@ ); } } - } - }); - }, - function() { - if ( - listSelNum === - $(this) - .closest("ol") - .children("li") - .index(this) + - 1 - ) { - if (typeof listDeselectedCssInfo !== "undefined") { - $(this).css(listDeselectedCssInfo); - } else { - if ( - typeof boxCssInfo === "undefined" || - typeof boxCssInfo["background-color"] === "undefined" - ) { - $(this).css("background-color", "#ffffff"); - } else { - $(this).css( - "background-color", - boxCssInfo["background-color"] - ); + listSelNum = 0; } } - listSelNum = 0; + ); + + $liEle.css("padding", "2px"); + + $olEle.append($liEle); + listNum++; + } + } + + if (listNum > 0 && $textArea.val().length >= settingMinTerm) { + $boxElement.html(""); + $boxElement.append($olEle); + $boxElement.css("display", "block"); + } else { + $boxElement.css("display", "none"); + } + } else { + $boxElement.css("display", "none"); + } + this.resize(); + + suggestingSts = false; + }, + + selectlist: function(direction) { + if ($boxElement.css("display") === "none") { + return; + } + + if (direction === "down") { + listSelNum++; + } else if (direction === "up") { + listSelNum--; + } else { + return; + } + + isFocusList = true; + + if (listSelNum < 0) { + listSelNum = listNum; + } else if (listSelNum > listNum) { + listSelNum = 0; + } + + $boxElement + .children("ol") + .children("li") + .each(function(i) { + if (i === listSelNum - 1) { + if (typeof listSelectedCssInfo === "undefined") { + $(this).css("background-color", "#e5e5e5"); + } else { + $(this).css(listSelectedCssInfo); + } + $textArea.val($(this).html()); + } else { + if (typeof listDeselectedCssInfo !== "undefined") { + $(this).css(listDeselectedCssInfo); + } else { + if ( + typeof boxCssInfo === "undefined" || + typeof boxCssInfo["background-color"] === "undefined" + ) { + $(this).css("background-color", "#ffffff"); + } else { + $(this).css( + "background-color", + boxCssInfo["background-color"] + ); + } } } + }); + if (listSelNum === 0) { + $textArea.val(inputText); + } + }, + + fixList: function() { + if (listSelNum > 0) { + $textArea.val( + $( + $boxElement + .children("ol") + .children("li") + .get(listSelNum - 1) + ).html() ); - - $liEle.css("padding", "2px"); - - $olEle.append($liEle); - listNum++; } - } + inputText = $textArea.val(); - if (listNum > 0 && $textArea.val().length >= settingMinTerm) { - $boxElement.html(""); - $boxElement.append($olEle); - $boxElement.css("display", "block"); - } else { + isFocusList = false; $boxElement.css("display", "none"); - } - } else { - $boxElement.css("display", "none"); - } - this.resize(); + listNum = 0; + }, - suggestingSts = false; - }, - - selectlist: function(direction) { - if ($boxElement.css("display") === "none") { - return; - } - - if (direction === "down") { - listSelNum++; - } else if (direction === "up") { - listSelNum--; - } else { - return; - } - - isFocusList = true; - - if (listSelNum < 0) { - listSelNum = listNum; - } else if (listSelNum > listNum) { - listSelNum = 0; - } - - $boxElement - .children("ol") - .children("li") - .each(function(i) { - if (i === listSelNum - 1) { - if (typeof listSelectedCssInfo === "undefined") { - $(this).css("background-color", "#e5e5e5"); - } else { - $(this).css(listSelectedCssInfo); - } - $textArea.val($(this).html()); - } else { - if (typeof listDeselectedCssInfo !== "undefined") { - $(this).css(listDeselectedCssInfo); - } else { - if ( - typeof boxCssInfo === "undefined" || - typeof boxCssInfo["background-color"] === "undefined" - ) { - $(this).css("background-color", "#ffffff"); - } else { - $(this).css( - "background-color", - boxCssInfo["background-color"] - ); - } - } + resize: function() { + $boxElement.css("top", $textArea.offset().top + $textArea.height() + 6); + $boxElement.css("left", $textArea.offset().left); + $boxElement.css("height", "auto"); + $boxElement.css("width", "auto"); + if ($boxElement.width() < $textArea.width() + settingAdjustWidthVal) { + $boxElement.width($textArea.width() + settingAdjustWidthVal); } - }); - if (listSelNum === 0) { - $textArea.val(inputText); - } - }, - - fixList: function() { - if (listSelNum > 0) { - $textArea.val( - $( - $boxElement - .children("ol") - .children("li") - .get(listSelNum - 1) - ).html() - ); - } - inputText = $textArea.val(); - - isFocusList = false; - $boxElement.css("display", "none"); - listNum = 0; - }, - - resize: function() { - $boxElement.css("top", $textArea.offset().top + $textArea.height() + 6); - $boxElement.css("left", $textArea.offset().left); - $boxElement.css("height", "auto"); - $boxElement.css("width", "auto"); - if ($boxElement.width() < $textArea.width() + settingAdjustWidthVal) { - $boxElement.width($textArea.width() + settingAdjustWidthVal); - } - } - }; + } + }; suggestor.init($(this), setting);