PageSourceSearch

https://thefreshtoast.com/wp-content/plugins/open-in-new-window-plugin/open_in_new_window.js

js thefreshtoast.com collected 2026-10-02 03:20:17 UTC 2,631 bytes, 85 lines download raw bytes

1/*
2Plugin Name: Open in New Window Plugin
3Plugin URI: http://www.BlogsEye.com/
4Description: Opens external links in a new window, keeping your blog page in the browser so you don't lose surfers to another site.
5Version: 2.4
6Author: Keith P. Graham
7Author URI: http://www.BlogsEye.com/
8
9This software is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12*/
13function kpg_oinw_action(event) {
14	try {
15		var b=document.getElementsByTagName("a");
16		var ksrv=window.location.hostname;
17		ksrv=ksrv.toLowerCase();
18		for (var i = 0; i < b.length; i++) {
19			/* IE 6 bug - the anchor might not be a link and might not support hostname */
20			if (b[i] && b[i].href) {
21				if (!(b[i].title)) {
22					var ih=b[i].innerHTML;
23					if (ih.indexOf('<img')==-1) { /* check for img tag */
24						b[i].title=kpgremoveHTMLTags(b[i].innerHTML);
25					}
26				}
27				var khref=b[i].href;
28				khref=khref.toLowerCase();
29				if ( b[i].target==null || b[i].target=='')  {
30					if (khref.indexOf('//')!=-1) { /* check to see if target is on this domain.*/
31						var no=b[i].rel;
32						if (no==null||no=='') {
33							no="noopener noreferrer";
34						} else {
35							no+=" noopener noreferrer";
36						}
37						if (b[i].hostname && location.hostname) {
38							if (b[i].hostname.toLowerCase() != location.hostname.toLowerCase()) {
39								b[i].target="_blank";
40								b[i].rel=no;
41							}
42						} 
43						if (b[i].target!="_blank"&&khref.indexOf(ksrv)==-1) { 					
44							b[i].target="_blank";
45							b[i].rel=no;
46						}
47						if (b[i].target!="_blank"&&kpg_oinw_checktypes) {
48							/* list of types to check here */
49							for (k=0;k<kpg_oinw_list.length;k++) {
50								if (khref.indexOf(kpg_oinw_list[k])!=-1) {
51									b[i].target="_blank";
52									b[i].rel=no;
53								}
54							}
55						} 
56					}
57				}
58			}
59		}
60	} catch (ee) {}
61}
62/* set the onload event */
63if (document.addEventListener) {
64	document.addEventListener("DOMContentLoaded", function(event) { kpg_oinw_action(event); }, false);
65} else if (window.attachEvent) {
66	window.attachEvent("onload", function(event) { kpg_oinw_action(event); });
67} else {
68	var oldFunc = window.onload;
69	window.onload = function() {
70		if (oldFunc) {
71			oldFunc();
72		}
73			kpg_oinw_action('load');
74		};
75}
76function kpgremoveHTMLTags(ihtml){
77	try {
78		ihtml = ihtml.replace(/&(lt|gt);/g, function (strMatch, p1){
79			return (p1 == "lt")? "<" : ">";
80		});
81		return ihtml.replace(/<\/?[^>]+(>|$)/g, "");
82	} catch (eee) {
83		return '';
84	}
85}	

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.