Wedge

Public area => The Pub => Plugins => Discussion démarrée par: Dismal Shadow le 17 Novembre 2011 à 08:28

Titre: Readability
Posté par: Dismal Shadow le 17 Novembre 2011 à 08:28
Just became a fan of Readability recently after they announced a revamped reading platform.
http://blog.readability.com/2011/11/reading-needs-a-platform-introducing-the-new-readability/

Readability — Read comfortably anytime, anywhere.(http://vimeo.com/30450876)


Hope someone can make this simple plugin: http://www.readability.com/publishers/tools

Am planning to request one over sm.org...
Titre: Re: Readability
Posté par: Arantor le 17 Novembre 2011 à 08:53
Pffft, writing this plugin should take a short amount of time; if it takes any more than 15 minutes in SMF, it's being done wrong.

Wedge on the other hand has to tackle it slightly differently, because their embed code is... um... unusual and I'm not entirely clear why it's being done the way it is. It's still probably 15 minutes but I need to test it to make sure it won't break anything else.

(That's using the basic integration. Using the full on API is naturally more complex.)
Titre: Re: Readability
Posté par: Dismal Shadow le 18 Novembre 2011 à 18:30
This is what I did:
Load.php

Code: [Sélectionner]
if (!isset($_REQUEST['xml']))
{
    $layers = $context['template_layers'];
    $context['template_layers'] = array();
           
    foreach ($layers as $layer)
    {
        $context['template_layers'][] = $layer;
                if ($layer == 'body' || $layer == 'main')
                    $context['template_layers'][] = 'Readability';
    }
}

Code: [Sélectionner]
/*This is where Readability button will be*/
function template_Readability_above()
{
echo'
<div class="rdbWrapper" data-show-read="1" data-show-send-to-kindle="1" data-show-print="0" data-show-email="0" data-orientation="0" data-version="1"></div><script type="text/javascript">(function() {var s = document.getElementsByTagName("script")[0],rdb = document.createElement("script"); rdb.type = "text/javascript"; rdb.async = true; rdb.src = document.location.protocol + "//www.readability.com/embed.js"; s.parentNode.insertBefore(rdb, s); })();</script>';
}
function template_Readability_below(){/*or here to show at the bottom*/}
/*End Readability button*/

Trying to add more social buttons that way, echoing them will results in a duplicate butons. :/
Titre: Re: Readability
Posté par: Arantor le 18 Novembre 2011 à 18:31
How exactly are you trying to add more social buttons?
Titre: Re: Readability
Posté par: Dismal Shadow le 18 Novembre 2011 à 18:39
Citation de Arantor le 18 Novembre 2011 à 18:31
How exactly are you trying to add more social buttons?
$context['template_layers'] then function template.

Yeah I'm doing it wrong. :P
Titre: Re: Readability
Posté par: Arantor le 18 Novembre 2011 à 18:40
Just add it into the one template layer that you're adding in that loop.
Titre: Re: Readability
Posté par: Dismal Shadow le 18 Novembre 2011 à 18:54
Not sure what you mean...

Code: [Sélectionner]
if (!isset($_REQUEST['xml']))
{
    $layers = $context['template_layers'];
    $context['template_layers'] = array();
           
    foreach ($layers as $layer)
    {
        $context['template_layers'][] = $layer;
                if ($layer == 'body' || $layer == 'main')
                    $context['template_layers'][] = 'Readability';
                    $context['template_layers'][] = 'Facebook';
                    $context['template_layers'][] = 'Twitter'; 
    }
}
Titre: Re: Readability
Posté par: Arantor le 18 Novembre 2011 à 19:02
The if is only conditional for the first line without braces, the other lines are going to run every time.

Code: [Sélectionner]
if (!isset($_REQUEST['xml']))
{
    $layers = $context['template_layers'];
    $context['template_layers'] = array();
           
    foreach ($layers as $layer)
    {
        $context['template_layers'][] = $layer;
        if ($layer == 'body' || $layer == 'main')
        {
            $context['template_layers'][] = 'Readability';
            $context['template_layers'][] = 'Facebook';
            $context['template_layers'][] = 'Twitter';
        }
    }
}
Titre: Re: Readability
Posté par: Dismal Shadow le 18 Novembre 2011 à 19:30
Can't seem to add more than 2 function template. Must be missing something.

Code: [Sélectionner]
/*This is where GPlus button will be*/
function template_GPlus_above()
{
            echo'
<g:plusone size="medium" annotation="inline"></g:plusone>';
}
function template_GPlus_below(){/*or here to show at the bottom*/}
/*End GPlus button*/

/*This is where Readability button will be*/
function template_Readability_above()
{
echo'
<div class="rdbWrapper" data-show-read="1" data-show-send-to-kindle="1" data-show-print="0" data-show-email="0" data-orientation="0" data-version="1"></div><script type="text/javascript">(function() {var s = document.getElementsByTagName("script")[0],rdb = document.createElement("script"); rdb.type = "text/javascript"; rdb.async = true; rdb.src = document.location.protocol + "//www.readability.com/embed.js"; s.parentNode.insertBefore(rdb, s); })();</script>';
}
function template_Readability_below(){/*or here to show at the bottom*/}
/*End Readability button*/

/*This is where Facebook button will be*/
function template_Facebook_above(){/*or here to show at the bottom*/}
function template_Facebook_below(){/*or here to show at the bottom*/}
/*End Facebook button*/

/*This is where Twitter button will be*/
function template_Twitter_above()
{
echo'
<a href="https://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-via="iapplecafe">Tweet</a><script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>';
}
function template_Twitter_below(){/*or here to show at the bottom*/}
/*End Twitter button*/
Titre: Re: Readability
Posté par: Arantor le 18 Novembre 2011 à 19:56
Code looks fine to me.
Titre: Re: Readability
Posté par: Dismal Shadow le 18 Novembre 2011 à 19:58
Citation de Arantor le 18 Novembre 2011 à 19:56
Code looks fine to me.
I know right, adding more than 2 functions bring my site down. Currently using 2 for now. :/
Titre: Re: Readability
Posté par: Arantor le 18 Novembre 2011 à 19:58
Contents of error log?
Titre: Re: Readability
Posté par: Dismal Shadow le 18 Novembre 2011 à 20:11
None. :/
Other than 500 or 404 for files that does not exist. (cPanel)


:edit: DUH! It was a conflit with the FB mod. So I removed the code. No point in doing so because it require JavaScript SDK which is complicated. :/
Titre: Re: Readability
Posté par: Dismal Shadow le 19 Novembre 2011 à 06:16
Back on topic, I was reading through https://www.readability.com/publishers/

It says you earn 70% when reader read a article using Readability on your site, am I correct?
Titre: Re: Readability
Posté par: Nao le 19 Novembre 2011 à 23:09
What exactly does that service provide?
Titre: Re: Readability
Posté par: Dismal Shadow le 19 Novembre 2011 à 23:38
Citation de Nao le 19 Novembre 2011 à 23:09
What exactly does that service provide?
Clean & readable?
Titre: Re: Readability
Posté par: Arantor le 19 Novembre 2011 à 23:56
Ah, the joys of clients that dispense with the look and feel an admin or themer has so carefully constructed...
Titre: Re: Readability
Posté par: Dismal Shadow le 20 Novembre 2011 à 00:09
Citation de Arantor le 19 Novembre 2011 à 23:56
Ah, the joys of clients that dispense with the look and feel an admin or themer has so carefully constructed...
You don't like the service, I take it? :p
Titre: Re: Readability
Posté par: Arantor le 20 Novembre 2011 à 00:12
I dislike the notion that users access my site in a way other that which I as an admin intend. That said, if I had a large number of mobile users, I'd consider it.
Titre: Re: Readability
Posté par: Nao le 20 Novembre 2011 à 00:24
Citation de ~DS~ le 19 Novembre 2011 à 23:38
Clean & readable?
Okay.. So, is 'Readability' a fancy new word for 'RSS/Atom feed'?
Titre: Re: Readability
Posté par: Arantor le 20 Novembre 2011 à 00:26
No, it's essentially a custom browser that chooses not to render most of the layout.
Titre: Re: Readability
Posté par: Nao le 20 Novembre 2011 à 00:30
Meeeehh..........

So, basically, that's Opera with 'User mode' enabled in the View menu.
How original!
Titre: Re: Readability
Posté par: Arantor le 20 Novembre 2011 à 00:32
Not quite, it must do some work to figure out stuff like tables, but it might be worth some experimentation, curious to see how well the web works in it.
Titre: Re: Readability
Posté par: Nao le 20 Novembre 2011 à 00:34
Well... Whatever. I don't think it's worth the hassle.
Titre: Re: Readability
Posté par: Arantor le 20 Novembre 2011 à 00:35
Certainly not as core, but a plugin might not be too much effort. Need to experiment.
Titre: Re: Readability
Posté par: Dismal Shadow le 20 Novembre 2011 à 00:40
Citation de Nao le 20 Novembre 2011 à 00:24
Citation de ~DS~ le 19 Novembre 2011 à 23:38
Clean & readable?
Okay.. So, is 'Readability' a fancy new word for 'RSS/Atom feed'?
Like Read It Later(http://readitlaterlist.com/) and Instapaper(http://www.instapaper.com/) before it, Readability is a "read it later" service. I have alot of items on Good Reader and find a good item, I have it sent to Readability that interests me the most for later reading because I don't have time. Same for Twitter, there are clients that support "read it later" services
Posté : 20 Novembre 2011 à 00:37

Click the Now button so you can see for yourself. http://iapplecafe.org/community/index.php/topic,410.msg806.html#msg806
Titre: Re: Readability
Posté par: Arantor le 20 Novembre 2011 à 00:57
Curious. I wonder what it uses to determine the 'main' content - I note it only has the first post in there.
Titre: Re: Readability
Posté par: Dismal Shadow le 20 Novembre 2011 à 01:12
Citation de Arantor le 20 Novembre 2011 à 00:57
Curious. I wonder what it uses to determine the 'main' content - I note it only has the first post in there.
That's how it's suppose to work, they act like a newspaper, removing everything, the comments, only pulling the main content of the article. I tested with with both Safari which came with its own "Reading List" on OS X Lion and iOS 5. In theory, on some sites, it does show posts after that.
Titre: Re: Readability
Posté par: Nao le 20 Novembre 2011 à 10:06
This website had at least ONE good idea... To convert links to footnotes. Can't believe I didn't think of that before. It would be useful in things like the Print page... Wouldn't it?
Titre: Re: Readability
Posté par: Arantor le 20 Novembre 2011 à 13:29
Yes, it probably would, come to think of it.
Titre: Re: Readability
Posté par: U Wish le 18 Janvier 2012 à 22:26
yeah i can see this being used by a ton of cell phones and basic readers perhaps..

but to actually use it on a site like Nao said, that is designed a certain way for a reason..
makes me wonder if one couldn't limit the ability of it and confine to to Mobile use only..  :whistle: :D
Posté : 18 Janvier 2012 à 22:25

simple matter of the main script finding the "viewer" plugin should work..  :cool:
Titre: Re: Readability
Posté par: Arantor le 13 Février 2012 à 01:24
Well, I was a bit bored this evening and didn't want to tackle anything too huge, so I made this as a plugin. I'm not 100% happy about it, because for some reason their JS doesn't play nicely if you do that. Or maybe I'm just tired and doing it wrong, don't know but it never worked properly unless I used their exact code for some reason.[1]

It's really not that exciting but it has all the usual refinements (admin page, etc.) and it's in the plugins SVN repo too.

(Moving to Plugins since it's now officially a plugin :P)
 1. Maybe tomorrow I'll take another look, eh.
Titre: Re: Readability
Posté par: Dismal Shadow le 13 Février 2012 à 02:02
I though you were against it. :p

Love it :D
Titre: Re: Readability
Posté par: Arantor le 13 Février 2012 à 02:07
I was against it as a core feature but as a plugin... *shrug* I don't have to use it now, do I? :P
Titre: Re: Readability
Posté par: Dismal Shadow le 13 Février 2012 à 02:10
Of course but awesome offical plugin nonetheless :)
Titre: Re: Readability
Posté par: Dr. Deejay le 13 Février 2012 à 16:07
Nice work Arantor :)
Titre: Re: Readability
Posté par: PantsManUK le 13 Février 2012 à 16:16
Excellent as always. My only disappointment, their ugly font choice (given NS's original screeny, I have to blame them for the font).
Titre: Re: Readability
Posté par: Arantor le 13 Février 2012 à 16:47
Yeah, their choice of font is pretty crappy, as is the lack of ability (that I could find readily) to handle multiple languages.

Might be worth having a chat with them about it, really, in case it can be done another way.
Titre: Re: Readability
Posté par: Nao le 13 Février 2012 à 17:52
Is that a small-size Georgia? Ouch...
Titre: Re: Readability
Posté par: Dismal Shadow le 27 Février 2012 à 15:03
Citation de Arantor le 13 Février 2012 à 16:47
Yeah, their choice of font is pretty crappy, as is the lack of ability (that I could find readily) to handle multiple languages.

Might be worth having a chat with them about it, really, in case it can be done another way.
Maybe I can ping them over on Twitter...


And oh, the app had been approved and is out due March 1st.
Readability: Enjoy Reading Again, March 1(http://www.youtube.com/watch?v=hjWf1D7uCeA#ws)
Titre: Re: Readability
Posté par: Arantor le 27 Février 2012 à 15:05
Go for it, and if they update it, let me know and I'll update my plugin.
Titre: Re: Readability
Posté par: Dismal Shadow le 27 Février 2012 à 18:41
Something like this?
Titre: Re: Readability
Posté par: Arantor le 27 Février 2012 à 18:45
Not really, no. I meant the actual font used in the Readability buttons - the buttons themselves use a serif font to display the letters - when everything else is sans-serif.

Though if there's an option to set fonts, that would be useful to know so that it can be added to the plugin.
Titre: Re: Readability
Posté par: Dismal Shadow le 27 Février 2012 à 18:47
Ahhhh, I see, it's what you are referring to then, the button per se. Stupid me, stupid old me. :P
Titre: Re: Readability
Posté par: Arantor le 27 Février 2012 à 18:48
Eh, I wasn't exactly that clear either ;) Still a valid question you raised :)