Kazushi Morishima 6 éve
szülő
commit
5ef9b6b0b7

+ 2 - 2
src/main/webapp/js/admin/dashboard.js

@@ -1,6 +1,6 @@
 $(function() {
 $(function() {
-  var $content = $("#content");
-  var $contentFrame = $("#contentFrame");
+  var $content = $("#content"),
+      $contentFrame = $("#contentFrame");
   $contentFrame.on("load", function() {
   $contentFrame.on("load", function() {
     $(this).height($content.height());
     $(this).height($content.height());
   });
   });

+ 3 - 3
src/main/webapp/js/admin/searchlist.js

@@ -1,7 +1,7 @@
 $(function() {
 $(function() {
-  var SEP_CHAR = "-";
-  var langCode;
-  var browserLang =
+  var SEP_CHAR = "-",
+      langCode,
+      browserLang =
     (window.navigator.languages && window.navigator.languages[0]) ||
     (window.navigator.languages && window.navigator.languages[0]) ||
     window.navigator.language ||
     window.navigator.language ||
     window.navigator.userLanguage ||
     window.navigator.userLanguage ||

+ 2 - 2
src/main/webapp/js/advance.js

@@ -1,6 +1,6 @@
 $(function() {
 $(function() {
-  var $searchButton = $("#searchButton");
-  var contextPath = $("#contextPath").val();
+  var $searchButton = $("#searchButton"),
+      contextPath = $("#contextPath").val();
 
 
   $("#searchForm").on("submit", function(e) {
   $("#searchForm").on("submit", function(e) {
     $searchButton.attr("disabled", true);
     $searchButton.attr("disabled", true);

+ 2 - 2
src/main/webapp/js/help.js

@@ -1,6 +1,6 @@
 $(function() {
 $(function() {
-  var $searchButton = $("#searchButton");
-  var contextPath = $("#contextPath").val();
+  var $searchButton = $("#searchButton"),
+      contextPath = $("#contextPath").val();
 
 
   $("#searchForm").on("submit", function(e) {
   $("#searchForm").on("submit", function(e) {
     $searchButton.attr("disabled", true);
     $searchButton.attr("disabled", true);

+ 2 - 2
src/main/webapp/js/index.js

@@ -1,8 +1,8 @@
 $(function() {
 $(function() {
   $("#contentQuery").focus();
   $("#contentQuery").focus();
 
 
-  var $searchButton = $("#searchButton");
-  var contextPath = $("#contextPath").val();
+  var $searchButton = $("#searchButton"),
+      contextPath = $("#contextPath").val();
 
 
   $("#searchForm").on("submit", function(e) {
   $("#searchForm").on("submit", function(e) {
     $searchButton.attr("disabled", true);
     $searchButton.attr("disabled", true);

+ 6 - 5
src/main/webapp/js/login.js

@@ -8,8 +8,9 @@ $(function() {
     .focus();
     .focus();
 
 
   $("section.content input").keypress(function(e) {
   $("section.content input").keypress(function(e) {
+    var $submitButton;
     if (e.which === 13) {
     if (e.which === 13) {
-      var $submitButton = $("input#submit, button#submit");
+      $submitButton = $("input#submit, button#submit");
       if ($submitButton.length > 0) {
       if ($submitButton.length > 0) {
         $submitButton[0].submit();
         $submitButton[0].submit();
       }
       }
@@ -35,10 +36,10 @@ $(function() {
   });
   });
 
 
   $("#confirmToDelete").on("show.bs.modal", function(event) {
   $("#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)
     $(this)
       .find(".modal-body #delete-doc-title")
       .find(".modal-body #delete-doc-title")

+ 6 - 5
src/main/webapp/js/profile.js

@@ -8,8 +8,9 @@ $(function() {
     .focus();
     .focus();
 
 
   $("section.content input").keypress(function(e) {
   $("section.content input").keypress(function(e) {
+    var $submitButton;
     if (e.which === 13) {
     if (e.which === 13) {
-      var $submitButton = $("input#submit, button#submit");
+      $submitButton = $("input#submit, button#submit");
       if ($submitButton.length > 0) {
       if ($submitButton.length > 0) {
         $submitButton[0].submit();
         $submitButton[0].submit();
       }
       }
@@ -35,10 +36,10 @@ $(function() {
   });
   });
 
 
   $("#confirmToDelete").on("show.bs.modal", function(event) {
   $("#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)
     $(this)
       .find(".modal-body #delete-doc-title")
       .find(".modal-body #delete-doc-title")

+ 42 - 28
src/main/webapp/js/search.js

@@ -1,9 +1,10 @@
 $(function() {
 $(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) {
   $("#searchForm").on("submit", function(e) {
     $searchButton.attr("disabled", true);
     $searchButton.attr("disabled", true);
@@ -44,7 +45,9 @@ $(function() {
       queryId = $("#queryId").val(),
       queryId = $("#queryId").val(),
       order = $(this).attr("data-order"),
       order = $(this).attr("data-order"),
       url = $(this).attr("href"),
       url = $(this).attr("href"),
-      buf = [];
+      buf = [],
+      hashIndex,
+      hashStr;
     buf.push(contextPath);
     buf.push(contextPath);
     buf.push("/go/?rt=");
     buf.push("/go/?rt=");
     buf.push(rt);
     buf.push(rt);
@@ -55,9 +58,9 @@ $(function() {
     buf.push("&order=");
     buf.push("&order=");
     buf.push(order);
     buf.push(order);
 
 
-    var hashIndex = url.indexOf("#");
+    hashIndex = url.indexOf("#");
     if (hashIndex >= 0) {
     if (hashIndex >= 0) {
-      var hashStr = url.substring(hashIndex);
+      hashStr = url.substring(hashIndex);
       buf.push("&hash=");
       buf.push("&hash=");
       buf.push(encodeURIComponent(hashStr));
       buf.push(encodeURIComponent(hashStr));
     }
     }
@@ -69,16 +72,18 @@ $(function() {
     var docId = $(this).attr("data-id"),
     var docId = $(this).attr("data-id"),
       rt = $("#rt").val(),
       rt = $("#rt").val(),
       url = $(this).attr("href"),
       url = $(this).attr("href"),
-      buf = [];
+      buf = [],
+      hashIndex,
+      hashStr;
     buf.push(contextPath);
     buf.push(contextPath);
     buf.push("/go/?rt=");
     buf.push("/go/?rt=");
     buf.push(rt);
     buf.push(rt);
     buf.push("&docId=");
     buf.push("&docId=");
     buf.push(docId);
     buf.push(docId);
 
 
-    var hashIndex = url.indexOf("#");
+    hashIndex = url.indexOf("#");
     if (hashIndex >= 0) {
     if (hashIndex >= 0) {
-      var hashStr = url.substring(hashIndex);
+      hashStr = url.substring(hashIndex);
       buf.push("&hash=");
       buf.push("&hash=");
       buf.push(encodeURIComponent(hashStr));
       buf.push(encodeURIComponent(hashStr));
       buf.push(hashStr);
       buf.push(hashStr);
@@ -86,11 +91,13 @@ $(function() {
   });
   });
 
 
   $result.on("click", "a.favorite", function(e) {
   $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) {
     if (values.length === 2 && $queryId.length > 0) {
-      var actionUrl = contextPath + "/json";
-      var docId = values[1];
+      actionUrl = contextPath + "/json";
+      docId = values[1];
       $.ajax({
       $.ajax({
         dataType: "json",
         dataType: "json",
         cache: false,
         cache: false,
@@ -104,13 +111,15 @@ $(function() {
         }
         }
       })
       })
         .done(function(data) {
         .done(function(data) {
+          var $favorited,
+              $favoritedCount;
           if (
           if (
             data.response.status === 0 &&
             data.response.status === 0 &&
             typeof data.response.result !== "undefined" &&
             typeof data.response.result !== "undefined" &&
             data.response.result === "ok"
             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");
             $favoritedCount.css("display", "none");
             $favorite.fadeOut(1000, function() {
             $favorite.fadeOut(1000, function() {
               $favorited.fadeIn(1000);
               $favorited.fadeIn(1000);
@@ -139,27 +148,31 @@ $(function() {
       }
       }
     })
     })
       .done(function(data) {
       .done(function(data) {
+        var docIds,
+            i;
         if (
         if (
           data.response.status === 0 &&
           data.response.status === 0 &&
           typeof data.response.num !== "undefined" &&
           typeof data.response.num !== "undefined" &&
           data.response.num > 0
           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];
             docIds[i] = "#" + docIds[i];
           }
           }
           $favorites.each(function(index) {
           $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]) {
               if (url === docIds[i]) {
                 found = true;
                 found = true;
                 break;
                 break;
               }
               }
             }
             }
             if (found) {
             if (found) {
-              var $favorited = $favorite.siblings(".favorited");
+              $favorited = $favorite.siblings(".favorited");
               $favorite.fadeOut(1000, function() {
               $favorite.fadeOut(1000, function() {
                 $favorited.fadeIn(1000);
                 $favorited.fadeIn(1000);
               });
               });
@@ -173,10 +186,11 @@ $(function() {
   }
   }
 
 
   $result.on("click", ".more a", function(e) {
   $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 !== "") {
     if (value !== "") {
-      var $info = $(value + " .info");
+      $info = $(value + " .info");
       if ($info.length > 0) {
       if ($info.length > 0) {
         $moreLink.fadeOut(500, function() {
         $moreLink.fadeOut(500, function() {
           $info.slideDown("slow");
           $info.slideDown("slow");
@@ -219,7 +233,7 @@ $(function() {
 
 
   IMG_LOADING_DELAY = 200;
   IMG_LOADING_DELAY = 200;
   IMG_LOADING_MAX = 0;
   IMG_LOADING_MAX = 0;
-  var loadImage = function(img, url, limit) {
+  loadImage = function(img, url, limit) {
     var imgData = new Image();
     var imgData = new Image();
     $(imgData).on("load", function() {
     $(imgData).on("load", function() {
       $(img).css("background-image", "");
       $(img).css("background-image", "");

+ 42 - 33
src/main/webapp/js/suggestor.js

@@ -1,27 +1,29 @@
 (function($) {
 (function($) {
   $.fn.suggestor = function(setting) {
   $.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 settingMinTerm = 1;
-    var settingAjaxInfo;
-    var settingAdjustWidthVal;
-    var $settingSearchForm;
-    var listSelectedCssInfo;
-    var listDeselectedCssInfo;
-    var boxCssInfo;
-
-    var suggestingSts = false;
-
-    var suggestor = {
+    var $boxElement,
+        $textArea,
+        inputText = "",
+        isFocusList = false,
+        listNum = 0,
+        listSelNum = 0,
+        isMouseHover = false,
+        started = false,
+        interval = 5,
+
+        settingMinTerm = 1,
+        settingAjaxInfo,
+        settingAdjustWidthVal,
+        $settingSearchForm,
+        listSelectedCssInfo,
+        listDeselectedCssInfo,
+        boxCssInfo,
+
+        suggestingSts = false,
+
+        suggestor = {
       init: function($element, setting) {
       init: function($element, setting) {
+        var suggestor;
+
         suggestingSts = false;
         suggestingSts = false;
         $boxElement = $("<div/>");
         $boxElement = $("<div/>");
         $boxElement.addClass("suggestorBox");
         $boxElement.addClass("suggestorBox");
@@ -76,7 +78,7 @@
         );
         );
 
 
         this.resize();
         this.resize();
-        var suggestor = this;
+        suggestor = this;
         $(window).resize(function() {
         $(window).resize(function() {
           suggestor.resize();
           suggestor.resize();
         });
         });
@@ -129,37 +131,44 @@
           return;
           return;
         }
         }
 
 
-        var hits = obj.response.result.hits;
-        var suggestor = this;
+        var hits = obj.response.result.hits,
+            suggestor = this,
+            reslist,
+            $olEle,
+            str,
+            chkCorrectWord,
+            $tmpli,
+            $liEle,
+            i, j, k;
 
 
         listNum = 0;
         listNum = 0;
         if (typeof hits !== "undefined") {
         if (typeof hits !== "undefined") {
-          var reslist = [];
-          for (var i = 0; i < hits.length; i++) {
+          reslist = [];
+          for (i = 0; i < hits.length; i++) {
             reslist.push(hits[i].text);
             reslist.push(hits[i].text);
           }
           }
-          var $olEle = $("<ol/>");
+          $olEle = $("<ol/>");
           $olEle.css("list-style", "none");
           $olEle.css("list-style", "none");
           $olEle.css("padding", "0");
           $olEle.css("padding", "0");
           $olEle.css("margin", "2px");
           $olEle.css("margin", "2px");
 
 
           for (
           for (
-            var j = 0;
+            j = 0;
             j < reslist.length && listNum < settingAjaxInfo.num;
             j < reslist.length && listNum < settingAjaxInfo.num;
             j++
             j++
           ) {
           ) {
-            var str = reslist[j];
-            var chkCorrectWord = true;
+            str = reslist[j];
+            chkCorrectWord = true;
 
 
-            var $tmpli = $($olEle.children("li"));
-            for (var k = 0; k < $tmpli.length; k++) {
+            $tmpli = $($olEle.children("li"));
+            for (k = 0; k < $tmpli.length; k++) {
               if (str === $($tmpli.get(k)).html()) {
               if (str === $($tmpli.get(k)).html()) {
                 chkCorrectWord = false;
                 chkCorrectWord = false;
               }
               }
             }
             }
 
 
             if (chkCorrectWord) {
             if (chkCorrectWord) {
-              var $liEle = $("<li/>");
+              $liEle = $("<li/>");
               $liEle.html(str);
               $liEle.html(str);
               $liEle.click(function() {
               $liEle.click(function() {
                 var str = $(this).html();
                 var str = $(this).html();