Ei kuvausta
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

view_arcrank.js 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369
  1. var body_display = '';
  2. // 轮询body元素是否被渲染出来
  3. function ey_body_render(display_value)
  4. {
  5. var obj = document.body;
  6. var timer = setTimeout(function(){
  7. if (null == obj || obj == '') {
  8. ey_body_render(display_value);
  9. } else {
  10. body_display = obj.style.display;
  11. obj.style.display = display_value;
  12. clearTimeout(timer); // 清理定时任务
  13. }
  14. }, 10);
  15. }
  16. // 文档阅读AJAX
  17. function ey_1564127378() {
  18. var JsonData = ey_1564127251;
  19. var get_url = JsonData.get_url;
  20. var ClosePage = JsonData.ClosePage;
  21. var users_id = ey_getCookie('users_id');
  22. if (users_id == '' || users_id == 0) {
  23. ey_body_render('none');
  24. }
  25. // 步骤一:创建异步对象
  26. var ajax = new XMLHttpRequest();
  27. //步骤二:设置请求的url参数,参数一是请求的类型,参数二是请求的url,可以带参数,动态的传递参数starName到服务端
  28. ajax.open("post", get_url, true);
  29. // 给头部添加ajax信息
  30. ajax.setRequestHeader("X-Requested-With", "XMLHttpRequest");
  31. // 如果需要像 HTML 表单那样 POST 数据,请使用 setRequestHeader() 来添加 HTTP 头。然后在 send() 方法中规定您希望发送的数据:
  32. ajax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  33. //步骤三:发送请求+数据
  34. ajax.send('_ajax=1&gourl='+encodeURIComponent(window.location.href));
  35. //步骤四:注册事件 onreadystatechange 状态改变就会调用
  36. ajax.onreadystatechange = function () {
  37. //步骤五 请求成功,处理逻辑
  38. if (ajax.readyState == 4 && ajax.status == 200) {
  39. var json = ajax.responseText;
  40. var res = JSON.parse(json);
  41. if (0 == res.code) {
  42. if (res.data && res.data.is_login == 0) {
  43. // 不可以查看
  44. ey_body_render(body_display);
  45. document.body.innerHTML = "<div style='text-align:center; font-size:20px; font-weight:bold; margin:50px 0px;'>跳转到登录界面中……</div>";
  46. window.location.href = res.data.gourl;
  47. } else {
  48. // 不可以查看
  49. document.body.innerHTML = "";
  50. setTimeout(function () {
  51. confirm(res.msg);
  52. if (ClosePage) {
  53. window.close();
  54. } else {
  55. var return_url = document.referrer;
  56. window.location.href = return_url;
  57. }
  58. }, 600);
  59. }
  60. } else if (1 == res.code) {
  61. ey_body_render(body_display);
  62. if ('undefined' != res.data.is_admin && 1 == res.data.is_admin) {
  63. setTimeout(function () {
  64. alert(res.data.msg);
  65. }, 1000);
  66. }
  67. }
  68. }
  69. };
  70. }
  71. ey_1564127378();
  72. // 视频购买
  73. function MediaOrderBuy_v878548() {
  74. var JsonData = ey_1564127251;
  75. var BuyUrl = JsonData.buy_url;
  76. var aid = JsonData.aid;
  77. // 步骤一:创建异步对象
  78. var ajax = new XMLHttpRequest();
  79. //步骤二:设置请求的url参数,参数一是请求的类型,参数二是请求的url,可以带参数,动态的传递参数starName到服务端
  80. ajax.open("post", BuyUrl, true);
  81. // 给头部添加ajax信息
  82. ajax.setRequestHeader("X-Requested-With", "XMLHttpRequest");
  83. // 如果需要像 HTML 表单那样 POST 数据,请使用 setRequestHeader() 来添加 HTTP 头。然后在 send() 方法中规定您希望发送的数据:
  84. ajax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  85. //步骤三:发送请求+数据
  86. ajax.send('aid=' + aid);
  87. //步骤四:注册事件 onreadystatechange 状态改变就会调用
  88. ajax.onreadystatechange = function () {
  89. //步骤五 请求成功,处理逻辑
  90. if (ajax.readyState == 4 && ajax.status == 200) {
  91. var json = ajax.responseText;
  92. var res = JSON.parse(json);
  93. if (1 == res.code && res.url) {
  94. window.location.href = res.url;
  95. } else {
  96. // 没有登录
  97. if (document.getElementById('ey_login_id_v665117')) { // 最新demo的弹窗登录
  98. $('#ey_login_id_v665117').trigger('click');
  99. } else { // 一般模板
  100. var url = '';
  101. if (res.data && res.data.url) {
  102. url = res.data.url;
  103. } else {
  104. url = res.url;
  105. }
  106. if (url.indexOf('?') > -1) {
  107. url += '&';
  108. } else {
  109. url += '?';
  110. }
  111. url += 'referurl=' + encodeURIComponent(window.location.href);
  112. window.location.href = url;
  113. }
  114. }
  115. }
  116. };
  117. }
  118. function MediaOrderBuy_1592878548() {
  119. MediaOrderBuy_v878548();
  120. }
  121. // 跳转至会员升级页面
  122. function LevelCentre_v878548() {
  123. var JsonData = ey_1564127251;
  124. window.location.href = JsonData.LevelCentreUrl;
  125. }
  126. // 点击隐藏遮幕层并播放视频
  127. function PlayVideo(id) {
  128. document.getElementsByClassName("jw-video-expense")[0].setAttribute("style", "display: none");
  129. document.getElementById(id).play();
  130. }
  131. // 视频播放逻辑AJAX
  132. function ey_1618221427(type) {
  133. if (video_sp_1618221427 && video_sp_1618221427 == 'sp3') { // 易而优
  134. console.log('函数:video_moban_3');
  135. video_moban_3(video_sp_1618221427);
  136. } else {
  137. if (video_sp_1618221427 && video_sp_1618221427 == 'sp1') { // 第一套demo视频模板
  138. console.log('函数:video_moban_1');
  139. video_moban_1('sp1');
  140. } else {
  141. console.log('函数:video_moban_2');
  142. video_moban_2('sp2'); // 知了那套
  143. }
  144. }
  145. }
  146. function video_moban_1(type) {
  147. var JsonData = ey_1564127251;
  148. var VideoLogicUrl = JsonData.VideoLogicUrl;
  149. var aid = JsonData.aid;
  150. // 步骤一:创建异步对象
  151. var ajax = new XMLHttpRequest();
  152. //步骤二:设置请求的url参数,参数一是请求的类型,参数二是请求的url,可以带参数,动态的传递参数starName到服务端
  153. ajax.open("post", VideoLogicUrl, true);
  154. // 给头部添加ajax信息
  155. ajax.setRequestHeader("X-Requested-With", "XMLHttpRequest");
  156. // 如果需要像 HTML 表单那样 POST 数据,请使用 setRequestHeader() 来添加 HTTP 头。然后在 send() 方法中规定您希望发送的数据:
  157. ajax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  158. //步骤三:发送请求+数据
  159. ajax.send('aid=' + aid+'&type='+type);
  160. //步骤四:注册事件 onreadystatechange 状态改变就会调用
  161. ajax.onreadystatechange = function () {
  162. //步骤五 请求成功,处理逻辑
  163. if (ajax.readyState == 4 && ajax.status == 200) {
  164. var json = ajax.responseText;
  165. var res = JSON.parse(json);
  166. if (1 == res.code && document.getElementById("BuyOnclick13579")) {
  167. if (res.data.status_value == 0){ // 所有人免费
  168. document.getElementById("BuyOnclick13579").innerHTML = '免费';
  169. }else if (res.data.status_value == 1){ // 所有人付费
  170. document.getElementById("BuyOnclick13579").setAttribute("onclick", "MediaOrderBuy_v878548();");
  171. document.getElementById("BuyOnclick13579").innerHTML = '立即购买';
  172. }else if (res.data.status_value == 3){ // 会员付费
  173. document.getElementById("BuyOnclick13579").setAttribute("href", "javascript:void(0);");
  174. document.getElementById("BuyOnclick13579").setAttribute("onclick", res.data.button_url);
  175. document.getElementById("BuyOnclick13579").innerHTML = res.data.button;
  176. }else{ // 会员免费
  177. document.getElementById("BuyOnclick13579").innerHTML = 'VIP';
  178. }
  179. document.getElementById("BuyOnclick13579").style.display = '';
  180. if (res.data.button) {
  181. if (document.getElementsByClassName('VideoButton13579')[0]) {
  182. var videoButton = document.getElementsByClassName('VideoButton13579');
  183. for (var i = 0; i < videoButton.length; i++) {
  184. videoButton[i].innerHTML = res.data.button;
  185. }
  186. }
  187. if('观看' == res.data.button){
  188. document.getElementById("BuyOnclick13579").setAttribute("href", "javascript:void(0);");
  189. document.getElementById("BuyOnclick13579").setAttribute("onclick", "window.location.href='"+res.data.button_url+"'");
  190. document.getElementById("BuyOnclick13579").innerHTML = '立即播放';
  191. }
  192. }
  193. }
  194. }
  195. };
  196. }
  197. function video_moban_2(type) {
  198. var JsonData = ey_1564127251;
  199. var VideoLogicUrl = JsonData.VideoLogicUrl;
  200. var aid = JsonData.aid;
  201. var videoPeriodObj = '';
  202. if (document.getElementById("video-period-20190425")) {
  203. videoPeriodObj = document.getElementById("video-period-20190425");
  204. } else if (document.getElementsByClassName('video-period')[0]) {
  205. videoPeriodObj = document.getElementsByClassName('video-period')[0];
  206. }
  207. if (videoPeriodObj) {
  208. var display_old_value = videoPeriodObj.style.display;
  209. videoPeriodObj.style.display = 'none';
  210. // 步骤一:创建异步对象
  211. var ajax = new XMLHttpRequest();
  212. //步骤二:设置请求的url参数,参数一是请求的类型,参数二是请求的url,可以带参数,动态的传递参数starName到服务端
  213. ajax.open("post", VideoLogicUrl, true);
  214. // 给头部添加ajax信息
  215. ajax.setRequestHeader("X-Requested-With", "XMLHttpRequest");
  216. // 如果需要像 HTML 表单那样 POST 数据,请使用 setRequestHeader() 来添加 HTTP 头。然后在 send() 方法中规定您希望发送的数据:
  217. ajax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  218. //步骤三:发送请求+数据
  219. ajax.send('aid=' + aid+'&type='+type);
  220. //步骤四:注册事件 onreadystatechange 状态改变就会调用
  221. ajax.onreadystatechange = function () {
  222. //步骤五 请求成功,处理逻辑
  223. if (ajax.readyState == 4 && ajax.status == 200) {
  224. var json = ajax.responseText;
  225. var res = JSON.parse(json);
  226. videoPeriodObj.style.display = display_old_value;
  227. if (1 == res.code) {
  228. if (res.data.status_value == 0){ // 所有人免费
  229. videoPeriodObj.innerHTML = '<div class="video-free-now button button-big bg-yellow text-center radius-rounded text-middle">免费</div>';
  230. }else if (res.data.status_value == 1){ // 所有人付费
  231. if (document.getElementById("BuyOnclick13579")) {
  232. document.getElementById("BuyOnclick13579").style.display = '';
  233. document.getElementById("BuyOnclick13579").setAttribute("onclick", "MediaOrderBuy_v878548();");
  234. document.getElementById("BuyOnclick13579").innerHTML = '立即购买';
  235. }
  236. }else if (res.data.status_value == 3){ // 会员付费
  237. var html = videoPeriodObj.innerHTML;
  238. videoPeriodObj.innerHTML = html+'<a class="video-free-now button button-big bg-yellow text-center radius-rounded text-middle" href="javascript:void(0);" onclick="'+res.data.button_url+'">'+res.data.button+'</a>';
  239. }else{ // 会员免费
  240. if (!res.data.button) {
  241. res.data.button = 'VIP';
  242. }
  243. videoPeriodObj.innerHTML = '<div class="video-free-now button button-big bg-yellow text-center radius-rounded text-middle" style="cursor: pointer;" onclick="'+res.data.button_url+'">'+res.data.button+'</div>';
  244. }
  245. if (res.data.button) {
  246. if (document.getElementsByClassName('VideoButton13579')[0]) {
  247. var videoButton = document.getElementsByClassName('VideoButton13579');
  248. for (var i = 0; i < videoButton.length; i++) {
  249. videoButton[i].innerHTML = res.data.button;
  250. }
  251. }
  252. if('观看' == res.data.button){
  253. videoPeriodObj.innerHTML = '<a class="video-free-now button button-big bg-yellow text-center radius-rounded text-middle" href="'+res.data.button_url+'">立即播放</a>';
  254. }
  255. }
  256. if (res.data.users_price && document.getElementById('users_price_1640658971')){
  257. document.getElementById('users_price_1640658971').innerHTML = res.data.users_price;
  258. }
  259. }
  260. }
  261. };
  262. }
  263. }
  264. // 易而优视频模板
  265. function video_moban_3(type)
  266. {
  267. var JsonData = ey_1564127251;
  268. var VideoLogicUrl = JsonData.VideoLogicUrl;
  269. var aid = JsonData.aid;
  270. // 步骤一:创建异步对象
  271. var ajax = new XMLHttpRequest();
  272. //步骤二:设置请求的url参数,参数一是请求的类型,参数二是请求的url,可以带参数,动态的传递参数starName到服务端
  273. ajax.open("post", VideoLogicUrl, true);
  274. // 给头部添加ajax信息
  275. ajax.setRequestHeader("X-Requested-With", "XMLHttpRequest");
  276. // 如果需要像 HTML 表单那样 POST 数据,请使用 setRequestHeader() 来添加 HTTP 头。然后在 send() 方法中规定您希望发送的数据:
  277. ajax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  278. //步骤三:发送请求+数据
  279. ajax.send('aid=' + aid+'&type='+type);
  280. //步骤四:注册事件 onreadystatechange 状态改变就会调用
  281. ajax.onreadystatechange = function () {
  282. //步骤五 请求成功,处理逻辑
  283. if (ajax.readyState == 4 && ajax.status == 200) {
  284. var json = ajax.responseText;
  285. var res = JSON.parse(json);
  286. if (1 == res.code) {
  287. if (res.data.status_name) {
  288. if (document.getElementById("Mianfei13579")) { // 易而优
  289. document.getElementById("Mianfei13579").innerHTML = res.data.status_name;
  290. }
  291. }
  292. if (res.data.play_auth == 1) {
  293. //有播放权限
  294. if (document.getElementById("Xuexi20210201")) { // 易而优
  295. if (-1 < $.inArray(res.data.status_value, [2,3])) {
  296. document.getElementById("Xuexi20210201").style.display = 'none';
  297. if (document.getElementById("VipFreeLearn20210201")) { // 易而优
  298. var href = document.getElementById("Xuexi20210201").getAttribute("href");
  299. document.getElementById("VipFreeLearn20210201").setAttribute("href", href);
  300. document.getElementById("VipFreeLearn20210201").style.display = '';
  301. }
  302. } else {
  303. document.getElementById("Xuexi20210201").style.display = '';
  304. }
  305. }
  306. } else {
  307. //没有播放权限
  308. if (-1 < $.inArray(res.data.status_value, [1,3])) {
  309. if (res.data.is_pay > 0) {
  310. if (document.getElementById("VipFreeLearn20210201") && 3 == res.data.status_value) { // 易而优
  311. document.getElementById("VipFreeLearn20210201").style.display = '';
  312. document.getElementById("VipFreeLearn20210201").innerHTML = 'VIP升级';
  313. document.getElementById("VipFreeLearn20210201").setAttribute("title", res.data.status_name+'可免费观看');
  314. }
  315. } else {
  316. if (document.getElementById("BuyOnclick20210201")) {
  317. document.getElementById("BuyOnclick20210201").style.display = 'block';
  318. }
  319. }
  320. } else if (res.data.status_value == 2) {
  321. if (document.getElementById("VipFreeLearn20210201")) { // 易而优
  322. document.getElementById("VipFreeLearn20210201").style.display = '';
  323. }
  324. if (res.data.no_vip_pay) {
  325. document.getElementById("BuyOnclick20210201").style.display = '';
  326. }
  327. }
  328. }
  329. if (res.data.button) {
  330. if (document.getElementsByClassName('VideoButton13579')[0]) {
  331. var videoButton = document.getElementsByClassName('VideoButton13579');
  332. for (var i = 0; i < videoButton.length; i++) {
  333. videoButton[i].innerHTML = res.data.button;
  334. }
  335. }
  336. }
  337. } else {
  338. if (document.getElementById("BuyOnclick20210201")) {
  339. document.getElementById("BuyOnclick20210201").style.display = 'block';
  340. }
  341. }
  342. }
  343. };
  344. }