Greasy Fork is available in English.

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

查看法例的好幫手

// ==UserScript==
// @name        印務局( io.gov.mo) 增強 script
// @namespace   asldufhiu32hr9283hf83123
// @include     http*://bo.io.gov.mo/bo/i*
// @require     https://code.jquery.com/jquery-3.3.1.slim.min.js
// @description 查看法例的好幫手
// @version     1.1
// @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");