Plugin to automatically embed original/mobilized article

Post plugins and custom CSS snippets here
macfly
Bear Rating Disaster
Bear Rating Disaster
Posts: 82
Joined: 27 Mar 2013, 23:07

Plugin to automatically embed original/mobilized article

Postby macfly » 14 Apr 2013, 15:38

Hi,

my first Plugin. It allows to embed the original content of an article (or a mobilized view generated by instapaper).
Due to the nature of the plugin, it needs some changes in the core, because there is no hook to call at article display time.

Installation:
[*]unzip in plugin home (generates new folder auto_embed_original).
[*]apply schema.sql to your database
[*]change to ttrss root folder
[*]apply patch with

Code: Select all

patch -p0 < ..plugins/auto_embed_original/auto_embed_original.diff

[*]enable plugin in configuration
[*]configure every feed, that should display original content in the feed configuration.
Attachments
auto_embed_original_1.0.zip
(6.72 KiB) Downloaded 275 times

macfly
Bear Rating Disaster
Bear Rating Disaster
Posts: 82
Joined: 27 Mar 2013, 23:07

Re: Plugin to automatically embed original/mobilized article

Postby macfly » 21 Apr 2013, 00:11

New Version, compatible with current trunc version, and does not need any patching.

Installation:

[*]download attached ZIP-File, unzip in the plugins directory, a new directory "auto_embed_original" will be created.
[*]enable auto_embed_original in settings/plugin

from now on, every article will have two new Icons at the bottom:
[*] one "embed" icon, simply toggles between original Article and rss-feed-content
[*] one "embed" icon with gear (=settings). This will allow to setup how the current feed will be displayed.

Hotkey for embedding original content is shift-v

Because this plugin needs to store some Information, two new tables will be created automatically.

feedback is welcome!

regards,
macfly
Attachments
auto_embed_original_1.1.zip
(8.89 KiB) Downloaded 270 times

cqrt
Bear Rating Disaster
Bear Rating Disaster
Posts: 70
Joined: 05 Apr 2013, 00:37

Re: Plugin to automatically embed original/mobilized article

Postby cqrt » 21 Apr 2013, 00:52

New Version, compatible with current trunc version, and does not need any patching.


Just to be clear, this is _only_ compatible with trunk? I tried it on 1.7.8 and it nuked my plugin interface.
Last edited by cqrt on 21 Apr 2013, 01:56, edited 1 time in total.

macfly
Bear Rating Disaster
Bear Rating Disaster
Posts: 82
Joined: 27 Mar 2013, 23:07

Re: Plugin to automatically embed original/mobilized article

Postby macfly » 21 Apr 2013, 01:49

yes, only compatible with trunc, right now. I guess, you have to wait until 1.7.9 then ...

cqrt
Bear Rating Disaster
Bear Rating Disaster
Posts: 70
Joined: 05 Apr 2013, 00:37

Re: Plugin to automatically embed original/mobilized article

Postby cqrt » 21 Apr 2013, 02:01

Man, my question reads like a retard wrote it (fixed :)).

Cheers macfly, all good. I was trying to avoid using trunk on a production install but now is as good a time as ever I guess.

macfly
Bear Rating Disaster
Bear Rating Disaster
Posts: 82
Joined: 27 Mar 2013, 23:07

Re: Plugin to automatically embed original/mobilized article

Postby macfly » 22 Apr 2013, 15:48

New Version.

Bugfix: when on first article in List and pressing hotkey for prev, check, if there is a pref article (instead of accessing the nonexisting article and generating an exception).

compatible with current trunc version only.


feedback is welcome!

regards,
macfly
Attachments
auto_embed_original_1.2.zip
(8.94 KiB) Downloaded 203 times

macfly
Bear Rating Disaster
Bear Rating Disaster
Posts: 82
Joined: 27 Mar 2013, 23:07

Re: Plugin to automatically embed original/mobilized article

Postby macfly » 26 Apr 2013, 15:49

