1var _____WB$wombat$assign$function_____=function(name){return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name))||self[name];};if(!self.__WB_pmw){self.__WB_pmw=function(obj){this.__WB_source=obj;return this;}}{ 2let window = _____WB$wombat$assign$function_____("window"); 3let self = _____WB$wombat$assign$function_____("self"); 4let document = _____WB$wombat$assign$function_____("document"); 5let location = _____WB$wombat$assign$function_____("location"); 6let top = _____WB$wombat$assign$function_____("top"); 7let parent = _____WB$wombat$assign$function_____("parent"); 8let frames = _____WB$wombat$assign$function_____("frames"); 9let opens = _____WB$wombat$assign$function_____("opens"); 10/** 11 The MIT License 12 13 Copyright (c) 2010 Daniel Park (http://metaweb.com, http://postmessage.freebaseapps.com) 14 15 Permission is hereby granted, free of charge, to any person obtaining a copy 16 of this software and associated documentation files (the "Software"), to deal 17 in the Software without restriction, including without limitation the rights 18 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 copies of the Software, and to permit persons to whom the Software is 20 furnished to do so, subject to the following conditions: 21 22 The above copyright notice and this permission notice shall be included in 23 all copies or substantial portions of the Software. 24 25 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 31 THE SOFTWARE. 32 **/ 33var NO_JQUERY = {}; 34(function(window, $, undefined) { 35 36 if (!("console" in window)) { 37 var c = window.console = {}; 38 c.log = c.warn = c.error = c.debug = function(){}; 39 } 40 41 if ($ === NO_JQUERY) { 42 // jQuery is optional 43 $ = { 44 fn: {}, 45 extend: function() { 46 var a = arguments[0]; 47 for (var i=1,len=arguments.length; i<len; i++) { 48 var b = arguments[i]; 49 for (var prop in b) { 50 a[prop] = b[prop]; 51 } 52 } 53 return a; 54 } 55 }; 56 } 57 58 $.fn.pm = function() { 59 console.log("usage: \nto send: $.pm(options)\nto receive: $.pm.bind(type, fn, [origin])"); 60 return this; 61 }; 62 63 // send postmessage 64 $.pm = window.pm = function(options) { 65 pm.send(options); 66 }; 67 68 // bind postmessage handler 69 $.pm.bind = window.pm.bind = function(type, fn, origin, hash, async_reply) { 70 pm.bind(type, fn, origin, hash, async_reply === true); 71 }; 72 73 // unbind postmessage handler 74 $.pm.unbind = window.pm.unbind = function(type, fn) { 75 pm.unbind(type, fn); 76 }; 77 78 // default postmessage origin on bind 79 $.pm.origin = window.pm.origin = null; 80 81 // default postmessage polling if using location hash to pass postmessages 82 $.pm.poll = window.pm.poll = 200; 83 84 var pm = { 85 86 send: function(options) { 87 var o = $.extend({}, pm.defaults, options), 88 target = o.target; 89 if (!o.target) { 90 console.warn("postmessage target window required"); 91 return; 92 } 93 if (!o.type) { 94 console.warn("postmessage type required"); 95 return; 96 } 97 var msg = {data:o.data, type:o.type}; 98 if (o.success) { 99 msg.callback = pm._callback(o.success); 100 } 101 if (o.error) { 102 msg.errback = pm._callback(o.error); 103 } 104 if (("postMessage" in target) && !o.hash) { 105 pm._bind(); 106 target.postMessage(JSON.stringify(msg), o.origin || '*'); 107 } 108 else { 109 pm.hash._bind(); 110 pm.hash.send(o, msg); 111 } 112 }, 113 114 bind: function(type, fn, origin, hash, async_reply) { 115 pm._replyBind ( type, fn, origin, hash, async_reply ); 116 }, 117 118 _replyBind: function(type, fn, origin, hash, isCallback) { 119 if (("postMessage" in window) && !hash) { 120 pm._bind(); 121 } 122 else { 123 pm.hash._bind(); 124 } 125 var l = pm.data("listeners.postmessage"); 126 if (!l) { 127 l = {}; 128 pm.data("listeners.postmessage", l); 129 } 130 var fns = l[type]; 131 if (!fns) { 132 fns = []; 133 l[type] = fns; 134 }
vendor: 13,129 bytes, lines 135-476
135 fns.push({fn:fn, callback: isCallback, origin:origin || $.pm.origin}); 136 }, 137 138 unbind: function(type, fn) { 139 var l = pm.data("listeners.postmessage"); 140 if (l) { 141 if (type) { 142 if (fn) { 143 // remove specific listener 144 var fns = l[type]; 145 if (fns) { 146 var m = []; 147 for (var i=0,len=fns.length; i<len; i++) { 148 var o = fns[i]; 149 if (o.fn !== fn) { 150 m.push(o); 151 } 152 } 153 l[type] = m; 154 } 155 } 156 else { 157 // remove all listeners by type 158 delete l[type]; 159 } 160 } 161 else { 162 // unbind all listeners of all type 163 for (var i in l) { 164 delete l[i]; 165 } 166 } 167 } 168 }, 169 170 data: function(k, v) { 171 if (v === undefined) { 172 return pm._data[k]; 173 } 174 pm._data[k] = v; 175 return v; 176 }, 177 178 _data: {}, 179 180 _CHARS: '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split(''), 181 182 _random: function() { 183 var r = []; 184 for (var i=0; i<32; i++) { 185 r[i] = pm._CHARS[0 | Math.random() * 32]; 186 }; 187 return r.join(""); 188 }, 189 190 _callback: function(fn) { 191 var cbs = pm.data("callbacks.postmessage"); 192 if (!cbs) { 193 cbs = {}; 194 pm.data("callbacks.postmessage", cbs); 195 } 196 var r = pm._random(); 197 cbs[r] = fn; 198 return r; 199 }, 200 201 _bind: function() { 202 // are we already listening to message events on this w? 203 if (!pm.data("listening.postmessage")) { 204 if (window.addEventListener) { 205 window.addEventListener("message", pm._dispatch, false); 206 } 207 else if (window.attachEvent) { 208 window.attachEvent("onmessage", pm._dispatch); 209 } 210 pm.data("listening.postmessage", 1); 211 } 212 }, 213 214 _dispatch: function(e) { 215 //console.log("$.pm.dispatch", e, this); 216 try { 217 var msg = JSON.parse(e.data); 218 } 219 catch (ex) { 220 //console.warn("postmessage data invalid json: ", ex); //message wasn't meant for pm 221 return; 222 } 223 if (!msg.type) { 224 //console.warn("postmessage message type required"); //message wasn't meant for pm 225 return; 226 } 227 var cbs = pm.data("callbacks.postmessage") || {}, 228 cb = cbs[msg.type]; 229 if (cb) { 230 cb(msg.data); 231 } 232 else { 233 var l = pm.data("listeners.postmessage") || {}; 234 var fns = l[msg.type] || []; 235 for (var i=0,len=fns.length; i<len; i++) { 236 var o = fns[i]; 237 if (o.origin && o.origin !== '*' && e.origin !== o.origin) { 238 console.warn("postmessage message origin mismatch", e.origin, o.origin); 239 if (msg.errback) { 240 // notify post message errback 241 var error = { 242 message: "postmessage origin mismatch", 243 origin: [e.origin, o.origin] 244 }; 245 pm.send({target:e.source, data:error, type:msg.errback}); 246 } 247 continue; 248 } 249 250 function sendReply ( data ) { 251 if (msg.callback) { 252 pm.send({target:e.source, data:data, type:msg.callback}); 253 } 254 } 255 256 try { 257 if ( o.callback ) { 258 o.fn(msg.data, sendReply, e); 259 } else { 260 sendReply ( o.fn(msg.data, e) ); 261 } 262 } 263 catch (ex) { 264 if (msg.errback) { 265 // notify post message errback 266 pm.send({target:e.source, data:ex, type:msg.errback}); 267 } else { 268 throw ex; 269 } 270 } 271 }; 272 } 273 } 274 }; 275 276 // location hash polling 277 pm.hash = { 278 279 send: function(options, msg) { 280 //console.log("hash.send", target_window, options, msg); 281 var target_window = options.target, 282 target_url = options.url; 283 if (!target_url) { 284 console.warn("postmessage target window url is required"); 285 return; 286 } 287 target_url = pm.hash._url(target_url); 288 var source_window, 289 source_url = pm.hash._url(window.location.href); 290 if (window == target_window.parent) { 291 source_window = "parent"; 292 } 293 else { 294 try { 295 for (var i=0,len=parent.frames.length; i<len; i++) { 296 var f = parent.frames[i]; 297 if (f == window) { 298 source_window = i; 299 break; 300 } 301 }; 302 } 303 catch(ex) { 304 // Opera: security error trying to access parent.frames x-origin 305 // juse use window.name 306 source_window = window.name; 307 } 308 } 309 if (source_window == null) { 310 console.warn("postmessage windows must be direct parent/child windows and the child must be available through the parent window.frames list"); 311 return; 312 } 313 var hashmessage = { 314 "x-requested-with": "postmessage", 315 source: { 316 name: source_window, 317 url: source_url 318 }, 319 postmessage: msg 320 }; 321 var hash_id = "#x-postmessage-id=" + pm._random(); 322 target_window.location = target_url + hash_id + encodeURIComponent(JSON.stringify(hashmessage)); 323 }, 324 325 _regex: /^\#x\-postmessage\-id\=(\w{32})/, 326 327 _regex_len: "#x-postmessage-id=".length + 32, 328 329 _bind: function() { 330 // are we already listening to message events on this w? 331 if (!pm.data("polling.postmessage")) { 332 setInterval(function() { 333 var hash = "" + window.location.hash, 334 m = pm.hash._regex.exec(hash); 335 if (m) { 336 var id = m[1]; 337 if (pm.hash._last !== id) { 338 pm.hash._last = id; 339 pm.hash._dispatch(hash.substring(pm.hash._regex_len)); 340 } 341 } 342 }, $.pm.poll || 200); 343 pm.data("polling.postmessage", 1); 344 } 345 }, 346 347 _dispatch: function(hash) { 348 if (!hash) { 349 return; 350 } 351 try { 352 hash = JSON.parse(decodeURIComponent(hash)); 353 if (!(hash['x-requested-with'] === 'postmessage' && 354 hash.source && hash.source.name != null && hash.source.url && hash.postmessage)) { 355 // ignore since hash could've come from somewhere else 356 return; 357 } 358 } 359 catch (ex) { 360 // ignore since hash could've come from somewhere else 361 return; 362 } 363 var msg = hash.postmessage, 364 cbs = pm.data("callbacks.postmessage") || {}, 365 cb = cbs[msg.type]; 366 if (cb) { 367 cb(msg.data); 368 } 369 else { 370 var source_window; 371 if (hash.source.name === "parent") { 372 source_window = window.parent; 373 } 374 else { 375 source_window = window.frames[hash.source.name]; 376 } 377 var l = pm.data("listeners.postmessage") || {}; 378 var fns = l[msg.type] || []; 379 for (var i=0,len=fns.length; i<len; i++) { 380 var o = fns[i]; 381 if (o.origin) { 382 var origin = /https?\:\/\/[^\/]*/.exec(hash.source.url)[0]; 383 if (o.origin !== '*' && origin !== o.origin) { 384 console.warn("postmessage message origin mismatch", origin, o.origin); 385 if (msg.errback) { 386 // notify post message errback 387 var error = { 388 message: "postmessage origin mismatch", 389 origin: [origin, o.origin] 390 }; 391 pm.send({target:source_window, data:error, type:msg.errback, hash:true, url:hash.source.url}); 392 } 393 continue; 394 } 395 } 396 397 function sendReply ( data ) { 398 if (msg.callback) { 399 pm.send({target:source_window, data:data, type:msg.callback, hash:true, url:hash.source.url}); 400 } 401 } 402 403 try { 404 if ( o.callback ) { 405 o.fn(msg.data, sendReply); 406 } else { 407 sendReply ( o.fn(msg.data) ); 408 } 409 } 410 catch (ex) { 411 if (msg.errback) { 412 // notify post message errback 413 pm.send({target:source_window, data:ex, type:msg.errback, hash:true, url:hash.source.url}); 414 } else { 415 throw ex; 416 } 417 } 418 }; 419 } 420 }, 421 422 _url: function(url) { 423 // url minus hash part 424 return (""+url).replace(/#.*$/, ""); 425 } 426 427 }; 428 429 $.extend(pm, { 430 defaults: { 431 target: null, /* target window (required) */ 432 url: null, /* target window url (required if no window.postMessage or hash == true) */ 433 type: null, /* message type (required) */ 434 data: null, /* message data (required) */ 435 success: null, /* success callback (optional) */ 436 error: null, /* error callback (optional) */ 437 origin: "*", /* postmessage origin (optional) */ 438 hash: false /* use location hash for message passing (optional) */ 439 } 440 }); 441 442 })(this, typeof jQuery === "undefined" ? NO_JQUERY : jQuery); 443; 444( function ( g ) { 445 446 var t = { 447 PLATFORM_WINDOWS: 'windows', 448 PLATFORM_IPHONE: 'iphone', 449 PLATFORM_IPOD: 'ipod', 450 PLATFORM_IPAD: 'ipad', 451 PLATFORM_BLACKBERRY: 'blackberry', 452 PLATFORM_BLACKBERRY_10: 'blackberry_10', 453 PLATFORM_SYMBIAN: 'symbian_series60', 454 PLATFORM_SYMBIAN_S40: 'symbian_series40', 455 PLATFORM_J2ME_MIDP: 'j2me_midp', 456 PLATFORM_ANDROID: 'android', 457 PLATFORM_ANDROID_TABLET: 'android_tablet', 458 PLATFORM_FIREFOX_OS: 'firefoxOS', 459 PLATFORM_MOBILE_GENERIC: 'mobile_generic', 460 461 userAgent : false, // Shortcut to the browser User Agent String. 462 matchedPlatformName : false, // Matched platform name. False otherwise. 463 matchedUserAgentName : false, // Matched UA String. False otherwise. 464 465 init: function() { 466 try { 467 t.userAgent = g.navigator.userAgent.toLowerCase(); 468 t.getPlatformName(); 469 t.getMobileUserAgentName(); 470 } catch ( e ) { 471 console.error( e ); 472 } 473 }, 474 475 initForTest: function( userAgent ) { 476 t.matchedPlatformName = false;
477 t.matchedUserAgentName = false; 478 try { 479 t.userAgent = userAgent.toLowerCase(); 480 t.getPlatformName(); 481 t.getMobileUserAgentName(); 482 } catch ( e ) { 483 console.error( e ); 484 } 485 }, 486 487 /** 488 * This method detects the mobile User Agent name. 489 */ 490 getMobileUserAgentName: function() { 491 if ( t.matchedUserAgentName !== false ) 492 return t.matchedUserAgentName; 493 494 if ( t.userAgent === false ) 495 return false; 496 497 if ( t.isChromeForIOS() ) 498 t.matchedUserAgentName = 'chrome-for-ios'; 499 else if ( t.isTwitterForIpad() ) 500 t.matchedUserAgentName = 'twitter-for-ipad'; 501 else if ( t.isTwitterForIphone() ) 502 t.matchedUserAgentName = 'twitter-for-iphone'; 503 else if ( t.isIPhoneOrIPod() ) 504 t.matchedUserAgentName = 'iphone'; 505 else if ( t.isIPad() ) 506 t.matchedUserAgentName = 'ipad'; 507 else if ( t.isAndroidTablet() ) 508 t.matchedUserAgentName = 'android_tablet'; 509 else if ( t.isAndroid() ) 510 t.matchedUserAgentName = 'android'; 511 else if ( t.isBlackberry10() ) 512 t.matchedUserAgentName = 'blackberry_10'; 513 else if ( has( 'blackberry' ) ) 514 t.matchedUserAgentName = 'blackberry'; 515 else if ( t.isBlackberryTablet() ) 516 t.matchedUserAgentName = 'blackberry_tablet'; 517 else if ( t.isWindowsPhone7() ) 518 t.matchedUserAgentName = 'win7'; 519 else if ( t.isWindowsPhone8() ) 520 t.matchedUserAgentName = 'winphone8'; 521 else if ( t.isOperaMini() ) 522 t.matchedUserAgentName = 'opera-mini'; 523 else if ( t.isOperaMobile() ) 524 t.matchedUserAgentName = 'opera-mobi'; 525 else if ( t.isKindleFire() ) 526 t.matchedUserAgentName = 'kindle-fire'; 527 else if ( t.isSymbianPlatform() ) 528 t.matchedUserAgentName = 'series60'; 529 else if ( t.isFirefoxMobile() ) 530 t.matchedUserAgentName = 'firefox_mobile'; 531 else if ( t.isFirefoxOS() ) 532 t.matchedUserAgentName = 'firefoxOS'; 533 else if ( t.isFacebookForIphone() ) 534 t.matchedUserAgentName = 'facebook-for-iphone'; 535 else if ( t.isFacebookForIpad() ) 536 t.matchedUserAgentName = 'facebook-for-ipad'; 537 else if ( t.isWordPressForIos() ) 538 t.matchedUserAgentName = 'ios-app'; 539 else if ( has( 'iphone' ) ) 540 t.matchedUserAgentName = 'iphone-unknown'; 541 else if ( has( 'ipad' ) ) 542 t.matchedUserAgentName = 'ipad-unknown'; 543 544 return t.matchedUserAgentName; 545 }, 546 547 /** 548 * This method detects the mobile platform name. 549 */ 550 getPlatformName : function() { 551 if ( t.matchedPlatformName !== false ) 552 return t.matchedPlatformName; 553 554 if ( t.userAgent === false ) 555 return false; 556 557 if ( has( 'windows ce' ) || has( 'windows phone' ) ) { 558 t.matchedPlatformName = t.PLATFORM_WINDOWS; 559 } else if ( has( 'ipad' ) ) { 560 t.matchedPlatformName = t.PLATFORM_IPAD; 561 } else if ( has( 'ipod' ) ) { 562 t.matchedPlatformName = t.PLATFORM_IPOD; 563 } else if ( has( 'iphone' ) ) { 564 t.matchedPlatformName = t.PLATFORM_IPHONE; 565 } else if ( has( 'android' ) ) { 566 if ( t.isAndroidTablet() ) 567 t.matchedPlatformName = t.PLATFORM_ANDROID_TABLET; 568 else 569 t.matchedPlatformName = t.PLATFORM_ANDROID; 570 } else if ( t.isKindleFire() ) { 571 t.matchedPlatformName = t.PLATFORM_ANDROID_TABLET; 572 } else if ( t.isBlackberry10() ) { 573 t.matchedPlatformName = t.PLATFORM_BLACKBERRY_10; 574 } else if ( has( 'blackberry' ) ) { 575 t.matchedPlatformName = t.PLATFORM_BLACKBERRY; 576 } else if ( t.isBlackberryTablet() ) { 577 t.matchedPlatformName = t.PLATFORM_BLACKBERRY; 578 } else if ( t.isSymbianPlatform() ) { 579 t.matchedPlatformName = t.PLATFORM_SYMBIAN; 580 } else if ( t.isSymbianS40Platform() ) { 581 t.matchedPlatformName = t.PLATFORM_SYMBIAN_S40; 582 } else if ( t.isJ2MEPlatform() ) { 583 t.matchedPlatformName = t.PLATFORM_J2ME_MIDP; 584 } else if ( t.isFirefoxOS() ) { 585 t.matchedPlatformName = t.PLATFORM_FIREFOX_OS; 586 } else if ( t.isFirefoxMobile() ) { 587 t.matchedPlatformName = t.PLATFORM_MOBILE_GENERIC; 588 } 589 590 return t.matchedPlatformName; 591 }, 592 593 594 /** 595 * Detect the BlackBerry OS version. 596 * 597 * Note: This is for smartphones only. Does not work on BB tablets. 598 */ 599 getBlackBerryOSVersion : check( function() { 600 if ( t.isBlackberry10() ) 601 return '10'; 602 603 if ( ! has( 'blackberry' ) ) 604 return false;
605 606 var rv = -1; // Return value assumes failure. 607 var re; 608 609 if ( has( 'webkit' ) ) { // Detecting the BB OS version for devices running OS 6.0 or higher 610 re = /Version\/([\d\.]+)/i; 611 } else { 612 // BlackBerry devices <= 5.XX 613 re = /BlackBerry\w+\/([\d\.]+)/i; 614 } 615 if ( re.exec( t.userAgent ) != null ) 616 rv = RegExp.$1.toString(); 617 618 return rv === -1 ? false : rv; 619 } ), 620 621 /** 622 * Detects if the current UA is iPhone Mobile Safari or another iPhone or iPod Touch Browser. 623 */ 624 isIPhoneOrIPod : check( function() { 625 return has( 'safari' ) && ( has( 'iphone' ) || has( 'ipod' ) ); 626 } ), 627 628 /** 629 * Detects if the current device is an iPad. 630 */ 631 isIPad : check( function() { 632 return has( 'ipad' ) && has( 'safari' ); 633 } ), 634 635 636 /** 637 * Detects if the current UA is Chrome for iOS 638 */ 639 isChromeForIOS : check( function() { 640 return t.isIPhoneOrIPod() && has( 'crios/' ); 641 } ), 642 643 /** 644 * Detects if the current browser is the Native Android browser. 645 */ 646 isAndroid : check( function() { 647 if ( has( 'android' ) ) { 648 return ! ( t.isOperaMini() || t.isOperaMobile() || t.isFirefoxMobile() ); 649 } 650 } ), 651 652 /** 653 * Detects if the current browser is the Native Android Tablet browser. 654 */ 655 isAndroidTablet : check( function() { 656 if ( has( 'android' ) && ! has( 'mobile' ) ) { 657 return ! ( t.isOperaMini() || t.isOperaMobile() || t.isFirefoxMobile() ); 658 } 659 } ), 660 661 662 /** 663 * Detects if the current browser is Opera Mobile 664 */ 665 isOperaMobile : check( function() { 666 return has( 'opera' ) && has( 'mobi' ); 667 } ), 668 669 /** 670 * Detects if the current browser is Opera Mini 671 */ 672 isOperaMini : check( function() { 673 return has( 'opera' ) && has( 'mini' ); 674 } ), 675 676 677 /** 678 * isBlackberry10() can be used to check the User Agent for a BlackBerry 10 device. 679 */ 680 isBlackberry10 : check( function() { 681 return has( 'bb10' ) && has( 'mobile' ); 682 } ), 683 684 /** 685 * isBlackberryTablet() can be used to check the User Agent for a RIM blackberry tablet 686 */ 687 isBlackberryTablet : check( function() { 688 return has( 'playbook' ) && has( 'rim tablet' ); 689 } ), 690 691 /** 692 * Detects if the current browser is a Windows Phone 7 device. 693 */ 694 isWindowsPhone7 : check( function () { 695 return has( 'windows phone os 7' ); 696 } ), 697 698 /** 699 * Detects if the current browser is a Windows Phone 8 device. 700 */ 701 isWindowsPhone8 : check( function () { 702 return has( 'windows phone 8' ); 703 } ), 704 705 /** 706 * Detects if the device platform is J2ME. 707 */ 708 isJ2MEPlatform : check( function () { 709 return has( 'j2me/midp' ) || ( has( 'midp' ) && has( 'cldc' ) ); 710 } ), 711 712 713 /** 714 * Detects if the device platform is the Symbian Series 40. 715 */ 716 isSymbianS40Platform : check( function() { 717 if ( has( 'series40' ) ) { 718 return has( 'nokia' ) || has( 'ovibrowser' ) || has( 'nokiabrowser' ); 719 } 720 } ), 721 722 723 /** 724 * Detects if the device platform is the Symbian Series 60. 725 */ 726 isSymbianPlatform : check( function() { 727 if ( has( 'webkit' ) ) { 728 // First, test for WebKit, then make sure it's either Symbian or S60. 729 return has( 'symbian' ) || has( 'series60' ); 730 } else if ( has( 'symbianos' ) && has( 'series60' ) ) { 731 return true; 732 } else if ( has( 'nokia' ) && has( 'series60' ) ) { 733 return true; 734 } else if ( has( 'opera mini' ) ) { 735 return has( 'symbianos' ) || has( 'symbos' ) || has( 'series 60' ); 736 } 737 } ), 738 739 740 /** 741 * Detects if the current browser is the Kindle Fire Native browser. 742 */ 743 isKindleFire : check( function() { 744 return has( 'silk/' ) && has( 'silk-accelerated=' ); 745 } ), 746 747 /** 748 * Detects if the current browser is Firefox Mobile (Fennec) 749 */ 750 isFirefoxMobile : check( function() { 751 return has( 'fennec' ); 752 } ), 753 754 755 /** 756 * Detects if the current browser is the native FirefoxOS browser 757 */ 758 isFirefoxOS : check( function() { 759 return has( 'mozilla' ) && has( 'mobile' ) && has( 'gecko' ) && has( 'firefox' ); 760 } ), 761 762 763 /** 764 * Detects if the current UA is Facebook for iPad 765 */ 766 isFacebookForIpad : check( function() { 767 if ( ! has( 'ipad' ) ) 768 return false;
769 770 return has( 'facebook' ) || has( 'fbforiphone' ) || has( 'fban/fbios;' ); 771 } ), 772 773 /** 774 * Detects if the current UA is Facebook for iPhone 775 */ 776 isFacebookForIphone : check( function() { 777 if ( ! has( 'iphone' ) ) 778 return false; 779 780 return ( has( 'facebook' ) && ! has( 'ipad' ) ) || 781 ( has( 'fbforiphone' ) && ! has( 'tablet' ) ) || 782 ( has( 'fban/fbios;' ) && ! has( 'tablet' ) ); // FB app v5.0 or higher 783 } ), 784 785 /** 786 * Detects if the current UA is Twitter for iPhone 787 */ 788 isTwitterForIphone : check( function() { 789 if ( has( 'ipad' ) ) 790 return false; 791 792 return has( 'twitter for iphone' ); 793 } ), 794 795 /** 796 * Detects if the current UA is Twitter for iPad 797 */ 798 isTwitterForIpad : check( function() { 799 return has( 'twitter for ipad' ) || ( has( 'ipad' ) && has( 'twitter for iphone' ) ); 800 } ), 801 802 803 /** 804 * Detects if the current UA is WordPress for iOS 805 */ 806 isWordPressForIos : check( function() { 807 return has( 'wp-iphone' ); 808 } ) 809 }; 810 811 function has( str ) { 812 return t.userAgent.indexOf( str ) != -1; 813 } 814 815 function check( fn ) { 816 return function() { 817 return t.userAgent === false ? false : fn() || false; 818 } 819 } 820 821 g.wpcom_mobile_user_agent_info = t; 822 823} )( typeof window !== 'undefined' ? window : this ); 824; 825 826}
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.