SEO URL REDIRECT V2
SEO URL REDIRECT V2
by zachreynolds
HTML
<ul class="seolist"></ul>
<script>
if (!location.origin)
location.origin = location.protocol + "//" + location.host;
//var newurl = location.origin.replace(/.*?:\/\//g, "");
//var newurl = location.origin.replace(/^https?\:\/\//i, "");
var newurl = nohttp(location.origin);
//newurl = 'http://' + url.split('/')[0];
var seoURL =
[
'http://www.activistpost.com/',
'http://vinarmani.com/',
'http://www.countermarkets.com/',
'http://BEBIVodka.com',
'http://GVRNURSLF.com',
'http://highimpactflix.com/',
'http://www.davidpakman.com',
'http://www.democracynow.org',
'https://pressfortruth.ca/',
'http://therealnews.com',
'https://theintercept.com/'];
var seoList = $('ul.seolist')
$.each(seoURL, function(i)
{
var li = $('<li/>')
.addClass('ui-menu-item')
.attr('role', 'menuitem')
.appendTo(seoList);
var aaa = $('<img src="http://s2.googleusercontent.com/s2/favicons?domain=' + baseurl(seoURL[i]) + '"/><a/>')
.addClass('ui-all')
//.text(seoURL[i]+newurl)
.text(nohttp(baseurl(seoURL[i]))) // create function base url only like: Builtwith.com
.attr({
href:parse(seoURL[i], newurl),
target:"_blank"
})
//.attr('href', parse(seoURL[i], newurl))
.appendTo(li);
console.log(baseurl(seoURL[i]));
});
//string interpolation in JavaScript
let url = newurl;
console.log(`http://www.browseo.net/?url=${url}`);
//string interpolation in JavaScript 2
var customURL = 'http://www.browseo.net/?url=%s';
//s = parse(customURL, newurl);
console.log(parse(customURL, newurl));
/******** FUNCTION *********/
function parse(str) {
var args = [].slice.call(arguments, 1),
i = 0;
return str.replace(/%s/g, function() {
return args[i++];
});
}
/************************/
function baseurl(url) {
var a = document.createElement('a');
a.href = url;
return a.protocol + '//' + a.hostname;
}
//console.log(baseurl(url));
/************************/
function...
CSS
ul.seolist img {
vertical-align: middle;
margin-right: 10px;
}
ul.seolist li {
list-style-type: none;
line-height: 25px;
}
ul.seolist li a {
text-transform: capitalize;
/* font-weight:bold; */
font: normal 20px 'Open Sans';
text-decoration: none;
color: #333;
margin: 0px 0px 0px 0px !important;position:absolute
}
ul.seolist li a:hover{color:#a00}
JavaScript
if (!location.origin)
location.origin = location.protocol + "//" + location.host;
//var newurl = location.origin.replace(/.*?:\/\//g, "");
//var newurl = location.origin.replace(/^https?\:\/\//i, "");
var newurl = nohttp(location.origin);
//newurl = 'http://' + url.split('/')[0];
var seoURL =
[
'http://www.activistpost.com/',
'http://vinarmani.com/',
'http://www.countermarkets.com/',
'http://BEBIVodka.com',
'http://GVRNURSLF.com',
'http://highimpactflix.com/',
'http://www.davidpakman.com',
'http://www.democracynow.org',
'https://pressfortruth.ca/',
'http://therealnews.com',
'https://theintercept.com/'];
var seoList = $('ul.seolist')
$.each(seoURL, function(i)
{
var li = $('<li/>')
.addClass('ui-menu-item')
.attr('role', 'menuitem')
.appendTo(seoList);
var aaa = $('<img src="http://s2.googleusercontent.com/s2/favicons?domain=' + baseurl(seoURL[i]) + '"/><a/>')
.addClass('ui-all')
//.text(seoURL[i]+newurl)
.text(nohttp(baseurl(seoURL[i]))) // create function base url only like: Builtwith.com
.attr({
href:parse(seoURL[i], newurl),
target:"_blank"
})
//.attr('href', parse(seoURL[i], newurl))
.appendTo(li);
console.log(baseurl(seoURL[i]));
});
//string interpolation in JavaScript
let url = newurl;
console.log(`http://www.browseo.net/?url=${url}`);
//string interpolation in JavaScript 2
var customURL = 'http://www.browseo.net/?url=%s';
//s = parse(customURL, newurl);
console.log(parse(customURL, newurl));
/******** FUNCTION *********/
function parse(str) {
var args = [].slice.call(arguments, 1),
i = 0;
return str.replace(/%s/g, function() {
return args[i++];
});
}
/************************/
function baseurl(url) {
var a = document.createElement('a');
a.href = url;
return a.protocol + '//' + a.hostname;
}
//console.log(baseurl(url));
/************************/
function nohttp(url) {
//var protomatch =...