1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
/* Do not modify this file directly. It is compiled from other files. */
/**
The MIT License
Copyright (c) 2010 Daniel Park (http://metaweb.com, http://postmessage.freebaseapps.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
**/
var NO_JQUERY={};!function(e,t,n){if(!("console"in e)){var a=e.console={};a.log=a.warn=a.error=a.debug=function(){}}t===NO_JQUERY&&(t={fn:{},extend:function(){for(var e=arguments[0],t=1,n=arguments.length;t<n;t++){var a=arguments[t];for(var r in a)e[r]=a[r]}return e}}),t.fn.pm=function(){return console.log("usage: \nto send: $.pm(options)\nto receive: $.pm.bind(type, fn, [origin])"),this},t.pm=e.pm=function(e){r.send(e)},t.pm.bind=e.pm.bind=function(e,t,n,a,s){r.bind(e,t,n,a,!0===s)},t.pm.unbind=e.pm.unbind=function(e,t){r.unbind(e,t)},t.pm.origin=e.pm.origin=null,t.pm.poll=e.pm.poll=200;var r={send:function(e){var n=t.extend({},r.defaults,e),a=n.target;if(!n.target)return void console.warn("postmessage target window required");if(!n.type)return void console.warn("postmessage type required");var s={data:n.data,type:n.type};n.success&&(s.callback=r._callback(n.success)),n.error&&(s.errback=r._callback(n.error)),"postMessage"in a&&!n.hash?(r._bind(),a.postMessage(JSON.stringify(s),n.origin||"*")):(r.hash._bind(),r.hash.send(n,s))},bind:function(e,t,n,a,s){r._replyBind(e,t,n,a,s)},_replyBind:function(n,a,s,o,i){"postMessage"in e&&!o?r._bind():r.hash._bind();var u=r.data("listeners.postmessage");u||(u={},r.data("listeners.postmessage",u));var c=u[n];c||(c=[],u[n]=c),c.push({fn:a,callback:i,origin:s||t.pm.origin})},unbind:function(e,t){var n=r.data("listeners.postmessage");if(n)if(e)if(t){var a=n[e];if(a){for(var s=[],o=0,i=a.length;o<i;o++){var u=a[o];u.fn!==t&&s.push(u)}n[e]=s}}else delete n[e];else for(var o in n)delete n[o]},data:function(e,t){return void 0===t?r._data[e]:(r._data[e]=t,t)},_data:{},_CHARS:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),_random:function(){for(var e=[],t=0;t<32;t++)e[t]=r._CHARS[0|32*Math.random()];return e.join("")},_callback:function(e){var t=r.data("callbacks.postmessage");t||(t={},r.data("callbacks.postmessage",t));var n=r._random();return t[n]=e,n},_bind:function(){r.data("listening.postmessage")||(e.addEventListener?e.addEventListener("message",r._dispatch,!1):e.attachEvent&&e.attachEvent("onmessage",r._dispatch),r.data("listening.postmessage",1))},_dispatch:function(e){function t(t){n.callback&&r.send({target:e.source,data:t,type:n.callback})}try{var n=JSON.parse(e.data)}catch(e){return}if(n.type){var a=r.data("callbacks.postmessage")||{},s=a[n.type];if(s)s(n.data);else for(var o=r.data("listeners.postmessage")||{},i=o[n.type]||[],u=0,c=i.length;u<c;u++){var l=i[u];if(l.origin&&"*"!==l.origin&&e.origin!==l.origin){if(console.warn("postmessage message origin mismatch",e.origin,l.origin),n.errback){var f={message:"postmessage origin mismatch",origin:[e.origin,l.origin]};r.send({target:e.source,data:f,type:n.errback})}}else try{l.callback?l.fn(n.data,t,e):t(l.fn(n.data,e))}catch(t){if(!n.errback)throw t;r.send({target:e.source,data:t,type:n.errback})}}}}};r.hash={send:function(t,n){var a=t.target,s=t.url;if(!s)return void console.warn("postmessage target window url is required");s=r.hash._url(s);var o,i=r.hash._url(e.location.href);if(e==a.parent)o="parent";else try{for(var u=0,c=parent.frames.length;u<c;u++){if(parent.frames[u]==e){o=u;break}}}catch(t){o=e.name}if(null==o)return void console.warn("postmessage windows must be direct parent/child windows and the child must be available through the parent window.frames list");var l={"x-requested-with":"postmessage",source:{name:o,url:i},postmessage:n},f="#x-postmessage-id="+r._random();a.location=s+f+encodeURIComponent(JSON.stringify(l))},_regex:/^\#x\-postmessage\-id\=(\w{32})/,_regex_len:"#x-postmessage-id=".length+32,_bind:function(){r.data("polling.postmessage")||(setInterval(function(){var t=""+e.location.hash,n=r.hash._regex.exec(t);if(n){var a=n[1];r.hash._last!==a&&(r.hash._last=a,r.hash._dispatch(t.substring(r.hash._regex_len)))}},t.pm.poll||200),r.data("polling.postmessage",1))},_dispatch:function(t){function n(e){a.callback&&r.send({target:i,data:e,type:a.callback,hash:!0,url:t.source.url})}if(t){try{if(t=JSON.parse(decodeURIComponent(t)),!("postmessage"===t["x-requested-with"]&&t.source&&null!=t.source.name&&t.source.url&&t.postmessage))return}catch(e){return}var a=t.postmessage,s=r.data("callbacks.postmessage")||{},o=s[a.type];if(o)o(a.data);else{var i;i="parent"===t.source.name?e.parent:e.frames[t.source.name];for(var u=r.data("listeners.postmessage")||{},c=u[a.type]||[],l=0,f=c.length;l<f;l++){var p=c[l];if(p.origin){var g=/https?\:\/\/[^\/]*/.exec(t.source.url)[0];if("*"!==p.origin&&g!==p.origin){if(console.warn("postmessage message origin mismatch",g,p.origin),a.errback){var d={message:"postmessage origin mismatch",origin:[g,p.origin]};r.send({target:i,data:d,type:a.errback,hash:!0,url:t.source.url})}continue}}try{p.callback?p.fn(a.data,n):n(p.fn(a.data))}catch(e){if(!a.errback)throw e;r.send({target:i,data:e,type:a.errback,hash:!0,url:t.source.url})}}}}},_url:function(e){return(""+e).replace(/#.*$/,"")}},t.extend(r,{defaults:{target:null,url:null,type:null,data:null,success:null,error:null,origin:"*",hash:!1}})}(this,"undefined"==typeof jQuery?NO_JQUERY:jQuery),"JSON"in window&&window.JSON||(JSON={}),function(){function f(e){return e<10?"0"+e:e}function quote(e){return escapable.lastIndex=0,escapable.test(e)?'"'+e.replace(escapable,function(e){var t=meta[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function str(e,t){var n,a,r,s,o,i=gap,u=t[e];switch(u&&"object"==typeof u&&"function"==typeof u.toJSON&&(u=u.toJSON(e)),"function"==typeof rep&&(u=rep.call(t,e,u)),typeof u){case"string":return quote(u);case"number":return isFinite(u)?String(u):"null";case"boolean":case"null":return String(u);case"object":if(!u)return"null";if(gap+=indent,o=[],"[object Array]"===Object.prototype.toString.apply(u)){for(s=u.length,n=0;n<s;n+=1)o[n]=str(n,u)||"null";return r=0===o.length?"[]":gap?"[\n"+gap+o.join(",\n"+gap)+"\n"+i+"]":"["+o.join(",")+"]",gap=i,r}if(rep&&"object"==typeof rep)for(s=rep.length,n=0;n<s;n+=1)"string"==typeof(a=rep[n])&&(r=str(a,u))&&o.push(quote(a)+(gap?": ":":")+r);else for(a in u)Object.hasOwnProperty.call(u,a)&&(r=str(a,u))&&o.push(quote(a)+(gap?": ":":")+r);return r=0===o.length?"{}":gap?"{\n"+gap+o.join(",\n"+gap)+"\n"+i+"}":"{"+o.join(",")+"}",gap=i,r}}"function"!=typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(e){return this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z"},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(e){return this.valueOf()});var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;"function"!=typeof JSON.stringify&&(JSON.stringify=function(e,t,n){var a;if(gap="",indent="","number"==typeof n)for(a=0;a<n;a+=1)indent+=" ";else"string"==typeof n&&(indent=n);if(rep=t,t&&"function"!=typeof t&&("object"!=typeof t||"number"!=typeof t.length))throw new Error("JSON.stringify");return str("",{"":e})}),"function"!=typeof JSON.parse&&(JSON.parse=function(text,reviver){function walk(e,t){var n,a,r=e[t];if(r&&"object"==typeof r)for(n in r)Object.hasOwnProperty.call(r,n)&&(a=walk(r,n),void 0!==a?r[n]=a:delete r[n]);return reviver.call(e,t,r)}var j;if(cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(e){return"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})),/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return j=eval("("+text+")"),"function"==typeof reviver?walk({"":j},""):j;throw new SyntaxError("JSON.parse")})}();
|