-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathiconic_history.js
33 lines (28 loc) · 1.24 KB
/
iconic_history.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
'use strict';
function genFaviconDiv(){
var faviconDiv = document.createElement('div');
faviconDiv.className = "faviconDiv";
return faviconDiv;
}
function addFaviconImg(item) {
var faviconDiv = genFaviconDiv();
var faviconTitle = item.title.replace(/\"/g, "");
faviconDiv.innerHTML += '<a href="' + item.url + '"><img title="Title: ' + faviconTitle + ' " class="favicon" src="' + item.favIconUrl + '"></img></a>';
document.getElementById('faviconHolder').appendChild(faviconDiv);
}
var testItem0 = {title: "CNN", url: "http://www.cnn.com",
favIconUrl: "http://www.cnn.com/favicon.ie9.ico" };
var testItem1 = {title: "wikipedia", url: "http://www.wikipedia.org/",
favIconUrl: "http://bits.wikimedia.org/favicon/wikipedia.ico" };
var testItem2 = {title: "Yahoo", url: "https://www.yahoo.com/",
favIconUrl: "https://s.yimg.com/rz/l/favicon.ico" };
var testItem3 = {title: "wework", url: "https://www.wework.com/",
favIconUrl: "https://www.wework.com/favicon.ico" };
function genFavicons(){
console.log("genFavicons");
addFaviconImg(testItem0);
addFaviconImg(testItem1);
addFaviconImg(testItem2);
addFaviconImg(testItem3);
}
document.addEventListener('DOMContentLoaded', genFavicons );