Wedge

Public area => The Pub => Plugins => Topic started by: Dismal Shadow on November 17th, 2011, 08:28 AM

Title: Readability
Post by: Dismal Shadow on November 17th, 2011, 08:28 AM
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...
Title: Re: Readability
Post by: Arantor on November 17th, 2011, 08:53 AM
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.)
Title: Re: Readability
Post by: Dismal Shadow on November 18th, 2011, 06:30 PM
This is what I did:
Load.php

Code: [Select]
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: [Select]
/*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. :/
Title: Re: Readability
Post by: Arantor on November 18th, 2011, 06:31 PM
How exactly are you trying to add more social buttons?
Title: Re: Readability
Post by: Dismal Shadow on November 18th, 2011, 06:39 PM
Quote from Arantor on November 18th, 2011, 06:31 PM
How exactly are you trying to add more social buttons?
$context['template_layers'] then function template.

Yeah I'm doing it wrong. :P
Title: Re: Readability
Post by: Arantor on November 18th, 2011, 06:40 PM
Just add it into the one template layer that you're adding in that loop.
Title: Re: Readability
Post by: Dismal Shadow on November 18th, 2011, 06:54 PM
Not sure what you mean...

Code: [Select]
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'; 
    }
}
Title: Re: Readability
Post by: Arantor on November 18th, 2011, 07:02 PM
The if is only conditional for the first line without braces, the other lines are going to run every time.

Code: [Select]
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';
        }
    }
}
Title: Re: Readability
Post by: Dismal Shadow on November 18th, 2011, 07:30 PM
Can't seem to add more than 2 function template. Must be missing something.

Code: [Select]
/*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*/
Title: Re: Readability
Post by: Arantor on November 18th, 2011, 07:56 PM
Code looks fine to me.
Title: Re: Readability
Post by: Dismal Shadow on November 18th, 2011, 07:58 PM
Quote from Arantor on November 18th, 2011, 07:56 PM
Code looks fine to me.
I know right, adding more than 2 functions bring my site down. Currently using 2 for now. :/
Title: Re: Readability
Post by: Arantor on November 18th, 2011, 07:58 PM
Contents of error log?
Title: Re: Readability
Post by: Dismal Shadow on November 18th, 2011, 08:11 PM
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. :/
Title: Re: Readability
Post by: Dismal Shadow on November 19th, 2011, 06:16 AM
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?
Title: Re: Readability
Post by: Nao on November 19th, 2011, 11:09 PM
What exactly does that service provide?
Title: Re: Readability
Post by: Dismal Shadow on November 19th, 2011, 11:38 PM
Quote from Nao on November 19th, 2011, 11:09 PM
What exactly does that service provide?
Clean & readable?
Title: Re: Readability
Post by: Arantor on November 19th, 2011, 11:56 PM
Ah, the joys of clients that dispense with the look and feel an admin or themer has so carefully constructed...
Title: Re: Readability
Post by: Dismal Shadow on November 20th, 2011, 12:09 AM
Quote from Arantor on November 19th, 2011, 11:56 PM
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
Title: Re: Readability
Post by: Arantor on November 20th, 2011, 12:12 AM
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.
Title: Re: Readability
Post by: Nao on November 20th, 2011, 12:24 AM
Quote from ~DS~ on November 19th, 2011, 11:38 PM
Clean & readable?
Okay.. So, is 'Readability' a fancy new word for 'RSS/Atom feed'?
Title: Re: Readability
Post by: Arantor on November 20th, 2011, 12:26 AM
No, it's essentially a custom browser that chooses not to render most of the layout.
Title: Re: Readability
Post by: Nao on November 20th, 2011, 12:30 AM
Meeeehh..........

So, basically, that's Opera with 'User mode' enabled in the View menu.
How original!
Title: Re: Readability
Post by: Arantor on November 20th, 2011, 12:32 AM
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.
Title: Re: Readability
Post by: Nao on November 20th, 2011, 12:34 AM
Well... Whatever. I don't think it's worth the hassle.
Title: Re: Readability
Post by: Arantor on November 20th, 2011, 12:35 AM
Certainly not as core, but a plugin might not be too much effort. Need to experiment.
Title: Re: Readability
Post by: Dismal Shadow on November 20th, 2011, 12:40 AM
Quote from Nao on November 20th, 2011, 12:24 AM
Quote from ~DS~ on November 19th, 2011, 11:38 PM
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
Posted: November 20th, 2011, 12:37 AM

Click the Now button so you can see for yourself. http://iapplecafe.org/community/index.php/topic,410.msg806.html#msg806
Title: Re: Readability
Post by: Arantor on November 20th, 2011, 12:57 AM
Curious. I wonder what it uses to determine the 'main' content - I note it only has the first post in there.
Title: Re: Readability
Post by: Dismal Shadow on November 20th, 2011, 01:12 AM
Quote from Arantor on November 20th, 2011, 12:57 AM
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.
Title: Re: Readability
Post by: Nao on November 20th, 2011, 10:06 AM
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?
Title: Re: Readability
Post by: Arantor on November 20th, 2011, 01:29 PM
Yes, it probably would, come to think of it.
Title: Re: Readability
Post by: U Wish on January 18th, 2012, 10:26 PM
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
Posted: January 18th, 2012, 10:25 PM

simple matter of the main script finding the "viewer" plugin should work..  :cool:
Title: Re: Readability
Post by: Arantor on February 13th, 2012, 01:24 AM
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.
Title: Re: Readability
Post by: Dismal Shadow on February 13th, 2012, 02:02 AM
I though you were against it. :p

Love it :D
Title: Re: Readability
Post by: Arantor on February 13th, 2012, 02:07 AM
I was against it as a core feature but as a plugin... *shrug* I don't have to use it now, do I? :P
Title: Re: Readability
Post by: Dismal Shadow on February 13th, 2012, 02:10 AM
Of course but awesome offical plugin nonetheless :)
Title: Re: Readability
Post by: Dr. Deejay on February 13th, 2012, 04:07 PM
Nice work Arantor :)
Title: Re: Readability
Post by: PantsManUK on February 13th, 2012, 04:16 PM
Excellent as always. My only disappointment, their ugly font choice (given NS's original screeny, I have to blame them for the font).
Title: Re: Readability
Post by: Arantor on February 13th, 2012, 04:47 PM
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.
Title: Re: Readability
Post by: Nao on February 13th, 2012, 05:52 PM
Is that a small-size Georgia? Ouch...
Title: Re: Readability
Post by: Dismal Shadow on February 27th, 2012, 03:03 PM
Quote from Arantor on February 13th, 2012, 04:47 PM
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)
Title: Re: Readability
Post by: Arantor on February 27th, 2012, 03:05 PM
Go for it, and if they update it, let me know and I'll update my plugin.
Title: Re: Readability
Post by: Dismal Shadow on February 27th, 2012, 06:41 PM
Something like this?
Title: Re: Readability
Post by: Arantor on February 27th, 2012, 06:45 PM
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.
Title: Re: Readability
Post by: Dismal Shadow on February 27th, 2012, 06:47 PM
Ahhhh, I see, it's what you are referring to then, the button per se. Stupid me, stupid old me. :P
Title: Re: Readability
Post by: Arantor on February 27th, 2012, 06:48 PM
Eh, I wasn't exactly that clear either ;) Still a valid question you raised :)