Showing
1 changed file
with
16 additions
and
17 deletions
@@ -12,22 +12,21 @@ var $ = require('yoho-jquery'); | @@ -12,22 +12,21 @@ var $ = require('yoho-jquery'); | ||
12 | var tip = require('./plugin/tip'); | 12 | var tip = require('./plugin/tip'); |
13 | 13 | ||
14 | /* 空方法 */ | 14 | /* 空方法 */ |
15 | -var emptyFn = function () { }; | 15 | +var emptyFn = function() { }; |
16 | 16 | ||
17 | /* 提示信息 */ | 17 | /* 提示信息 */ |
18 | var tipInfo = '暂不支持,请在YOHO!BUY应用中打开'; | 18 | var tipInfo = '暂不支持,请在YOHO!BUY应用中打开'; |
19 | 19 | ||
20 | var qs = window.queryString; | 20 | var qs = window.queryString; |
21 | 21 | ||
22 | -var yoho, $appLink, $appButton; | 22 | +var yoho, $appLink; |
23 | 23 | ||
24 | $appLink = $('#yoho-app-link'); | 24 | $appLink = $('#yoho-app-link'); |
25 | 25 | ||
26 | if (!$appLink.length) { | 26 | if (!$appLink.length) { |
27 | - $('body').append('<a id="yoho-app-link" href="javascript:;" style="display:none !important;"><span></span></a>'); | 27 | + $('body').append('<a id="yoho-app-link" href="javascript:;" style="display:none !important;"></a>'); |
28 | $appLink = $('#yoho-app-link'); | 28 | $appLink = $('#yoho-app-link'); |
29 | } | 29 | } |
30 | -$appButton = $appLink.find('span'); | ||
31 | 30 | ||
32 | yoho = { | 31 | yoho = { |
33 | /** | 32 | /** |
@@ -42,7 +41,7 @@ yoho = { | @@ -42,7 +41,7 @@ yoho = { | ||
42 | */ | 41 | */ |
43 | data: window.yohoInterfaceData, | 42 | data: window.yohoInterfaceData, |
44 | 43 | ||
45 | - ready: function (callback) { | 44 | + ready: function(callback) { |
46 | if (this.isApp) { | 45 | if (this.isApp) { |
47 | document.addEventListener('deviceready', callback); | 46 | document.addEventListener('deviceready', callback); |
48 | } else { | 47 | } else { |
@@ -57,7 +56,7 @@ yoho = { | @@ -57,7 +56,7 @@ yoho = { | ||
57 | * @param success 调用成功的回调方法 | 56 | * @param success 调用成功的回调方法 |
58 | * @param fail 调用失败的回调方法 | 57 | * @param fail 调用失败的回调方法 |
59 | */ | 58 | */ |
60 | - invokeMethod: function (method, args, success, fail) { | 59 | + invokeMethod: function(method, args, success, fail) { |
61 | var appInterface = window.yohoInterface; | 60 | var appInterface = window.yohoInterface; |
62 | 61 | ||
63 | if (this.isApp && appInterface) { | 62 | if (this.isApp && appInterface) { |
@@ -75,18 +74,18 @@ yoho = { | @@ -75,18 +74,18 @@ yoho = { | ||
75 | * @param name 方法名 | 74 | * @param name 方法名 |
76 | * @param callback 回调 | 75 | * @param callback 回调 |
77 | */ | 76 | */ |
78 | - addNativeMethod: function (name, callback) { | 77 | + addNativeMethod: function(name, callback) { |
79 | var appInterface = window.yohoInterface; | 78 | var appInterface = window.yohoInterface; |
80 | 79 | ||
81 | // 延迟 500ms 注入 | 80 | // 延迟 500ms 注入 |
82 | - setTimeout(function () { | 81 | + setTimeout(function() { |
83 | if (appInterface) { | 82 | if (appInterface) { |
84 | appInterface[name] = callback; | 83 | appInterface[name] = callback; |
85 | } | 84 | } |
86 | }, 500); | 85 | }, 500); |
87 | }, | 86 | }, |
88 | 87 | ||
89 | - parseUrl: function (url) { | 88 | + parseUrl: function(url) { |
90 | var query = {}, | 89 | var query = {}, |
91 | hashs, | 90 | hashs, |
92 | hash, | 91 | hash, |
@@ -98,7 +97,7 @@ yoho = { | @@ -98,7 +97,7 @@ yoho = { | ||
98 | if (hashs && hashs.length) { | 97 | if (hashs && hashs.length) { |
99 | for (i = 0; i < hashs.length; i++) { | 98 | for (i = 0; i < hashs.length; i++) { |
100 | hash = hashs[i].split('='); | 99 | hash = hashs[i].split('='); |
101 | - console.log(hashs[i]) | 100 | + console.log(hashs[i]); |
102 | query[hash[0]] = hash[1]; | 101 | query[hash[0]] = hash[1]; |
103 | } | 102 | } |
104 | } | 103 | } |
@@ -109,7 +108,7 @@ yoho = { | @@ -109,7 +108,7 @@ yoho = { | ||
109 | }; | 108 | }; |
110 | }, | 109 | }, |
111 | 110 | ||
112 | - getUid: function () { | 111 | + getUid: function() { |
113 | if (yoho.isApp) { | 112 | if (yoho.isApp) { |
114 | return qs.uid; | 113 | return qs.uid; |
115 | } | 114 | } |
@@ -117,7 +116,7 @@ yoho = { | @@ -117,7 +116,7 @@ yoho = { | ||
117 | return window.gitUid(); | 116 | return window.gitUid(); |
118 | }, | 117 | }, |
119 | 118 | ||
120 | - goLogin: function (refer, data) { | 119 | + goLogin: function(refer, data) { |
121 | var url; | 120 | var url; |
122 | 121 | ||
123 | url = 'http://m.yohobuy.com/signin.html?refer=' + encodeURIComponent(refer); | 122 | url = 'http://m.yohobuy.com/signin.html?refer=' + encodeURIComponent(refer); |
@@ -133,15 +132,15 @@ yoho = { | @@ -133,15 +132,15 @@ yoho = { | ||
133 | param: refer.query | 132 | param: refer.query |
134 | } | 133 | } |
135 | } | 134 | } |
136 | - })) | 135 | + })); |
137 | } | 136 | } |
138 | 137 | ||
139 | $appLink.attr('href', url); | 138 | $appLink.attr('href', url); |
140 | - $appButton.click(); | 139 | + $appLink[0].click(); |
141 | return false; | 140 | return false; |
142 | }, | 141 | }, |
143 | 142 | ||
144 | - goH5: function (link, data) { | 143 | + goH5: function(link, data) { |
145 | var url = link; | 144 | var url = link; |
146 | 145 | ||
147 | if (!link) { | 146 | if (!link) { |
@@ -159,11 +158,11 @@ yoho = { | @@ -159,11 +158,11 @@ yoho = { | ||
159 | url: link.path, | 158 | url: link.path, |
160 | param: link.query | 159 | param: link.query |
161 | } | 160 | } |
162 | - })) | 161 | + })); |
163 | } | 162 | } |
164 | 163 | ||
165 | $appLink.attr('href', url); | 164 | $appLink.attr('href', url); |
166 | - $appButton.click(); | 165 | + $appLink[0].click(); |
167 | return false; | 166 | return false; |
168 | } | 167 | } |
169 | }; | 168 | }; |
-
Please register or login to post a comment