您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
%%добавляет поддержку разметки вакабы&макабы вконтакте%%
当前为
// ==UserScript== // @name vkch // @icon https://2ch.hk/favicon.ico // @namespace vkch // @version 0.5 // @description %%добавляет поддержку разметки вакабы&макабы вконтакте%% // @author .dmitry // @include *://vk.com/* // @require http://code.jquery.com/jquery-latest.min.js // @encoding utf-8 // ==/UserScript== // extend jQuery with my method .vkchWhenUpdated ( function( $ ) { // wait until the main object will exists, parse all it childs for makaba&wakaba markup and bind on it's modification markup parser $.fn.vkchWhenUpdated = function( childAreasQuery ) { function vkchPWNED( ) { var $this = $( this ); function vkchChildAreas( ) { var childAreas = $this.find( childAreasQuery ).not( ".vkchPWNED" ); childAreas.addClass( "vkchPWNED" ); vkchPOWER( childAreas ); vkchRainbow( childAreas ); } $this.bind( "DOMNodeInserted", vkchChildAreas ); vkchChildAreas( ); } var $this = $( this.selector ); $this.not( ".vkchPWNED" ).addClass( "vkchPWNED" ) .each( vkchPWNED ) ; // observer if( window.vkchWhenUpdatedIntervals == undefined || window.vkchWhenUpdatedIntervals[this.selector] == undefined ) { window.vkchWhenUpdatedIntervals = window.vkchWhenUpdatedIntervals || []; window.vkchWhenUpdatedIntervals[this.selector] = setInterval( function (){ $this.vkchWhenUpdated( childAreasQuery ); }, 500 ); } return $this; }; } ( jQuery ) ); function vkchPOWER( $htmlCollection ) { var rules = [ // code { rule: /``(.+?)``/gm, replacement: "<code style='display: inline-block; border: 1px solid #2b587a; max-width: 100%; overflow: auto; padding: calc( 1ex ); white-space: nowrap'>$1</code>" }, // spoiler { rule: /%%(.+?)%%/gm, replacement: "<span style='padding: 1px 0px; background-color: #edf1f5; color: #edf1f5 !important; cursor: text' onmouseover='this.style.setProperty( \"color\", \"black\", \"important\" )' onmouseout='this.style.setProperty( \"color\", \"#edf1f5\", \"important\" )'>$1</span>" }, { rule: /\[spoiler\](.+?)\[\/spoiler\]/gim, replacement: "<span style='padding: 1px 0px; background-color: #edf1f5; color: #edf1f5 !important; cursor: text' onmouseover='this.style.setProperty( \"color\", \"black\", \"important\" )' onmouseout='this.style.setProperty( \"color\", \"#edf1f5\", \"important\" )'>$1</span>" }, // quote { rule: /(^|\<br[^\>]*\>)\>\;(.*?)(?=\<br[^\>]*\>|$)/gim, replacement: "$1<span style='color: darkgreen !important'>>$2</span>" }, // unmarked list { rule: /(^|\<br[^\>]*\>)(?:\*)\s(.*?)(?=\<br[^\>]*\>|$)/gim, replacement: "$1<li style='margin-top: 0 !important; margin-left: calc( 1em ) !important'>$2" }, // boldness { rule: /\*\*(.+?)\*\*/gm, replacement: "<span style='font-weight: bold'>$1</span>" }, { rule: /\[b\](.+?)\[\/b\]/gim, replacement: "<span style='font-weight: bold'>$1</span>" }, // italic { rule: /\*(.+?)\*/gm, replacement: "<span style='font-style: italic'>$1</span>" }, { rule: /\[i\](.+?)\[\/i\]/gim, replacement: "<span style='font-style: italic'>$1</span>" }, // underline { rule: /__(.+?)__/gm, replacement: "<span style='text-decoration: underline'>$1</span>" }, { rule: /\[u\](.+?)\[\/u\]/gim, replacement: "<span style='text-decoration: underline'>$1</span>" }, // strike { rule: /\[s\](.+?)\[\/s\]/gim, replacement: "<s>$1</s>" }, // overline { rule: /\[o\](.+?)\[\/o\]/gim, replacement: "<span style='text-decoration: overline'>$1</span>" }, // sup { rule: /\[sup\](.+?)\[\/sup\]/gim, replacement: "<sup>$1</sup>" }, // sub { rule: /\[sub\](.+?)\[\/sub\]/gim, replacement: "<sub>$1</sub>" }, ]; for( var id = 0; id < $htmlCollection.length; id ++ ) { var htmlObject = $htmlCollection[id]; for( var i = 0; i < rules.length; i ++ ) { if( rules[i].rule.test( htmlObject.innerHTML ) == true ) { htmlObject.innerHTML = htmlObject.innerHTML.replace( rules[i].rule, rules[i].replacement ); } } } } function vkchRainbow( $htmlCollection ) { var rules = [ { rule: /vkch/gim, replacement: "VKCH" }, { rule: /совас/gim, replacement: "КЕПЧУК" }, ]; for( var id = 0; id < $htmlCollection.length; id ++ ) { var htmlObject = $htmlCollection[id]; for( var i = 0; i < rules.length; i ++ ) { if( rules[i].rule.test( htmlObject.innerHTML ) == true ) { var backgroundColor = Math.floor( Math.random( ) * 255 ) + ", " + Math.floor( Math.random( ) * 255 ) + ", " + Math.floor( Math.random( ) * 255 ); var textColor = Math.floor( 255 - Math.random( ) * 255 ) + ", " + Math.floor( 255 - Math.random( ) * 255 ) + ", " + Math.floor( 255 - Math.random( ) * 255 ); htmlObject.innerHTML = htmlObject.innerHTML.replace( rules[i].rule, "<span style='padding: 1px !important; background-color: rgb( " + backgroundColor + " ) !important; color: rgb( " + textColor + " ) !important'>" + rules[i].replacement + "</span>" ); } } } } /* Instant Messages begings here */ $( "#im_content" ).vkchWhenUpdated( ".im_msg_text" ); // My Messages $( ".fc_tab_log_msgs" ).vkchWhenUpdated( ".fc_msg" ); // Messages Widget /* Instant Messages ends here */ /* Wall Posts and Comments begins here */ $( "#page_wall_posts" ).vkchWhenUpdated( ".wall_post_text" ); // Wall Posts $( "#feed_rows" ).vkchWhenUpdated( ".wall_post_text" ); // Wall Posts in Feed $( "#wl_post" ).vkchWhenUpdated( ".wall_post_text" ); // Extended Wall Post $( ".im_msg_media" ).vkchWhenUpdated( ".wall_post_text" ); // Wall Post in Instant Messenger $( ".replies_wrap" ).vkchWhenUpdated( ".wall_reply_text" ); // Wall Comments $( ".reply_dived" ).vkchWhenUpdated( ".wall_reply_text" ); // Extended Posts Comments /* Wall Posts and Comments ends here */
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址