Dismal Shadow

  • Madman in a Box
  • Me: Who is Arantor? Cleverbot: It stands for time and relative dimensions in space.
  • Posts: 1,185
Readability
« 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.


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

Am planning to request one over sm.org...

📎 Screen Shot 2011-11-17 at 3.27.46 AM.png - 30.53 kB, 622x296, viewed 465 times.

“I will stand on my ground as an atheist until your god shows up...If my irreligious bothers you much, and if you think everything I do is heresy to your god I don't care. Heresy is for those who believe, I don't. So, it isn't heresy at all!


   Jack in, Wedge,
   EXECUTE!

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Readability
« Reply #1, 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.)
When we unite against a common enemy that attacks our ethos, it nurtures group solidarity. Trolls are sensational, yes, but we keep everyone honest. | Game Memorial

Dismal Shadow

  • Madman in a Box
  • Me: Who is Arantor? Cleverbot: It stands for time and relative dimensions in space.
  • Posts: 1,185
Re: Readability
« Reply #2, 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. :/

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Readability
« Reply #3, on November 18th, 2011, 06:31 PM »
How exactly are you trying to add more social buttons?

Dismal Shadow

  • Madman in a Box
  • Me: Who is Arantor? Cleverbot: It stands for time and relative dimensions in space.
  • Posts: 1,185
Re: Readability
« Reply #4, 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

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Readability
« Reply #5, on November 18th, 2011, 06:40 PM »
Just add it into the one template layer that you're adding in that loop.

Dismal Shadow

  • Madman in a Box
  • Me: Who is Arantor? Cleverbot: It stands for time and relative dimensions in space.
  • Posts: 1,185
Re: Readability
« Reply #6, 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'; 
    }
}

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Readability
« Reply #7, 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';
        }
    }
}

Dismal Shadow

  • Madman in a Box
  • Me: Who is Arantor? Cleverbot: It stands for time and relative dimensions in space.
  • Posts: 1,185
Re: Readability
« Reply #8, 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*/

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Readability
« Reply #9, on November 18th, 2011, 07:56 PM »
Code looks fine to me.

Dismal Shadow

  • Madman in a Box
  • Me: Who is Arantor? Cleverbot: It stands for time and relative dimensions in space.
  • Posts: 1,185
Re: Readability
« Reply #10, 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. :/

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Readability
« Reply #11, on November 18th, 2011, 07:58 PM »
Contents of error log?

Dismal Shadow

  • Madman in a Box
  • Me: Who is Arantor? Cleverbot: It stands for time and relative dimensions in space.
  • Posts: 1,185
Re: Readability
« Reply #12, on November 18th, 2011, 08:11 PM »Last edited on November 18th, 2011, 09:18 PM by ~DS~
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. :/

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Readability
« Reply #14, on November 19th, 2011, 11:09 PM »
What exactly does that service provide?