您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Rollover for user info and follow button.
当前为
// ==UserScript== // @name FollowOver // @namespace https://www.ekkooff.com/ // @version 0.5 // @description Rollover for user info and follow button. // @author Kevin Roberts (@echo) // @match https://gab.ai/* // @include https://gab.ai/home // @grant none // ==/UserScript== (function() { 'use strict'; console.log('wooooooot!'); var timeout=null; var timeout2=null; var id=null; var styles = $('<style type="text/css">\n\ #followpopup {\n\ background-color:white;\n\ position:absolute;\n\ z-index:10000;\n\ display:none;\n\ height:140px;\n\ width:500px;\n\ padding:4px;\n\ border:1px solid #666;\n\ border-radius:5px;\n\ }\n\ \n\ #followpopup-head {\n\ text-align: center;\n\ margin-bottom:10px;\n\ }\n\ \n\ #followpopup-bio {\n\ height: 75px;\n\ overflow: hidden;\n\ margin-bottom:5px;\n\ }\n\ \n\ #followpopup-info {\n\ border: 1px solid #edeeee;\n\ overflow:hidden;\n\ border-radius:4px;\n\ display:block;\n\ width:100%;\n\ position:relative;\n\ }\n\ \n\ #followpopup-follow {\n\ right:0;\n\ position:absolute;\n\ width:55px;\n\ color: white;\n\ text-decoration: none;\n\ padding: 5px 10px;\n\ display: inline-block;\n\ }\n\ \n\ #followpopup-info span {\n\ border-right: 1px solid #edeeee;\n\ padding: 3px;\n\ display: inline-block;\n\ }\n\ \n\ #followpopup #followpopup-followback {\n\ right:75px;\n\ position:absolute;\n\ padding-right: 6px;\n\ height: 100%;\n\ }\n\ \n\ #followpopup .follow {\n\ background: #34cf7f;\n\ }\n\ \n\ #followpopup .unfollow {\n\ background: red;\n\ }\n\ \n\ #followpopup .pending {\n\ background: #edeeee;\n\ color: #000;\n\ }\n\ \n\ #followpopup .empty {\n\ background: transparent;\n\ }\n\ \n\ </style>'); var userInfoPopup = $('<div id="followpopup">\ <div id="followpopup-head">\ <strong><span id="followpopup-name"></span></strong>\ <span id="followpopup-username"></span>\ </div>\ <div id="followpopup-bio"></div>\ <div id="followpopup-info">\ ?<span id="followpopup-score"></span>\ <span id="followpopup-posts"></span>\ <span id="followpopup-followers"></span>\ <span id="followpopup-following"></span>\ <span id="followpopup-followback"></span>\ <a href="#" id="followpopup-follow"></a>\ </div>\ </div>'); $('body').append(styles).append(userInfoPopup); if($('body').css('background-color')!=='rgba(0, 0, 0, 0)'&&$('body').css('background-color')!=='transparent') { userInfoPopup.css('background-color',$('body').css('background-color')); } $('#followpopup-follow').click(function() { var d = {}; if($(this).text()==='Unfollow'||$(this).text()==='Pending') { d._method = 'delete'; } var priv = $(this).hasClass('private'); $.ajax({ method: 'POST', url: '/users/'+id+'/follow', data: d }).done(function(data) { if(data.state==='success') { if(d._method) { $('#followpopup-follow').text('Follow').removeClass().addClass('follow'); if($('#followpopup-followback i').hasClass('ion-arrow-swap')) { $('#followpopup-followback i').removeClass().addClass('ion-arrow-left-c'); } } else if(!priv) { $('#followpopup-follow').text('Unfollow').removeClass().addClass('unfollow'); if($('#followpopup-followback i').hasClass('ion-arrow-left-c')) { $('#followpopup-followback i').removeClass().addClass('ion-arrow-swap'); } } else { $('#followpopup-follow').text('Pending').removeClass().addClass('pending'); } if(priv) { $('#followpopup-follow').addClass('private'); } } }); return false; }); $('body').on('mouseenter','a.post__meta__name__full, a.post__meta__name__username, .notification-list .notification-list__item__message div:first-child span a:first-child, .notification-list__item__users a, a.notification-list__item__mention__name, a.notification-list__item__mention__username, a.inner-post-mention, a.mini-user-list__item__name, a.mini-user-list__item__username',function(e){ clearTimeout(timeout); clearTimeout(timeout2); timeout2 = setTimeout(function() { clearTimeout(timeout); var offset = $(e.currentTarget).offset(); var offset2 = $(e.currentTarget.parentElement).offset(); var height = $(window).height(); var width = $(window).width(); var name = e.currentTarget.href.substr(e.currentTarget.href.lastIndexOf('/')+1); $.ajax({ method: 'GET', url: '/users/'+name, headers: { 'Authorization': 'Bearer '+localStorage.id_token } }).done(function(data) { id = data.id; $('#followpopup-name').text(data.name); $('#followpopup-username').text('@'+data.username); $('#followpopup-bio').text(data.bio); $('#followpopup-score').text(data.score); $('#followpopup-posts').text(data.post_count+' posts'); $('#followpopup-followers').text(data.follower_count+' followers'); $('#followpopup-following').text(data.following_count+' following'); if(data.followed) { if(data.following) { $('#followpopup-followback').html('<i class="ion-arrow-swap"></i>'); } else { $('#followpopup-followback').html('<i class="ion-arrow-left-c"></i>'); } } else { $('#followpopup-followback').html(' '); } if(authUser.username!=data.username) { if(data.follow_pending) { $('#followpopup-follow').text('Pending').removeClass().addClass('pending'); } else if(!data.following) { $('#followpopup-follow').text('Follow').removeClass().addClass('follow'); } else { $('#followpopup-follow').text('Unfollow').removeClass().addClass('unfollow'); } } else { $('#followpopup-follow').text('').removeClass().addClass('empty'); } if(data.is_private) { $('#followpopup-follow').addClass('private'); } userInfoPopup.css({ top:((e.clientY<(height/2))?offset.top+25:offset.top-160)+'px', left:(((width-515)>offset2.left)?offset2.left:width-515)+'px' }); userInfoPopup.show(); }); },500); }).on('mouseleave','a.post__meta__name__full, a.post__meta__name__username, .notification-list .notification-list__item__message div:first-child span a:first-child, .notification-list__item__users a, a.notification-list__item__mention__name, a.notification-list__item__mention__username, a.inner-post-mention, a.mini-user-list__item__name, a.mini-user-list__item__username',function(){ clearTimeout(timeout2); timeout = setTimeout(function(){ userInfoPopup.hide(); }, 650); }); userInfoPopup.mouseenter(function() { clearTimeout(timeout); clearTimeout(timeout2); }).mouseleave(function() { clearTimeout(timeout2); timeout = setTimeout(function() { userInfoPopup.hide(); }, 650); }); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址