1var ModalHistory = { 2 modalStack: [], 3 popOnClose: false, 4 closeOnPop: false, 5 originalTitle: document.title, 6 closeCallback: function (modalObject) {}, 7 openModal: function (modalObject, url, title, rel) { 8 if ('pushState' in history) { 9 history.pushState({}, title || document.title, url); 10 this.modalStack.push({ modalObject: modalObject, title: title, rel: rel || 'stack' }); 11 if (title) 12 document.title = title; 13 } 14 }, 15 updateTitle: function () { 16 document.title = this.modalStack.length ? (this.modalStack[this.modalStack.length-1].title || this.originalTitle) : this.originalTitle; 17 }, 18 closeModal: function () { 19 if (!this.closeOnPop) { 20 this.popOnClose = true; 21 history.back(); 22 this.modalStack.pop(); 23 this.updateTitle(); 24 } else { 25 this.closeOnPop = false; 26 } 27 }, 28 closeAll: function () { 29 while (this.modalStack.length > 0) { 30 this.popOnClose = true; 31 this.modalStack.pop(); 32 history.back(); 33 } 34 }, 35 popModal: function () { 36 var modal; 37 38 if (!this.popOnClose) { 39 if (this.modalStack.length) { 40 this.closeOnPop = true; 41 modal = this.modalStack.pop(); 42 this.closeCallback(modal); 43 this.updateTitle(); 44 } 45 } else { 46 this.popOnClose = false; 47 } 48 } 49}; 50$(window).on('popstate', function () { 51 ModalHistory.popModal(); 52}); 53 54ModalHistory.closeCallback = function (state) { 55 state.modalObject.hide(); 56}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.