PluginProbe ʕ •ᴥ•ʔ
Gallery : FooGallery / 3.3.2
Gallery : FooGallery v3.3.2
3.3.2 3.3.3 3.3.0 3.1.31 3.1.32 3.1.34 3.1.36 3.2.0 3.2.6 trunk 1.10.3 2.0.24 2.1.34 2.2.44 2.3.3 2.4.32 3.0.6 3.1.11 3.1.12 3.1.13 3.1.20 3.1.25 3.1.26 3.1.26.1 3.1.26.2
foogallery / freemius / assets / js / nojquery.ba-postmessage.js
foogallery / freemius / assets / js Last commit date
pricing 3 days ago index.php 3 days ago jquery.form.js 3 days ago nojquery.ba-postmessage.js 3 days ago postmessage.js 3 days ago
nojquery.ba-postmessage.js
28 lines
1 /*!
2 * jQuery postMessage - v0.5 - 9/11/2009
3 * http://benalman.com/projects/jquery-postmessage-plugin/
4 *
5 * Copyright (c) 2009 "Cowboy" Ben Alman
6 * Dual licensed under the MIT and GPL licenses.
7 * http://benalman.com/about/license/
8 *
9 * Non-jQuery fork by Jeff Lee
10 *
11 * This fork consists of the following changes:
12 * 1. Basic code cleanup and restructuring, for legibility.
13 * 2. The `postMessage` and `receiveMessage` functions can be bound arbitrarily,
14 * in terms of both function names and object scope. Scope is specified by
15 * the the "this" context of NoJQueryPostMessageMixin();
16 * 3. I've removed the check for Opera 9.64, which used `$.browser`. There were
17 * at least three different GitHub users requesting the removal of this
18 * "Opera sniff" on the original project's Issues page, so I figured this
19 * would be a relatively safe change.
20 * 4. `postMessage` no longer uses `$.param` to serialize messages that are not
21 * strings. I actually prefer this structure anyway. `receiveMessage` does
22 * not implement a corresponding deserialization step, and as such it seems
23 * cleaner and more symmetric to leave both data serialization and
24 * deserialization to the client.
25 * 5. The use of `$.isFunction` is replaced by a functionally-identical check.
26 * 6. The `$:nomunge` YUI option is no longer necessary.
27 */
28 function NoJQueryPostMessageMixin(n,e){var t,i,o,s,a,r=1;return window.postMessage?(window.addEventListener?(t=function(n){window.addEventListener("message",n,!1)},i=function(n){window.removeEventListener("message",n,!1)}):(t=function(n){window.attachEvent("onmessage",n)},i=function(n){window.detachEvent("onmessage",n)}),this[n]=function(n,e,t){e&&t.postMessage(n,e.replace(/([^:]+:\/\/[^\/]+).*/,"$1"))},this[e]=function(n,e,s){if(o&&(i(o),o=null),!n)return!1;o=t((function(t){switch(Object.prototype.toString.call(e)){case"[object String]":if(e!==t.origin)return!1;break;case"[object Function]":if(e(t.origin))return!1}n(t)}))}):(this[n]=function(n,e,t){e&&(t.location=e.replace(/#.*$/,"")+"#"+ +new Date+r+++"&"+n)},this[e]=function(n,e,t){s&&(clearInterval(s),s=null),n&&(t="number"==typeof e?e:"number"==typeof t?t:100,s=setInterval((function(){var e=document.location.hash,t=/^#?\d+&/;e!==a&&t.test(e)&&(a=e,n({data:e.replace(t,"")}))}),t))}),this}