| 1 if(!window.MutationObserver&&!window.WebKitMutationObserver){!function(global){v
ar SideTable;if(typeof WeakMap!=="undefined"&&navigator.userAgent.indexOf("Firef
ox/")<0){SideTable=WeakMap}else{!function(){var defineProperty=Object.defineProp
erty;var hasOwnProperty=Object.hasOwnProperty;var counter=(new Date).getTime()%1
e9;SideTable=function(){this.name="__st"+(Math.random()*1e9>>>0)+(counter++ +"__
")};SideTable.prototype={set:function(key,value){defineProperty(key,this.name,{v
alue:value,writable:true})},get:function(key){return hasOwnProperty.call(key,thi
s.name)?key[this.name]:undefined},"delete":function(key){this.set(key,undefined)
}}}()}var registrationsTable=new SideTable;var setImmediate=window.msSetImmediat
e;if(!setImmediate){var setImmediateQueue=[];var sentinel=String(Math.random());
window.addEventListener("message",function(e){if(e.data===sentinel){var queue=se
tImmediateQueue;setImmediateQueue=[];queue.forEach(function(func){func()})}});se
tImmediate=function(func){setImmediateQueue.push(func);window.postMessage(sentin
el,"*")}}var isScheduled=false;var scheduledObservers=[];function scheduleCallba
ck(observer){scheduledObservers.push(observer);if(!isScheduled){isScheduled=true
;setImmediate(dispatchCallbacks)}}function wrapIfNeeded(node){return window.Shad
owDOMPolyfill&&window.ShadowDOMPolyfill.wrapIfNeeded(node)||node}function dispat
chCallbacks(){isScheduled=false;var observers=scheduledObservers;scheduledObserv
ers=[];observers.sort(function(o1,o2){return o1.uid_-o2.uid_});var anyNonEmpty=f
alse;observers.forEach(function(observer){var queue=observer.takeRecords();remov
eTransientObserversFor(observer);if(queue.length){observer.callback_(queue,obser
ver);anyNonEmpty=true}});if(anyNonEmpty)dispatchCallbacks()}function removeTrans
ientObserversFor(observer){observer.nodes_.forEach(function(node){var registrati
ons=registrationsTable.get(node);if(!registrations)return;registrations.forEach(
function(registration){if(registration.observer===observer)registration.removeTr
ansientObservers()})})}function forEachAncestorAndObserverEnqueueRecord(target,c
allback){for(var node=target;node;node=node.parentNode){var registrations=regist
rationsTable.get(node);if(registrations){for(var j=0;j<registrations.length;j++)
{var registration=registrations[j];var options=registration.options;if(node!==ta
rget&&!options.subtree)continue;var record=callback(options);if(record)registrat
ion.enqueue(record)}}}}var uidCounter=0;function MutationObserver(callback){this
.callback_=callback;this.nodes_=[];this.records_=[];this.uid_=++uidCounter}Mutat
ionObserver.prototype={get constructor(){return MutationObserver},observe:functi
on(target,options){target=wrapIfNeeded(target);if(!options.childList&&!options.a
ttributes&&!options.characterData||options.attributeOldValue&&!options.attribute
s||options.attributeFilter&&options.attributeFilter.length&&!options.attributes|
|options.characterDataOldValue&&!options.characterData){throw new SyntaxError}va
r registrations=registrationsTable.get(target);if(!registrations)registrationsTa
ble.set(target,registrations=[]);var registration;for(var i=0;i<registrations.le
ngth;i++){if(registrations[i].observer===this){registration=registrations[i];reg
istration.removeListeners();registration.options=options;break}}if(!registration
){registration=new Registration(this,target,options);registrations.push(registra
tion);this.nodes_.push(target)}registration.addListeners()},disconnect:function(
){this.nodes_.forEach(function(node){var registrations=registrationsTable.get(no
de);for(var i=0;i<registrations.length;i++){var registration=registrations[i];if
(registration.observer===this){registration.removeListeners();registrations.spli
ce(i,1);break}}},this);this.records_=[]},takeRecords:function(){var copyOfRecord
s=this.records_;this.records_=[];return copyOfRecords}};function MutationRecord(
type,target){this.type=type;this.target=target;this.addedNodes=[];this.removedNo
des=[];this.previousSibling=null;this.nextSibling=null;this.attributeName=null;t
his.attributeNamespace=null;this.oldValue=null}function copyMutationRecord(origi
nal){var record=new MutationRecord(original.type,original.target);record.addedNo
des=original.addedNodes.slice();record.removedNodes=original.removedNodes.slice(
);record.previousSibling=original.previousSibling;record.nextSibling=original.ne
xtSibling;record.attributeName=original.attributeName;record.attributeNamespace=
original.attributeNamespace;record.oldValue=original.oldValue;return record}var
currentRecord,recordWithOldValue;function getRecord(type,target){return currentR
ecord=new MutationRecord(type,target)}function getRecordWithOldValue(oldValue){i
f(recordWithOldValue)return recordWithOldValue;recordWithOldValue=copyMutationRe
cord(currentRecord);recordWithOldValue.oldValue=oldValue;return recordWithOldVal
ue}function clearRecords(){currentRecord=recordWithOldValue=undefined}function r
ecordRepresentsCurrentMutation(record){return record===recordWithOldValue||recor
d===currentRecord}function selectRecord(lastRecord,newRecord){if(lastRecord===ne
wRecord)return lastRecord;if(recordWithOldValue&&recordRepresentsCurrentMutation
(lastRecord))return recordWithOldValue;return null}function Registration(observe
r,target,options){this.observer=observer;this.target=target;this.options=options
;this.transientObservedNodes=[]}Registration.prototype={enqueue:function(record)
{var records=this.observer.records_;var length=records.length;if(records.length>
0){var lastRecord=records[length-1];var recordToReplaceLast=selectRecord(lastRec
ord,record);if(recordToReplaceLast){records[length-1]=recordToReplaceLast;return
}}else{scheduleCallback(this.observer)}records[length]=record},addListeners:func
tion(){this.addListeners_(this.target)},addListeners_:function(node){var options
=this.options;if(options.attributes)node.addEventListener("DOMAttrModified",this
,true);if(options.characterData)node.addEventListener("DOMCharacterDataModified"
,this,true);if(options.childList)node.addEventListener("DOMNodeInserted",this,tr
ue);if(options.childList||options.subtree)node.addEventListener("DOMNodeRemoved"
,this,true)},removeListeners:function(){this.removeListeners_(this.target)},remo
veListeners_:function(node){var options=this.options;if(options.attributes)node.
removeEventListener("DOMAttrModified",this,true);if(options.characterData)node.r
emoveEventListener("DOMCharacterDataModified",this,true);if(options.childList)no
de.removeEventListener("DOMNodeInserted",this,true);if(options.childList||option
s.subtree)node.removeEventListener("DOMNodeRemoved",this,true)},addTransientObse
rver:function(node){if(node===this.target)return;this.addListeners_(node);this.t
ransientObservedNodes.push(node);var registrations=registrationsTable.get(node);
if(!registrations)registrationsTable.set(node,registrations=[]);registrations.pu
sh(this)},removeTransientObservers:function(){var transientObservedNodes=this.tr
ansientObservedNodes;this.transientObservedNodes=[];transientObservedNodes.forEa
ch(function(node){this.removeListeners_(node);var registrations=registrationsTab
le.get(node);for(var i=0;i<registrations.length;i++){if(registrations[i]===this)
{registrations.splice(i,1);break}}},this)},handleEvent:function(e){e.stopImmedia
tePropagation();switch(e.type){case"DOMAttrModified":var name=e.attrName;var nam
espace=e.relatedNode.namespaceURI;var target=e.target;var record=new getRecord("
attributes",target);record.attributeName=name;record.attributeNamespace=namespac
e;var oldValue=e.attrChange===MutationEvent.ADDITION?null:e.prevValue;forEachAnc
estorAndObserverEnqueueRecord(target,function(options){if(!options.attributes)re
turn;if(options.attributeFilter&&options.attributeFilter.length&&options.attribu
teFilter.indexOf(name)===-1&&options.attributeFilter.indexOf(namespace)===-1){re
turn}if(options.attributeOldValue)return getRecordWithOldValue(oldValue);return
record});break;case"DOMCharacterDataModified":var target=e.target;var record=get
Record("characterData",target);var oldValue=e.prevValue;forEachAncestorAndObserv
erEnqueueRecord(target,function(options){if(!options.characterData)return;if(opt
ions.characterDataOldValue)return getRecordWithOldValue(oldValue);return record}
);break;case"DOMNodeRemoved":this.addTransientObserver(e.target);case"DOMNodeIns
erted":var target=e.relatedNode;var changedNode=e.target;var addedNodes,removedN
odes;if(e.type==="DOMNodeInserted"){addedNodes=[changedNode];removedNodes=[]}els
e{addedNodes=[];removedNodes=[changedNode]}var previousSibling=changedNode.previ
ousSibling;var nextSibling=changedNode.nextSibling;var record=getRecord("childLi
st",target);record.addedNodes=addedNodes;record.removedNodes=removedNodes;record
.previousSibling=previousSibling;record.nextSibling=nextSibling;forEachAncestorA
ndObserverEnqueueRecord(target,function(options){if(!options.childList)return;re
turn record})}clearRecords()}};global.MutationObserver=MutationObserver}(window)
} |