• 【学习笔记】浏览器Console个性化输出


    一、效果图展示

     二、代码分享,吧如下代码封装到js文件里即可

    /*
     * 张金奎
     * 2019-12-6 00:16:40
     * 一小群有思想并且有着献身精神的公民可以改变世界。不要怀疑这种说法,事实上,世界正是这样被改变的。
     */
    
    hitokoto();
    function hitokoto() {
        $.ajax({
            type: "GET",
            url: "https://hitokoto.jijidown.com/v1/api/hitokoto?maxlength=80",
            data: {},
            dataType: "json",
            success: function (data) {
                //alert(data.hitokoto);
                console.log(data.hitokoto + "《" + data.source+"》");
            }
        });
    }
    if (console) {
    
        var outs = [], fi = function () { return { msg: "", style: "" } };
    
        var oi = fi();
        oi.msg = "  才雨又晴晴又雨";
        oi.style = "padding:10px 40px 10px;line-height:30px;background:url('https://images.cnblogs.com/cnblogs_com/kudsu/1298007/o_200824155830see_no_evil_monkey_310px_1214323_easyicon.net.png') no-repeat;background-size:15% 100%;font-size:1.8rem;color:rgba(184, 149, 88)";
        outs.push(oi);
    
        oi = fi();
        oi.msg = "https://www.netnr.com";
        oi.style = "background-image:-webkit-gradient( linear, left top, right top, color-stop(0, #f22), color-stop(0.15, #f2f), color-stop(0.3, #22f), color-stop(0.45, #2ff), color-stop(0.6, #25e),color-stop(0.75, #4f2), color-stop(0.9, #f2f), color-stop(1, #f22) );color:transparent;-webkit-background-clip: text;font-size:1.5em;"
        outs.push(oi);
    
        oi = fi();
        oi.msg = "
    微博:
    https://weibo.com/kudsu
    
    GitHub:
    https://github.com/kudsu
    
    博客园:
    https://www.cnblogs.com/kudsu/
    ";
        outs.push(oi);
    
        if (!("ActiveXObject" in window)) {
            outs.map(function (x) {
                console.log("%c" + x.msg, x.style);
            });
        }
    }

    三、结束

     

  • 相关阅读:
    04_Javascript初步第二天(上)
    用python实现省市县多级嵌套下拉列表
    爬虫之 BeautifulSoup与Xpath
    爬虫之 selenium模块
    爬虫请求库 requests
    抽屉网自动点赞 评论
    爬取京东商品信息
    爬取豆瓣电影top250
    爬虫基本原理
    Django auth认证
  • 原文地址:https://www.cnblogs.com/kudsu/p/13557358.html
Copyright © 2020-2023  润新知