Kamiel

MadsOrmma.js

Jun 19th, 2014
375
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. window.init_ormmaview = function() {
  2.     var b = window.ormmaview = {},
  3.         j = {
  4.             width: 100,
  5.             height: 100,
  6.             useCustomClose: !1,
  7.             isModal: !1,
  8.             lockOrientation: !1,
  9.             useBackground: !1,
  10.             backgroundColor: "#ffffff",
  11.             backgroundOpacity: 1
  12.         },
  13.         resizeProps = {
  14.             width: 100,
  15.             height: 100,
  16.             customClosePosition: "top-right",
  17.             offsetX: 0,
  18.             offsetY: 0,
  19.             allowOffscreen: !1
  20.         },
  21.         orientationProps = {
  22.             allowOrientationChange : !0,
  23.             forceOrientation : "none"
  24.         },
  25.         calendarParams = {
  26.             description: "",
  27.             location: "",
  28.             summary: "",
  29.             start: "",
  30.             end: "",
  31.             status: "",
  32.             transparency: "",
  33.             recurrence: "",
  34.             reminder: ""
  35.         },
  36.         c = {},
  37.         i = [],
  38.         p = !1,
  39.         n = !1;
  40.     b.fireAssetReadyEvent = function(b, g) {
  41.         var e = c.assetReady;
  42.         if (e != null) for (var h = 0; h < e.length; h++) e[h](b, g);
  43.         return "OK"
  44.     };
  45.     b.fireAssetRemovedEvent = function(b) {
  46.         var g = c.assetRemoved;
  47.         if (g != null) for (var e = 0; e < g.length; e++) g[e](b);
  48.         return "OK"
  49.     };
  50.     b.fireAssetRetiredEvent = function(b) {
  51.         var g = c.assetRetired;
  52.         if (g != null) for (var e = 0; e < g.length; e++) g[e](b);
  53.         return "OK"
  54.     };
  55.     b.fireChangeEvent = function(b) {
  56.         var g = c.change;
  57.         if (g != null) for (var e = 0; e < g.length; e++) g[e](b);
  58.         return "OK"
  59.     };
  60.     b.fireErrorEvent = function(b, g) {
  61.         var e = c.error;
  62.         if (e != null) for (var h = 0; h < e.length; h++) e[h](b, g);
  63.         return "OK"
  64.     };
  65.     b.fireShakeEvent = function() {
  66.         var b = c.shake;
  67.         if (b != null) for (var g = 0; g < b.length; g++) b[g]();
  68.         return "OK"
  69.     };
  70.     b.fireResponseEvent = function(b, g) {
  71.         var e = c.response;
  72.         if (e != null) for (var h = 0; h < e.length; h++) e[h](b, g);
  73.         return "OK"
  74.     };
  75.     b.nativeCallComplete = function() {
  76.         if (i.length == 0) p = !1;
  77.         else {
  78.             var b = i.pop();
  79.             window.location = b;
  80.             return "OK"
  81.         }
  82.     };
  83.     b.showAlert = function(b) {
  84.         alert(b)
  85.     };
  86.     b.zeroPad = function(b) {
  87.         var g = "";
  88.         b < 10 && (g += "0");
  89.         g += b;
  90.         return g
  91.     };
  92.     b.executeNativeCall = function(b) {
  93.         for (var g = "ormma://" + b, c, h = !0, j = 1; j < arguments.length; j += 2) c = arguments[j + 1], c != null && (h ? (g += "?", h = !1) : g += "&", g += arguments[j] + "=" + encodeURIComponent(c));
  94.         p || !n ? i.push(g) : (p = !0, window.location = g)
  95.     };
  96.     b.activate = function(b) {
  97.         this.executeNativeCall("service", "name", b, "enabled", "Y")
  98.     };
  99.     b.addEventListener = function(b, g) {
  100.         var e = c[b];
  101.         e == null && (c[b] = [], e = c[b]);
  102.         for (var h in e) if (g == h) return;
  103.         e.push(g)
  104.     };
  105.     b.deactivate = function(b) {
  106.         this.executeNativeCall("service", "name", b, "enabled", "N")
  107.     };
  108.     b.removeEventListener = function(b, g) {
  109.         var e = c[b];
  110.         e != null && e.remove(g)
  111.     };
  112.     b.close = function() {
  113.         this.executeNativeCall("close")
  114.     };
  115.     b.expand = function(b) {
  116.         //window.alert("executeNativecall expand");
  117.         this.executeNativeCall("expand", "url", b, "width", j.width, "height", j.height, "useCustomClose", j.useCustomClose, "isModal", j.isModal, "useBackground", j.useBackground, "backgroundColor", j.backgroundColor, "backgroundOpacity", j.backgroundOpacity, "lockOrientation", j.lockOrientation, "allowOrientationChange", orientationProps.allowOrientationChange, "forceOrientation", orientationProps.forceOrientation)
  118.     };
  119.     b.hide = function() {
  120.         this.executeNativeCall("hide")
  121.     };
  122.     b.open = function(b) {
  123.         this.executeNativeCall("open", "url", b)
  124.     };
  125.     b.openMap = function(b, c) {
  126.         this.executeNativeCall("openMap", "url", b, "fullscreen", c)
  127.     };
  128.     b.resize = function() {
  129.         //window.alert("resize");
  130.         this.executeNativeCall("resize", "width", resizeProps.width, "height", resizeProps.height, "customClosePosition", resizeProps.customClosePosition, "offsetX", resizeProps.offsetX, "offsetY", resizeProps.offsetY, "allowOffscreen", resizeProps.allowOffscreen);
  131.     };
  132.     b.setResizeProperties = function(b) {
  133.         //window.alert("setResizeProperties");
  134.         var c = "width,height,customClosePosition,offsetX,offsetY,allowOffscreen".split(",");
  135.         for (f in c) {
  136.             var e = c[f];
  137.             b[e] !== void 0 && (resizeProps[e] = b[e])
  138.         }
  139.     };
  140.     b.getResizeProperties = function() {
  141.         return resizeProps;
  142.     };
  143.     b.setOrientationProperties = function(b) {
  144.         //window.alert("setResizeProperties");
  145.         var c = "allowOrientationChange,forceOrientation".split(",");
  146.         for (f in c) {
  147.             var e = c[f];
  148.             b[e] !== void 0 && (orientationProps[e] = b[e])
  149.         }
  150.     };
  151.     b.getOrientationProperties = function() {
  152.         return orientationProps;
  153.     };
  154.     b.getExpandProperties = function() {
  155.         return j
  156.     };
  157.     b.setExpandProperties = function(b) {
  158.         var c = "width,height,useCustomClose,isModal,lockOrientation,useBackground,backgroundColor,backgroundOpacity".split(",");
  159.         for (f in c) {
  160.             var e = c[f];
  161.             b[e] !== void 0 && (j[e] = b[e])
  162.         }
  163.     };
  164.     b.show = function() {
  165.         this.executeNativeCall("show")
  166.     };
  167.     b.storePicture = function(b) {
  168.         this.executeNativeCall("storePicture", "url", b)
  169.     };
  170.     b.useCustomClose = function(b) {
  171.         j.useCustomClose = b
  172.     };
  173.     b.playAudio = function(b, c) {
  174.         var e = "this.executeNativeCall( 'playAudio'";
  175.         e += ", 'url', '" + b + "'";
  176.         c != null && (e += typeof c.autoplay != "undefined" && c.autoplay != null ? ", 'autoplay', 'Y'" : ", 'autoplay', 'N'", e += typeof c.controls != "undefined" && c.controls != null ? ", 'controls', 'Y'" : ", 'controls', 'N'", e += typeof c.loop != "undefined" && c.loop != null ? ", 'loop', 'Y'" : ", 'loop', 'N'", e += typeof c.position != "undefined" && c.position != null ? ", 'position', 'Y'" : ", 'position', 'N'", e += typeof c.startStyle != "undefined" && c.startStyle != null ? ", 'startStyle', '" + c.startStyle + "'" : ", 'startStyle', 'normal'", e += typeof c.stopStyle != "undefined" && c.stopStyle != null ? ", 'stopStyle', '" + c.stopStyle + "'" : ", 'stopStyle', 'normal'");
  177.         e += " );";
  178.         eval(e)
  179.     };
  180.     b.playVideo = function(b, c) {
  181.         var e = "this.executeNativeCall( 'playVideo'";
  182.         e += ", 'url', '" + b + "'";
  183.         c != null && (e += typeof c.audio != "undefined" && c.audio != null ? ", 'audioMuted', 'Y'" : ", 'audioMuted', 'N'", e += typeof c.autoplay != "undefined" && c.autoplay != null ? ", 'autoplay', 'Y'" : ", 'autoplay', 'N'", e += typeof c.controls != "undefined" && c.controls != null ? ", 'controls', 'Y'" : ", 'controls', 'N'", e += typeof c.loop != "undefined" && c.loop != null ? ", 'loop', 'Y'" : ", 'loop', 'N'", typeof c.position != "undefined" && c.position != null && (e += ", 'position_top', '" + c.position.top + "'", e += ", 'position_left', '" + c.position.left + "'", typeof c.width != "undefined" && c.width != null && (e += ", 'position_width', '" + c.width + "'"), typeof c.height != "undefined" && c.height != null && (e += ", 'position_height', '" + c.height + "'")), e += typeof c.startStyle != "undefined" && c.startStyle != null ? ", 'startStyle', '" + c.startStyle + "'" : ", 'startStyle', 'normal'", e += typeof c.stopStyle != "undefined" && c.stopStyle != null ? ", 'stopStyle', '" + c.stopStyle + "'" : ", 'stopStyle', 'normal'");
  184.         e += " );";
  185.         eval(e)
  186.     };
  187.     b.createEvent = function(c, b, e) {
  188.         var h = c.getFullYear(),
  189.             i = c.getMonth() + 1,
  190.             j = c.getDate(),
  191.             n = c.getHours(),
  192.             c = c.getMinutes();
  193.         this.executeNativeCall("calendar_mraid1", "date", h + this.zeroPad(i) + this.zeroPad(j) + this.zeroPad(n) + this.zeroPad(c), "title", b, "body", e)
  194.     };
  195.     b.createCalendarEvent = function(b) {
  196.         var cc = "description,location,summary,start,end,status,transparency,recurrence,reminder".split(",");
  197.         for (f in cc) {
  198.             var e = cc[f];
  199.             b[e] !== void 0 && (calendarParams[e] = b[e]);
  200.         }
  201.         this.executeNativeCall("calendar", "description", calendarParams.description, "location", calendarParams.location, "summary", calendarParams.summary, "start", calendarParams.start, "end", calendarParams.end, "transparency", calendarParams.transparency, "recurrence", calendarParams.recurrence, "reminder", calendarParams.reminder);
  202.     };
  203.     b.makeCall = function(c) {
  204.         this.executeNativeCall("phone", "number", c)
  205.     };
  206.     b.sendMail = function(c, b, e) {
  207.         this.executeNativeCall("email", "to", c, "subject", b, "body", e, "html", "N")
  208.     };
  209.     b.sendSMS = function(c, b) {
  210.         this.executeNativeCall("sms", "to", c, "body", b)
  211.     };
  212.     b.setShakeProperties = function() {};
  213.     b.addAsset = function(c, b) {
  214.         this.executeNativeCall("addasset", "uri", url, "alias", b)
  215.     };
  216.     b.request = function(c, b) {
  217.         this.executeNativeCall("request", "uri", c, "display", b)
  218.     };
  219.     b.removeAsset = function(c) {
  220.         this.executeNativeCall("removeasset", "alias", c)
  221.     };
  222.     document.addEventListener("DOMContentLoaded", function() {
  223.         n = !0;
  224.         this.nativeCallComplete()
  225.     })
  226. };
  227. window.ormmaview || window.init_ormmaview();
  228. window.init_ormma = function() {
  229.     var b = window.ormma = {},
  230.         j = b.STATES = {
  231.             UNKNOWN: "unknown",
  232.             DEFAULT: "default",
  233.             RESIZED: "resized",
  234.             EXPANDED: "expanded",
  235.             HIDDEN: "hidden"
  236.         },
  237.         c = b.EVENTS = {
  238.             ASSETREADY: "assetReady",
  239.             ASSETREMOVED: "assetRemoved",
  240.             ASSETRETIRED: "assetRetired",
  241.             ERROR: "error",
  242.             INFO: "info",
  243.             HEADINGCHANGE: "headingChange",
  244.             KEYBOARDCHANGE: "keyboardChange",
  245.             LOCATIONCHANGE: "locationChange",
  246.             NETWORKCHANGE: "networkChange",
  247.             ORIENTATIONCHANGE: "orientationChange",
  248.             READY: "ready",
  249.             RESPONSE: "response",
  250.             SCREENCHANGE: "screenChange",
  251.             SHAKE: "shake",
  252.             SIZECHANGE: "sizeChange",
  253.             STATECHANGE: "stateChange",
  254.             TILTCHANGE: "tiltChange",
  255.             VIEWABLECHANGE: "viewableChange"
  256.         };
  257.     b.CONTROLS = {
  258.         BACK: "back",
  259.         FORWARD: "forward",
  260.         REFRESH: "refresh",
  261.         ALL: "all"
  262.     };
  263.     var i = b.FEATURES = {
  264.         LEVEL1: "level-1",
  265.         LEVEL2: "level-2",
  266.         LEVEL3: "level-3",
  267.         SCREEN: "screen",
  268.         ORIENTATION: "orientation",
  269.         HEADING: "heading",
  270.         LOCATION: "location",
  271.         SHAKE: "shake",
  272.         TILT: "tilt",
  273.         NETWORK: "network",
  274.         SMS: "sms",
  275.         PHONE: "phone",
  276.         TEL: "tel",
  277.         EMAIL: "email",
  278.         CALENDAR: "calendar",
  279.         CAMERA: "camera",
  280.         STOREPICTURE: "storePicture",
  281.         INLINEVIDEO: "inlineVideo",
  282.         AUDIO: "audio",
  283.         VIDEO: "video",
  284.         MAP: "map"
  285.     },
  286.         p = b.NETWORK = {
  287.             OFFLINE: "offline",
  288.             WIFI: "wifi",
  289.             CELL: "cell",
  290.             UNKNOWN: "unknown"
  291.         },
  292.         n = j.UNKNOWN,
  293.         u = {
  294.             width: 0,
  295.             height: 0
  296.         },
  297.         g = {
  298.             x: 0,
  299.             y: 0,
  300.             width: 0,
  301.             height: 0
  302.         },
  303.         defaultPosition = {
  304.             x: 0,
  305.             y: 0,
  306.             width: 0,
  307.             height: 0
  308.         },
  309.        
  310.         e = {
  311.             width: 0,
  312.             height: 0
  313.         },
  314.         h = {
  315.             "level-1": !0,
  316.             "level-2": !0,
  317.             "level-3": !0,
  318.             screen: !0,
  319.             orientation: !0,
  320.             heading: !0,
  321.             location: !0,
  322.             shake: !0,
  323.             tilt: !0,
  324.             network: !0,
  325.             sms: !0,
  326.             phone:!0,
  327.             tel: !0,
  328.             email: !0,
  329.             calendar: !0,
  330.             camera: !0,
  331.             storePicture: !0,
  332.             inlineVideo: !0,
  333.             audio: !0,
  334.             video: !0,
  335.             map: !0
  336.         },
  337.         w = -1,
  338.         x = !1,
  339.         q = null,
  340.         s = p.UNKNOWN,
  341.         y = -1,
  342.         A = "inline",
  343.         t = null,
  344.         v = {
  345.             interval: 10,
  346.             intensity: 20
  347.         },
  348.         r = null,
  349.         m = {},
  350.         B = -1,
  351.         z = !1,
  352.         E = {
  353.             width: function(a) {
  354.                 return !isNaN(a) && a > 0
  355.             },
  356.             height: function(a) {
  357.                 return !isNaN(a) && a > 0
  358.             },
  359.             useCustomClose: function(a) {
  360.                 return a === !0 || a === !1
  361.             },
  362.             isModal: function(a) {
  363.                 return a === !0 || a === !1
  364.             },
  365.             lockOrientation: function(a) {
  366.                 return a === !0 || a === !1
  367.             },
  368.             useBackground: function(a) {
  369.                 return a === !0 || a === !1
  370.             },
  371.             backgroundColor: function(a) {
  372.                 return typeof a == "string" && a.substr(0, 1) == "#" && !isNaN(parseInt(a.substr(1), 16))
  373.             },
  374.             backgroundOpacity: function(a) {
  375.                 return !isNaN(a) && a >= 0 && a <= 1
  376.             }
  377.         },
  378.         F = {
  379.             intensity: function(a) {
  380.                 return !isNaN(a)
  381.             },
  382.             interval: function(a) {
  383.                 return !isNaN(a)
  384.             }
  385.         },
  386.         G = {
  387.             state: function(a) {
  388.                 d(c.INFO, "setting state to " + k(a));
  389.                 n = a;
  390.                 d(c.STATECHANGE, n)
  391.             },
  392.             size: function(a) {
  393.                 d(c.INFO, "setting size to " + k(a));
  394.                 u = a;
  395.                 d(c.SIZECHANGE, u.width, u.height)
  396.             },
  397.             defaultPosition: function(a) {
  398.                 d(c.INFO, "setting default position to " + k(a));
  399.                 defaultPosition = a
  400.             },
  401.             currentPosition: function(a) {
  402.                 d(c.INFO, "setting current position to " + k(a));
  403.                 g = a
  404.             },
  405.             maxSize: function(a) {
  406.                 d(c.INFO, "setting maxSize to " + k(a));
  407.                 e = a
  408.             },
  409.             expandProperties: function(a) {
  410.                 d(c.INFO, "merging expandProperties with " + k(a));
  411.                 ormmaview.setExpandProperties(a)
  412.             },
  413.             resizeProperties: function(a) {
  414.                 d(c.INFO, "merging resizeProperties with " + k(a));
  415.                 ormmaview.setResizeProperties(a);
  416.             },
  417.             orientationProperties: function(a) {
  418.                 d(c.INFO, "merging orientationProperties with " + k(a));
  419.                 ormmaview.setOrientationProperties(a);
  420.             },
  421.             supports: function(a) {
  422.                 d(c.INFO, "setting supports to " + k(a));
  423.                 h = {};
  424.                 for (var b in i) h[i[b]] = C(i[b], a)
  425.             },
  426.             heading: function(a) {
  427.                 d(c.INFO, "setting heading to " + k(a));
  428.                 w = a;
  429.                 d(c.HEADINGCHANGE, w)
  430.             },
  431.             keyboardState: function(a) {
  432.                 d(c.INFO, "setting keyboardState to " + k(a));
  433.                 x = a;
  434.                 d(c.KEYBOARDCHANGE, x)
  435.             },
  436.             location: function(a) {
  437.                 d(c.INFO, "setting location to " + k(a));
  438.                 q = a;
  439.                 d(c.LOCATIONCHANGE, q.lat, q.lon, q.acc)
  440.             },
  441.             network: function(a) {
  442.                 d(c.INFO, "setting network to " + k(a));
  443.                 s = a;
  444.                 d(c.NETWORKCHANGE, s != p.OFFLINE && s != p.UNKNOWN, s)
  445.             },
  446.             orientation: function(a) {
  447.                 d(c.INFO, "setting orientation to " + k(a));
  448.                 y = a;
  449.                 d(c.ORIENTATIONCHANGE, y)
  450.             },
  451.             placementType: function(a) {
  452.                 d(c.INFO, "setting placementType to " + k(a));
  453.                 A = a
  454.             },
  455.             screenSize: function(a) {
  456.                 d(c.INFO, "setting screenSize to " + k(a));
  457.                 t = a;
  458.                 d(c.SCREENCHANGE, t.width, t.height)
  459.             },
  460.             shakeProperties: function(a) {
  461.                 d(c.INFO, "setting shakeProperties to " + k(a));
  462.                 v = a
  463.             },
  464.             tilt: function(a) {
  465.                 d(c.INFO, "setting tilt to " + k(a));
  466.                 r = a;
  467.                 d(c.TILTCHANGE, r.x, r.y, r.z)
  468.             },
  469.             cacheRemaining: function(a) {
  470.                 d(c.INFO, "setting cacheRemaining to " + k(a));
  471.                 B = a
  472.             },
  473.             viewable: function(a) {
  474.                 d(c.INFO, "setting viewable to " + k(a));
  475.                 z = a;
  476.                 d(c.VIEWABLECHANGE, a)
  477.             }
  478.         },
  479.         l = {},
  480.         H = function(a) {
  481.             this.event = a;
  482.             this.count = 0;
  483.             var c = {};
  484.             this.add = function(b) {
  485.                 var d = String(b);
  486.                 c[d] || (c[d] = b, this.count++, this.count == 1 && ormmaview.activate(a))
  487.             };
  488.             this.remove = function(b) {
  489.                 b = String(b);
  490.                 return c[b] ? (c[b] = null, delete c[b], this.count--, this.count == 0 && ormmaview.deactivate(a), !0) : !1
  491.             };
  492.             this.removeAll = function() {
  493.                 for (var a in c) this.remove(c[a])
  494.             };
  495.             this.broadcast = function(a) {
  496.                 for (var b in c) c[b].apply({}, a)
  497.             };
  498.             this.toString = function() {
  499.                 var b = [a, ":"],
  500.                     d;
  501.                 for (d in c) b.push("|", d, "|");
  502.                 return b.join("")
  503.             }
  504.         };
  505.     ormmaview.addEventListener("change", function(a) {
  506.         for (var c in a)(0, G[c])(a[c])
  507.     });
  508.     ormmaview.addEventListener("shake", function() {
  509.         d(c.SHAKE)
  510.     });
  511.     ormmaview.addEventListener("error", function(a, b) {
  512.         d(c.ERROR, a, b)
  513.     });
  514.     ormmaview.addEventListener("response", function(a, b) {
  515.         d(c.RESPONSE, a, b)
  516.     });
  517.     ormmaview.addEventListener("assetReady", function(a, b) {
  518.         m[a] = b;
  519.         d(c.ASSETREADY, a)
  520.     });
  521.     ormmaview.addEventListener("assetRemoved", function(a) {
  522.         m[a] = null;
  523.         delete m[a];
  524.         d(c.ASSETREMOVED, a)
  525.     });
  526.     ormmaview.addEventListener("assetRetired", function(a) {
  527.         m[a] = null;
  528.         delete m[a];
  529.         d(c.ASSETRETIRED, a)
  530.     });
  531.     var o = function(a) {
  532.             var c = function() {};
  533.             c.prototype = a;
  534.             return new c
  535.         },
  536.         k = function(a) {
  537.             if (typeof a == "object") if (a.push) {
  538.                 var c = [],
  539.                     b;
  540.                 for (b in a) c.push(a[b]);
  541.                 return "[" + c.join(",") + "]"
  542.             } else {
  543.                 c = [];
  544.                 for (b in a) c.push("'" + b + "':" + a[b]);
  545.                 return "{" + c.join(",") + "}"
  546.             } else return String(a)
  547.         },
  548.         D = function(a, b, e, h) {
  549.             if (h) if (a === void 0) return d(c.ERROR, "Required object missing.", e), !1;
  550.             else for (var g in b) if (a[g] === void 0) return d(c.ERROR, "Object missing required property " + g, e), !1;
  551.             for (g in a) if (b[g]) {
  552.                 if (!b[g](a[g])) return d(c.ERROR, "Value of property " + g + " is not valid type.", e), !1
  553.             } else return d(c.ERROR, "Invalid property specified - " + g + ".", e), !1;
  554.             return !0
  555.         },
  556.         C = function(a, c) {
  557.             for (var b in c) if (c[b] == a) return !0;
  558.             return !1
  559.         },
  560.         d = function() {
  561.             for (var a = Array(arguments.length), c = 0; c < arguments.length; c++) a[c] = arguments[c];
  562.             c = a.shift();
  563.             l[c] && l[c].broadcast(a)
  564.         };
  565.     b.signalReady = function() {
  566.         window.ORMMAReady && ORMMAReady();
  567.         d(c.READY);
  568.         d(c.INFO, "callback invoked")
  569.     };
  570.     b.addEventListener = function(a, b) {
  571.         !a || !b ? d(c.ERROR, "Both event and listener are required.", "addEventListener") : C(a, c) ? (l[a] || (l[a] = new H(a)), l[a].add(b)) : d(c.ERROR, "Unknown event: " + a, "addEventListener")
  572.     };
  573.     b.close = function() {
  574.         ormmaview.close()
  575.     };
  576.     b.expand = function(a) {
  577.         ormmaview.expand(a)
  578.     };
  579.     b.getDefaultPosition = function() {
  580.         return o(defaultPosition)
  581.     };
  582.     b.getCurrentPosition = function() {
  583.         return o(g)
  584.     };
  585.     b.getExpandProperties = function() {
  586.         return o(ormmaview.getExpandProperties())
  587.     };
  588.     b.getMaxSize = function() {
  589.         return o(e)
  590.     };
  591.     b.getSize = function() {
  592.         return o(u)
  593.     };
  594.     b.getState = function() {
  595.         return n
  596.     };
  597.     b.hide = function() {
  598.         n == j.HIDDEN ? d(c.ERROR, "Ad is currently hidden.", "hide") : ormmaview.hide()
  599.     };
  600.     b.isViewable = function() {
  601.         return z
  602.     };
  603.     b.open = function(a) {
  604.         a ? ormmaview.open(a) : d(c.ERROR, "URL is required.", "open")
  605.     };
  606.     b.openMap = function(a, b) {
  607.         a ? ormmaview.openMap(a, b) : d(c.ERROR, "POI is required.", "openMap")
  608.     };
  609.     b.removeEventListener = function(a, b) {
  610.         a ? b && (!l[a] || !l[a].remove(b)) ? d(c.ERROR, "Listener not currently registered for event", "removeEventListener") : (l[a] && l[a].removeAll(), l[a] && l[a].count == 0 && (l[a] = null, delete l[a])) : d(c.ERROR, "Must specify an event.", "removeEventListener")
  611.     };
  612.     /*
  613.     b.resize = function(a, b) {
  614.         if (a == null || b == null || isNaN(a) || isNaN(b) || a < 0 || b < 0) d(c.ERROR, "Requested size must be numeric values >= 0.", "resize");
  615.         else {
  616.             if (a > e.width) a = e.width;
  617.             if (b > e.height) b = e.height;
  618.             ormmaview.resize(a, b)
  619.         }
  620.     };
  621.     */
  622.     b.resize = function() {
  623.         ormmaview.resize();
  624.     };
  625.     b.setResizeProperties = function(a) {
  626.         ormmaview.setResizeProperties(a);
  627.     };
  628.     b.getResizeProperties = function() {
  629.         return o(ormmaview.getResizeProperties())
  630.     };
  631.     b.setOrientationProperties = function(a) {
  632.         ormmaview.setOrientationProperties(a);
  633.     };
  634.     b.getOrientationProperties = function() {
  635.         return o(ormmaview.getOrientationProperties())
  636.     };
  637.     b.setExpandProperties = function(a) {
  638.         D(a, E, "setExpandProperties") && ormmaview.setExpandProperties(a)
  639.     };
  640.     b.show = function() {
  641.         n != j.HIDDEN ? d(c.ERROR, "Ad is currently visible.", "show") : ormmaview.show()
  642.     };
  643.     b.playAudio = function(a, b) {
  644.         h[i.AUDIO] ? !a || typeof a != "string" ? d(c.ERROR, "Request must specify a URL", "playAudio") : ormmaview.playAudio(a, b) : d(c.ERROR, "Method not supported by this client.", "playAudio")
  645.     };
  646.     b.playVideo = function(a, b) {
  647.         h[i.VIDEO] ? !a || typeof a != "string" ? d(c.ERROR, "Request must specify a URL", "playVideo") : ormmaview.playVideo(a, b) : d(c.ERROR, "Method not supported by this client.", "playVideo")
  648.     };
  649.     b.createEvent = function(a, b, e) {
  650.         b = b.replace(/^\\s+|\\s+$/g, "");
  651.         e = e.replace(/^\\s+|\\s+$/g, "");
  652.         h[i.CALENDAR] ? !a || typeof a != "object" || !a.getDate ? d(c.ERROR, "Valid date required.", "createEvent") : !b || typeof b != "string" || b.length == 0 ? d(c.ERROR, "Valid title required.", "createEvent") : !e || typeof e != "string" || e.length == 0 ? d(c.ERROR, "Valid body required.", "createEvent") : ormmaview.createEvent(a, b, e) : d(c.ERROR, "Method not supported by this client.", "createEvent")
  653.     };
  654.     b.createCalendarEvent = function(a) {
  655.         /*
  656.         h[i.CALENDAR] ? !a ? d(c.ERROR, "Valid date required.", "createCalendarEvent") : ormmaview.createCalendarEvent(a) : d(c.ERROR, "Method not supported by this client.", "createCalendarEvent");
  657.         a = a.replace(/^\\s+|\\s+$/g, "");
  658.         */
  659.         ormmaview.createCalendarEvent(a);
  660.     };
  661.     b.getHeading = function() {
  662.         h[i.HEADING] || d(c.ERROR, "Method not supported by this client.", "getHeading");
  663.         return w
  664.     };
  665.     b.getKeyboardState = function() {
  666.         h[i.LEVEL2] || d(c.ERROR, "Method not supported by this client.", "getKeyboardState");
  667.         return x
  668.     };
  669.     b.getLocation = function() {
  670.         h[i.LOCATION] || d(c.ERROR, "Method not supported by this client.", "getLocation");
  671.         return null == q ? null : o(q)
  672.     };
  673.     b.getNetwork = function() {
  674.         h[i.NETWORK] || d(c.ERROR, "Method not supported by this client.", "getNetwork");
  675.         return s
  676.     };
  677.     b.getOrientation = function() {
  678.         h[i.ORIENTATION] || d(c.ERROR, "Method not supported by this client.", "getOrientation");
  679.         return y
  680.     };
  681.     b.getPlacementType = function() {
  682.         return A
  683.     };
  684.     b.getScreenSize = function() {
  685.         if (h[i.SCREEN]) return null == t ? null : o(t);
  686.         else d(c.ERROR, "Method not supported by this client.", "getScreenSize")
  687.     };
  688.     b.getShakeProperties = function() {
  689.         if (h[i.SHAKE]) return null == v ? null : o(v);
  690.         else d(c.ERROR, "Method not supported by this client.", "getShakeProperties")
  691.     };
  692.     b.getTilt = function() {
  693.         if (h[i.TILT]) return null == r ? null : o(r);
  694.         else d(c.ERROR, "Method not supported by this client.", "getTilt")
  695.     };
  696.     b.getVersion = function() {
  697.         return "2.0"
  698.     };
  699.     b.makeCall = function(a) {
  700.         h[i.TEL] || h[i.PHONE] ? !a || typeof a != "string" ? d(c.ERROR, "Request must provide a number to call.", "makeCall") : ormmaview.makeCall(a) : d(c.ERROR, "Method not supported by this client.", "makeCall")
  701.     };
  702.     b.sendMail = function(a, b, e) {
  703.         h[i.EMAIL] ? !a || typeof a != "string" ? d(c.ERROR, "Request must specify a recipient.", "sendMail") : ormmaview.sendMail(a, b, e) : d(c.ERROR, "Method not supported by this client.", "sendMail")
  704.     };
  705.     b.sendSMS = function(a, b) {
  706.         h[i.SMS] ? !a || typeof a != "string" ? d(c.ERROR, "Request must specify a recipient.", "sendSMS") : ormmaview.sendSMS(a, b) : d(c.ERROR, "Method not supported by this client.", "sendSMS")
  707.     };
  708.     b.setShakeProperties = function(a) {
  709.         h[i.SHAKE] ? D(a, F, "setShakeProperties") && (v = a, ormmaview.setShakeProperties(a)) : d(c.ERROR, "Method not supported by this client.", "setShakeProperties")
  710.     };
  711.     b.storePicture = function(a) {
  712.         ormmaview.storePicture(a)
  713.     };
  714.     b.supports = function(a) {
  715.         return h[a] ? !0 : !1
  716.     };
  717.     b.useCustomClose = function(a) {
  718.         a === !0 || a === !1 ? ormmaview.useCustomClose(a) : d(c.ERROR, "Flag must be boolean", "useCustomClose")
  719.     };
  720.     b.addAsset = function(a, b) {
  721.         !a || !b || typeof a != "string" || typeof b != "string" ? d(c.ERROR, "URL and alias are required.", "addAsset") : h[i.LEVEL3] ? ormmaview.addAsset(a, b) : a.indexOf("ormma://") == 0 ? d(c.ERROR, "Native device assets not supported by this client.", "addAsset") : (m[b] = a, d(c.ASSETREADY, b))
  722.     };
  723.     b.addAssets = function(a) {
  724.         for (var c in a) b.addAsset(a[c], c)
  725.     };
  726.     b.getAssetURL = function(a) {
  727.         m[a] || d(c.ERROR, "Alias unknown.", "getAssetURL");
  728.         return m[a]
  729.     };
  730.     b.getCacheRemaining = function() {
  731.         h[i.LEVEL3] || d(c.ERROR, "Method not supported by this client.", "getCacheRemaining");
  732.         return B
  733.     };
  734.     b.request = function(a, b) {
  735.         h[i.LEVEL3] ? !a || typeof a != "string" ? d(c.ERROR, "URI is required.", "request") : ormmaview.request(a, b) : d(c.ERROR, "Method not supported by this client.", "request")
  736.     };
  737.     b.removeAllAssets = function() {
  738.         for (var a in m) b.removeAsset(a)
  739.     };
  740.     b.removeAsset = function(a) {
  741.         !a || typeof a != "string" ? d(c.ERROR, "Alias is required.", "removeAsset") : m[a] ? h[i.LEVEL3] ? ormmaview.removeAsset(a) : (m[a] = null, delete m[a], d(c.ASSETREMOVED, a)) : d(c.ERROR, "Alias unknown.", "removeAsset")
  742.     };
  743.     b.getViewable = function() {
  744.         return z
  745.     }
  746. };
  747. window.ormma || window.init_ormma();
  748. window.Ormma = window.ormma;
  749. window.mraid = window.ormma;
  750. window.open = window.ormma.open;
Advertisement
Add Comment
Please, Sign In to add comment