dever 7 years ago
parent
commit
e754e9e9a8
1 changed files with 12 additions and 2 deletions
  1. 12 2
      front/static/document.js

+ 12 - 2
front/static/document.js

@@ -28,6 +28,7 @@ var Document =
     width : 0,
     left : 0,
     zoom : 11,
+    path : '',
     Init : function(option)
     {
         var self = this;
@@ -46,10 +47,19 @@ var Document =
 
     ,Script : function(name)
     {
-        var path = location.href.split('document.js');
+        var self = this;
+        if (!self.path) {
+            $('script').each(function()
+            {
+                if ($(this).attr('src').indexOf('document.js') != -1) {
+                    path = $(this).attr('src').split('document.js');
+                    self.path = path[0];
+                }
+            });
+        }
         var script = document.createElement("script");
         script.type = "text/javascript";
-        script.src = path[0] + name + ".js";
+        script.src = self.path + name + ".js";
         document.getElementsByTagName('head')[0].appendChild(script);
     }