印務局( io.gov.mo) 增強 script

查看法例的好幫手

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name        印務局( io.gov.mo) 增強 script
// @namespace   asldufhiu32hr9283hf83123
// @include     http*://bo.dsaj.gov.mo/bo/i*
// @require     https://code.jquery.com/jquery-3.3.1.slim.min.js
// @description 查看法例的好幫手
// @version     1.2
// @grant       none
// ==/UserScript==

var W_PANE = 600;

var s="<div id='div_pane_index' style='left:-"+W_PANE+"px; top:9%; width:"+W_PANE+"px; height:79%; position: fixed; background: #FFFFFF; border: 3px solid #EEAAAA; padding: 6px; overflow-x: hidden; overflow-y: hidden; font-size:13px; opacity:0.9; filter:alpha(opacity=90);'>";

var h = $('h2,h3');

for( var i=0; i<h.length; i++ ){
	var I = i;
	h.eq(i).attr("anchor_index", i);
	var text = h.eq(i).text();
	if( (text.indexOf("第")==0 || text.indexOf("附件")==0 || text.indexOf("表")==0
			|| text.indexOf("Artigo ")==0 || text.indexOf("CAPÍTULO ")==0 || text.indexOf("SECÇÃO ")==0 )
			&& i+1<h.length ){
		i++;
		text += " <b>" + h.eq(i).text() + "</b>";
	}
	s += "<span style='display:block; cursor: pointer; padding-left:50px;text-indent:-50px;' index='"+I+"'>"+ text + "</span>";
//	onclick='$(\"[anchor_index="+I+"]\").css(\"background-color\":\"#DC9900\").animate({\"background-color\":\"#FFFFFF\"},2000);'>"+ text + "</span>";
//	[0].scrollIntoView();
}

s += "</div>";
$('body').append( s);

$('#div_pane_index>span').click( function(){
	var t = $("[anchor_index="+$(this).attr("index")+"]");
	t[0].scrollIntoView();
	t.css({
		transition: '0s',
		'background-color': '#ffe600',
	});
	setTimeout(function() {
		t.css({
			transition: "10s",
			"background-color": "#ffe60000",
		})
	},1);
} );

$("<style type='text/css'> #div_pane_index>span:hover{ background-color:#EEee77; } #div_pane_index:hover{ left:0 !important; overflow-y: auto !important; } </style>").appendTo("head");