web/embedscript.php
changeset 621 44f90de0016f
parent 620 953c68b4da79
child 752 2bf1bd3ae424
equal deleted inserted replaced
620:953c68b4da79 621:44f90de0016f
    55         _updater = function() {
    55         _updater = function() {
    56             _blocked = true;
    56             _blocked = true;
    57             window.setTimeout(function() {
    57             window.setTimeout(function() {
    58                 _blocked = false;
    58                 _blocked = false;
    59             }, 1000);
    59             }, 1000);
    60             _frame.contentWindow.postMessage({type: "hashchange", hash: document.location.hash}, "*");
    60             _frame.contentWindow.postMessage(document.location.hash, "*");
    61         };
    61         };
    62     
    62     
    63     window.onhashchange = _updater;
    63     window.onhashchange = _updater;
    64     
    64     
    65     window.addEventListener('message', function(_e) {
    65     window.addEventListener('message', function(_e) {
    66         if (_e.data.type === "hashchange" && !_blocked) {
    66         if (/^#/.test(_e.data) && !_blocked) {
    67             document.location.hash = _e.data.hash;
    67             document.location.hash = _e.data;
    68         }
    68         }
    69     });
    69     });
    70     
    70     
    71     window.setTimeout(_updater, 2000);
    71     window.setTimeout(_updater, 2000);
    72     
    72