zoukankan      html  css  js  c++  java
  • js

    // ==UserScript==
    // @name 添加隐藏内容
    // @author Wind
    // @namespace *************
    // @description 添加隐藏内容
    // @version 1.3
    // @include http://bbs.maxthon.cn/thread*
    // @include http://bbs.maxthon.cn/forum.php?mod=viewthread&tid=*
    // @include http://bbs.maxthon.cn/forum.php?mod=post&action=reply&fid=*
    // @include http://bbs.maxthon.cn/forum.php?mod=post&action=newthread&fid=*
    // @copyright 2013+, Wind
    // ==/UserScript==


    (function() {
    var bar=document.getElementsByClassName('bar');

    var fpd=document.getElementsByClassName('fpd');

    //var objdiv = document.createElement("a");

    //添加隐藏内容
    function addhide()
    {
    var textArea = document.getElementById("fastpostmessage");
    if(textArea.value!="") textArea.value += ' [hide] [/hide]';
    else
    textArea.value = '[hide] [/hide]';
    }
    //神来一句
    var catsoul='<a href="javascript:;" title="神来一句" id="custom_catsoul" style="float: left;margin: 2px 5px 0 0; 40px;height: 20px;background: url(../../static/image/editor/editor.gif) no-repeat;text-indent: -9999px;line-height: 20px;overflow: hidden;background-position: -136px -90px;" >神来一句</a>';

    //创建选项
    var Cbox='<a href="javascript:;" title="添加隐藏内容" id="custom_hide" style="float: left;margin: 2px 5px 0 0; 20px;height: 20px;background: url(../../static/image/editor/editor.gif) no-repeat;text-indent: -9999px;line-height: 20px;overflow: hidden;background-position: -120px -40px;">Hide</a>';


    //fpd.innerHTML+=Cbox;


    if (fpd && bar) {
    if (fpd[0].innerHTML.indexOf("添加隐藏内容") < 0) fpd[0].innerHTML+=Cbox+catsoul; //fpd[0].appendChild(objdiv);

    } else if (bar && !fpd) {
    if (bar[0].innerHTML.indexOf("添加隐藏内容") < 0) bar[0].innerHTML+=Cbox+catsoul; //bar[0].appendChild(objdiv);

    }

    var the_hide = document.getElementById("custom_hide");
    the_hide.addEventListener("click", addhide);

    var the_catsoul = document.getElementById("custom_catsoul");
    the_catsoul.addEventListener("click", addcatsoul);




    //添加神来一句
    function addcatsoul()
    {
    var textArea = document.getElementById("fastpostmessage");


    var catsoul= new Array(
    '数组示例---不用---',
    '[catsoul=1]直到我膝盖中了一箭[/catsoul]',
    '[catsoul=2]我擦![/catsoul]',
    '[catsoul=3]你懂的。[/catsoul]',
    '[catsoul=4]这真是极好的[/catsoul]',
    '[catsoul=5]给力![/catsoul]',
    '[catsoul=6]你妹。[/catsoul]',
    '[catsoul=7]感觉不会再爱了[/catsoul]',
    '[catsoul=8]楼下怎么看?[/catsoul]',
    '[catsoul=9]呵呵。[/catsoul]',
    '[img]https://lh6.googleusercontent.com/-7bEMnc8A8LI/UIdtwdmWhlI/AAAAAAAAATw/9nmdVgdQJIk/s577/%E7%AD%BE%E5%90%8D%E5%9B%BE%E7%89%87.gif[/img]'
    );

    //随机数
    var N=catsoul.length-1;
    var radom_num = 0;
    radom_num = parseInt(Math.random()*N+1); //1-N

    if(textArea.value!="") textArea.value +=' ' + catsoul[radom_num];
    else
    textArea.value = catsoul[radom_num];
    }


    })();

  • 相关阅读:
    1092 最好吃的月饼 (20 分)
    pat 乙级 1093 字符串A+B (20 分)
    pat乙级 1091 N-自守数 (15 分)
    查询GC日志、动态年龄计算
    四大特性以及事务的隔离级别
    R语言学习
    利用python进行数据分析3_Pandas的数据结构
    python_109_切片补充和list函数
    爬虫_python3_requests
    利用python进行数据分析1_numpy的基本操作,建模基础
  • 原文地址:https://www.cnblogs.com/Wind-Blog/p/3226716.html
Copyright © 2011-2022 走看看