Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Pétrolette
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
9
Issues
9
List
Board
Labels
Milestones
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
yPhil
Pétrolette
Commits
d847e29a
Commit
d847e29a
authored
Mar 31, 2018
by
yPhil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New image picking tactics
parent
30afbfdf
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
13 deletions
+35
-13
package.json
package.json
+2
-2
PTL.dialog.js
public/js/PTL.dialog.js
+1
-2
PTL.feed.js
public/js/PTL.feed.js
+32
-9
No files found.
package.json
View file @
d847e29a
...
...
@@ -23,9 +23,9 @@
"
bower
"
:
"1.8.2"
,
"
ejs
"
:
"2.5.7"
,
"
express
"
:
"4.16.2"
,
"
favrat
"
:
"latest"
,
"
feedparser
"
:
"2.2.9"
,
"
feedrat
"
:
"0.1.48"
,
"
favrat
"
:
"latest"
,
"
feedrat
"
:
"latest"
,
"
pm2
"
:
"2.10.2"
}
}
public/js/PTL.dialog.js
View file @
d847e29a
// @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL-v3-or-Later
PTL
.
dialog
=
{
kill
:
function
(
$dialog
)
{
$dialog
.
dialog
(
'destroy'
);
...
...
@@ -53,7 +52,7 @@ PTL.dialog = {
$dialog
.
dialog
(
'open'
);
});
},
feedPrefs
:
function
(
$button
,
isNewFeed
,
isQueryString
)
{
feedPrefs
:
function
(
$button
,
isNewFeed
)
{
$
(
'#dialogs'
).
load
(
'/static/templates/dialogs.html #feedPrefs'
,
function
()
{
...
...
public/js/PTL.feed.js
View file @
d847e29a
...
...
@@ -250,7 +250,12 @@ PTL.feed = {
if
(
index
==
parseInt
(
feedLimit
))
return
false
;
var
$description
=
$
.
parseHTML
(
item
.
description
),
imageUrl
;
imageUrl
,
imgTypes
=
[
'image'
,
'image/jpg'
,
'image/jpeg'
,
'image/gif'
,
'image/png'
];
var
$imageLink
=
$
(
'<a>'
).
attr
(
'target'
,
'_blank'
),
$itemLink
=
$
(
'<a>'
).
attr
(
'target'
,
'_blank'
),
...
...
@@ -275,22 +280,37 @@ PTL.feed = {
var
$tempDom
=
$
(
'<null>'
).
append
(
$description
);
if
(
typeof
$tempDom
.
find
(
'span a'
).
attr
(
'href'
)
!==
'undefined'
)
{
console
.
log
(
'item: (%s)'
,
JSON
.
stringify
(
item
));
if
(
item
.
image
&&
typeof
item
.
image
.
url
!==
'undefined'
)
{
// console.log('#### item.image: (%s)', feedHost);
imageUrl
=
item
.
image
.
url
;
}
if
(
!
imageUrl
&&
typeof
$tempDom
.
find
(
'span a'
).
attr
(
'href'
)
!==
'undefined'
)
{
if
(
PTL
.
util
.
isImage
(
$tempDom
.
find
(
'span a'
).
attr
(
'href'
)))
{
imageUrl
=
$tempDom
.
find
(
'span a'
).
attr
(
'href'
);
// console.log('#### $tempDom A: (%s)', feedHost);
}
}
if
(
!
imageUrl
&&
typeof
$tempDom
.
find
(
'img'
).
attr
(
'src'
)
!==
'undefined'
)
{
imageUrl
=
$tempDom
.
find
(
'img'
).
attr
(
'src'
);
// console.log('#### $tempDom IMG: (%s)', feedHost);
}
// if (typeof item.image.url !== 'undefined') {
// console.log('whoa!: (%s)');
// }
if
(
typeof
item
.
enclosures
[
0
]
!==
'undefined'
&&
item
.
enclosures
[
0
].
url
)
{
// console.log('item.enclosures[0].type: (%s)', item.enclosures[0].type);
if
(
!
imageUrl
&&
imgTypes
.
indexOf
(
item
.
enclosures
[
0
].
type
)
>
-
1
)
{
imageUrl
=
item
.
enclosures
[
0
].
url
;
// console.log('#### YESS: (%s)', feedHost);
}
// console.log('enclosures: (%s)', item.enclosures[0].url.match(/\.(jpg|png|jpeg|gif)$/));
// if (item.enclosures.url.match(/\.(jpg|png|jpeg|gif)$/)) {
...
...
@@ -298,9 +318,12 @@ PTL.feed = {
// }
if
(
item
.
enclosures
[
0
].
url
.
match
(
/
\.(
jpg|png|jpeg|gif
)
$/
))
{
imageUrl
=
item
.
enclosures
[
0
].
url
;
}
// console.log('item.enclosures: %s (%s): %s', JSON.stringify(item.enclosures[0].type), feedUrl, item.enclosures[0].url.match(/\.(jpg|png|jpeg|gif)$/));
// if (item.enclosures[0].url.match(/\.(jpg|png|jpeg|gif)$/)) {
// imageUrl = item.enclosures[0].url;
// }
if
(
item
.
enclosures
[
0
].
url
.
match
(
/
\.(
ogg|mp3
)
$/
))
{
$soundLink
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment