PageSourceSearch

https://www.cs.com.cn/static/common-ios/js/mi4-common.js

js cs.com.cn collected 2026-10-02 03:34:54 UTC 18,406 bytes, 531 lines download raw bytes

1// var baseUrl = "//localhost:8089/mi4_server/";
2var baseUrl = "//mi4.amonsoft.com:8089/mi4_server/";
3//var baseUrl = "//danuo-admin.amonsoft.com:8089/mi4_server/";
4var smallVr;
5var bigVr;
6// 是否为服务器调试模式(true:是 false:否)
7var _IS_SERVER_DEBUG = false;
8
9//打开一个链接
10function openLink(targetUrl) {
11    window.open(targetUrl);
12}
13//打开一个链接(新窗)
14function openLinkInSelf(targetUrl) {
15    window.open(targetUrl, "_self");
16}
17// 点赞文章
18function approveArticle() {
19    if (_miId) {
20        var param = {
21            'WB_ID': _wbId,
22            'SUB_ID': _subId,
23            'MI_ID': _miId,
24        };
25        $.ajax({
26            type: "POST",
27            url: baseUrl + "mi4-web/tracer/approve",
28            data: param,
29            success: function (result) {
30                console.log(result);
31                alert(result.msg);
32            },
33            error: function (e) {
34                console.log(e.status);
35                console.log(e.responseText);
36            }
37        });
38    }
39}
40$(document).ready(function () {
41    var MobileUA = (function () {
42        var ua = navigator.userAgent.toLowerCase();
43        // console.log('ua', ua);
44        var mua = {
45            IOS: /ipod|iphone|ipad/.test(ua), //iOS
46            IPHONE: /iphone/.test(ua), //iPhone
47            IPAD: /ipad/.test(ua), //iPad
48            ANDROID: /android/.test(ua), //Android Device
49            WINDOWS: /windows/.test(ua), //Windows Device
50            TOUCH_DEVICE: ('ontouchstart' in window) || /touch/.test(ua), //Touch Device
51            MOBILE: /mobile/.test(ua), //Mobile Device (iPad)
52            ANDROID_TABLET: false, //Android Tablet
53            WINDOWS_TABLET: false, //Windows Tablet
54            TABLET: false, //Tablet (iPad, Android, Windows)
55            SMART_PHONE: false //Smart Phone (iPhone, Android)
56        };
57        mua.ANDROID_TABLET = mua.ANDROID && !mua.MOBILE;
58        mua.WINDOWS_TABLET = mua.WINDOWS && /tablet/.test(ua);
59        mua.TABLET = mua.IPAD || mua.ANDROID_TABLET || mua.WINDOWS_TABLET;
60        mua.SMART_PHONE = mua.MOBILE && !mua.TABLET;
61        return mua;
62    }());
63
64    //== AliPlayer Start==
65    var playerContainers = $("div.qplayer_item");
66    console.log(playerContainers);
67    $.each(playerContainers, function (idx, tmpPlayerDiv) {  //遍历二维数组
68        var playSrc = $(tmpPlayerDiv).attr("src");
69        var videowidth = $(tmpPlayerDiv).attr("data-width")
70        var videoheight = $(tmpPlayerDiv).attr("data-height")
71        var daposter = $(tmpPlayerDiv).attr("data-poster")
72        console.log('daposter', daposter);
73        console.log('videowidth', videowidth);
74        console.log('videoheight', videoheight);
75
76        if (MobileUA.MOBILE) {
77            if (playSrc.indexOf("rtmp") > -1) {
78                playSrc = playSrc.replace("rtmp", "http") + ".m3u8";
79            } else if (playSrc.indexOf(".flv") > -1) {
80                playSrc = playSrc.replace(".flv", ".m3u8");
81            }
82        }
83        //alert(playSrc);
84        console.log('MobileUA.SMART_PHONE', MobileUA.SMART_PHONE);
85        console.log('MobileUA.playSrc', playSrc);
86
87        $(tmpPlayerDiv).find("img").remove();
88        var id = "player-con_" + idx;
89        $(tmpPlayerDiv).attr("id", id)
90        var player = new Aliplayer({
91            "id": id,
92            "source": playSrc,
93            "width": videowidth + "px",
94            "height": videoheight + "px",
95            "autoplay": false,
96            "isLive": false,
97            "rePlay": true,
98            "playsinline": true,
99            "preload": true,
100            "controlBarVisibility": "always",
101            "useH5Prism": true,
102            "cover": ""
103        }, function (player) {
104            console.log("The player is created");
105        }
106        );
107    });
108    //== AliPlayer End==
109    //== QiniuPlayer Start==
110    /*
111    var playerContainers = $("div.qplayer_item");
112    $.each(playerContainers, function(idx, tmpPlayerDiv){  //遍历二维数组
113           $(tmpPlayerDiv).find("img").remove();
114             var player = new QPlayer({
115                 url: $(tmpPlayerDiv).attr("src"),
116                 container: tmpPlayerDiv,
117                 autoplay: true,
118           });
119     });
120     */
121    //== QiniuPlayer End==
122    //== VRlayer End==
123    var playerContainers = $("div.vrplayer_item");
124    $.each(playerContainers, function (idx, tmpVrPlayerDiv) {
125        if (idx == 0) {// only one
126            $(tmpVrPlayerDiv).find("img").remove();
127            /*M-Player播放器参数配置*/
128            var tmpContainer = tmpVrPlayerDiv;
129            var url = $(tmpVrPlayerDiv).attr("src")
130            var wStr = "100%";//tmpVrPlayerDiv.style.width;
131            var hStr = "100%";//mpVrPlayerDiv.style.height;//"470px";
132            if (MobileUA.MOBILE) {
133                hStr = (window.innerWidth / 2) + "px";
134                $(tmpVrPlayerDiv).parent().css("height", hStr);
135            } else {
136                hStr = (window.innerWidth / 3) + "px";
137                $(tmpVrPlayerDiv).parent().css("height", hStr);
138            }
139            initMPlayer(0, tmpContainer, url, wStr, hStr);
140
141            // var fullContainer = document.getElementById("viewer");
142            // initMPlayer(1, fullContainer, url, null, null);
143
144            // var fullContainer = document.getElementById("viewer");
145            // initMPlayer(fullContainer, url, null, null);
146
147            // console.log("player src:" + $(tmpVrPlayerDiv).attr("src"))
148            /*播放器参数配置*/
149            /*
150             initLoad({
151             container: tmpVrPlayerDiv,
152             name: "SceneViewer",
153             scenesArr: [
154                 //todo:注意修改视频路径,需要保证播放页面与视频属于同一域名下
155                 {sceneId: "v1" + idx, sceneName: "赛车", sceneFilePath: $(tmpVrPlayerDiv).attr("src"), sceneType: "Video"}
156             ],
157             //播放器不支持全景播放回调
158             errorCallBack: function (e) {
159                 console.log("错误状态:" + e);
160             },
161             //浏览器不支持全屏回调
162             fsCallBack: function (status, playObj) {
163                 alert("浏览器不支持全屏!");
164             }
165             });
166             */
167        }
168    });
169    //M-VR-Player
170    function initMPlayer(flg, tmpContainer, tmpUrl, wStr, hStr) {
171        var scene, renderer;
172        var container;
173        AVR.debug = true;
174        if (!AVR.Broswer.isIE() && AVR.Broswer.webglAvailable()) {
175            renderer = new THREE.WebGLRenderer();
176        } else {
177            renderer = new THREE.CanvasRenderer();
178        }
179        renderer.setPixelRatio(window.devicePixelRatio);
180        container = tmpContainer;
181        container.appendChild(renderer.domElement);
182        scene = new THREE.Scene();
183        // fov 选项可调整初始视频远近
184        var vr = new VR(scene, renderer, container, { "fov": 100 });
185        if (flg == 0) {
186            smallVr = vr;
187        } else {
188            bigVr = vr;
189        }
190        vr.vrbox.radius = 600;
191        if (AVR.isCrossScreen()) {
192            vr.effect.separation = 1.2;
193        }
194        vr.loadProgressManager.onLoad = function () {
195            vr.video.muted = false;
196            vr.VRObject.getObjectByName("__mxrealityDefault").visible = true;
197        }
198        if (MobileUA.SMART_PHONE) {
199            AVR.useGyroscope = true;
200        }
201        vr.init(function () {
202        });
203        if (tmpUrl.indexOf(".mp4") > -1) {
204            vr.playPanorama(tmpUrl, vr.resType.video);
205        } else if (tmpUrl.indexOf(".m3u8") > -1) {
206            vr.playPanorama(tmpUrl, vr.resType.sliceVideo);
207        }
208        // vr.video.setAttribute("loop","loop");
209        vr.video.crossOrigin = "*";
210        vr.video.onended = function () {
211        }
212        if (wStr && hStr) {
213            container.style = "";
214            container.style.width = wStr;
215            container.style.height = hStr;
216        } else {
217            container.style.display = "none";
218        }
219        document.body.style = "";
220    }
221    //== VRPlayer End==
222    try {
223        if (_pageNo && _pageNo == 1) {//第1页
224            $("#firstPageBtn").addClass("disabled");
225            $("#prevPageBtn").addClass("disabled");
226        }
227        if (_pageNo && _pageNo == _pageCnt) {//下·一页
228            $("#nextPageBtn").addClass("disabled");
229            $("#lastPageBtn").addClass("disabled");
230        }
231
232        // 第1页
233        $("#firstPageBtn a").click(function () {
234            // alert(_pagePrefix);
235            window.open(_pagePrefix + "1.html", "_self");
236        });
237        // 上一页
238        $("#prevPageBtn a").click(function () {
239            window.open(_pagePrefix + (_pageNo - 1) + ".html", "_self");
240        });
241        // 下一页
242        $("#nextPageBtn a").click(function () {
243            window.open(_pagePrefix + (_pageNo - -1) + ".html", "_self");
244        });
245        // 最后一页
246        $("#lastPageBtn a").click(function () {
247            window.open(_pagePrefix + _pageCnt + ".html", "_self");
248        });
249    } catch (e) {
250
251    }
252    //======Mplayer Start======
253    $("div.vrplayer_item").mouseover(function () {
254        document.body.style.overflow = "hidden";
255    });
256    $("div.vrplayer_item").mouseout(function () {
257        document.body.style.overflow = "auto";
258    });
259    $("#viewer").click(function () {
260        $("#closePlayer").animate({
261            opacity: "1"
262        }, 500);
263    });
264    $("#closePlayer").mouseover(function () {
265        $("#closePlayer").animate({
266            opacity: "1"
267        }, 500);
268    });
269    $("#closePlayer").mouseout(function () {
270        $("#closePlayer").animate({
271            opacity: "0"
272        }, 4500);
273    });
274    $("#closePlayer").click(function () {
275        document.body.style = "overflow:auto";
276        $("#viewer").animate({
277            height: "toggle",
278            opacity: "toggle"
279        }, "hide");
280        bigVr.video && bigVr.video.pause(), bigVr.audio && bigVr.audio.pause();
281        $("#closePlayer").hide();
282    });
283    //======Mplayer End======
284});
285//======mx function start======
286var preHeight;
287window.addEventListener("orientationchange", function () {
288    //alert(window.orientation + ":" + window.innerWidth + ":" + window.innerHeight);
289    if (window.orientation == 0) {//立
290        var playerContainers = $("div.vrplayer_item");
291        $.each(playerContainers, function (idx, tmpVrPlayerDiv) {
292            $(tmpVrPlayerDiv).css("height", preHeight);
293            $(tmpVrPlayerDiv).parent().css("height", preHeight);
294        });
295    } else if (Math.abs(window.orientation) == 90) {//横
296        var tmpHeight = 100;
297        var playerContainers = $("div.vrplayer_item");
298        $.each(playerContainers, function (idx, tmpVrPlayerDiv) {
299            preHeight = $(tmpVrPlayerDiv).css("height");
300            $(tmpVrPlayerDiv).css("height", window.innerWidth - tmpHeight + "px");
301            $(tmpVrPlayerDiv).parent().css("height", window.innerWidth - tmpHeight + "px");
302        });
303    }
304}, false);
305function _mi4_mx_fullscreen() {
306    if (MobileUA.MOBILE) {
307        return true;
308    }
309    $(document).scrollTop(0);
310    smallVr.video && smallVr.video.pause(), smallVr.audio && smallVr.audio.pause();
311    $("#viewer").animate({
312        height: "toggle",
313        opacity: "toggle"
314    }, "slow");
315    bigVr.video && bigVr.video.play(), bigVr.audio && bigVr.audio.play();
316    document.body.style = "overflow:hidden";
317    $("#closePlayer").show();
318    $("#closePlayer").animate({
319        opacity: "0"
320    }, 8500);
321    return false;
322}
323
324
325//=============topic start===================
326// 投票提交
327function _mi4Vote(formId, hidId, attrVal) {
328    // alert(hidId + ":" + attrVal);
329    // 设定值
330    $("#" + hidId).val(attrVal);
331    if (confirm("是否提交?")) {
332        _submitMi4TopicData(formId);
333    }
334}
335// 投票提交
336function _mi4SubmitForm(formId) {
337    var hasEmpty = false;
338    $("#" + formId + " select").each(function (index, item) {
339        // alert("$(item).val()" + $(item).find("option:selected").val());
340        if (hasEmpty == false && $(item).val() == "") {
341            alert("选项不能为空,请选择!");
342            $(item).focus();
343            hasEmpty = true;
344        }
345    });
346    if (hasEmpty == false) {
347        var radioNmArr = [];
348        $("#" + formId + " input[type='radio'] ").each(function (index, item) {
349            if (radioNmArr.indexOf($(item).attr('name')) == -1) {
350                radioNmArr.push($(item).attr('name'));
351            }
352        });
353
354        radioNmArr.forEach(function (item) {
355            if (hasEmpty == false && !$("input[name=" + item + "]:checked").val()) {
356                alert("该项目不能为空,请选择!");
357                $("input[name=" + item + "]:eq(0)").focus();
358                hasEmpty = true;
359            }
360        });
361    }
362    if (hasEmpty == false) {
363        var checkboxNmArr = [];
364        $("#" + formId + " input[type='checkbox'] ").each(function (index, item) {
365            if (checkboxNmArr.indexOf($(item).attr('name')) == -1) {
366                checkboxNmArr.push($(item).attr('name'));
367            }
368        });
369
370        checkboxNmArr.forEach(function (item) {
371            if (hasEmpty == false && !$("input[name=" + item + "]:checked").val()) {
372                alert("该项目不能为空,请选择!");
373                $("input[name=" + item + "]:eq(0)").focus();
374                hasEmpty = true;
375            }
376        });
377    }
378    if (hasEmpty) {
379        return false;
380    }
381    if (confirm("是否提交?")) {
382        _submitMi4TopicData(formId);
383    }
384}
385
386$.fn.serializeObject = function () {
387    var o = {};
388    var a = this.serializeArray();
389    $.each(a, function () {
390        if (o[this.name]) {
391            if (!o[this.name].push) {
392                o[this.name] = [o[this.name]];
393            }
394            o[this.name].push(this.value || '');
395        } else {
396            o[this.name] = this.value || '';
397        }
398    });
399    return o;
400};
401
402function _submitMi4TopicData(formId) {
403    var mid = $("#mip").val();
404    var midVal = readCookie('mip_' + mid);
405    var formData = $("#" + formId).serialize();
406    $.ajax({
407        beforeSend: function (XMLHttpRequest) {
408            XMLHttpRequest.setRequestHeader("system-flag", "mi4");
409            XMLHttpRequest.setRequestHeader('mip_' + mid, midVal);
410        },
411        // xhrFields: {
412        //     withCredentials  : true
413        //},
414        //crossDomain: true,
415        type: "POST",
416        url: baseUrl + "mi4-web/topic/submit",
417        contentType: "application/json;charset=utf-8",
418        data: JSON.stringify($("#mi4MainForm").serializeObject()),
419        dataType: "json",
420        success: function (message) {
421            // alert("提交成功"+JSON.stringify(message));
422            var expires = new Date();
423            expires.setTime(expires.getTime() + 500 * 24 * 60 * 60 * 1000);
424            document.cookie = message.k + "=" + message.r + "; expires=" + expires.toGMTString() + "; path=/; domain=;";
425            window.location.href = "message.html";
426        },
427        error: function (message) {
428            alert("提交失败" + JSON.stringify(message));
429        }
430    });
431}
432function setCookie(name, value, expires) {
433    var d = new Date();
434    d.setTime(d.getTime() + (365 * 24 * 60 * 60 * 1000));
435    var expires = "expires=" + d.toGMTString();
436    document.cookie = name + "=" + value + "; " + expires + "; path=/; domain=;";
437}
438
439function readCookie(name) {
440    var cookieValue = "";
441    var search = name + "=";
442    if (document.cookie.length > 0) {
443        offset = document.cookie.indexOf(search);
444        if (offset != -1) {
445            offset += search.length;
446            end = document.cookie.indexOf(";", offset);
447            if (end == -1) end = document.cookie.length;
448            cookieValue = unescape(document.cookie.substring(offset, end))
449        }
450    }
451    return cookieValue;
452}
453//=============topic end ===================
454
455//=============load remote html content=========
456function loadMi4Fragment(htmlUrl, callBackFunc, errCallBackFunc) {
457    // 不运行
458    if (_IS_SERVER_DEBUG) return;
459
460    $.ajax({
461        type: "GET",
462        url: htmlUrl,
463        data: {},
464        success: function (result) {
465            // console.log(result);
466            //alert(result.msg);
467            if (callBackFunc) {
468                callBackFunc(result);
469            }
470        },
471        error: function (e) {
472            //console.log('mi4-status:' + e.status);
473            //console.log(e.responseText);
474            // (第2道保护)
475            //if(e.status == '404'){
476            errCallBackFunc(e);
477            //$("#MORE_DATE_PAGE_BTN").removeClass("show");
478            //$("#MORE_DATE_PAGE_BTN").addClass("hide");
479            //$("#NO_MORE_DATE_PAGE_BTN").removeClass("hide");
480            //}
481        }
482    });
483}
484//=============
485
486// ===getPageFile START===
487function getPageFileNm(pageGuide, pageNo) {
488    var ret = "";
489    if (pageGuide[pageNo]) {
490        ret = pageGuide[pageNo];
491    }
492    return ret;
493}
494
495
496$.ajax({
497    type: "GET",
498    url: "/mi4-web/app-config/getAppStyleConfig?&wbId=1",
499    data: {},
500    success: function (data) {
501        console.log(data);
502        if (data.code === 0 && data.config) {
503            const masVal = data.config.masVal;
504            if (masVal === "default") {
505                console.log("默认");
506            } else if (masVal === "gray") {
507                applyGrayscaleFilter();
508            }
509        } else {
510            console.error("获取配置失败或配置数据缺失");
511        }
512    },
513    error: function (xhr, status, error) {
514        console.error("AJAX请求失败:", status, error);
515    }
516});
517function applyGrayscaleFilter() {
518    const htmlElement = document.documentElement; // 获取<html>元素
519    const grayscaleFilter = `
520     -webkit-filter: grayscale(100%);
521     -moz-filter: grayscale(100%);
522     -ms-filter: grayscale(100%);
523     -o-filter: grayscale(100%);
524     filter: grayscale(100%);
525     filter: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg'><filter id='grayscale'><feColorMatrix type='matrix' values='0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0'/></filter></svg>#grayscale");
526     filter: progid:DXImageTransform.Microsoft.BasicImage(grayscale=1);
527 `;
528    htmlElement.style.cssText += grayscaleFilter;
529}
530
531// ===getPageFile END===

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.