Forráskód Böngészése

Make fast-loading work with yemi

Vijayakrishnan 5 éve
szülő
commit
c51aacad39
1 módosított fájl, 12 hozzáadás és 1 törlés
  1. 12 1
      public/js/mc.js

+ 12 - 1
public/js/mc.js

@@ -108,9 +108,20 @@ function initFastLoad(_parent = false) {
                 var content = $(_data).find('.stag-content');
                 if(content) {
                     content = content.html();
-                    console.log(content);
+                    content += '<script src="/js/yemi.js"></script>';
                     targetParent.html(content);
                     initFastLoad(targetParent);
+
+                    // push state
+                    var target = _a.href;
+                    if(target.indexOf('//') !== -1) {
+                        target = target.split('//')[1];
+                        if(target.indexOf('/') !== -1) {
+                            target = target.substr(target.indexOf('/') + 1);
+                        }
+                    }
+                    window.top.history.pushState(target, null, '/mc/' + target);
+
                 }
                 else {
                     console.warn('Target page not found: ' + this.href);