From 52e0fadfa093b8df12020f57db6c8fde3c0ebfea Mon Sep 17 00:00:00 2001 From: kong0107 Date: Sat, 24 Aug 2013 16:12:48 +0800 Subject: [PATCH] Fixing #9 with a not-so-good solution I shall detect the highest `zIndex` of the element's ancestors. This isn't easy without jQuery since some `zIndex` is applied in CSS selectors. Also skip small windows from parsing since they are usually scripts from other sites (such as Facebook) and don't even contain any chinese words. --- LER.js | 10 +++++++++- main.css | 1 + manifest.json | 7 +++---- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/LER.js b/LER.js index 055bed6..7c32a5f 100644 --- a/LER.js +++ b/LER.js @@ -21,6 +21,10 @@ LER = function(){ }; } else var debug = function(){}; + if(window.innerHeight < 50 || window.innerWidth < 100) { + debug("window too small, ignored."); + return; + } /// 數字補零(其實不是數字也沒關係) var zeroFill = function(num, strlen){ @@ -193,6 +197,10 @@ LER = function(){ : (document.body.offsetWidth - popup.offsetWidth) ; s.left = left + "px"; + /* See #9 + for(var p = self; p != document.body; p = p.parentNode) + s.zIndex = Math.max(s.zIndex, p.style.zIndex); + */ var arrow = popup.firstChild; arrow.style.marginLeft = x - left - (arrow.offsetWidth / 2) + "px"; }, 350); @@ -936,4 +944,4 @@ LER = function(){ debugTime: function(str) {debug(str);} }; }(); -LER.debugTime("initialization"); +if(typeof LER == "object" && LER.debugTime) LER.debugTime("initialization"); \ No newline at end of file diff --git a/main.css b/main.css index d022cc8..636adb4 100644 --- a/main.css +++ b/main.css @@ -60,6 +60,7 @@ margin: 0; padding: 0; text-align: left; + z-index: 1069; } .LER-popup-head { diff --git a/manifest.json b/manifest.json index a35ba24..4c0f7c7 100644 --- a/manifest.json +++ b/manifest.json @@ -2,10 +2,9 @@ "manifest_version": 2, "name": "法規亦毒氣", "description": "將網頁中的法規與條號都轉變成連結,讓您快速查閱指定條文。", -"version": "0.4.4.2", -"permissions": [ - "http://law.moj.gov.tw/" -], +"version": "0.4.4.3", +"author": "kong0107", +"homepage_url": "http://g0v.github.io/laweasyread-front/", "icons" : {"128": "icon.png"}, "options_page": "options.html", "browser_action": {