New Version, compatible with master @8cefe38a0a1623db866cb9bf295fe8a591ad5488

Using the correct js-hook for expanding article and the correct hook for feed-settings.

You can configure the feed display-mode with the embed-icon-gear for the current displayed feed or in the feed configuration.

feedback?
Attachments
auto_embed_original_1.4.zip
(9 KiB) Downloaded 512 times

taclm
Bear Rating Trainee
Bear Rating Trainee
Posts: 6
Joined: 29 Apr 2013, 16:59

Re: Plugin to automatically embed original/mobilized article

Postby taclm » 29 Apr 2013, 19:57

Hi macfly,

Been using TTRSS on my shared hosting since they announced the demise of Google Reader, and am totally impressed with it and the work you guys have done with it. I have since purchased the Android app and am loving the integrated experience and have to say I'm a bit addicted now :).

Anyway, one of the things I've been very interested in is seeing the original article for certain feeds display. I've been keeping an eye out for the work you have been doing with this plugin and find it extremely useful. I don't fully get all the issues you are hitting with making this work flawlessly, but I have to say the plugin is working well overall. The latest version is also now displaying elements like web page comments, and some java script functions that earlier versions would not.

I installed the latest master trunk (current version as well as 8cefe38a0a1623db866cb9bf295fe8a591ad5488) and the 1.4 plugin. The shift-v works well and the settings describe are all there. The only thing I can't seem to get working is actually displaying the full article as default, even though the feed settings as set to full original article. It only displays feed content until I change it manually.

Any ideas on this would be greatly appreciated. Also, if you need me to test anything, please let me know.

Thanks!

taclm
Bear Rating Trainee
Bear Rating Trainee
Posts: 6
Joined: 29 Apr 2013, 16:59

Re: Plugin to automatically embed original/mobilized article

Postby taclm » 29 Apr 2013, 20:27

Duplicate - Please ignore :D
Last edited by taclm on 30 Apr 2013, 19:37, edited 1 time in total.

macfly
Bear Rating Disaster
Bear Rating Disaster
Posts: 82
Joined: 27 Mar 2013, 23:07

Re: Plugin to automatically embed original/mobilized article

Postby macfly » 29 Apr 2013, 22:52

hm, strange. Please open javascript-console, display a feed with full content configured and click an article to issue the expansion.

in the console should appear:

Code: Select all

cdmExpandArticle xxxxx index.php:5015
HOOK_ARTICLE_EXPANDED: xxxxx index.php:6351
feedAutoloadContent: embed finished


what does your console display?

taclm
Bear Rating Trainee
Bear Rating Trainee
Posts: 6
Joined: 29 Apr 2013, 16:59

Re: Plugin to automatically embed original/mobilized article

Postby taclm » 30 Apr 2013, 15:24

Thanks for getting back to me :).

I clicked on an article after setting "Full original article" by right-clicking "Edit Feed" and do not see the code you have. I see this:

Code: Select all

PluginHost::run 9 /ttrss/:876
loading article: 43487 /ttrss/:692
cache check result: true /ttrss/:692
additional ids: 42418 /ttrss/:694
PluginHost::run 3 /ttrss/:876
PluginHost::run 1 /ttrss/:876
?op=article&method=view&id=43487&cids=42418&mode=prefetch /ttrss/:695
request_counters: rate limit reached: 3 /ttrss/:627
article_callback2 43487 /ttrss/:685
request_counters: rate limit reached: 4


I then took a look at what happens when I right-click "Edit feed" This:

Code: Select all

