!(function() { console.log('W2A[launchWebview]:wap2appquit'); if (!window.wap2app) { console.log('W2A[launchWebview]:wap2appquit[wap2app is undefined]'); return; } var ID = '__W2A_QUIT_IFRAME'; var FEEDBACK_ID = '__W2A_FEEDBACK'; //var REVERSE_VENDORS = ['HTC', 'Sony', 'LGE', 'HUAWEI','Meizu']; var REVERSE_VENDORS = ['SONY', 'HTC', 'LGE', 'MOTOROLA']; var REVERSE_NEXUS_MODEL = 'NEXUS'; var isReverse = function() { var vendor = plus.device.vendor.toUpperCase(); var model = plus.device.model.toUpperCase(); if (~REVERSE_VENDORS.indexOf(vendor)) { return true; } if (~model.indexOf(REVERSE_NEXUS_MODEL)) { return true; } return false; }; /** * 打开反馈页面 */ var openFeedback = function() { plus.nativeUI.showWaiting(); var feedbackOptions = wap2app.getW2AOptions().globalOptions.feedback; var url = feedbackOptions.url; var params = feedbackOptions.params; if (typeof params === 'function') { params = params(); } if (wap2app.util.isObject(params)) { url = wap2app.ajax.appendQuery(url, wap2app.extend(params, { p: plus.os.name === 'Android' ? 'a' : plus.os.name === 'iOS' ? 'i' : '', plus_version: plus.runtime.innerVersion, vendor: plus.device.vendor, md: plus.device.model })); } var feedbackWebview = plus.webview.create(url, FEEDBACK_ID); feedbackWebview.addEventListener('titleUpdate', function() { plus.nativeUI.closeWaiting(); feedbackWebview.show('slide-in-right', 300); }); }; /** * 退出应用 */ var quit = function() { plus.runtime.quit(); }; wap2app.plusReady(function() { console.log('W2A[launchWebview]:wap2appquit[plusready]'); var confirm = wap2app.confirm; plus.runtime.getProperty(plus.runtime.appid, function(wgtinfo) { console.log('W2A[launchWebview]:wap2appquit[' + wgtinfo.name + ']'); wap2app.domReady(function() { confirm.init({ id: ID, html: '