1024_mob_add_href

1024 mobile version add href link, remove onclick.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name         1024_mob_add_href
// @namespace    http://tampermonkey.net/
// @version      0.9
// @description  1024 mobile version add href link, remove onclick.
// @author       You
// @match        *://*/thread0806.php*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    if( document.cookie.indexOf('ismob=1') == -1){
        console.log('desktop');
        var aLists = document.getElementsByTagName('a');
        for(var i = 0;i < aLists.length; i++){
            if(aLists[i].href.indexOf("htm_data/") > -1 ){
                aLists[i].href = aLists[i].href.replace('htm_data','htm_mob');
            }
        }
    }else{
        console.log('mobile');
        $('.t_one').each(function(){
            var hf = $(this).attr('onclick');
            if(hf != undefined){
                hf = hf.substring(hf.indexOf('htm_mob'),hf.lastIndexOf('.html')+5);
                $(this).children().attr('href',hf);
                $(this).children().attr('target',"_blank");
                $(this).removeAttr('onclick');
            }
        })
    }
})();