backend.php?op=pref-feeds&method=editfeed&id=54 /ttrss/:575
in feedlist init /ttrss/:624
PluginHost::run 3 /ttrss/:876
?op=feeds&method=view&feed=54&view_mode=adaptive&order_by=feed_dates&m=ForceUpdate&cat=false /ttrss/:623
PluginHost::run 4 /ttrss/:876
scheduling request of counters... /ttrss/:626
?op=rpc&method=getAllCounters&seq=44 /ttrss/:627
request_counters: rate limit reached: 0 /ttrss/:627
PluginHost::run 9 /ttrss/:876
headlines_callback2 [offset=0] B:false I:false /ttrss/:663
no cached articles received /ttrss/:673
scheduling request of counters... /ttrss/:626
?op=rpc&method=getAllCounters&seq=45 /ttrss/:627
PluginHost::run 5 /ttrss/:876
PluginHost::run 9 /ttrss/:876
PluginHost::run 9


I noticed after a while the feed setting was reset back to "Feed Content" . I thought this was strange, so I played with the "Configure embed original button" on the right. I clicked that and it was set to "Feed content". I set it to "Full original article" and clicked OK. This was output:

Code: Select all

dojo/parser::parse() error Error {} parser.js:8
(anonymous function) parser.js:8
_2e9 dojo.js:15
then._2f6.then dojo.js:15
lang.extend.otherwise dojo.js:15
_1b.parse parser.js:8
html._ContentSetter._2d5._parse tt-rss-layer.js:15
html._ContentSetter._2d5.onEnd tt-rss-layer.js:15
html._ContentSetter._2d5.set tt-rss-layer.js:15
_5d3._setContent tt-rss-layer.js:15
(anonymous function) tt-rss-layer.js:15
_2c4 dojo.js:15
_2c2 dojo.js:15
resolve.callback dojo.js:15
_2c4 dojo.js:15
_2c2 dojo.js:15
resolve.callback dojo.js:15
_2c4 dojo.js:15
_2c2 dojo.js:15
resolve.callback dojo.js:15
rDfd.then.otherwise._422.error dojo.js:15
_2e9 dojo.js:15
_2e3 dojo.js:15
resolve dojo.js:15
_2ef dojo.js:15
_2e9 dojo.js:15
_2e3 dojo.js:15
resolve dojo.js:15
_2ef dojo.js:15
_2e9 dojo.js:15
_2e3 dojo.js:15
resolve dojo.js:15
_2ef dojo.js:15
_2e9 dojo.js:15
_2e3 dojo.js:15
resolve dojo.js:15
_46c dojo.js:15
_478 dojo.js:15
scheduling request of counters... /ttrss/:626
?op=rpc&method=getAllCounters&seq=57&last_article_id=44800 /ttrss/:627
PluginHost::run 9 /ttrss/:876
request_counters: rate limit reached: 2 /ttrss/:627
request_counters: rate limit reached: 3


and expanded the error above. I then clicked "Configure embed original button" again, and it was set back to "Feed Content"

Anything else I can assist with? I am using a shared hosting.

Thanks again.

taclm
Bear Rating Trainee
Bear Rating Trainee
Posts: 6
Joined: 29 Apr 2013, 16:59

Re: Plugin to automatically embed original/mobilized article

Postby taclm » 30 Apr 2013, 16:17

Playing with this a bit more, I decided to change to "Combined feed display" in preferences. Now the full article will show fine within the frame and no JS messages.
autoembed1.png
Pic1
autoembed1.png (158.98 KiB) Viewed 15529 times


I then unchecked Combined feed display, and it only shows Feed Display, although the Full Article is set in embed settings.
autoembed2.png
Pic2
autoembed2.png (153.21 KiB) Viewed 15529 times


Hope this helps

taclm
Bear Rating Trainee
Bear Rating Trainee
Posts: 6
Joined: 29 Apr 2013, 16:59

Re: Plugin to automatically embed original/mobilized article

Postby taclm » 01 May 2013, 00:40

One more thing that may help as per your request that I may have missed.

I opened an article in normal (non-Combined Feed Display) and clicked on an article, then expanded it to show original. Here is the JS output:

Code: Select all

