/* Copyright (c) 2011 The MRAID.org project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
(function() {
var mraidview = window.mraidview = {};
var isCustomClose = false;
/****************************************************/
/********** PROPERTIES OF THE MRAID BRIDGE **********/
/****************************************************/
/** Expand Properties */
var expandProperties = {
useBackground: false,
backgroundColor: '#ffffff',
backgroundOpacity: 1.0,
lockOrientation: false,
width: null,
height: null,
useCustomClose: false,
isModal: true
};
/** Mraid Resize Properties */
var resizeProperties = {
width: null,
height: null,
customClosePosition: null,
offsetX: null,
offsetY: null,
allowOffscreen: null
};
/** Mraid Orientation Properties */
var orientationProperties = {
allowOrientationChange: true,
forceOrientation: "none"
};
/** The set of listeners for MRAID Native Bridge Events */
var listeners = {};
/** A Queue of Calls to the Native SDK that still need execution */
var nativeCallQueue = [];
/** Identifies if a native call is currently in progress */
var nativeCallInFlight = false;
/** timer for identifying iframes */
var timer;
var totalTime;
/**********************************************/
/********** OBJECTIVE-C ENTRY POINTS **********/
/**********************************************/
/**
* Called by the Objective-C SDK when an asset has been fully cached.
*
* @returns string, "OK"
*/
mraidview.fireAssetReadyEvent = function(alias, URL) {
var handlers = listeners["assetReady"];
if (handlers != null) {
for (var i = 0; i < handlers.length; i++) {
handlers[i](alias, URL);
}
}
return "OK";
};
/**
* Called by the Objective-C SDK when an asset has been removed from the
* cache at the request of the creative.
*
* @returns string, "OK"
*/
mraidview.fireAssetRemovedEvent = function(alias) {
var handlers = listeners["assetRemoved"];
if (handlers != null) {
for (var i = 0; i < handlers.length; i++) {
handlers[i](alias);
}
}
return "OK";
};
/**
* Called by the Objective-C SDK when an asset has been automatically
* removed from the cache for reasons outside the control of the creative.
*
* @returns string, "OK"
*/
mraidview.fireAssetRetiredEvent = function(alias) {
var handlers = listeners["assetRetired"];
if (handlers != null) {
for (var i = 0; i < handlers.length; i++) {
handlers[i](alias);
}
}
return "OK";
};
/**
* Called by the Objective-C SDK when various state properties have changed.
*
* @returns string, "OK"
*/
mraidview.fireChangeEvent = function(properties) {
var handlers = listeners["change"];
if (handlers != null) {
for (var i = 0; i < handlers.length; i++) {
handlers[i](properties);
}
}
return "OK";
};
/**
* Called by the Objective-C SDK when an error has occured.
*
* @returns string, "OK"
*/
mraidview.fireErrorEvent = function(message, action) {
var handlers = listeners["error"];
if (handlers != null) {
for (var i = 0; i < handlers.length; i++) {
handlers[i](message, action);
}
}
return "OK";
};
/**
* Called by the Objective-C SDK when the user shakes the device.
*
* @returns string, "OK"
*/
mraidview.fireShakeEvent = function() {
var handlers = listeners["shake"];
if (handlers != null) {
for (var i = 0; i < handlers.length; i++) {
handlers[i]();
}
}
return "OK";
};
/**
* nativeCallComplete notifies the abstraction layer that a native call has
* been completed..
*
* NOTE: This function is called by the native code and is not intended to be
* used by anything else.
*
* @returns string, "OK"
*/
mraidview.nativeCallComplete = function(cmd) {
// anything left to do?
if (nativeCallQueue.length == 0) {
nativeCallInFlight = false;
return;
}
// still have something to do
var bridgeCall = nativeCallQueue.pop();
window.location = bridgeCall;
return "OK";
};
/**
*
*/
mraidview.showAlert = function(message) {
alert(message);
};
/*********************************************/
/********** INTERNALLY USED METHODS **********/
/*********************************************/
/**
*
*/
mraidview.zeroPad = function(number) {
var text = "";
if (number < 10) {
text += "0";
}
text += number;
return text;
}
/**
*
*/
mraidview.executeNativeCall = function(command) {
// build iOS command
var bridgeCall = "mraid://" + command;
var value;
var firstArg = true;
for (var i = 1; i < arguments.length; i += 2) {
value = arguments[i + 1];
if (value == null) {
// no value, ignore the property
continue;
}
// add the correct separator to the name/value pairs
if (firstArg) {
bridgeCall += "?";
firstArg = false;
} else {
bridgeCall += "&";
}
bridgeCall += arguments[i] + "=" + escape(value);
}
// add call to queue
if (nativeCallInFlight) {
// call pending, queue up request
nativeCallQueue.push(bridgeCall);
} else {
// no call currently in process, execute it directly
nativeCallInFlight = true;
window.location = bridgeCall;
}
};
/***************************************************************************/
/********** LEVEL 0 (not part of spec, but required by public API **********/
/***************************************************************************/
/**
*
*/
mraidview.activate = function(event) {
this.executeNativeCall("service", "name", event, "enabled", "Y");
};
/**
*
*/
mraidview.addEventListener = function(event, listener) {
var handlers = listeners[event];
if (handlers == null) {
// no handlers defined yet, set it up
listeners[event] = [];
handlers = listeners[event];
}
// see if the listener is already present
for (var handler in handlers) {
if (listener == handler) {
// listener already present, nothing to do
return;
}
}
// not present yet, go ahead and add it
handlers.push(listener);
};
/**
*
*/
mraidview.deactivate = function(event) {
this.executeNativeCall("service", "name", event, "enabled", "N");
};
/**
*
*/
mraidview.removeEventListener = function(event, listener) {
var handlers = listeners[event];
if (handlers != null) {
handlers.remove(listener);
}
};
/*****************************/
/********** LEVEL 1 **********/
/*****************************/
/**
*
*/
mraidview.close = function() {
this.executeNativeCall("close");
};
/**
*
*/
mraidview.expand = function(dimensions, URL) {
try {
var cmd = "this.executeNativeCall( 'expand'";
if (URL != null) {
cmd += ", 'url', '" + URL + "'";
}
if ((typeof dimensions.x != "undefined") && (dimensions.x != null)) {
cmd += ", 'x', '" + dimensions.x + "'";
}
if ((typeof dimensions.y != "undefined") && (dimensions.y != null)) {
cmd += ", 'y', '" + dimensions.y + "'";
}
if ((typeof dimensions.width != "undefined") && (dimensions.width != null)) {
cmd += ", 'w', '" + dimensions.width + "'";
}
if ((typeof dimensions.height != "undefined") && (dimensions.height != null)) {
cmd += ", 'h', '" + dimensions.height + "'
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
【7年前搬的砖、有用的就下载参考下咯】 这都是整理的日常用到的demo!! 网络缓存 控件 应用 游戏 apns airplay应用之间的传输 分享 淘宝 糗百 微博 二维码 试衣间滑动等等。。。。 43+7个外加c++书籍资料 coco2d仿愤怒的小鸟 极品飞车手机按键映射控制电脑demo 自己需要的就下载 解压后大概130m左右吧!!! 差评的你还是别下载了!!! 文件压缩还有140M 上传不到 分两个文件上传。。。
资源推荐
资源详情
资源评论
收起资源包目录
ios 源码的集合(43+7 下下)demo (2766个子文件)
01cf1e62a26ffc4f0c6f098c7fbfb52101dd17 5KB
021da77c4a2bbcc71ca85ecadd61eb38c09597 6KB
0220b1de7fb5818133752c7c0ae8c70b26efa4 5KB
0251c3acd912778a69c03097973307969c486d 970B
02c19e289f1e79ef7e3b37c90e906257946346 4KB
03cd153aa6f0f8233d92fe0d265d1a42329c4c 1KB
03d423a6718b26a4115f9b6d991677df6d5235 2KB
05b921cdbc546353c7f79d4648689939f188ad 1KB
06d2d301dd1e77dfa3bf5e86bd3f0d3d63fd10 137B
06f8be59ad4265304d4d8043f2e46cb5639ebb 4KB
075a0870845f46093c3acbe09b7577aeb1056b 2KB
07930511313c9037292e22f2abffa5a7e86596 4KB
07a1357f57c20fa60695595e61ec3079272595 166B
0843d2831b260f8ef6913a853edf1a9cbbbdf2 440B
084c8cb1766dc5adef3af8c782ec648a0f6ee9 961B
08e7c8d19c430aab46b5746d75d98f7f8ecdda 3KB
091b6650e98a8f8b080040c4f353d610e17437 1KB
0929a945363e04504abc219f18c39e6d6cd512 3KB
09870bdd7528ae903069211db88225cccc23df 822B
09b3bbbd46d62e1fbdaf565af7f60cfefe0dc5 2KB
09ce029c05c0f3adc72fe0019d9af520855cdf 5KB
09dda1ac6a08a5b4bbba06470fdefc43f1a963 2KB
09e55bf43309611f0466983c13a4011d59fc38 1KB
0ab4a98a51e347de40eeb4d94f7c1db8145bd6 4KB
0aff511406cbd381f9fb05c5c7b8a21fbc3110 9KB
0bdd6587eda432b0123a6dc689df77bb1f419a 3KB
0c11b6cafca46bd92e204def2064b150bf7904 4KB
0d96913a6c11fbe8781fc48d832cfa3accd44e 2KB
0d98c4ada95df1f23b60313359ce8218feaf3c 877B
0d9c3b24ff11bd51609a0b7d268c52594352ec 431B
0e403d17bd736d6a0f3001cef7abe73b0b3ae3 4KB
0e901b88749f4102701889d18c70f64a3f03e8 1KB
10362c42bb6ddb4a626021231ab51c37d76e9d 314B
1136d0d8909f5547f7dd2bd62c718efbfb95c1 276B
11476ff90a2d4c8b2dd085381727499632aed8 2KB
123559349c858e89c2f25a30080fb06033794f 75B
137e8360f88f793ede8ef9158bfa39d7426c80 4KB
13e67d1ded13ba1b6dbc3eaa0e1b16427ed3ce 750B
1453f4203945aaf34cec703b37664fd4670b30 2KB
1469ec9eacd0eb317344501f49a5fb40a10288 5KB
153b1fe3fae78bfa65cb6d3e97fdcdf843ccfb 1KB
158823a6c12246f5cb1d787b36959355290507 914B
16c34d1bbebd96454cce0c0a192ffeb418bc17 986B
17439bfc79fffa7dc5cbfc23fa5ef06afc3713 2KB
17ecefa8a5114f3468ea249850e9013b52042c 280B
186ba5c9837281ac5a3d4905bc1c7e490fa0f4 449B
18d3e136bcd9719495b32b9fd1d1c2132df06c 2KB
19371b8fc415b71f45c35d0c7a13ea36f3a6ca 5KB
1959d640d39f28e304b0f06d740aa2a46c6f2f 532B
19ac2fb7c37fbaa02f3a2d752fadbf5dcaa7a6 11KB
1a01bda06c14983afec1700b666b69e1a7bf9c 764B
1a05bceb0f3eddce8ea82c3fc562a206761539 3KB
1a0b9ec00663d7b5789a90a2b08ad25bfd8a63 1KB
1a5288b423a5c3e7bfccf4205a96effafa62d3 788B
1a954b4e88679999594efbd4416c31f3873243 830B
1b26f38aae11b53cb628b6900ef6b1d3e13029 924B
1b6a2fffe1a5c4e965c126ad1267e54b1b3ece 1KB
1b78d4d49c76bbd5e9ad7bc4c40696ab0c1b81 281B
1ba81133576b088f0f5321e0475fe381c9c2a9 2KB
1c35e3e74ee0cc62fb8046e8d55dc1ece1422a 147B
1c49b844cecdfe26ee978f8a8b7e6853580675 798B
1c6a8770f8dd25f49da61c0658da6c6ec42b3d 2KB
1cd73abe89ff94a5134ed4bda3e2becbc1d739 412B
1cdef51983825918b6ff97991f47aa319709d4 2KB
1cff94260bf2e26811c4d0ed2104967a3b57ee 460B
1da8b1092636b058e7049d428416a09e1c42b5 135B
1e87d6232bcc2807b60adf829103f10bad7802 3KB
1ef5b1e024fdca0511200d3ba25df2233b527e 80B
1f0432a9a2e5a2f305bb084657e04d7929caac 216B
1f6de1ee13459b5281c1a51280f06fb59a7af4 1KB
1fa501be816001179394e280abb0259dd089de 898B
2047e472d3c853e4215848a4bef307a009e636 1KB
221fdf611deb86372a10d1e3ea5444fbafc58c 985B
22dfb28af7d2c3f5e64c96993ca59c264a54ce 1KB
2330d5143cb4b5c2677b6873d8445705dc43a1 362B
23f78a2c799bb70a2be91ccf7ad574c6ff232c 1KB
2414730ab40aef3f6c49060a83cedb69383cff 3KB
242246e3bde465b2b99124ff923948649727b8 329B
24eaaece9fd98901706eb9eff86875d1985f6c 3KB
2518d966983a52f05e6fa29cab507f1c7d3ee9 3KB
251ccd4dd0a819ac128bbe6d857ace3c73e1fe 79B
2527dbc5a16335d187cbabafdaa557b848503b 2KB
25774ed889d130ec3de547fdbd36ef6d980911 3KB
2594273d2ac29fa32fb4c52ac96ee1d700d8e1 2KB
25a52f917646fd731645b0d762642a028741dc 5KB
26314d0d5b8cedaf2154cb85b056d0094b7d71 345B
2684232acbe079653499f44c9b6b2c8fdb6606 779B
26bf6ef18d172c682545825a1057cc13cf3825 1KB
2702fedc32d5e5cb1fd1e32314ca7e14336a37 3KB
27c99ba6bafcdfda9897dc477a2cb0b1404c53 1KB
27e93b98c820348d118d97f68eccd7b78c2dd8 791B
2966fecb7c33a634cc3313dc2551020ee35590 5KB
29774a05c1acbe941a5c39982ca0ec5f891094 534B
29d4005f7a84c5bb9a1bf8b55747fa27640323 1KB
2aedd14a32ebe523a3a0c7d494b87782348d5b 2KB
2b5740239ef1791eee7c994fff1e82f38cee45 4KB
2bfc7857c0bde289f2285f09492d77fcc962b6 221B
2c09f6cbedd676119ad1aedec4a7a2652438c3 3KB
2cd0661a891deea11d0a48b78d3bc21e529c3f 197B
2d85027dc4f4e983dcd64821a731d2166f56ea 3KB
共 2766 条
- 1
- 2
- 3
- 4
- 5
- 6
- 28
资源评论
- xlm043222014-07-29挺好的,可以下来学学!
- Kilven_ck2016-10-17这个源码可以参考下,谢谢楼主
- icecily2015-01-04学习了!挺不错的呢!
三三三牛
- 粉丝: 36
- 资源: 15
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功