Feast upon the Word Blog

A blog focused on LDS scriptures and teaching

FIX: Scripture window embedded in Feast wiki

Posted by Matthew on December 6, 2010

Janet Lisonbee pointed out on the submit a question page that the scripture window embedded in commentary pages of the wiki site wasn’t working well. At least for now I have fixed this by changing the link embedded to point to the “classic” version of the scripture site on lds.org. See here for an example: http://feastupontheword.org/Alma_13:1-5. Thanks Janet for bringing the problem to my attention.

This is fixed only “for now” because I assume that at some point (in a few months?) lds.org will retire their classic site. It would be nice if, at that point, we have already recoded how the feast site embeds the lds scriptures in order to make use of the new scripture site. I’m a bit stumped though on how to do that. If you think you may be able to help me, read on.

Some technical background:

The wiki runs on an older version of mediawiki. This version of mediawiki has a modified SkinTemplate.php to show an iframe referring to lds.org’s scripture site. It is able to get the correct source page for the iframe by looking at the title of the page. The php code for this is:


if(preg_match("/JS-(\w)_(\d+):(\d+)-(\d+)/",$this->thispage))
{
$str=preg_replace("/JS-(\w)_(\d+):(\d+)-(\d+)/","JS_$1/$2/$3-$4#$3",$this->thispage);
}
elseif(preg_match("/D&C_(\d+):(\d+)-(\d+)/",$this->thispage))
{
$str=preg_replace("/D&C_(\d+):(\d+)-(\d+)/","DC/$1/$2-$3#$2",$this->thispage);
}
elseif(preg_match("/(\d+_)?\w+_\d+:[\d-]+/",$this->thispage))
{
$str=preg_replace("/((\d+_)?\w+)_(\d+):(\d+)-(\d+)/","$1/$3/$4-$5#$4",$this->thispage);
}
else {
return '';
}
if( $action == 'edit' ) {
$height = '20em';
$width = '100%';
} else {
$height = '40em';
$width = '38%';
}

return(
”.
‘// ‘);
}

The problem with the new site is that it forces a lot of wasted space within the iFrame. This happens in 2 ways:

1) If the site encounters the old form of a link like http://scriptures.lds.org/alma/13/1-5#1 it automatically redirects to the new format http://lds.org/scriptures/bofm/alma/13.1-5?lang=eng#0 . Notice particularly 2 things about the new format. 1st it includes an abbreviation of the scripture volume. In this case “bofm.” 2nd it moves the user up a verse. So if the first verse the link asks for is verse 1, lds.org starts them at verse 0–which in this case is just the top of the page. If you pass a link starting with verse 21, lds.org will start you at verse 20. For a large page that is nicer looking. In a little iFrame window an extra verse isn’t helpful. I see two possible solutions. (a) Drastically change the way the iframe is generated so it isn’t within SkinTemplate where it doesn’t know the volume. Not sure where yet…maybe putting within the content of the wiki markup something that indicates the correct iFrame url and then messing with how the markup is interpreted to make it work. (b) Hard code into SkinTemplate the volume of each book abbreviation so that from the page title SkinTemplate can figure out the correct volume of scripture and create the correct link.

2) The new site has a left navigation that gets in the way. I think it may be a security feature that you cannot get javascript to scroll the iFrame to the right to skip the navigation. If that is wrong and there is a way to do it, please let me know. Alternatively I looked around for a mobile version of the scripture site assuming that such a site would be similarly concerned with not wasting any space on a strip down the left side for navigation. Though the Church has some great mobile apps out there, I didn’t see a mobile online version of the scripture site.

PS in general anyone fluent in PHP and/or SQL who would like to help improve the wiki, let me know. Thanks.

if(preg_match(“/JS-(\w)_(\d+):(\d+)-(\d+)/”,$this->thispage))
{
$str=preg_replace(“/JS-(\w)_(\d+):(\d+)-(\d+)/”,”JS_$1/$2/$3-$4#$3″,$this->thispage);
}
elseif(preg_match(“/D&C_(\d+):(\d+)-(\d+)/”,$this->thispage))
{
$str=preg_replace(“/D&C_(\d+):(\d+)-(\d+)/”,”DC/$1/$2-$3#$2″,$this->thispage);
}
elseif(preg_match(“/(\d+_)?\w+_\d+:[\d-]+/”,$this->thispage))
{
$str=preg_replace(“/((\d+_)?\w+)_(\d+):(\d+)-(\d+)/”,”$1/$3/$4-$5#$4″,$this->thispage);
}
else {
return ”;
}
if( $action == ‘edit’ ) {
$height = ’20em';
$width = ‘100%';
} else {
$height = ’40em';
$width = ‘38%';

return(
http://scriptures.lds.org/’.strtolower($str).’‘.
‘<script type type=”text/javascript”>
function scrolltotop() { window.scrollTo(0,0); }
if (window.addEventListener) window.addEventListener(“load”,scrolltotop,false);
else if (window.attachEvent) window.attachEvent(“onload”,scrolltotop);</script>’);
}

2 Responses to “FIX: Scripture window embedded in Feast wiki”

  1. Robert C. said

    Nice work, Matthew!

  2. RobF said

    Thanks Matthew. Wish I knew enough to help!

Sorry, the comment form is closed at this time.

 
Follow

Get every new post delivered to your Inbox.

Join 315 other followers

%d bloggers like this: