oneindex辅助

1.打开外部播放器 2.点击右下角蓝色图标 切换大图模式

目前为 2018-11-05 提交的版本。查看 最新版本

// ==UserScript==
// @name         oneindex辅助
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  1.打开外部播放器 2.点击右下角蓝色图标 切换大图模式
// @author       wangwangyang
// @match        https://sleazyfork.org/zh-CN/scripts/26927-222%E5%8F%B7%E5%B7%B4%E5%A3%AB%E9%80%9A%E7%A5%A8/code
// @grant        none
// @require      http://cdn.bootcss.com/jquery/2.1.4/jquery.min.js
// @include      *://*/*
// ==/UserScript==

(function() {
    'use strict';
    $.noConflict();
    if (jQuery('body').hasClass('mdui-theme-primary-blue-grey')) {
        var ls = window.localStorage;
        jQuery('.mdui-theme-accent-blue .mdui-color-theme-accent').attr('href', 'javascript:;');
        jQuery('.mdui-theme-accent-blue .mdui-color-theme-accent').click(function() {
            thumbb();
        });
        jQuery('.mdui-list .file  a').each(function() {
            var href = jQuery(this).attr('href');
            if (typeof(href) != 'undefined') {
                //console.info(href);
                if (jQuery(this).find('i').text() == 'ondemand_video') {
                    var key = jQuery(this).find('span').text();
                    if (ls[key] != null) {
                        jQuery(this).css("backgroundColor", "#f0f0ff");
                    }
                    var loc = window.location.href;
                    var xy = loc.substring(0, loc.indexOf('://') + 3);
                    var host = loc.substring(xy.length, loc.length);
                    host = host.substring(0, host.indexOf('/'));
                    loc = xy + host;
                    //console.info(loc);
                    //            href='oneindex://'+loc+href;
                    href = 'potplayer://' + loc + href;
                    jQuery(this).attr('href', 'javascript:;');
                    jQuery(this).attr('url', href);
                    jQuery(this).attr('target', '_self');
                    //console.info(href);
                    jQuery(this).click(function() {
                        var url = jQuery(this).attr('url');
                        console.info(url);
                        jQuery(this).css("backgroundColor", "#f0f0ff");
                        var key = jQuery(this).find('span').text();
                        ls.setItem(key, url);
                        console.info(jQuery(this).find('span').text());
                        window.location.href = url;
                    })
                }
            }
        });

        function thumbb() {
            if (jQuery('.mdui-fab i').text() == "apps") {
                jQuery('.mdui-fab i').text("format_list_bulleted");
                jQuery('.nexmoe-item').removeClass('thumb');
                jQuery('.nexmoe-item .mdui-icon').show();
                jQuery('.nexmoe-item .mdui-list-item').css("background", "");
            } else {
                jQuery('.mdui-fab i').text("apps");
                jQuery('.mdui-col-xs-12 i.mdui-icon').each(function() {
                    if (jQuery(this).text() == "image" || jQuery(this).text() == "ondemand_video") {
                        var href = jQuery(this).parent().parent().attr('href');
                        var thumb = (href.indexOf('?') == -1) ? '?t=220': '&t=220';
                        //jQuery('.nexmoe-item').remove();
                        //jQuery('body').append('<img src=\"'+href+'\" style=\"width:100%;\">');
                        jQuery(this).parent().parent().html('<img src=\"' + href + '\" style=\"width:100%;\">');
                        jQuery(this).hide();
                    }
                });
            }

        }

    }
})();