完善页内页打开功能。

main
PJ568 2 years ago
parent bc2ce96691
commit 23ef4c3692

@ -402,7 +402,4 @@ ins.adsbygoogle[data-ad-status="unfilled"]{
} }
#rcb_menu>#rcb_t6{ #rcb_menu>#rcb_t6{
display: none display: none
}
#rcb_menu>#rcb_t7{
display: none
} }

@ -44,11 +44,11 @@
<li id="rcb_t4">&nbsp;前进</li> <li id="rcb_t4">&nbsp;前进</li>
<li id="rcb_t5">&nbsp;重载</li> <li id="rcb_t5">&nbsp;重载</li>
<li id="rcb_t6">🆕&nbsp;新标签页打开</li> <li id="rcb_t6">🆕&nbsp;新标签页打开</li>
<li id="rcb_t7">📖&nbsp;在页内页打开</li> <li style="display:none" id="rcb_t7">📖&nbsp;在页内页打开</li>
</ul> </ul>
</body> </body>
</html> </html>
<script src="/lib/js/api.js"></script> <script src="/lib/js/api.js"></script>
<script src="/js/popup.js"></script> <script src="/js/popup.js"></script>
<script src="/js/contextmenu.js"></script> <script src="/js/openLink.js"></script>
<script src="/js/openLink.js"></script> <script src="/js/contextmenu.js"></script>

@ -6,7 +6,8 @@ function RightClickMenu(e) {
rightMenu.style.display = 'block'; rightMenu.style.display = 'block';
if (e.target.closest('a')) { if (e.target.closest('a')) {
newTab.style.display = 'block'; newTab.style.display = 'block';
if (document.write(location.href)=='https://tools.pj568.eu.org/') {document.querySelector('#rcb_t7').style.display = 'block'} // if (document.write(location.href)=='https://tools.pj568.eu.org/') {document.querySelector('#rcb_t7').style.display = 'block'}
document.querySelector('#rcb_t7').style.display = 'block';
} else { } else {
newTab.style.display = 'none'; newTab.style.display = 'none';
document.querySelector('#rcb_t7').style.display = 'none'; document.querySelector('#rcb_t7').style.display = 'none';
@ -46,6 +47,9 @@ rightMenu.addEventListener('click', function (e) {
window.open(url); window.open(url);
} }
break; break;
case "rcb_t7":
openBtnLink();
break;
default: default:
console.error(e.target.id); console.error(e.target.id);
break; break;

@ -1,8 +1,19 @@
function openLink() { function openLink () {
var iframe = document.getElementById("myFrame"); var iframe = document.getElementById("myFrame");
var iframeSrc = iframe.getAttribute("src"); var iframeSrc = iframe.getAttribute("src");
var encodedSrc = encodeURIComponent(iframeSrc); encode_and_open (iframeSrc)
}
var link = "/incert/?link=" + encodedSrc; function openBtnLink () {
window.location.assign(link) var a = document.closest ('a');
} var aSrc = a.getAttribute ("src");
var encodedaSrc = encodeURIComponent (aSrc);
var url = "/incert/?link=" + encodedaSrc;
document.querySelector('#myFrame').src = url;
document.querySelector('#myFrame').scrollIntoView({ behavior: 'smooth' });
}
function encode_and_open (event) {
var encodedSrc = encodeURIComponent (event);
var link = "/incert/?link=" + encodedSrc;
window.location.assign (link)
}
Loading…
Cancel
Save