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,a){if(!("console"in e)){var n=e.console={};n.log=n.warn=n.error=n.debug=function(){}}t===NO_JQUERY&&(t={fn:{},extend:function(){for(var e=arguments[0],t=1,a=arguments.length;t<a;t++){var n=arguments[t];for(var r in n)e[r]=n[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,a,n,s){r.bind(e,t,a,n,!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 a=t.extend({},r.defaults,e),n=a.target;if(a.target)if(a.type){var s={data:a.data,type:a.type};a.success&&(s.callback=r._callback(a.success)),a.error&&(s.errback=r._callback(a.error)),"postMessage"in n&&!a.hash?(r._bind(),n.postMessage(JSON.stringify(s),a.origin||"*")):(r.hash._bind(),r.hash.send(a,s))}else console.warn("postmessage type required");else console.warn("postmessage target window required")},bind:function(e,t,a,n,s){r._replyBind(e,t,a,n,s)},_replyBind:function(a,n,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[a];c||(c=[],u[a]=c),c.push({fn:n,callback:i,origin:s||t.pm.origin})},unbind:function(e,t){var a=r.data("listeners.postmessage");if(a)if(e)if(t){var n=a[e];if(n){for(var s=[],o=0,i=n.length;o<i;o++){var u=n[o];u.fn!==t&&s.push(u)}a[e]=s}}else delete a[e];else for(var o in a)delete a[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 a=r._random();return t[a]=e,a},_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){try{var t=JSON.parse(e.data)}catch(e){return}if(t.type){var a=(r.data("callbacks.postmessage")||{})[t.type];if(a)a(t.data);else for(var n=(r.data("listeners.postmessage")||{})[t.type]||[],s=0,o=n.length;s<o;s++){var i=n[s];if(i.origin&&"*"!==i.origin&&e.origin!==i.origin){if(console.warn("postmessage message origin mismatch",e.origin,i.origin),t.errback){var u={message:"postmessage origin mismatch",origin:[e.origin,i.origin]};r.send({target:e.source,data:u,type:t.errback})}}else try{i.callback?i.fn(t.data,c,e):c(i.fn(t.data,e))}catch(a){if(!t.errback)throw a;r.send({target:e.source,data:a,type:t.errback})}function c(a){t.callback&&r.send({target:e.source,data:a,type:t.callback})}}}}};r.hash={send:function(t,a){var n=t.target,s=t.url;if(s){s=r.hash._url(s);var o,i=r.hash._url(e.location.href);if(e==n.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){var l={"x-requested-with":"postmessage",source:{name:o,url:i},postmessage:a},f="#x-postmessage-id="+r._random();n.location=s+f+encodeURIComponent(JSON.stringify(l))}else console.warn("postmessage windows must be direct parent/child windows and the child must be available through the parent window.frames list")}else console.warn("postmessage target window url is required")},_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,a=r.hash._regex.exec(t);if(a){var n=a[1];r.hash._last!==n&&(r.hash._last=n,r.hash._dispatch(t.substring(r.hash._regex_len)))}},t.pm.poll||200),r.data("polling.postmessage",1))},_dispatch:function(t){if(t){try{if(!("postmessage"===(t=JSON.parse(decodeURIComponent(t)))["x-requested-with"]&&t.source&&null!=t.source.name&&t.source.url&&t.postmessage))return}catch(e){return}var a=t.postmessage,n=(r.data("callbacks.postmessage")||{})[a.type];if(n)n(a.data);else{var s;s="parent"===t.source.name?e.parent:e.frames[t.source.name];for(var o=(r.data("listeners.postmessage")||{})[a.type]||[],i=0,u=o.length;i<u;i++){var c=o[i];if(c.origin){var l=/https?\:\/\/[^\/]*/.exec(t.source.url)[0];if("*"!==c.origin&&l!==c.origin){if(console.warn("postmessage message origin mismatch",l,c.origin),a.errback){var f={message:"postmessage origin mismatch",origin:[l,c.origin]};r.send({target:s,data:f,type:a.errback,hash:!0,url:t.source.url})}continue}}function p(e){a.callback&&r.send({target:s,data:e,type:a.callback,hash:!0,url:t.source.url})}try{c.callback?c.fn(a.data,p):p(c.fn(a.data))}catch(e){if(!a.errback)throw e;r.send({target:s,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"!=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 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 a,n,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,a=0;a<s;a+=1)o[a]=str(a,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,a=0;a<s;a+=1)"string"==typeof(n=rep[a])&&(r=str(n,u))&&o.push(quote(n)+(gap?": ":":")+r);else for(n in u)Object.hasOwnProperty.call(u,n)&&(r=str(n,u))&&o.push(quote(n)+(gap?": ":":")+r);return r=0===o.length?"{}":gap?"{\n"+gap+o.join(",\n"+gap)+"\n"+i+"}":"{"+o.join(",")+"}",gap=i,r}}"function"!=typeof JSON.stringify&&(JSON.stringify=function(e,t,a){var n;if(gap="",indent="","number"==typeof a)for(n=0;n<a;n+=1)indent+=" ";else"string"==typeof a&&(indent=a);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){var j;function walk(e,t){var a,n,r=e[t];if(r&&"object"==typeof r)for(a in r)Object.hasOwnProperty.call(r,a)&&(void 0!==(n=walk(r,a))?r[a]=n:delete r[a]);return reviver.call(e,t,r)}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")})}();
|