Compare commits
18 Commits
Author | SHA1 | Date | |
---|---|---|---|
3828d78e94 | |||
8e573ce062 | |||
a235e783a7 | |||
f710368b3b | |||
ffe7d9865a | |||
dae021b1e5 | |||
2ede686495 | |||
438a17583a | |||
5b1aa7db58 | |||
26051543fd | |||
314b3d56f2 | |||
e757056047 | |||
4002c3b55c | |||
fc3ceb7f78 | |||
3404cc07f7 | |||
f242973384 | |||
86747dbadc | |||
0a857ba5e6 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
||||
*.zip
|
||||
rssfinder/LICENSE
|
||||
|
14
CHANGELOG
14
CHANGELOG
@ -1,2 +1,16 @@
|
||||
0.4.0
|
||||
- Split the button into two, copy url and open in tab
|
||||
|
||||
0.3.0
|
||||
- Fix JS error when "href" attribute was not present in the link
|
||||
- The popup window should now follow the desktop theme (or colors)
|
||||
|
||||
0.2.0
|
||||
- Recognize and display more feed types
|
||||
- application/atom+xml
|
||||
- application/stream+json
|
||||
- application/rdf+xml
|
||||
- Provide icon
|
||||
|
||||
0.1.0
|
||||
- First release
|
||||
|
22
Makefile
Normal file
22
Makefile
Normal file
@ -0,0 +1,22 @@
|
||||
PROJECT = rssfinder
|
||||
VERSION = 0.4.0
|
||||
|
||||
FILES = $(PROJECT)/main.qml
|
||||
FILES += $(PROJECT)/finder.js
|
||||
FILES += $(PROJECT)/metadata.desktop
|
||||
FILES += $(PROJECT)/rss.svg
|
||||
FILES += $(PROJECT)/clipboard.svg
|
||||
FILES += $(PROJECT)/LICENSE
|
||||
|
||||
package: copy_license update_version
|
||||
zip -X $(PROJECT)_v$(VERSION).zip $(FILES)
|
||||
|
||||
copy_license:
|
||||
@cp "LICENSE" "$(PROJECT)/LICENSE"
|
||||
|
||||
update_version:
|
||||
@sed -i "s/^X-Falkon-Version.*$$/X-Falkon-Version\=$(VERSION)/g" $(PROJECT)/metadata.desktop
|
||||
|
||||
clean:
|
||||
rm -f "./$(PROJECT)/LICENSE"
|
||||
rm -f "./$(PROJECT)_v$(VERSION).zip"
|
@ -12,3 +12,6 @@ Go to [Falkon store](https://store.falkon.org/p/1689113/) press `Install` and fo
|
||||
|
||||
### Manual
|
||||
Copy the `rssfinder` directory into `~/.config/falkon/plugins/`
|
||||
|
||||
## Thanks to
|
||||
The `clipboard` icon is talken from [SVG Repo](https://www.svgrepo.com/svg/260400/clipboard).
|
||||
|
34
rssfinder/clipboard.svg
Normal file
34
rssfinder/clipboard.svg
Normal file
@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
||||
<svg height="800px" width="800px" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
viewBox="0 0 512 512" xml:space="preserve">
|
||||
<path style="fill:#ED8800;" d="M102.8,512c-19.94,0-36.162-16.222-36.162-36.162V91.694c0-19.94,16.222-36.162,36.162-36.162h306.4
|
||||
c19.94,0,36.162,16.222,36.162,36.162v384.144c0,19.94-16.222,36.162-36.162,36.162H102.8z"/>
|
||||
<path style="fill:#CC7400;" d="M409.2,55.531h-33.319c19.94,0,36.162,16.222,36.162,36.162v384.144
|
||||
c0,19.94-16.222,36.162-36.162,36.162H409.2c19.939,0,36.162-16.222,36.162-36.162V91.694
|
||||
C445.362,71.753,429.14,55.531,409.2,55.531z"/>
|
||||
<path style="fill:#ECE5DD;" d="M384.629,99.957H127.371c-8.993,0-16.308,7.316-16.308,16.308v251.353v83.648
|
||||
c0,8.993,7.316,16.308,16.308,16.308h83.648h89.961h83.648c8.993,0,16.308-7.316,16.308-16.308v-83.648V116.265
|
||||
C400.937,107.272,393.621,99.957,384.629,99.957z"/>
|
||||
<path style="fill:#D9CBBD;" d="M384.629,99.957H351.31c8.993,0,16.308,7.316,16.308,16.308v251.353v83.648
|
||||
c0,8.993-7.316,16.308-16.308,16.308h33.319c8.993,0,16.308-7.316,16.308-16.308v-83.648V116.265
|
||||
C400.937,107.272,393.621,99.957,384.629,99.957z"/>
|
||||
<path style="fill:#3E3D43;" d="M200.469,101.067c-18.677,0-33.874-15.196-33.874-33.874s15.197-33.874,33.874-33.874h12.077
|
||||
C217.801,13.677,235.609,0,256,0s38.199,13.68,43.454,33.319h12.077c18.677,0,33.874,15.196,33.874,33.874
|
||||
s-15.197,33.874-33.874,33.874H200.469z"/>
|
||||
<path style="fill:#D9CBBD;" d="M195.901,366.508c8.949,0,16.23,7.281,16.23,16.23l0.785,84.838L111.063,365.722L195.901,366.508z"/>
|
||||
<path style="fill:#C0AB91;" d="M111.063,365.722l101.852,101.852h-85.544c-8.993,0-16.308-7.316-16.308-16.308V365.722z"/>
|
||||
<g>
|
||||
<path style="fill:#BABABA;" d="M167.15,175.479h111.063c4.601,0,8.33-3.73,8.33-8.33s-3.728-8.33-8.33-8.33H167.15
|
||||
c-4.601,0-8.33,3.729-8.33,8.33S162.548,175.479,167.15,175.479z"/>
|
||||
<path style="fill:#BABABA;" d="M322.638,175.479h22.213c4.601,0,8.33-3.73,8.33-8.33s-3.728-8.33-8.33-8.33h-22.213
|
||||
c-4.601,0-8.33,3.729-8.33,8.33S318.036,175.479,322.638,175.479z"/>
|
||||
<path style="fill:#BABABA;" d="M167.15,242.117h44.425c4.601,0,8.33-3.729,8.33-8.33c0-4.6-3.728-8.33-8.33-8.33H167.15
|
||||
c-4.601,0-8.33,3.729-8.33,8.33C158.82,238.388,162.548,242.117,167.15,242.117z"/>
|
||||
<path style="fill:#BABABA;" d="M247.67,233.787c0,4.6,3.728,8.33,8.33,8.33h66.638c4.601,0,8.33-3.729,8.33-8.33
|
||||
c0-4.6-3.728-8.33-8.33-8.33H256C251.399,225.458,247.67,229.187,247.67,233.787z"/>
|
||||
<path style="fill:#BABABA;" d="M167.15,308.755h133.275c4.601,0,8.33-3.729,8.33-8.33s-3.728-8.33-8.33-8.33H167.15
|
||||
c-4.601,0-8.33,3.729-8.33,8.33S162.548,308.755,167.15,308.755z"/>
|
||||
</g>
|
||||
<circle style="fill:#FFFFFF;" cx="256" cy="44.98" r="11.106"/>
|
||||
</svg>
|
After Width: | Height: | Size: 2.8 KiB |
58
rssfinder/finder.js
Normal file
58
rssfinder/finder.js
Normal file
@ -0,0 +1,58 @@
|
||||
(function() {
|
||||
|
||||
var availableLinks = [];
|
||||
var links = document.getElementsByTagName('link');
|
||||
var siteTitle = 'No title was found';
|
||||
|
||||
if (document.getElementsByTagName('title').lenght > 0) {
|
||||
siteTitle = document.getElementsByTagName('title')[0].innerHTML
|
||||
}
|
||||
|
||||
for (link of links) {
|
||||
if ( (link.getAttribute('rel') == 'alternate')
|
||||
&& ( (link.getAttribute('type') == 'application/rss+xml')
|
||||
|| (link.getAttribute('type') == 'application/atom+xml')
|
||||
|| (link.getAttribute('type') == 'application/stream+json')
|
||||
|| (link.getAttribute('type') == 'application/rdf+xml')
|
||||
)
|
||||
) {
|
||||
var linkTitle;
|
||||
var linkUrl;
|
||||
|
||||
if (link.hasAttribute('title')) {
|
||||
linkTitle = link.getAttribute('title');
|
||||
} else {
|
||||
linkTitle = siteTitle;
|
||||
}
|
||||
|
||||
if (link.hasAttribute('href') == true) {
|
||||
if (link.getAttribute('href').startsWith('/')) {
|
||||
linkUrl = window.location.protocol + '//' + window.location.hostname + link.getAttribute('href');
|
||||
} else if (!link.getAttribute('href').includes('/')) {
|
||||
linkUrl = window.location.protocol + '//' + window.location.hostname + '/' + link.getAttribute('href');
|
||||
} else {
|
||||
linkUrl = link.getAttribute('href');
|
||||
}
|
||||
|
||||
availableLinks.push({
|
||||
title: linkTitle,
|
||||
url: linkUrl
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (availableLinks.length == 0) {
|
||||
availableLinks.push({
|
||||
title: 'No RSS feed was found',
|
||||
url: 'No URL is provided'
|
||||
});
|
||||
}
|
||||
|
||||
var out = {
|
||||
links: availableLinks
|
||||
};
|
||||
|
||||
return out;
|
||||
|
||||
})()
|
@ -8,9 +8,15 @@ Falkon.PluginInterface {
|
||||
QtObject {
|
||||
id: rssFinderObject
|
||||
property ListModel feeds: ListModel {}
|
||||
property string jsFinder
|
||||
}
|
||||
|
||||
init: function(state, settingsPath){
|
||||
init: function(state, settingsPath) {
|
||||
console.log(i18n('"RSSFinder" plugin is loading'))
|
||||
rssFinderObject.jsFinder = Falkon.FileUtils.readAllFileContents('finder.js')
|
||||
if (rssFinderObject.jsFinder.length == 0) {
|
||||
console.log(i18n('"RSSFinder" Unable to load "finder.js""'))
|
||||
}
|
||||
console.log(i18n('"RSSFinder" plugin loaded'))
|
||||
}
|
||||
|
||||
@ -31,56 +37,13 @@ Falkon.PluginInterface {
|
||||
}
|
||||
|
||||
function findFeeds() {
|
||||
if (rssFinderObject.jsFinder.length == 0) {
|
||||
return
|
||||
}
|
||||
|
||||
var window = Falkon.Windows.getCurrent()
|
||||
var currentTab = findCurrentTab(window)
|
||||
var result = currentTab.execJavaScript("
|
||||
var availableLinks = [];
|
||||
var links = document.getElementsByTagName('link');
|
||||
var siteTitle = 'No title was found';
|
||||
|
||||
if (document.getElementsByTagName('title').lenght > 0) {
|
||||
siteTitle = document.getElementsByTagName('title')[0].innerHTML
|
||||
}
|
||||
|
||||
for (link of links) {
|
||||
if (link.getAttribute('rel') == 'alternate' && link.getAttribute('type') == 'application/rss+xml') {
|
||||
var linkTitle;
|
||||
var linkUrl;
|
||||
|
||||
if (link.hasAttribute('title')) {
|
||||
linkTitle = link.getAttribute('title');
|
||||
} else {
|
||||
linkTitle = siteTitle;
|
||||
}
|
||||
|
||||
if (link.getAttribute('href').startsWith('/')) {
|
||||
linkUrl = window.location.protocol + '//' + window.location.hostname + link.getAttribute('href');
|
||||
} else if (!link.getAttribute('href').includes('/')) {
|
||||
linkUrl = window.location.protocol + '//' + window.location.hostname + '/' + link.getAttribute('href');
|
||||
} else {
|
||||
linkUrl = link.getAttribute('href');
|
||||
}
|
||||
|
||||
availableLinks.push({
|
||||
title: linkTitle,
|
||||
url: linkUrl
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (links.length == 0) {
|
||||
availableLinks.push({
|
||||
title: 'No RSS feed was found',
|
||||
url: 'No URL is provided'
|
||||
});
|
||||
}
|
||||
|
||||
var out = {
|
||||
links: availableLinks
|
||||
};
|
||||
|
||||
out;
|
||||
")
|
||||
var result = currentTab.execJavaScript(rssFinderObject.jsFinder)
|
||||
|
||||
rssFinderObject.feeds.clear()
|
||||
|
||||
@ -97,50 +60,89 @@ Falkon.PluginInterface {
|
||||
identity: 'rssfinder-id'
|
||||
title: i18n('RSS Finder')
|
||||
toolTip: i18n('RSS Finder')
|
||||
icon: 'rss'
|
||||
icon: 'rss.svg'
|
||||
location: Falkon.BrowserAction.NavigationToolBar | Falkon.BrowserAction.StatusBar
|
||||
onClicked: findFeeds()
|
||||
|
||||
popup: ScrollView {
|
||||
id: popupWindow
|
||||
popup: Pane {
|
||||
id: mainPane
|
||||
width: 500
|
||||
height: 200
|
||||
|
||||
ScrollBar.horizontal.policy: ScrollBar.AlwaysOn
|
||||
ScrollView {
|
||||
width: mainPane.width
|
||||
height: mainPane.height
|
||||
|
||||
anchors.top: parent.top
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
||||
ScrollBar.vertical.policy: ScrollBar.AlwaysOn
|
||||
|
||||
ListView {
|
||||
Component {
|
||||
id: contactsDelegate
|
||||
|
||||
RowLayout {
|
||||
spacing: 2
|
||||
width: rssList.width
|
||||
|
||||
Button {
|
||||
hoverEnabled: true
|
||||
width: popupWindow.width
|
||||
onClicked: Falkon.Clipboard.copy(url)
|
||||
onClicked: Falkon.Tabs.addTab({
|
||||
url: url,
|
||||
windowId: Falkon.Windows.getCurrent()
|
||||
})
|
||||
clip: true
|
||||
|
||||
ToolTip.delay: 1000
|
||||
ToolTip.timeout: 5000
|
||||
ToolTip.visible: hovered
|
||||
ToolTip.text: i18n("Click to copy URL")
|
||||
ToolTip.text: i18n("Open in new tab")
|
||||
|
||||
ColumnLayout {
|
||||
id: wrapper
|
||||
spacing: 0
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
Text {
|
||||
text: "<strong>" + title + "</strong>"
|
||||
contentItem: ColumnLayout {
|
||||
Label {
|
||||
font.bold: true
|
||||
topPadding: 5
|
||||
leftPadding: 5
|
||||
text: title
|
||||
}
|
||||
Text {
|
||||
Label {
|
||||
leftPadding: 5
|
||||
bottomPadding: 5
|
||||
text: url
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
hoverEnabled: true
|
||||
onClicked: Falkon.Clipboard.copy(url)
|
||||
|
||||
ToolTip.visible: hovered
|
||||
ToolTip.text: i18n("Copy URL")
|
||||
|
||||
contentItem: Image {
|
||||
source: 'clipboard.svg'
|
||||
sourceSize.width: 50
|
||||
sourceSize.height: 50
|
||||
fillMode: Image.PreserveAspectFit
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
id: rssList
|
||||
model: rssFinderObject.feeds
|
||||
delegate: contactsDelegate
|
||||
focus: true
|
||||
spacing: 5
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,11 +2,11 @@
|
||||
Name=RSS Finder
|
||||
Comment=Helps you search for RSS feeds on websites
|
||||
|
||||
Icon=rss
|
||||
Icon=rss.svg
|
||||
Type=Service
|
||||
X-Falkon-Type=Extension/Qml
|
||||
|
||||
X-Falkon-Author=Juraj Oravec
|
||||
X-Falkon-Email=jurajoravec@mailo.com
|
||||
X-Falkon-Version=0.1.0
|
||||
X-Falkon-Version=0.4.0
|
||||
X-Falkon-Settings=false
|
||||
|
18
rssfinder/rss.svg
Normal file
18
rssfinder/rss.svg
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="128px" height="128px" id="RSSicon" viewBox="0 0 256 256">
|
||||
<defs>
|
||||
<linearGradient x1="0.085" y1="0.085" x2="0.915" y2="0.915" id="RSSg">
|
||||
<stop offset="0.0" stop-color="#E3702D"/><stop offset="0.1071" stop-color="#EA7D31"/>
|
||||
<stop offset="0.3503" stop-color="#F69537"/><stop offset="0.5" stop-color="#FB9E3A"/>
|
||||
<stop offset="0.7016" stop-color="#EA7C31"/><stop offset="0.8866" stop-color="#DE642B"/>
|
||||
<stop offset="1.0" stop-color="#D95B29"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<rect width="256" height="256" rx="55" ry="55" x="0" y="0" fill="#CC5D15"/>
|
||||
<rect width="246" height="246" rx="50" ry="50" x="5" y="5" fill="#F49C52"/>
|
||||
<rect width="236" height="236" rx="47" ry="47" x="10" y="10" fill="url(#RSSg)"/>
|
||||
<circle cx="68" cy="189" r="24" fill="#FFF"/>
|
||||
<path d="M160 213h-34a82 82 0 0 0 -82 -82v-34a116 116 0 0 1 116 116z" fill="#FFF"/>
|
||||
<path d="M184 213A140 140 0 0 0 44 73 V 38a175 175 0 0 1 175 175z" fill="#FFF"/>
|
||||
</svg>
|
After Width: | Height: | Size: 1.1 KiB |
Loading…
Reference in New Issue
Block a user