Uncaught ReferenceError: googletag is not defined www.japantimes.co.jp:174
(anonymous function) www.japantimes.co.jp:174
Uncaught ReferenceError: googletag is not defined www.japantimes.co.jp:232
(anonymous function) www.japantimes.co.jp:232
Uncaught ReferenceError: googletag is not defined www.japantimes.co.jp:906
(anonymous function) www.japantimes.co.jp:906
Uncaught ReferenceError: googletag is not defined www.japantimes.co.jp:1046
(anonymous function) www.japantimes.co.jp:1046
Uncaught ReferenceError: googletag is not defined www.japantimes.co.jp:1073
(anonymous function) www.japantimes.co.jp:1073
Uncaught ReferenceError: googletag is not defined www.japantimes.co.jp:1134
(anonymous function) www.japantimes.co.jp:1134
Uncaught ReferenceError: googletag is not defined www.japantimes.co.jp:1143
(anonymous function) www.japantimes.co.jp:1143
Uncaught ReferenceError: googletag is not defined www.japantimes.co.jp:1187
(anonymous function) www.japantimes.co.jp:1187
Uncaught ReferenceError: googletag is not defined www.japantimes.co.jp:1222
(anonymous function) www.japantimes.co.jp:1222
GET http://www.googletagservices.com/tag/js/gpt.js  www.japantimes.co.jp:132
(anonymous function) www.japantimes.co.jp:132
(anonymous function) www.japantimes.co.jp:133
Resource interpreted as Font but transferred with MIME type image/svg+xml: "http://www.japantimes.co.jp/wp-content/themes/jt_theme/library/fonts/pluto/plutosansregular-webfont.svg#PlutoSansRegular". www.japantimes.co.jp:1429
Resource interpreted as Font but transferred with MIME type image/svg+xml: "http://www.japantimes.co.jp/wp-content/themes/jt_theme/library/fonts/pluto/plutosansbold-webfont.svg#PlutoSansBold". www.japantimes.co.jp:1429
Resource interpreted as Font but transferred with MIME type image/svg+xml: "http://www.japantimes.co.jp/wp-content/themes/jt_theme/library/fonts/icons/icomoon.svg#icomoon". www.japantimes.co.jp:1429
GET http://www.google.com/uds/api/ads/3.0/e162e906be09f87ba08b0b7fbee32444/search.I.js  jsapi:21
google.(anonymous function).d jsapi:21
(anonymous function) jsapi:61
Resource interpreted as Font but transferred with MIME type image/svg+xml: "http://mediacdn.disqus.com/1367277409/fonts/next/embed-icons.svg#embed-icons".
Resource interpreted as Script but transferred with MIME type text/html: "http://www.japantimes.co.jp/opinion/2013/05/01/editorials/restarting-talks-with-north-korea/?cf_action=sync_comments&post_id=356113". www.japantimes.co.jp:951
(anonymous function) www.japantimes.co.jp:951
i.trigger embed.js:18
(anonymous function) embed.js:56
i.trigger embed.js:18
(anonymous function)

macfly
Bear Rating Disaster
Bear Rating Disaster
Posts: 82
Joined: 27 Mar 2013, 23:07

Re: Plugin to automatically embed original/mobilized article

Postby macfly » 01 May 2013, 15:35

no, the lines

Uncaught ReferenceError: googletag is not defined www.japantimes.co.jp are error-codes from the embedded iframe itself.

I asked fox, if there is any chance, that he implements the hook-call in non-combined-mode. That is the reason, why my plugin does not work - it is simply not called in this mode.

macfly

taclm
Bear Rating Trainee
Bear Rating Trainee
Posts: 6
Joined: 29 Apr 2013, 16:59

Re: Plugin to automatically embed original/mobilized article

Postby taclm » 01 May 2013, 17:35

Got it. I saw your question to Fox - thanks. Let's see if he can implement the hook in that mode.

I've actually been getting used to the combined mode and kinda liking it :) .

Thanks for you assistance.


Return to “Themes and plugins”

Who is online

Users browsing this forum: No registered users and 1 guest