Changes made :

1. The size of the panel will adjust according to the length of the text.
2. The overflow of the text would break in new line. (Actual bug fixed)
3. Made history links clickable.
4. Beautified the extension panel.
This commit is contained in:
Kartik Gupta
2016-10-11 03:42:51 +05:30
parent 59f995ebf0
commit 78b0b5d229
3 changed files with 41 additions and 5 deletions

View File

@@ -1,4 +1,32 @@
html, body {
margin: 0.2em;
width: 350px;
margin: 0.3em;
width: auto;
min-width: 250px;
max-width: 500px;
background-color: #f8f8f8;
}
div {
margin-left: 0.5em;
margin-right: 0.5em;
border-bottom: 1px solid grey;
}
#history-title {
font-weight: bold;
margin-left: 0.5em;
margin-right: 0.5em;
}
#history {
display: block;
word-wrap: break-word;
margin: 0.5em;
text-decoration: none;
}
#clear {
text-decoration: none;
margin-left: 0.5em;
margin-right: 0.5em;
}

View File

@@ -7,9 +7,11 @@
</head>
<body>
<p>History for this domain (limited to 5 results):</p>
<p id="history-title">History for <span id="domain1"></span> (Last 5 results) :</p>
<div></div>
<p id="history"></p>
<p><a href="#" id="clear">Clear history for this domain</a></p>
<div></div>
<p><a href="#" id="clear">Clear history for <span id="domain2"></span></a></p>
<script src="history.js"></script>
</body>

View File

@@ -2,6 +2,8 @@
function get_hostname(url) {
var a = document.createElement('a');
a.href = url;
document.getElementById('domain1').innerHTML = a.hostname;
document.getElementById('domain2').innerHTML = a.hostname;
return a.hostname;
}
@@ -27,8 +29,12 @@ chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
for (var k in results) {
var history = results[k];
var li = document.createElement('p');
var a = document.createElement('a');
var url = document.createTextNode(history.url);
li.appendChild(url);
a.href = history.url;
a.target = '_blank';
a.appendChild(url);
li.appendChild(a);
list.appendChild(li);
}
}