From a7f23af160c6b0bb97c380c3c0667e9e786c177a Mon Sep 17 00:00:00 2001 From: Aurelien David Date: Thu, 24 Jan 2019 22:58:54 +0100 Subject: [PATCH] use browser style for popup --- manifest.json | 2 +- popup/popup.html | 5 ++--- popup/popup.js | 33 ++++++++++++++++++++++++--------- 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/manifest.json b/manifest.json index 4cb8cc6..a0d38c1 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "RSSPreview", - "version": "3.0.1", + "version": "3.1", "author": "Aurelien David", "homepage_url": "https://github.com/aureliendavid/rsspreview", diff --git a/popup/popup.html b/popup/popup.html index 84eafac..2a18da7 100644 --- a/popup/popup.html +++ b/popup/popup.html @@ -9,10 +9,9 @@ - +
+
diff --git a/popup/popup.js b/popup/popup.js index 7f6d6d7..797edb4 100644 --- a/popup/popup.js +++ b/popup/popup.js @@ -7,18 +7,33 @@ document.addEventListener("DOMContentLoaded", function(event) { const feeds = JSON.parse(url.searchParams.get('feeds')); for (feed_url in feeds) { - if (feeds.hasOwnProperty(feed_url)) { - let li = document.createElement("li"); - let a = document.createElement("a"); + if (feeds.hasOwnProperty(feed_url)) { - a.href = feed_url; - a.target = "_blank"; - a.innerText = feeds[feed_url]; + let li = document.createElement("div"); + li.classList.add("panel-list-item"); + li.setAttribute("data-href", feed_url); - li.appendChild(a); - feedList.appendChild(li); - } + let a = document.createElement("div"); + a.classList.add("text"); + a.innerText = feeds[feed_url]; + + li.appendChild(a); + feedList.appendChild(li); + } } + document.querySelectorAll(".panel-list-item").forEach( (elem) => { + + elem.addEventListener('click', (event) => { + + let url = elem.getAttribute("data-href"); + if (url) + browser.tabs.create({url: url}); + + + }); + + }); + });