Walking Trip …

Walking Trip

Walking Trip

Offenbach's Suite ... Warts 'n All

Offenbach's Suite ... Warts 'n All

If this was interesting you may be interested in this too.

Posted in Photography, Trips | Tagged , , | 34 Comments

Mac OS MAMP Timekeeping Web Application PHP Calendar Tutorial

Mac OS MAMP Timekeeping Web Application PHP Calendar Tutorial

Mac OS MAMP Timekeeping Web Application PHP Calendar Tutorial

Okay then, yesterday’s Mac OS MAMP Timekeeping Web Application PHP Image Metadata Tutorial “image metadata smarts” puts us in a position to get onto the “bells and whistles” side of our Timekeeping (macOS and Mac OS X only at this stage) web application. We channel the calendar display talents of Monthly Chronicler LocalStorage Tutorial in thought and act (its web application is opened in an iframe … hence our need to ask you to download monthly_chronicler.html to MAMP‘s $_SERVER[‘DOCUMENT_ROOT’] “HTMLCSS” subfolder) to offer a new (“reveal”) piece of details/summary hosted “Yearly Report Calendar” functionality.

<?php

// quarter_hour_timer.php
// RJM Programming
// December, 2021

// iptc_make_tag() function by Thies C. Arntzen
function iptc_make_tag($rec, $data, $value) {
$length = strlen($value);
$retval = chr(0x1C) . chr($rec) . chr($data);

if($length < 0x8000)
{
$retval .= chr($length >> 8) . chr($length & 0xFF);
}
else
{
$retval .= chr(0x80) .
chr(0x04) .
chr(($length >> 24) & 0xFF) .
chr(($length >> 16) & 0xFF) .
chr(($length >> 8) & 0xFF) .
chr($length & 0xFF);
}

return $retval . $value;
}

if (isset($_GET['myta'])) {
$dru="HTTP://" . $_SERVER['SERVER_NAME'] . "" . str_replace("~","",str_replace(":443~","",str_replace(":80~","",(":" . $_SERVER['SERVER_PORT'] . "~")))) . "/";
$contis=str_replace('+',' ',urldecode($_GET['myta']));
//file_put_contents('xx.xx', $contis);
$myf='';
$backi='';
$cali='';
$taback='';
$bcontis="'" . str_replace(chr(34), "' + String.fromCharCode(34) + '", str_replace("\n", "' + String.fromCharCode(10) + '", str_replace("\r\n", "' + String.fromCharCode(10) + '", str_replace("'", "' + String.fromCharCode(39) + '", $contis)))) . "'";
if (substr(($bcontis . ' '),0,3) == "' + ") { $bcontis=$bcontis.substr(3); }
if (substr((' ' . $bcontis),-3,3) == " + '") { $bcontis=$bcontis.substr(0,(-3 + strlen($bcontis))); }
foreach ($_GET as $name=>$val) {
if ($name != 'myta' && $val == '') {
//echo $name;
$myf=$name;
$taback=str_replace('-','_',str_replace('itd','tatd',$myf));
$backi=str_replace('-','_',str_replace('screen-','itd_',$myf));
$cali=str_replace('-','',str_replace('screen-','td',$myf));
$idcali=explode('-',explode('_',str_replace('screen-','td',str_replace('itd_','td',$myf)))[0])[0];


// Thanks to https://doc.bccnsoft.com/docs/php-docs-7-en/function.iptcembed.html

// Path to jpeg file
$path = $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . str_replace('_','-',str_replace('itd_','screen-',$myf)) . '.jpg';
//file_put_contents('x.x',$path);

$capt = ""; // Thanks to https://www.php.net/manual/en/function.iptcparse.php
$size = getimagesize( $path, $info );
if (isset($info["APP13"])) {
//file_put_contents('xx.xx',$path);
if ($iptc = iptcparse( $info["APP13"] ) ) {
//file_put_contents('xxx.xxx',$path);
$capt = str_replace( "\000", "", $iptc["2#120"][0] );
//file_put_contents('xxxx.xxxx',$capt);
}
}
$bcontis="" . str_replace(chr(34), "' + String.fromCharCode(34) + '", str_replace("\n", "' + String.fromCharCode(10) + '", str_replace("\r\n", "' + String.fromCharCode(10) + '", str_replace("'", "' + String.fromCharCode(39) + '", $capt)))) . "";
$ccpre="<p onclick=this.innerHTML+=String.fromCharCode(60)+String.fromCharCode(98)+String.fromCharCode(114)+String.fromCharCode(62); style=background-color:orange;background-size:contain;background-image:linear-gradient(rgba(255,255,255,0.3),rgba(255,255,255,0.3)),URL(" . $dru . str_replace('_','-',str_replace('itd_','screen-',$myf)) . ".jpg" . "); title=" . substr(str_replace('td','p',$cali),-4,2) . ":" . substr(str_replace('td','p',$cali),-2,2) . "++ id=" . str_replace('td','p',$cali) . ">";
$ccpost="</p>";
$ccontis="<br><p style='background-color:orange; title='" . str_replace('td','p',$cali) . "' id=" . str_replace('td','p',$cali) . ">" . str_replace(chr(34), "' + String.fromCharCode(34) + '", str_replace("\n", "<br>", str_replace("\r\n", "<br>", str_replace("'", "' + String.fromCharCode(39) + '", $capt)))) . "</p>";

//file_put_contents('xxxxx.xxxxx',$bcontis);
//file_put_contents('xxxxxx.xxxxxx',$taback . ' ... ' . $backi);
//file_put_contents('xxxxxxx.xxxxxxx',"parent.document.getElementById('" . $backi . "').title='" . $bcontis . "'; parent.document.getElementById('" . $taback . "').value='" . $bcontis . "'; ");

}
if ($bcontis != "''") { echo "<html><body onload=\" parent.document.getElementById('" . $backi . "').title='" . $bcontis . "'; parent.document.getElementById('" . $taback . "').value='" . $bcontis . "'; if (parent.document.getElementById('" . $idcali . "')) { var huhg='" . $ccpre . "' + parent.document.getElementById('" . $taback . "').value + '" . $ccpost . "'; while (huhg.indexOf(String.fromCharCode(10)) != -1) { huhg=huhg.replace(String.fromCharCode(10),'<br>'); } parent.document.getElementById('" . $idcali . "').innerHTML+=huhg; } \"></body></html>"; }
}
} else if (isset($_POST['myta'])) {
$dru="HTTP://" . $_SERVER['SERVER_NAME'] . "" . str_replace("~","",str_replace(":443~","",str_replace(":80~","",(":" . $_SERVER['SERVER_PORT'] . "~")))) . "/";
$contis=str_replace('+',' ',urldecode($_POST['myta']));
//file_put_contents('xx.xx', $contis);
$myf='';
$backi='';
$cali='';
$bcontis="'" . str_replace(chr(34), "' + String.fromCharCode(34) + '", str_replace("\n", "' + String.fromCharCode(10) + '", str_replace("\r\n", "' + String.fromCharCode(10) + '", str_replace("'", "' + String.fromCharCode(39) + '", $contis)))) . "'";


$ccpre="<p onclick=this.innerHTML+=String.fromCharCode(60)+String.fromCharCode(98)+String.fromCharCode(114)+String.fromCharCode(62); style=background-color:orange;background-size:contain;background-image:linear-gradient(rgba(255,255,255,0.3),rgba(255,255,255,0.3)),URL(" . $dru . str_replace('_','-',str_replace('itd_','screen-',$myf)) . ".jpg" . "); title=" . substr(str_replace('td','p',$cali),-4,2) . ":" . substr(str_replace('td','p',$cali),-2,2) . "++ id=" . str_replace('td','p',$cali) . ">";
$ccpost="</p>";
$ccontis="<br><p style='background-color:orange; title='" . str_replace('td','p',$cali) . "' id=" . str_replace('td','p',$cali) . ">" . str_replace(chr(34), "' + String.fromCharCode(34) + '", str_replace("\n", "<br>", str_replace("\r\n", "<br>", str_replace("'", "' + String.fromCharCode(39) + '", $capt)))) . "</p>";


if (substr(($bcontis . ' '),0,3) == "' + ") { $bcontis=$bcontis.substr(3); }
if (substr((' ' . $bcontis),-3,3) == " + '") { $bcontis=$bcontis.substr(0,(-3 + strlen($bcontis))); }
foreach ($_POST as $name=>$val) {
if ($name != 'myta') {
$myf=$name;
$backi=str_replace('-','_',str_replace('screen-','itd_',$myf));
$taback=str_replace('tatd','tatd_',substr(str_replace('-','',str_replace('_','',str_replace('itd','tatd',str_replace('screen','tatd',$myf)))),0,12)) . '_' . substr(str_replace('-','',str_replace('_','',str_replace('itd','tatd',str_replace('screen','tatd',$myf)))),-4,4);
$pback=str_replace('tatd','ip',$taback);
$cali=str_replace('-','',str_replace('screen-','td',$myf));
$idcali=explode('-',explode('_',str_replace('screen-','td',str_replace('itd_','td',$myf)))[0])[0];


// Thanks to https://doc.bccnsoft.com/docs/php-docs-7-en/function.iptcembed.html

// Path to jpeg file
$path = $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . $myf . '.jpg';

//file_put_contents('x.x', $path);

// Set the IPTC tags
$iptc = array(
'2#120' => $contis,
'2#116' => 'Copyright 2021, RJM Programming'
);

// Convert the IPTC tags into binary code
$data = '';

foreach($iptc as $tag => $string) {
$tag = substr($tag, 2);
$data .= iptc_make_tag(2, $tag, $string);
}

// Embed the IPTC data
$content = iptcembed($data, $path);

// Write the new image data out to the file.
$fp = fopen($path, "wb");
fwrite($fp, $content);
fclose($fp);

}
echo "<html><body onload=\" parent.document.getElementById('" . $backi . "').title=" . $bcontis . "; if (parent.document.getElementById('" . $idcali . "')) { var huhg='" . $ccpre . "' + parent.document.getElementById('" . $taback . "').value + '" . $ccpost . "'; if (parent.document.getElementById('" . $pback . "')) { huhg=parent.document.getElementById('" . $taback . "').value; } while (huhg.indexOf(String.fromCharCode(10)) != -1) { huhg=huhg.replace(String.fromCharCode(10),'<br>'); } if (parent.document.getElementById('" . $pback . "')) { parent.document.getElementById('" . $pback . "').innerHTML=huhg; } else { parent.document.getElementById('" . $idcali . "').innerHTML+=huhg; } } \"></body></html>";
}
} else {
exec("/usr/sbin/screencapture -Cd -tjpg /Applications/MAMP/htdocs/screen-`date +\"%Y%m%d-%H%M\"`.jpg");
}
exit;

?>

And so, again, our changed quarter_hour_timer.html (we ask you to download to MAMP‘s $_SERVER[‘DOCUMENT_ROOT’] “HTMLCSS” subfolder) Timekeeping Web Application suited to macOS (or Mac OS X) “screencapture” command line usage, is helped out by a calendar integrationally changed quarter_hour_timer.php PHP (we ask you to download to MAMP‘s $_SERVER[‘DOCUMENT_ROOT’] “HTMLCSS” subfolder) for you to try out on your MAMP macOS environment.


Previous relevant Mac OS MAMP Timekeeping Web Application PHP Image Metadata Tutorial is shown below.

Mac OS MAMP Timekeeping Web Application PHP Image Metadata Tutorial

Mac OS MAMP Timekeeping Web Application PHP Image Metadata Tutorial

In our opinion, what would make the day before yesterday’s Mac OS MAMP Timekeeping Web Application PHP Intranet Tutorial “Timekeeping Web Application” cooler would be to add to the intelligence of the screen capture images, ahead of other data related improvements to come.

We’ve spoken in the past about Exif in that respect but PHP has Iptc image metadata functions we can call on …

  • iptcembed to embed new metadata into an existant image from those associated “caption” textarea elements we offer
  • iptcparse to extract old metadata from an existant image into those associated “caption” textarea elements we offer

This metadata can be like a database source we use moving forward on this project, meaning the one image data entity can suffice for both visual and textual usage purposes.

And so our changed quarter_hour_timer.html Timekeeping Web Application suited to macOS (or Mac OS X) “screencapture” command line usage, is helped out by a much more usefully changed quarter_hour_timer.php PHP …

<?php

// quarter_hour_timer.php
// RJM Programming
// December, 2021

// iptc_make_tag() function by Thies C. Arntzen
function iptc_make_tag($rec, $data, $value) {
$length = strlen($value);
$retval = chr(0x1C) . chr($rec) . chr($data);

if($length < 0x8000)
{
$retval .= chr($length >> 8) . chr($length & 0xFF);
}
else
{
$retval .= chr(0x80) .
chr(0x04) .
chr(($length >> 24) & 0xFF) .
chr(($length >> 16) & 0xFF) .
chr(($length >> 8) & 0xFF) .
chr($length & 0xFF);
}

return $retval . $value;
}

if (isset($_GET['myta'])) {
$contis=str_replace('+',' ',urldecode($_GET['myta']));
//file_put_contents('xx.xx', $contis);
$myf='';
$backi='';
$taback='';
$bcontis="'" . str_replace(chr(34), "' + String.fromCharCode(34) + '", str_replace("\n", "' + String.fromCharCode(10) + '", str_replace("\r\n", "' + String.fromCharCode(10) + '", str_replace("'", "' + String.fromCharCode(39) + '", $contis)))) . "'";
if (substr(($bcontis . ' '),0,3) == "' + ") { $bcontis=$bcontis.substr(3); }
if (substr((' ' . $bcontis),-3,3) == " + '") { $bcontis=$bcontis.substr(0,(-3 + strlen($bcontis))); }
foreach ($_GET as $name=>$val) {
if ($name != 'myta' && $val == '') {
//echo $name;
$myf=$name;
$taback=str_replace('-','_',str_replace('itd','tatd',$myf));
$backi=str_replace('-','_',str_replace('screen-','itd_',$myf));

// Thanks to https://doc.bccnsoft.com/docs/php-docs-7-en/function.iptcembed.html

// Path to jpeg file
$path = $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . str_replace('_','-',str_replace('itd_','screen-',$myf)) . '.jpg';
//file_put_contents('x.x',$path);

$capt = ""; // Thanks to https://www.php.net/manual/en/function.iptcparse.php
$size = getimagesize( $path, $info );
if (isset($info["APP13"])) {
//file_put_contents('xx.xx',$path);
if ($iptc = iptcparse( $info["APP13"] ) ) {
//file_put_contents('xxx.xxx',$path);
$capt = str_replace( "\000", "", $iptc["2#120"][0] );
//file_put_contents('xxxx.xxxx',$capt);
}
}
$bcontis="" . str_replace(chr(34), "' + String.fromCharCode(34) + '", str_replace("\n", "' + String.fromCharCode(10) + '", str_replace("\r\n", "' + String.fromCharCode(10) + '", str_replace("'", "' + String.fromCharCode(39) + '", $capt)))) . "";
//file_put_contents('xxxxx.xxxxx',$bcontis);
//file_put_contents('xxxxxx.xxxxxx',$taback . ' ... ' . $backi);
//file_put_contents('xxxxxxx.xxxxxxx',"parent.document.getElementById('" . $backi . "').title='" . $bcontis . "'; parent.document.getElementById('" . $taback . "').value='" . $bcontis . "'; ");

}
if ($bcontis != "''") { echo "<html><body onload=\" parent.document.getElementById('" . $backi . "').title='" . $bcontis . "'; parent.document.getElementById('" . $taback . "').value='" . $bcontis . "'; \"><p>parent.document.getElementById('" . $backi . "').title='" . $bcontis . "'; parent.document.getElementById('" . $taback . "').value='" . $bcontis . "';</p></body></html>"; }
}
} else if (isset($_POST['myta'])) {
$contis=str_replace('+',' ',urldecode($_POST['myta']));
//file_put_contents('xx.xx', $contis);
$myf='';
$backi='';
$bcontis="'" . str_replace(chr(34), "' + String.fromCharCode(34) + '", str_replace("\n", "' + String.fromCharCode(10) + '", str_replace("\r\n", "' + String.fromCharCode(10) + '", str_replace("'", "' + String.fromCharCode(39) + '", $contis)))) . "'";
if (substr(($bcontis . ' '),0,3) == "' + ") { $bcontis=$bcontis.substr(3); }
if (substr((' ' . $bcontis),-3,3) == " + '") { $bcontis=$bcontis.substr(0,(-3 + strlen($bcontis))); }
foreach ($_POST as $name=>$val) {
if ($name != 'myta') {
$myf=$name;
$backi=str_replace('-','_',str_replace('screen-','itd_',$myf));

// Thanks to https://doc.bccnsoft.com/docs/php-docs-7-en/function.iptcembed.html

// Path to jpeg file
$path = $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . $myf . '.jpg';

//file_put_contents('x.x', $path);

// Set the IPTC tags
$iptc = array(
'2#120' => $contis,
'2#116' => 'Copyright 2021, RJM Programming'
);

// Convert the IPTC tags into binary code
$data = '';

foreach($iptc as $tag => $string) {
$tag = substr($tag, 2);
$data .= iptc_make_tag(2, $tag, $string);
}

// Embed the IPTC data
$content = iptcembed($data, $path);

// Write the new image data out to the file.
$fp = fopen($path, "wb");
fwrite($fp, $content);
fclose($fp);

}
echo "<html><body onload=\" parent.document.getElementById('" . $backi . "').title=" . $bcontis . "; \"></body></html>";
}
} else {
exec("/usr/sbin/screencapture -Cd -tjpg /Applications/MAMP/htdocs/screen-`date +\"%Y%m%d-%H%M\"`.jpg");
}
exit;

?>


Previous relevant Mac OS X MAMP Timekeeping Web Application Email Tutorial is shown below.

Mac OS X MAMP Timekeeping Web Application Email Tutorial

Mac OS X MAMP Timekeeping Web Application Email Tutorial

The practicalities of yesterday’s (Mac OS X MAMP Timekeeping Web Application Primer Tutorial) timekeeping Mac OS X Web Application, left as they are, would leave you with a somewhat useful web application whose use is only for the here and now, but what if you want it to be more accountable? Well, that is when we, here, at RJM Programming, like to use that tried and trusted email form of communication.

Today’s email methods spurn the use of server-side intervention, at least for now. So what is available to us as tools, if we don’t include Ajax nor jQuery in that list? Well, we have, to our minds …

  • mailto links (get us to the email client) +
  • the body section of that email can have a clipboard image pasted into it, for which we can utilize HTML5 canvas element’s toDataURL() method, teamed up with a window.open popup window of the toDataURL image data, which can be selected and copied, optionally, by the user themselves, should they wish this to make their email more self explanatory

We last discussed this thinking with Canvas Annotation Email Attachment Clipboard Tutorial.

We rely on the crontab functionality, being as there is no server-side help, to create the image file, whose contents eventually go to make up the contents that can be selected and copied and pasted by the user into the body section of the email (and sent off to whosoever they feel like sending it too, as you have the full power of the email client available to you with the interaction you have with an actual email client program).

Here is the HTML and Javascript quarter_hour_timer.html which changed to cater for today’s email functionality in this way, and, as per the Stop Press from yesterday, we’ll also have a live run link here today.


Previous relevant Mac OS X MAMP Timekeeping Web Application Primer Tutorial is shown below.

Mac OS X MAMP Timekeeping Web Application Primer Tutorial

Mac OS X MAMP Timekeeping Web Application Primer Tutorial

Sometimes when you program, especially for administrative type functionality, there are useful programs to write, that are able to become web applications, but in a limited set of platforms. So it is today with our timekeeping web application that relies on …

  • Mac OS X operating system +
  • Existance of [/usr/sbin/]screencapture +
  • crontab active and editable via crontab -e +
  • One of …
    1. MAMP installed to, in our case, /Applications/MAMP/htdocs/ (as is mentioned in the relevant crontab background task that snapshots the user’s screen every quarter hour) that maps to the MAMP web application URL HTTP://localhost:8888/ … or …
    2. crontab directory mention that corresponds to a URL call of our web application like for our Google Chrome example (where the directory below, used, could be a place of your choosing (that matches what is in your crontab task entry)) …

      file:///Applications/MAMP/htdocs/quarter_hour_timer.html?localplace=

      … or just, via the web browser’s File -> Open File menu …

      file:///Applications/MAMP/htdocs/quarter_hour_timer.html

… pretty restrictive, huh? … but pretty useful for our quarter hour timekeeping purposes today.

We want to have a web application that is running at the user’s discretion, and when first fired up, looks for outputs from crontab tasks above …


0,15,30,45 * * * * /usr/sbin/screencapture -Cd -tjpg /Applications/MAMP/htdocs/screen-`date +"\%Y\%m\%d-\%H\%M"`.jpg

… for the current day in question and if existant show …

  1. a date and time stamp +
  2. the snapshot of what you were doing at the quarter hour, that is clickable to make bigger for more in depth viewing +
  3. an HTML textarea element in which you can optionally type in more specifics about that quarter hour

So, as much as we like to think of Mac OS X Terminal application’s BSD (a unix derivative) operating system, as being a lot like Linux, there are some commands and usage that …

  • adds Mac OS X specific command line functionality to a Linux or unix base set of functionality, like for today’s screencapture command … and we’ve included another such example, below, with the command say featuring in Mac OS X Text to English Speech Primer Tutorial as shown below
  • changes switches on Linux or unix commands
  • won’t have some Linux or unix commands that other platforms do

In the great tradition of behoving … we behove … we behove thee quarter_hour_timer.html if you like, my liege. On this occasion you’ll have gleaned that there is no live run link, because the RJM Programming web server is not Mac OS X … so command line screencapture has no meaning for a CentOS web server’s operating system command line. You’ll see in the code that rather than use “Client Pre-emptive Iframe” concepts to check for existence of crontab screen capture images, we, instead use the onerror event for HTML img elements to check for non-existance.

Stop Press

Just noticed that, perhaps, after all, a live run from the RJM Programming website can make sense if you have a Mac OS X laptop, for instance, that is running that suggested crontab entry as explained in tutorial above. That type of live run managed to latch on to our local crontab screencaptures on my MacBook Pro.


Previous relevant Mac OS X Text to English Speech Primer Tutorial is shown below.

Mac OS X Text to English Speech Primer Tutorial

Mac OS X Text to English Speech Primer Tutorial

We’ve got a few new ideas today …

  1. Text to English Speech via Mac OS X’s command line say command used by PHP via exec to make say.php (which is useful as a download to a Mac OS X laptop using MAMP) which, today, does not have a live run because the web server of domain rjmprogramming.com.au is a CentOS Linux server … Linux equivalent of Mac OS X’s say? … read here
  2. Trying to present this brought up the usual movie production problem with iMovie overlaying the audio on top of the video (though you may want to try, and you could start reading with this link) versus QuickTime Player talent to catch both audio and video tracks (and that we ended up using), but not of the “screen goings on”, alas versus MPlayer OSX Extended which can play separately but not two tracks on top and doesn’t do any reconstituting … so …
  3. Improved on our inhouse Video/Audio synchronizing efforts by allowing audio_video.html supervisor (changed in this way) be able to be called to press one of its preconceived synchronization buttons onload which we do with (the newly added) Macbeth Act 1 Scene 1 … in a small celebration of the Bard … who, am thinking (in that Falstaff way), would have got a huge chuckle out of “anonymous” instead of “anon” during the Three Witches scene … we had to do something to say Happy Birthday

Along the way we tried filming the MacBook Pro with the iPad to a YouTube

… but weren’t happy with the audio quality, alas (too/two).

If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.

Leave a comment

WordPress Blog Search Within Search Posting Progress Tutorial

WordPress Blog Search Within Search Posting Progress Tutorial

WordPress Blog Search Within Search Posting Progress Tutorial

When there is a way in which to express progress made in a long running job with a web application, there are two HTML element tags we can turn to, at the very least, to help out. One is the progress tag, and the one we use today is called the meter tag.

And so, onto the recent WordPress Blog Search Within Search Posting Content Tutorial ‘s “Search Within Search” WordPress blog improvements, we wanted to show a progress bar for the user to show them progress is being made, especially apt that is for when they choose to look through the blog posting content as well, with their searches.

WordPress works with “loop” functionality off the MySql query made in the background with all three search basis concepts …

  • search
  • tag
  • category

… and our “Search Within Search” functionality allows for “sub-searches” off a tag or category basis. In order to show the progress bar we need …

  • minimum progress … that’s easy … zero (0)
  • maximum progress … see code below …
  • current progress …

    [PageNumberCurrentlyShowing] x [NumberOfEntriesShownPerLoopingPage]

    … or to be precise, the minimum of that above and the maximum progress

… as per the PHP TwentyTen theme’s (good ol’) header.php “intervention code” below …

<?php

$searchcount='0';
$meterbit="";

function getsc($lhmode) {
global $wp_query, $searchcount, $meterbit;
if ($wp_query) {
if (strpos(('~' . $_SERVER['QUERY_STRING']), '~s=') !== false || strpos(($_SERVER['REQUEST_URI']), '/tag/') !== false || strpos(($_SERVER['REQUEST_URI']), '/cat') !== false) {
if ($lhmode && isset($_GET['wopenall']) && isset($_GET['totp'])) {
$pgn='1';
if (strpos($_SERVER['REQUEST_URI'], '/page/') !== false) {
$pgn=explode('/',explode('?',explode('/page/',$_SERVER['REQUEST_URI'])[1])[0])[0];
}
$pppg=$wp_query->post_count;
if (strpos(urldecode($_GET['totp']), '.') !== false) { $pppg=explode('.',urldecode($_GET['totp']))[1]; }
$meterbit="<meter style=display:inline-block; min=0 max=" . explode('.',urldecode($_GET['totp']))[0] . " value=" . min(explode('.',urldecode($_GET['totp']))[0],($pgn * $pppg)) . "></meter>";
return '';
} else if ($lhmode && !isset($_GET['wopenall'])) {
return '';
}
$searchcount = '' . $wp_query->found_posts; //$wp_query->found_posts > 1 ? 'results' : 'result'; // if found posts is greater than one echo results(plural) else echo result (singular)
// echo $wp_query->found_posts . " $not_singular found";
if (strpos(('~' . $_SERVER['QUERY_STRING']), '~s=') !== false) {
return ''; //$allsearch = new WP_Query("s=" . $_GET['s'] . "&showposts=0");
} else if (strpos(($_SERVER['REQUEST_URI']), '/tag/') !== false) {
$allsearch = new WP_Query("tag=" . explode('/',explode('?',explode('/tag/',$_SERVER['REQUEST_URI'])[1])[0])[0] . "&showposts=0");
} else if (isset($_GET['tag'])) {
$allsearch = new WP_Query("tag=" . $_GET['tag'] . "&showposts=0");
} else if (strpos(($_SERVER['REQUEST_URI']), '/category') !== false) {
$allsearch = new WP_Query("category=" . explode('/',explode('?',explode('/category/',$_SERVER['REQUEST_URI'])[1])[0])[0] . "&showposts=0");
} else if (isset($_GET['category'])) {
$allsearch = new WP_Query("category=" . $_GET['category'] . "&showposts=0");
} else if (strpos(($_SERVER['REQUEST_URI']), '/cat') !== false) {
$allsearch = new WP_Query("cat=" . explode('/',explode('?',explode('/cat/',$_SERVER['REQUEST_URI'])[1])[0])[0] . "&showposts=0");
} else if (isset($_GET['cat'])) {
$allsearch = new WP_Query("cat=" . $_GET['cat'] . "&showposts=0");
}
$searchcount = '' . $allsearch->found_posts;
//echo "s=" . $_GET['s'] . "&showposts=0 has " . $searchcount . " results";
//exit;
if ($lhmode) {
if (isset($_GET['wopenall'])) {
if (strpos(($_SERVER['REQUEST_URI']), '/page/') !== false && isset($_GET['totp'])) {
$pgn=explode('/',explode('?',explode('/page/',$_SERVER['REQUEST_URI'])[1])[0])[0];
$pppg=$wp_query->post_count;
if (strpos(urldecode($_GET['totp']), '.') !== false) { $pppg=explode('.',urldecode($_GET['totp']))[1]; }
$meterbit="<meter style=display:inline-block; min=0 max=" . explode('.',urldecode($_GET['totp']))[0] . " value=" . min(explode('.',urldecode($_GET['totp']))[0],($pgn * $pppg)) . "></meter>";
} else {
$meterbit="<meter style=display:inline-block; min=0 max=" . $searchcount . " value=" . min($searchcount,$wp_query->post_count) . "></meter>";
}
return " if ((('' + location.hash) == '' || ('' + location.hash + '~').indexOf('tentcon~') != -1) && document.URL.indexOf('?wopenall=') != -1) { location.href=document.URL.split('#')[0].replace('?wopenall=','?totp=" . $searchcount . "." . $wp_query->post_count . "&wopenall=') + ('#' + location.hash + '~').replace('#~','').replace('##','#').replace('~',''); } \n ";
} else {
return '';
}
} else {
return '' . $searchcount;
}
}
}
return '';
}

?>

… called amongst the first bits of Javascript the PHP writes out …

<?php

<script>
var getsc="";
<?php echo getsc(true); ?>

var dgsbi='';
// blah blah Javascript blah
</script>

?>

… and displayed right at the end of header.php’s HTML writing out …

<?php

<div id="main"><?php global $meterbit; echo $meterbit; ?>

?>

… to help you plan your searching day! Hooray!


Previous relevant WordPress Blog Search Within Search Posting Content Tutorial is shown below.

WordPress Blog Search Within Search Posting Content Tutorial

WordPress Blog Search Within Search Posting Content Tutorial

The recent WordPress Blog Search Within Search Reveal Tutorial

  • revamped Search within (Category/Tag) Search of Blog Posting Titles … and today we extend that to …
  • revamped Search within (Category/Tag) Search of Blog Posting content … simply by appending space character(s) to the relevant Category/Tag entered

We have a single intervention starting point in (WordPress Blog Twenty Ten theme’s header.php at) …

<?php

$tblurb .= " if (ourwov == '' || cntsuffixmore(hones[iot].innerHTML).toLowerCase().indexOf(decodeURIComponent(ourwov.replace('+', '%20').replace('+', '%20').replace('+', '%20').replace('+', '%20').toLowerCase())) != -1) { \n";

?>

… that hones[iot].innerHTML representing ( but actually hones[iot].innerHTML.split(‘</a>’)[0].split(‘>’)[eval(-1 + hones[iot].innerHTML.split(‘</a>’)[0].split(‘>’).length)].trim() ) a blog posting title able to be turned into a blog posting URL (because we are using a WordPress title permalink system) via …

<?php

csajaxit('//www.rjmprogramming.com.au/ITblog/' + urlit(xxxhones[cntsuffixiiiz].innerHTML.split('</a>')[0].split('>')[eval(-1 + xxxhones[cntsuffixiiiz].innerHTML.split('</a>')[0].split('>').length)].trim()));

?>

… you can contextualize in all the new location.hash containing “#tentcon” “blog posting content” search methodology Ajax (and leading into Ajax) code that can glean “posting content” from “posting titles” …

<?php

var cntthrough=true;
var cntsuffft=8000;
var cnttsuff=document.title;
var cntsuffixes=[];
var cntsuffixzhr=null;
var cntsuffixiiiz=0;
var cntsuffixsi=null;
var cntsuffixi=0;
var cntsuffix='';
if (('' + location.hash).indexOf('tentcon') != -1) { cntsuffix='#tentcon'; cntsuffft=9000; }

function csbackin() {
if (cntsuffixzhr.readyState == 4) {
if (cntsuffixzhr.status == 200) {
if (cntsuffixzhr.responseText) {
clearInterval(cntsuffixsi);
cntsuffixsi=null;
cntsuffixes[eval(-1 + cntsuffixes.length)]=cntsuffixzhr.responseText;
cntsgather();
}
}
}
}

function csajaxit(urlin) {
if (urlin.length > 0) {
if (window.XMLHttpRequest) {
cntsuffixzhr = new window.XMLHttpRequest;
}
else {
try {
cntsuffixzhr = new ActiveXObject('Msxml2.XMLHTTP');
} catch (othermicrosoft) {
try {
cntsuffixzhr = new ActiveXObject('Microsoft.XMLHTTP');
} catch (failed) {
cntsuffixzhr = false;
}
}
}
if (cntsuffixzhr) {
cntsuffixzhr.onreadystatechange = csbackin;
cntsuffixzhr.open('GET', urlin, true);
cntsuffixzhr.send(null);
}
}
}

function cntsuffixmore(invl) {
var cntsuffixj=cntsuffixi;
cntsuffixi++;
if (cntsuffix == '') {
return invl;
}
if (eval('' + cntsuffixes.length) > eval('' + cntsuffixj)) {
return cntsuffixes[cntsuffixj];
}
return invl;
}

function postcntsgather() {
if (cntsuffixes[cntsuffixiiiz] == '') {
var xxxhones=docgetclass('entry-title', 'h2');
cntsuffixes[cntsuffixiiiz]=xxxhones[cntsuffixiiiz].innerHTML.split('</a>')[0].split('>')[eval(-1 + xxxhones[cntsuffixiiiz].innerHTML.split('</a>')[0].split('>').length)].trim();
cntsgather();
if (cntsuffixsi) { clearInterval(cntsuffixsi); cntsuffixsi=null; }
}
}

function cntsgather() {
var xxxhones=docgetclass('entry-title', 'h2');
cntsuffixiiiz=eval('' + cntsuffixes.length);
if (eval(0 + eval('' + cntsuffixes.length)) < eval('' + xxxhones.length)) {
if (eval('' + xxxhones.length) == 1) {
cntsuffixes.push(' ');
document.title='' + cntsuffixes.length + '/' + xxxhones.length + ': ' + xxxhones[cntsuffixiiiz].innerHTML.split('</a>')[0].split('>')[eval(-1 + xxxhones[cntsuffixiiiz].innerHTML.split('</a>')[0].split('>').length)].trim() + ' ... ' + cnttsuff;
if (cntsuffix != '') {
cntthrough=true;
//alert(30);
if (window.opener) {
//alert(31);
window.opener.cntt();
//alert(32);
window.opener.backatparentclosingchild();
//alert(33);
}
}
} else {
cntsuffixes.push('');
document.title='' + cntsuffixes.length + '/' + xxxhones.length + ': ' + xxxhones[cntsuffixiiiz].innerHTML.split('</a>')[0].split('>')[eval(-1 + xxxhones[cntsuffixiiiz].innerHTML.split('</a>')[0].split('>').length)].trim() + ' ... ' + cnttsuff;
csajaxit('//www.rjmprogramming.com.au/ITblog/' + urlit(xxxhones[cntsuffixiiiz].innerHTML.split('</a>')[0].split('>')[eval(-1 + xxxhones[cntsuffixiiiz].innerHTML.split('</a>')[0].split('>').length)].trim()));
}
cntsuffixsi=setInterval(postcntsgather, 5000);
}
}

function cntt() {
cntthrough=true;
}

?>

… augmented by new code

<?php

function precc() { // wopenall= functionality
var xxhones=docgetclass('entry-title', 'h2');
if (xxhones.length == 1) { cntthrough=true; }
if (document.URL.indexOf('wopenall=') != -1) { document.body.style.cursor='progress'; }
if (document.getElementById('s')) {
document.getElementById('s').placeholder='Space appended compares to whole posting content';
}

if (xxhones.length >= 1 && cntsuffix != '') {
if (cntsuffix != '' && eval(0 + eval('' + cntsuffixes.length)) < eval('' + xxhones.length)) {
if (eval('' + cntsuffixes.length) == 0) { if (xxhones.length == 1) { cntthrough=true; } else { cntthrough=false; } setTimeout(cntsgather,200); }
setTimeout(precc,2000);
return false;
} else if (cntsuffix != '' && eval('' + cntsuffixes.length) >= 1) {
if (cntsuffixes[eval(-1 + cntsuffixes.length)] == '') {
setTimeout(precc,2000);
return false;
}
}
} else if (cntsuffix != '') {
cntthrough=true;
//alert(0);
if (window.opener) {
//alert(1);
window.opener.cntt();
//alert(2);
window.opener.backatparentclosingchild();
//alert(3);
}
}
cntsuffixi=0;
cntthrough=true;

var wa=wasaction;
if (wasaction == "") {
document.getElementById('s').style.width='55%';
wasaction=document.getElementById('searchform').action;
}
<?php
if ((isset($_GET['byorder']) || isset($_POST['byorder'])) && (isset($_GET['s']) || isset($_POST['s']))) {
if (isset($_GET['byorder'])) file_put_contents("localsearch_" . my_t_d_server_remote_addr() . ".qry", urldecode($_GET['byorder']));
if (isset($_POST['byorder'])) file_put_contents("localsearch_" . my_t_d_server_remote_addr() . ".qry", urldecode($_POST['byorder']));
echo "\n setTimeout(muchlater, 30000); \n";
} else if (file_exists("localsearch_" . my_t_d_server_remote_addr() . ".qry")) {
unlink("localsearch_" . my_t_d_server_remote_addr() . ".qry");
}
if (isset($_GET['highlight']) || isset($_POST['highlight'])) {
$doww="";
if (isset($_GET['s'])) $doww=str_replace("'", "`", urldecode(str_replace("+", " ", $_GET['s'])));
if (isset($_POST['s'])) $doww=str_replace("'", "`", urldecode(str_replace("+", " ", $_POST['s'])));
if (isset($_GET['highlight'])) {
if (strlen($_GET['highlight']) > 0) $doww=str_replace("'", "`", urldecode(str_replace("+", " ", $_GET['highlight'])));
}
if (isset($_POST['highlight'])) {
if (strlen($_POST['highlight']) > 0) $doww=str_replace("'", "`", urldecode(str_replace("+", " ", $_POST['highlight'])));
}
echo "\n inlook=\"" . $doww . "\"; \n";
echo "\n setTimeout(highlightsearch,3000); \n";
}
?>
preprecc('wopenallwas');
document.getElementById('searchsubmit').style.display='none';
var wbis=document.getElementById('searchform').action.indexOf("/wordpress"); // /ITblog");
var taglist, catlist;
var tagvar, tagvar2, catvar, catvar2;
if (wbis != -1) {
//catlist=docgetclass('widget-title', 'h3');
catvar=document.getElementById('categories-2').innerHTML.split("href=");
catvar2=document.getElementById('categories-2').innerHTML.split("title=");
} else {
//catlist=docgetclass('widget-title', 'h3');
catvar=document.getElementById('categories-2').innerHTML.split("href=");
catvar2=document.getElementById('categories-2').innerHTML.split("href=");
}
if (wbis != -1 && document.getElementById('tag_cloud-3')) {
//taglist=docgetclass('tagcloud', 'h3');
tagvar=document.getElementById('tag_cloud-3').innerHTML.split("href=");
tagvar2=document.getElementById('tag_cloud-3').innerHTML.split("title=");
} else {
//taglist=docgetclass('tagcloud', 'div');
tagvar=document.getElementById('tag_cloud-2').innerHTML.split("href=");
tagvar2=document.getElementById('tag_cloud-2').innerHTML.split("title=");
}
var sparea, thedelim="", itc, tcval, tctitle;
catselis="<select onchange='ovsel(this, this.value);' id='catselis' style='display:none;'><option value=' '>Categories below ...</option><option value=''>Not shown below ...</option></select>";
tagselis="<select onchange='ovsel(this, this.value);' id='tagselis' style='display:none;'><option value=' '>Popular Tags below ...</option><option value=''>Not shown below ...</option></select>";
for (itc=1; itc<catvar.length; itc++) {
thedelim=catvar[itc].substring(0,1);
tctitle=catvar2[itc].substring(1).replace(">","<").split("<");
if (wbis != -1) {
sparea=catvar[itc].substring(1).split("?cat=");
tcval=sparea[1].split(thedelim);
} else {
sparea=catvar[itc].substring(1).split("/category/");
tcval=sparea[1].split("/");
}
catselis=catselis.replace("</select>", "<option value='" + tcval[0] + "'>" + tctitle[1] + "</option></select>");
}
for (itc=1; itc<tagvar.length; itc++) {
thedelim=tagvar[itc].substring(0,1);
tctitle=tagvar[itc].substring(1).replace(">","<").split("<");
if (wbis != -1) {
sparea=tagvar[itc].substring(1).split("?tag=");
tcval=sparea[1].split(thedelim);
} else {
sparea=tagvar[itc].substring(1).split("/tag/");
tcval=sparea[1].split("/");
}
tagselis=tagselis.replace("</select>", "<option value='" + tcval[0] + "'>" + tctitle[1] + "</option></select>");
}
//formihis = document.getElementById('searchform').innerHTML.replace("</div>", "<input style='display:none;' type='radio' name='stype' value=''><input onclick=\"radiocc('Search');\" type='radio' name='stype' value='Search'>Search<input onclick=\"radiocc('Tag');\" type='radio' name='stype' value='Tag'>Tag<input onclick=\"radiocc('Category');\" type='radio' name='stype' value='Category'>Category<select id='seltc' style='display:none;' onchange=\"tcwindowopen(this.value);\" size='1'><option value=''>Blog Postings below ...</option></select></div>");
//formihis = document.getElementById('searchform').innerHTML.replace("</div>", tagselis + catselis + "<input style='display:none;' type='radio' name='stype' value=''><input onclick=\"radiocc('Search');\" type='radio' name='stype' value='Search'>Se<a title='Welcome to alphabetical search functionality ...' href='#searchform' onclick='alphabeticaltest();' onmouseover='getHighlightedSearch();' onmouseout='yehBut();' ontouchstart='getHighlightedSearch();' ontouchend='yehBut();'><font color=red>a</font></a>rc<a title='Welcome to highlighted search functionality ...' href='#searchform' onclick='highlighttest();'><font color=orange>h</font></a><input onclick=\"radiocc('Tag');\" type='radio' name='stype' value='Tag'><a onclick=\"ovput('Tag');\" title=\"Overlay Tag dropdown ...\" href=\"#tagselis\">Tag</a><input onclick=\"radiocc('Category');\" type='radio' name='stype' value='Category'><a onclick=\"ovput('Category');\" title=\"Overlay Category dropdown ...\" href=\"#catselis\">Category</a><select id='seltc' style='display:none;' onchange=\"window.open(this.value,'_blank');\" size='1'><option value=''>Blog Postings below ...</option></select></div>");

//formihis = document.getElementById('searchform').innerHTML.replace("</div>", tagselis + catselis + "<input style='display:none;' type='radio' name='stype' value=''><input title='Traditional WordPress search ...' style='margin-left:-2px;' onclick=\"radiocc('Search');\" type='radio' name='stype' value='Search'>Se<a title=' ... welcome to the long hover functionality that shows Blog Post regarding Alphabetical Search Functionality' href='#searchform' onclick='alphabeticaltest();' onmouseover='getAlphabeticalSearch();' onmouseout='yehBut();' ontouchstart='getAlphabeticalSearch();' ontouchend='yehBut();'><font color=red>a" + getsupalpha + "</font></a>rc<a title=' ... welcome to the long hover functionality that shows Blog Post regarding Highlighted Search Functionality' href='#searchform' onclick='highlighttest();' onmouseover='getHighlightedSearch();' onmouseout='yehBut();' ontouchstart='getHighlightedSearch();' ontouchend='yehBut();'><font color=orange>h" + getsuphl + "</font></a>  <input title='Popular WordPress Tag in TextBox above search ...' onclick=\"radiocc('Tag');\" type='radio' name='stype' value='Tag'>  <a onclick=\"ovput('Tag');\" title=\"Overlay Tag dropdown ...\" href=\"#tagselis\">Tag</a>  <input title='WordPress Category (string) in TextBox above search ...' onclick=\"radiocc('Category');\" type='radio' name='stype' value='Category'>  <a onclick=\"ovput('Category');\" title=\"Overlay Category dropdown ...\" href=\"#catselis\">Category</a>" + getalpha + "<select id='seltc' style='display:none;' onchange=\"window.open(this.value,'_blank');\" size='1'><option value=''>Blog Postings below ...</option></select></div>");
formihis = document.getElementById('searchform').innerHTML.replace("</div>", tagselis + catselis + "<input style='display:none;' type='radio' name='stype' value=''><input title='Traditional WordPress search ...' style='margin-left:-2px;' onclick=\"radiocc('Search');\" type='radio' name='stype' value='Search'>Se<a title=' ... welcome to the long hover functionality that shows Blog Post regarding Alphabetical Search Functionality' href='#searchform' onclick='alphabeticaltest();' onmouseover='getAlphabeticalSearch();' onmouseout='yehBut();' ontouchstart='getAlphabeticalSearch();' ontouchend='yehBut();'><font color=red>a" + getsupalpha + "</font></a>rc<a title=' ... welcome to the long hover functionality that shows Blog Post regarding Highlighted Search Functionality' href='#searchform' onclick='highlighttest();' onmouseover='getHighlightedSearch();' onmouseout='yehBut();' ontouchstart='getHighlightedSearch();' ontouchend='yehBut();'><font color=orange>h" + getsuphl + "</font></a><input title='Popular WordPress Tag in TextBox above search ...' onclick=\"radiocc('Tag');\" type='radio' name='stype' value='Tag'> <a onclick=\"ovput('Tag');\" title=\"Overlay Tag dropdown ...\" href=\"#tagselis\">Tag</a><input title='WordPress Category (string) in TextBox above search ...' onclick=\"radiocc('Category');\" type='radio' name='stype' value='Category'>  <a onclick=\"ovput('Category');\" title=\"Overlay Category dropdown ...\" href=\"#catselis\">Category</a><input title='WordPress Blog Posting Title RegExp search ...' onclick=\"asksr();\" type='checkbox' id='scbtype' value='Title RE'><a style='cursor;pointer;text-decoration;underline;' title='WordPress Blog Posting Title RegExp search ...' onclick=\"asksr();\">Title RE</a>" + getalpha + "<select id='seltc' style='display:none;' onchange=\"window.open(this.value,'_blank');\" size='1'><option value=''>Blog Postings below ...</option></select></div>");

formihis = formihis.replace("input id", "input onblur='preradiocc();' id");
document.getElementById('searchform').innerHTML = formihis;
document.getElementById('s').onblur = preradiocc;
if (wa == "") {
document.getElementById('s').style.width='55%';
}
<?php
$tblurb="";
if (isset($_GET['wopenall'])) {
$tpage=1;
$furl="";
$sru=explode("?", $_SERVER['REQUEST_URI']);
if (isset($_GET['paged'])) {
$tpage=$_GET['paged'];
//$nurl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . str_replace("paged=" . $tpage, "paged=" . ($tpage + 1), $_SERVER['QUERY_STRING']);
//$furl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . str_replace("paged=" . $tpage, "paged=1", $_SERVER['QUERY_STRING']);
$nurl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . str_replace("paged=" . $tpage, "paged=" . ($tpage + 1), $_SERVER['QUERY_STRING']);
$furl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . str_replace("paged=" . $tpage, "paged=1", $_SERVER['QUERY_STRING']);
} else if (isset($_GET['tag']) || isset($_GET['cat']) || isset($_GET['s'])) {
//$nurl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . $_SERVER['QUERY_STRING'] . "&paged=2";
//if (1 == 2) $furl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . $_SERVER['QUERY_STRING'] . "&paged=1";
$nurl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . $_SERVER['QUERY_STRING'] . "&paged=2";
if (1 == 2) $furl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . $_SERVER['QUERY_STRING'] . "&paged=1";
} else if (strpos("/wordpress/", $_SERVER['REQUEST_URI']) !== false) {
//$nurl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . str_replace("wopenall=", "s=", $_SERVER['QUERY_STRING']);
$nurl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . str_replace("wopenall=", "s=", $_SERVER['QUERY_STRING']);
$tblurb = " location.href='" . $nurl . "'; \n";
} else {
$tstuff=explode("page/", $sru[0]);
if (sizeof($tstuff) > 1) {
$tstu=explode("/", $tstuff[1]);
$tpage=$tstu[0];
//$nurl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . str_replace("/" . $tpage, "/" . ($tpage + 1), $sru[0]) . "?" . $_SERVER['QUERY_STRING'];
//$furl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . str_replace("/" . $tpage, "/1", $sru[0]) . "?" . $_SERVER['QUERY_STRING'];
$nurl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . str_replace("/" . $tpage, "/" . ($tpage + 1), $sru[0]) . "?" . $_SERVER['QUERY_STRING'];
$furl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . str_replace("/" . $tpage, "/1", $sru[0]) . "?" . $_SERVER['QUERY_STRING'];
} else {
//$nurl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "/page/2/" . "?" . $_SERVER['QUERY_STRING'];
//if (1 == 2) $furl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "/page/1/" . "?" . $_SERVER['QUERY_STRING'];
$nurl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "/page/2/" . "?" . $_SERVER['QUERY_STRING'];
if (1 == 2) $furl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "/page/1/" . "?" . $_SERVER['QUERY_STRING'];
}
}
if ($tblurb == "") {
$tblurb = " ourtcprefix=location.search.split('tcprefix=')[1] ? location.search.split('tcprefix=')[1].split('&')[0] : ''; \n";
$tblurb .= " ourtcdelay=location.search.split('tcdelay=')[1] ? location.search.split('tcdelay=')[1].split('&')[0] : 0; \n";
$tblurb .= " var ourwov=location.search.split('wopenall=')[1] ? location.search.split('wopenall=')[1].split('&')[0] : ' '; \n";
$tblurb .= " var ourhl=location.search.split('highlight=')[1] ? location.search.split('highlight=')[1].split('&')[0] : ''; \n";
$tblurb .= " var ows, owt, owstwo, owttwo='', iot, hl=1; \n";
$tblurb .= " if (ourwov != ' ') { \n";
$tblurb .= " var hones=docgetclass('entry-title', 'h2'); \n";
$tblurb .= " hl=hones.length; \n";
$tblurb .= " if (hones.length > 0) { \n";
$tblurb .= " for (iot=0; iot<hones.length; iot++) { \n";
$tblurb .= " if (hones[iot].innerHTML.indexOf('Not Found') != -1) hl=eval(-1 + hl); \n";
$tblurb .= " if (ourwov == '' || cntsuffixmore(hones[iot].innerHTML).toLowerCase().indexOf(decodeURIComponent(ourwov.replace('+', '%20').replace('+', '%20').replace('+', '%20').replace('+', '%20').toLowerCase())) != -1) { \n";
$tblurb .= " owt=hones[iot].innerHTML.split('title='); \n";
$tblurb .= " ows=hones[iot].innerHTML.split('href='); \n owttwo=''; ";
$tblurb .= " if (owt.length > 1) { \n";
$tblurb .= " owttwo=(owt[1] + ' ').substring(1).split(owt[1].substring(0,1))[0].split('>')[0].replace('Permalink to','').trim(); } \n";
$tblurb .= " if (ows.length > 1) { \n";
$tblurb .= " owstwo=ows[1].substring(1).split(ows[1].substring(0,1)); \n";
$tblurb .= " if (ourhl != '' && owstwo[0].indexOf('?') != -1) { owstwo[0]+=('&highlight=' + ourhl); } \n";
$tblurb .= " else if (ourhl != '' && owstwo[0].indexOf('?') == -1) { owstwo[0]+=('?highlight=' + ourhl); } \n";
$tblurb .= " if ((ourtcprefix == '!' || tcprefix == '!') || (ourtcprefix == '|' || tcprefix == '|') || (ourtcprefix == '+' || tcprefix == '+') || (ourtcprefix == '*' || tcprefix == '*') || (ourtcprefix != '' || tcprefix != '') || (ourtcdelay != 0 || tcdelay != 0)) { if ((ourtcprefix == '!' || tcprefix == '!') || (ourtcprefix == '|' || tcprefix == '|') || (ourtcprefix == '+' || tcprefix == '+') || (ourtcprefix == '*' || tcprefix == '*')) { top.document.getElementById('seltc').style.display='block'; } else { optcol='lightgreen'; } top.document.getElementById('seltc').innerHTML += '<option id=\"tco' + iot + '\" onmouseover=\"getSws(event);\" onmouseout=\"yehbut();\" ontouchstart=\"getSws(event);\" ontouchend=\"yehbut();\" title=\"... you can wait for the long hover functionality for a Blog Post Preview\" style=\"background-color:' + optcol + ';\" value=\"' + owstwo[0] + '\">' + hones[iot].innerHTML + '</option>'; } else { if (1 == 1) { window.opener.offurls.push(jshow(owstwo[0],owttwo)); } else { window.open(owstwo[0], '_blank'); } } \n";
$tblurb .= " } \n";
$tblurb .= " } \n";
$tblurb .= " } console.log(' window.opener.offurls.length=' + window.opener.offurls.length); if (1 == 11) { setTimeout(jshowdet,1000); } else { document.getElementById('justshow').innerHTML=window.opener.document.getElementById('justshow').innerHTML; document.getElementById('justshow').style.display='none'; window.opener.document.getElementById('justshow').style.display='none'; } \n";
$tblurb .= " hones=docgetclass('nav-previous', 'div'); \n";
$tblurb .= " if (hones.length > 0 && ((tcprefix == '!' || tcprefix == '+' || tcprefix == '|' || tcprefix == '*'))) { \n";
if (strpos($nurl, "/page/2/") !== false || strpos($nurl, "paged=2") !== false) {
//$tblurb .= " location.href = '" . $nurl . "#' + window.opener.offurls.length; \n";
//$tblurb .= " offchild=window.open('" . $nurl . "#' + window.opener.offurls.length,'_self'); \n";
//$tblurb .= " document.getElementsByTagName('iframe')[0].src = '" . $nurl . "#' + window.opener.offurls.length; \n";
$tblurb .= " window.opener.backatparent('" . $nurl . "#' + (cntsuffix + ' ').substring(1).trim() + window.opener.offurls.length); \n";
} else {
//$tblurb .= " location.href = '" . $nurl . "#' + window.opener.offurls.length; \n";
//$tblurb .= " offchild=window.open('" . $nurl . "#' + window.opener.offurls.length,'_self'); \n";
//$tblurb .= " document.getElementsByTagName('iframe')[0].src = '" . $nurl . "#' + window.opener.offurls.length; \n";
$tblurb .= " window.opener.backatparent('" . $nurl . "#' + (cntsuffix + ' ').substring(1).trim() + window.opener.offurls.length); \n";
}
$tblurb .= " } else if (hones.length > 0) { \n";
//$tblurb .= " location.href = '" . $nurl . "#' + window.opener.offurls.length; \n";
//$tblurb .= " offchild=window.open('" . $nurl . "#' + window.opener.offurls.length,'_self'); \n";
//$tblurb .= " document.getElementsByTagName('iframe')[0].src = '" . $nurl . "#' + window.opener.offurls.length; \n";
$tblurb .= " window.opener.backatparent('" . $nurl . "#' + (cntsuffix + ' ').substring(1).trim() + window.opener.offurls.length); \n";
$tblurb .= " } else { \n";
$tblurb .= " preprecc('wopenall'); \n";
$tblurb .= " } \n";
$tblurb .= " } \n";
if ($furl != "") $tblurb .= " if (hl == 0) { \n";
//if ($furl != "") $tblurb .= " location.href = '" . str_replace("wopenall=", "wopenallwas=", $furl) . "#' + window.opener.offurls.length; \n";
//if ($furl != "") $tblurb .= " offchild=window.open('" . str_replace("wopenall=", "wopenallwas=", $furl) . "#' + window.opener.offurls.length,'_self'); \n";
//if ($furl != "") $tblurb .= " document.getElementsByTagName('iframe')[0].src = '" . str_replace("wopenall=", "wopenallwas=", $furl) . "#' + window.opener.offurls.length; \n";
if ($furl != "") $tblurb .= " window.opener.backatparent('" . str_replace("wopenall=", "wopenallwas=", $furl) . "#' + (cntsuffix + ' ').substring(1).trim() + window.opener.offurls.length); \n";
if ($furl != "") $tblurb .= " } \n";
$tblurb .= " } \n";
}
echo $tblurb;
}
?>
return true;
}

function backatparentclosingchild() {
if (!cntthrough) { return ''; }
if (offchild != null) {
console.log(offchild.document.URL);
var odu=offchild.document.URL;
if (odu.replace('?cat=','/category/').replace('?category=','/category/').split('/category/').length > 1) {
prehgsuffix=decodeURIComponent(odu.replace('?cat=','/category/').replace('?category=','/category/').split('/category/')[1].split('/')[0]).substring(0,1).toUpperCase() + decodeURIComponent(odu.replace('?cat=','/category/').replace('?category=','/category/').split('/category/')[1].split('/')[0] + ' ').substring(1).trim().replace(/\-/g,' ') + ' | Robert James Metcalfe Blog';
} else if (odu.replace('?tag=','/tag/').split('/tag/').length > 1) {
prehgsuffix=decodeURIComponent(odu.replace('?tag=','/tag/').split('/tag/')[1].split('/')[0]).substring(0,1).toUpperCase() + decodeURIComponent(odu.replace('?tag=','/tag/').split('/tag/')[1].split('/')[0] + ' ').substring(1).trim().replace(/\-/g,' ') + ' | Robert James Metcalfe Blog';
}
offchild.close();
offchild=null;
if (odu.indexOf('all=') != -1) {
if (odu.replace('?','/').indexOf('/cat') != -1) {
xxsuffix=' ... searching for ' + decodeURIComponent(odu.split('all=')[1].split('&')[0].split('#')[0]) + ' (within that category)';
} else if (odu.replace('?','/').indexOf('/tag') != -1) {
xxsuffix=' ... searching for ' + decodeURIComponent(odu.split('all=')[1].split('&')[0].split('#')[0]) + ' (within that tag)';
} else {
xxsuffix=' ... searching for ' + decodeURIComponent(odu.split('all=')[1].split('&')[0].split('#')[0]);
}
if (cntsuffix != '') { xxsuffix=xxsuffix.replace('... searching for ','... searching all posting content for '); }
}
if (odu.indexOf('highlight=') != -1) {
console.log('odu=' + odu);
hgsuffix=decodeURIComponent(odu.split('highlight=')[1].split('&')[0].split('#')[0]).replace(/\'/g, '`');
console.log('hgsuffix=' + hgsuffix);
}
if (offchildclose) {
if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
document.getElementById('jshowd').style.zIndex='999';
document.getElementById('jshowd').style.position='fixed';
document.getElementById('jshowd').style.backgroundColor='yellow';
document.getElementById('jshowd').style.border='2px dotted red';
document.getElementById('jshowd').style.left='10px';
document.getElementById('jshowd').style.top='5px';
document.getElementById('jshowd').style.display='block';
document.getElementById('jshowd').click();
} else {
jshowdet();
}
clearInterval(offchildclose);
}
}
}

function backatparent(bapurl) {
if (offchild != null) {
if (offchildclose) { clearInterval(offchildclose); offchildclose=null; }
offchild.close();
offchild=null;
}
if (offchildclose) { clearInterval(offchildclose); offchildclose=null; }
if (cntsuffix != '') { cntthrough=false; }
offchild=window.open(bapurl, '_blank');
offchildclose = setInterval(backatparentclosingchild, cntsuffft);
}

function jshowdet() {
var xsuffix=xxsuffix;
if (prehgsuffix == '') { prehgsuffix=document.title; } else if (prehgsuffix.toUpperCase() == 'IOS') { prehgsuffix='iOS'; } else if (prehgsuffix.toUpperCase() == 'IPHONE') { prehgsuffix='iPhone'; } else if (prehgsuffix.toUpperCase() == 'IPAD') { prehgsuffix='iPad'; } else if (prehgsuffix.toUpperCase() == 'IPOD') { prehgsuffix='iPod'; } else if (prehgsuffix.toUpperCase() == 'MACOS') { prehgsuffix='macOS'; } else if (prehgsuffix.toUpperCase() == 'MAC OS X') { prehgsuffix='Mac OS X'; }
//window.focus();
if (document.URL.indexOf('all=') != -1 && xxsuffix == '') {
xsuffix=' ... searching for ' + decodeURIComponent(document.URL.split('all=')[1].split('&')[0].split('#')[0]);
}
if (window.opener && xxsuffix == '') {
if (window.opener.document.URL.indexOf('all=') != -1) {
xsuffix=' ... searching for ' + decodeURIComponent(window.opener.document.URL.split('all=')[1].split('&')[0].split('#')[0]);
}
}
var hgf=null;
if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
hgf=window.open('','_blank'); //,'top=50,left=50,width=900,height=900');
} else {
hgf=window.open('','_blank','top=50,left=50,width=900,height=900');
}
var tsuffix='';
hgf.onload = function () {
if (document.URL.indexOf('all=') != -1) {
hgf.document.title = prehgsuffix + ' ... searching for ' + document.URL.split('all=')[eval(-1 + document.URL.split('all=').length)];
} else {
hgf.document.title = prehgsuffix; // + ' ... searching for ' + document.URL.split('all=')[eval(-1 + document.URL.split('all=').length)];
}
}
if (document.URL.indexOf('all=') != -1) {
tsuffix = '<title>' + prehgsuffix + ' ... searching for ' + decodeURIComponent(document.URL.split('all=')[eval(-1 + document.URL.split('all=').length)].split('&')[0].split('#')[0]) + '</title>';
} else {
tsuffix = '<title>' + prehgsuffix + xsuffix + '</title>'; // + ' ... searching for ' + document.URL.split('all=')[eval(-1 + document.URL.split('all=').length)];
}
//alert(document.URL + ' ... ' + document.title);
//if (window.opener) { alert(window.opener.document.URL + ' ... ' + window.opener.document.title); }
if (document.getElementById('justshow').innerHTML != '') {
hgf.document.write('<html><head>' + tsuffix + ' <style> #justshow { width:100%; } details { width:100%; } summary { background-color: #f0f0f0; font-weight: bold; } </style></head><body> ' + document.getElementById('justshow').outerHTML.replace('none','block') + '</body></html>');
} else {
hgf.document.write('<html><head>' + tsuffix + ' <style> #justshow { width:100%; } details { width:100%; } summary { background-color: #f0f0f0; font-weight: bold; } </style></head><body> ' + window.opener.document.getElementById('justshow').outerHTML.replace('none','block') + '</body></html>');
}
}

function jshow(inuis, inttwo) {
if (hgsuffix != '' && inuis.indexOf('highlight=') == -1) { if (inuis.indexOf('?') != -1) { inuis+='&highlight=' + encodeURIComponent(hgsuffix); } else { inuis+='?highlight=' + encodeURIComponent(hgsuffix); } }
if (inttwo == '') { inttwo=inuis; } // else if (inttwo.indexOf('bookmark') != -1 && inttwo.indexOf(' Tutorial') != -1) { inttwo=inttwo.split('bookmark')[1].substring(2).split(' Tutorial')[0] + ' Tutorial'; } else { alert(inttwo + ' ... ' + decodeURIComponent(inttwo)); }
if (hgsuffix != '') {
var wds=(' ' + inttwo + ' ');
var awds=wds.split(' ');
for (var iwds=1; iwds<awds.length; iwds++) {
if (awds[iwds].toLowerCase() == hgsuffix.toLowerCase().replace(/\`/g,"'")) {
inttwo=inttwo.replace(awds[iwds], '<mark>' + awds[iwds] + '</mark>');
}
}
}
if (window.opener.document.getElementById('justshow').innerHTML == '') {
window.opener.document.getElementById('justshow').innerHTML='<div id=theurls style=width:100%;></div>';
window.opener.document.getElementById('justshow').innerHTML=window.opener.document.getElementById('justshow').innerHTML.replace('</div>', '<details id=detl0><summary>' + inttwo + '</summary><iframe style=width:100%;height:900px; src=' + inuis + '></iframe></details><br></div>');
//window.opener.document.getElementById('justshow').style.display='block';
} else {
var huhd=window.opener.document.getElementById('justshow').innerHTML.split('<details').length;
window.opener.document.getElementById('justshow').innerHTML=window.opener.document.getElementById('justshow').innerHTML.replace('</div>', '<details id=detl' + huhd + ' onclick="document.getElementById(' + "'divl" + huhd + "'" + ').innerHTML=' + "'" + '<iframe style=width:100%;height:900px; src=' + inuis + '></iframe>' + "';" + '"><summary onclick="document.getElementById(' + "'divl" + huhd + "'" + ').innerHTML=' + "'" + '<iframe style=width:100%;height:900px; src=' + inuis + '></iframe>' + "';" + '">' + inttwo + '</summary><span id=divl' + huhd + '></span></details><br></div>');
}
//alert(window.opener.document.getElementById('justshow').innerHTML);
return inuis;
}

?>

Some new HTML …


<a id="jshowd" onclick="jshowdet();" style="display:none;">Click me for Search Report if Not Already Showing</a>

… is used with mobile platforms, enabling taps before window.open operations.

And finally new external Javascript …


<script type='text/javascript' src='//www.rjmprogramming.com.au/marquee_placeholder.js'></script>

teams up with

<?php

if (document.getElementById('s')) {
document.getElementById('s').placeholder='Space appended compares to whole posting content';
}


?>

… to make the Search input type=textbox into a “Marquee Placeholder” functioning one, as we talked about with yesterday’s Marquee Placeholder Primer Tutorial, to help explain this new Search with Search blog posting content functionality to the user.

Worth trying!


Previous relevant WordPress Blog Search Within Search Reveal Tutorial is shown below.

WordPress Blog Search Within Search Reveal Tutorial

WordPress Blog Search Within Search Reveal Tutorial

We’re revisiting WordPress Blog (Twenty Ten theme) inhouse “Search within Search” functionality related to WordPress Blog Search Within Search Overlay Tutorial from way back when.

We think it’s awkward the way that previous “Search within Search” methodologies would keep opening new tabs in the web browser. This could end in a meltdown for a very common “Search within Search”. It also is not a succinct way to display the findings.

Since those “long ago days” we’ve been using, a lot, our favourite “reveal” pairing of HTML5 details/summary HTML element combination, and the redesign today is going to add a lot more succinctness to the whole set of methodologies here, we think you’ll find!

Another great help here, as far as the webpage to webpage navigation goes is to no longer “location.href=[nextURL]” it but rather …


offchild=window.open([nextURL], '_self');

… (style of doing) it, and in so doing, the original search webpage can be a parent sending off its “initial lieutenant” webpage and then onto subsequent webpages opened in this “window.open” way (in our WordPress blog’s Twenty Ten theme’s good ol’ header.php) …

<?php echo ”

var offurls=[];
var offchild=null;
var offchildclose=null;

function backatparent(bapurl) {
if (offchild != null) { if (offchildclose) { clearInterval(offchildclose); } offchild.close(); offchild=null; }
offchild=window.open(bapurl, '_blank');
offchildclose = setInterval(backatparentclosingchild, 8000);
}

“; ?>

… so that the “non lieutenant” windows can be closed as the process continues (concertinaing away) until a WordPress 404.php window like discussed with yesterday’s WordPress Error 404 Primer Tutorial is the final webpage in the chain …

<?php echo ”

var xxsuffix='';
var hgsuffix='';
var prehgsuffix='';

function backatparentclosingchild() {
if (offchild != null) {
console.log(offchild.document.URL);
var odu=offchild.document.URL;
if (odu.replace('?cat=','/category/').replace('?category=','/category/').split('/category/').length > 1) {
prehgsuffix=decodeURIComponent(odu.replace('?cat=','/category/').replace('?category=','/category/').split('/category/')[1].split('/')[0]).substring(0,1).toUpperCase() + decodeURIComponent(odu.replace('?cat=','/category/').replace('?category=','/category/').split('/category/')[1].split('/')[0] + ' ').substring(1).trim().replace(/\-/g,' ') + ' | Robert James Metcalfe Blog';
} else if (odu.replace('?tag=','/tag/').split('/tag/').length > 1) {
prehgsuffix=decodeURIComponent(odu.replace('?tag=','/tag/').split('/tag/')[1].split('/')[0]).substring(0,1).toUpperCase() + decodeURIComponent(odu.replace('?tag=','/tag/').split('/tag/')[1].split('/')[0] + ' ').substring(1).trim().replace(/\-/g,' ') + ' | Robert James Metcalfe Blog';
}
offchild.close();
offchild=null;
if (odu.indexOf('all=') != -1) {
if (odu.replace('?','/').indexOf('/cat') != -1) {
xxsuffix=' ... searching for ' + decodeURIComponent(odu.split('all=')[1].split('&')[0].split('#')[0]) + ' (within that category)';
} else if (odu.replace('?','/').indexOf('/tag') != -1) {
xxsuffix=' ... searching for ' + decodeURIComponent(odu.split('all=')[1].split('&')[0].split('#')[0]) + ' (within that tag)';
} else {
xxsuffix=' ... searching for ' + decodeURIComponent(odu.split('all=')[1].split('&')[0].split('#')[0]);
}
}
if (odu.indexOf('highlight=') != -1) {
console.log('odu=' + odu);
hgsuffix=decodeURIComponent(odu.split('highlight=')[1].split('&')[0].split('#')[0]).replace(/\'/g, '`');
console.log('hgsuffix=' + hgsuffix);
}
if (offchildclose) {
jshowdet();
clearInterval(offchildclose);
}
}
}

… displaying the findings …

<?php echo ”

function jshowdet() {
var xsuffix=xxsuffix;
if (prehgsuffix == '') { prehgsuffix=document.title; } else if (prehgsuffix.toUpperCase() == 'IOS') { prehgsuffix='iOS'; } else if (prehgsuffix.toUpperCase() == 'IPHONE') { prehgsuffix='iPhone'; } else if (prehgsuffix.toUpperCase() == 'IPAD') { prehgsuffix='iPad'; } else if (prehgsuffix.toUpperCase() == 'IPOD') { prehgsuffix='iPod'; } else if (prehgsuffix.toUpperCase() == 'MACOS') { prehgsuffix='macOS'; } else if (prehgsuffix.toUpperCase() == 'MAC OS X') { prehgsuffix='Mac OS X'; }
//window.focus();
if (document.URL.indexOf('all=') != -1 && xxsuffix == '') {
xsuffix=' ... searching for ' + decodeURIComponent(document.URL.split('all=')[1].split('&')[0].split('#')[0]);
}
if (window.opener && xxsuffix == '') {
if (window.opener.document.URL.indexOf('all=') != -1) {
xsuffix=' ... searching for ' + decodeURIComponent(window.opener.document.URL.split('all=')[1].split('&')[0].split('#')[0]);
}
}
var hgf=window.open('','_blank','top=50,left=50,width=900,height=900');
var tsuffix='';
hgf.onload = function () {
if (document.URL.indexOf('all=') != -1) {
hgf.document.title = prehgsuffix + ' ... searching for ' + document.URL.split('all=')[eval(-1 + document.URL.split('all=').length)];
} else {
hgf.document.title = prehgsuffix; // + ' ... searching for ' + document.URL.split('all=')[eval(-1 + document.URL.split('all=').length)];
}
}
if (document.URL.indexOf('all=') != -1) {
tsuffix = '<title>' + prehgsuffix + ' ... searching for ' + decodeURIComponent(document.URL.split('all=')[eval(-1 + document.URL.split('all=').length)].split('&')[0].split('#')[0]) + '</title>';
} else {
tsuffix = '<title>' + prehgsuffix + xsuffix + '</title>'; // + ' ... searching for ' + document.URL.split('all=')[eval(-1 + document.URL.split('all=').length)];
}
//alert(document.URL + ' ... ' + document.title);
//if (window.opener) { alert(window.opener.document.URL + ' ... ' + window.opener.document.title); }
if (document.getElementById('justshow').innerHTML != '') {
hgf.document.write(tsuffix + ' <style> #justshow { width:100%; } details { width:100%; } summary { background-color: #f0f0f0; font-weight: bold; } </style> ' + document.getElementById('justshow').outerHTML.replace('none','block'));
} else {
hgf.document.write(tsuffix + ' <style> #justshow { width:100%; } details { width:100%; } summary { background-color: #f0f0f0; font-weight: bold; } </style> ' + window.opener.document.getElementById('justshow').outerHTML.replace('none','block'));
}
}

“; ?>

… and the build up of that report stems from a changed codeset (featuring a new window.opener arrangement function friend call) …

<?php echo ”

function precc() { // wopenall= functionality
var wa=wasaction;
if (wasaction == "") {
document.getElementById('s').style.width='55%';
wasaction=document.getElementById('searchform').action;
}
<?php
if ((isset($_GET['byorder']) || isset($_POST['byorder'])) && (isset($_GET['s']) || isset($_POST['s']))) {
if (isset($_GET['byorder'])) file_put_contents("localsearch_" . my_t_d_server_remote_addr() . ".qry", urldecode($_GET['byorder']));
if (isset($_POST['byorder'])) file_put_contents("localsearch_" . my_t_d_server_remote_addr() . ".qry", urldecode($_POST['byorder']));
echo "\n setTimeout(muchlater, 30000); \n";
} else if (file_exists("localsearch_" . my_t_d_server_remote_addr() . ".qry")) {
unlink("localsearch_" . my_t_d_server_remote_addr() . ".qry");
}
if (isset($_GET['highlight']) || isset($_POST['highlight'])) {
$doww="";
if (isset($_GET['s'])) $doww=str_replace("'", "`", urldecode(str_replace("+", " ", $_GET['s'])));
if (isset($_POST['s'])) $doww=str_replace("'", "`", urldecode(str_replace("+", " ", $_POST['s'])));
if (isset($_GET['highlight'])) {
if (strlen($_GET['highlight']) > 0) $doww=str_replace("'", "`", urldecode(str_replace("+", " ", $_GET['highlight'])));
}
if (isset($_POST['highlight'])) {
if (strlen($_POST['highlight']) > 0) $doww=str_replace("'", "`", urldecode(str_replace("+", " ", $_POST['highlight'])));
}
echo "\n inlook=\"" . $doww . "\"; \n";
echo "\n setTimeout(highlightsearch,3000); \n";
}
?>
preprecc('wopenallwas');
document.getElementById('searchsubmit').style.display='none';
var wbis=document.getElementById('searchform').action.indexOf("/wordpress"); // /ITblog");
var taglist, catlist;
var tagvar, tagvar2, catvar, catvar2;
if (wbis != -1) {
//catlist=docgetclass('widget-title', 'h3');
catvar=document.getElementById('categories-2').innerHTML.split("href=");
catvar2=document.getElementById('categories-2').innerHTML.split("title=");
} else {
//catlist=docgetclass('widget-title', 'h3');
catvar=document.getElementById('categories-2').innerHTML.split("href=");
catvar2=document.getElementById('categories-2').innerHTML.split("href=");
}
if (wbis != -1 && document.getElementById('tag_cloud-3')) {
//taglist=docgetclass('tagcloud', 'h3');
tagvar=document.getElementById('tag_cloud-3').innerHTML.split("href=");
tagvar2=document.getElementById('tag_cloud-3').innerHTML.split("title=");
} else {
//taglist=docgetclass('tagcloud', 'div');
tagvar=document.getElementById('tag_cloud-2').innerHTML.split("href=");
tagvar2=document.getElementById('tag_cloud-2').innerHTML.split("title=");
}
var sparea, thedelim="", itc, tcval, tctitle;
catselis="<select onchange='ovsel(this, this.value);' id='catselis' style='display:none;'><option value=' '>Categories below ...</option><option value=''>Not shown below ...</option></select>";
tagselis="<select onchange='ovsel(this, this.value);' id='tagselis' style='display:none;'><option value=' '>Popular Tags below ...</option><option value=''>Not shown below ...</option></select>";
for (itc=1; itc<catvar.length; itc++) {
thedelim=catvar[itc].substring(0,1);
tctitle=catvar2[itc].substring(1).replace(">","<").split("<");
if (wbis != -1) {
sparea=catvar[itc].substring(1).split("?cat=");
tcval=sparea[1].split(thedelim);
} else {
sparea=catvar[itc].substring(1).split("/category/");
tcval=sparea[1].split("/");
}
catselis=catselis.replace("</select>", "<option value='" + tcval[0] + "'>" + tctitle[1] + "</option></select>");
}
for (itc=1; itc<tagvar.length; itc++) {
thedelim=tagvar[itc].substring(0,1);
tctitle=tagvar[itc].substring(1).replace(">","<").split("<");
if (wbis != -1) {
sparea=tagvar[itc].substring(1).split("?tag=");
tcval=sparea[1].split(thedelim);
} else {
sparea=tagvar[itc].substring(1).split("/tag/");
tcval=sparea[1].split("/");
}
tagselis=tagselis.replace("</select>", "<option value='" + tcval[0] + "'>" + tctitle[1] + "</option></select>");
}
//formihis = document.getElementById('searchform').innerHTML.replace("</div>", "<input style='display:none;' type='radio' name='stype' value=''><input onclick=\"radiocc('Search');\" type='radio' name='stype' value='Search'>Search<input onclick=\"radiocc('Tag');\" type='radio' name='stype' value='Tag'>Tag<input onclick=\"radiocc('Category');\" type='radio' name='stype' value='Category'>Category<select id='seltc' style='display:none;' onchange=\"tcwindowopen(this.value);\" size='1'><option value=''>Blog Postings below ...</option></select></div>");
//formihis = document.getElementById('searchform').innerHTML.replace("</div>", tagselis + catselis + "<input style='display:none;' type='radio' name='stype' value=''><input onclick=\"radiocc('Search');\" type='radio' name='stype' value='Search'>Se<a title='Welcome to alphabetical search functionality ...' href='#searchform' onclick='alphabeticaltest();' onmouseover='getHighlightedSearch();' onmouseout='yehBut();' ontouchstart='getHighlightedSearch();' ontouchend='yehBut();'><font color=red>a</font></a>rc<a title='Welcome to highlighted search functionality ...' href='#searchform' onclick='highlighttest();'><font color=orange>h</font></a><input onclick=\"radiocc('Tag');\" type='radio' name='stype' value='Tag'><a onclick=\"ovput('Tag');\" title=\"Overlay Tag dropdown ...\" href=\"#tagselis\">Tag</a><input onclick=\"radiocc('Category');\" type='radio' name='stype' value='Category'><a onclick=\"ovput('Category');\" title=\"Overlay Category dropdown ...\" href=\"#catselis\">Category</a><select id='seltc' style='display:none;' onchange=\"window.open(this.value,'_blank');\" size='1'><option value=''>Blog Postings below ...</option></select></div>");

//formihis = document.getElementById('searchform').innerHTML.replace("</div>", tagselis + catselis + "<input style='display:none;' type='radio' name='stype' value=''><input title='Traditional WordPress search ...' style='margin-left:-2px;' onclick=\"radiocc('Search');\" type='radio' name='stype' value='Search'>Se<a title=' ... welcome to the long hover functionality that shows Blog Post regarding Alphabetical Search Functionality' href='#searchform' onclick='alphabeticaltest();' onmouseover='getAlphabeticalSearch();' onmouseout='yehBut();' ontouchstart='getAlphabeticalSearch();' ontouchend='yehBut();'><font color=red>a" + getsupalpha + "</font></a>rc<a title=' ... welcome to the long hover functionality that shows Blog Post regarding Highlighted Search Functionality' href='#searchform' onclick='highlighttest();' onmouseover='getHighlightedSearch();' onmouseout='yehBut();' ontouchstart='getHighlightedSearch();' ontouchend='yehBut();'><font color=orange>h" + getsuphl + "</font></a>  <input title='Popular WordPress Tag in TextBox above search ...' onclick=\"radiocc('Tag');\" type='radio' name='stype' value='Tag'>  <a onclick=\"ovput('Tag');\" title=\"Overlay Tag dropdown ...\" href=\"#tagselis\">Tag</a>  <input title='WordPress Category (string) in TextBox above search ...' onclick=\"radiocc('Category');\" type='radio' name='stype' value='Category'>  <a onclick=\"ovput('Category');\" title=\"Overlay Category dropdown ...\" href=\"#catselis\">Category</a>" + getalpha + "<select id='seltc' style='display:none;' onchange=\"window.open(this.value,'_blank');\" size='1'><option value=''>Blog Postings below ...</option></select></div>");
formihis = document.getElementById('searchform').innerHTML.replace("</div>", tagselis + catselis + "<input style='display:none;' type='radio' name='stype' value=''><input title='Traditional WordPress search ...' style='margin-left:-2px;' onclick=\"radiocc('Search');\" type='radio' name='stype' value='Search'>Se<a title=' ... welcome to the long hover functionality that shows Blog Post regarding Alphabetical Search Functionality' href='#searchform' onclick='alphabeticaltest();' onmouseover='getAlphabeticalSearch();' onmouseout='yehBut();' ontouchstart='getAlphabeticalSearch();' ontouchend='yehBut();'><font color=red>a" + getsupalpha + "</font></a>rc<a title=' ... welcome to the long hover functionality that shows Blog Post regarding Highlighted Search Functionality' href='#searchform' onclick='highlighttest();' onmouseover='getHighlightedSearch();' onmouseout='yehBut();' ontouchstart='getHighlightedSearch();' ontouchend='yehBut();'><font color=orange>h" + getsuphl + "</font></a><input title='Popular WordPress Tag in TextBox above search ...' onclick=\"radiocc('Tag');\" type='radio' name='stype' value='Tag'> <a onclick=\"ovput('Tag');\" title=\"Overlay Tag dropdown ...\" href=\"#tagselis\">Tag</a><input title='WordPress Category (string) in TextBox above search ...' onclick=\"radiocc('Category');\" type='radio' name='stype' value='Category'>  <a onclick=\"ovput('Category');\" title=\"Overlay Category dropdown ...\" href=\"#catselis\">Category</a><input title='WordPress Blog Posting Title RegExp search ...' onclick=\"asksr();\" type='checkbox' id='scbtype' value='Title RE'><a style='cursor;pointer;text-decoration;underline;' title='WordPress Blog Posting Title RegExp search ...' onclick=\"asksr();\">Title RE</a>" + getalpha + "<select id='seltc' style='display:none;' onchange=\"window.open(this.value,'_blank');\" size='1'><option value=''>Blog Postings below ...</option></select></div>");

formihis = formihis.replace("input id", "input onblur='preradiocc();' id");
document.getElementById('searchform').innerHTML = formihis;
document.getElementById('s').onblur = preradiocc;
if (wa == "") {
document.getElementById('s').style.width='55%';
}
<?php
$tblurb="";
if (isset($_GET['wopenall'])) {
$tpage=1;
$furl="";
$sru=explode("?", $_SERVER['REQUEST_URI']);
if (isset($_GET['paged'])) {
$tpage=$_GET['paged'];
//$nurl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . str_replace("paged=" . $tpage, "paged=" . ($tpage + 1), $_SERVER['QUERY_STRING']);
//$furl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . str_replace("paged=" . $tpage, "paged=1", $_SERVER['QUERY_STRING']);
$nurl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . str_replace("paged=" . $tpage, "paged=" . ($tpage + 1), $_SERVER['QUERY_STRING']);
$furl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . str_replace("paged=" . $tpage, "paged=1", $_SERVER['QUERY_STRING']);
} else if (isset($_GET['tag']) || isset($_GET['cat']) || isset($_GET['s'])) {
//$nurl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . $_SERVER['QUERY_STRING'] . "&paged=2";
//if (1 == 2) $furl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . $_SERVER['QUERY_STRING'] . "&paged=1";
$nurl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . $_SERVER['QUERY_STRING'] . "&paged=2";
if (1 == 2) $furl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . $_SERVER['QUERY_STRING'] . "&paged=1";
} else if (strpos("/wordpress/", $_SERVER['REQUEST_URI']) !== false) {
//$nurl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . str_replace("wopenall=", "s=", $_SERVER['QUERY_STRING']);
$nurl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . str_replace("wopenall=", "s=", $_SERVER['QUERY_STRING']);
$tblurb = " location.href='" . $nurl . "'; \n";
} else {
$tstuff=explode("page/", $sru[0]);
if (sizeof($tstuff) > 1) {
$tstu=explode("/", $tstuff[1]);
$tpage=$tstu[0];
//$nurl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . str_replace("/" . $tpage, "/" . ($tpage + 1), $sru[0]) . "?" . $_SERVER['QUERY_STRING'];
//$furl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . str_replace("/" . $tpage, "/1", $sru[0]) . "?" . $_SERVER['QUERY_STRING'];
$nurl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . str_replace("/" . $tpage, "/" . ($tpage + 1), $sru[0]) . "?" . $_SERVER['QUERY_STRING'];
$furl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . str_replace("/" . $tpage, "/1", $sru[0]) . "?" . $_SERVER['QUERY_STRING'];
} else {
//$nurl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "/page/2/" . "?" . $_SERVER['QUERY_STRING'];
//if (1 == 2) $furl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "/page/1/" . "?" . $_SERVER['QUERY_STRING'];
$nurl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "/page/2/" . "?" . $_SERVER['QUERY_STRING'];
if (1 == 2) $furl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "/page/1/" . "?" . $_SERVER['QUERY_STRING'];
}
}
if ($tblurb == "") {
$tblurb = " ourtcprefix=location.search.split('tcprefix=')[1] ? location.search.split('tcprefix=')[1].split('&')[0] : ''; \n";
$tblurb .= " ourtcdelay=location.search.split('tcdelay=')[1] ? location.search.split('tcdelay=')[1].split('&')[0] : 0; \n";
$tblurb .= " var ourwov=location.search.split('wopenall=')[1] ? location.search.split('wopenall=')[1].split('&')[0] : ' '; \n";
$tblurb .= " var ourhl=location.search.split('highlight=')[1] ? location.search.split('highlight=')[1].split('&')[0] : ''; \n";
$tblurb .= " var ows, owt, owstwo, owttwo='', iot, hl=1; \n";
$tblurb .= " if (ourwov != ' ') { \n";
$tblurb .= " var hones=docgetclass('entry-title', 'h2'); \n";
$tblurb .= " hl=hones.length; \n";
$tblurb .= " if (hones.length > 0) { \n";
$tblurb .= " for (iot=0; iot<hones.length; iot++) { \n";
$tblurb .= " if (hones[iot].innerHTML.indexOf('Not Found') != -1) hl=eval(-1 + hl); \n";
$tblurb .= " if (ourwov == '' || hones[iot].innerHTML.toLowerCase().indexOf(decodeURIComponent(ourwov.replace('+', '%20').replace('+', '%20').replace('+', '%20').replace('+', '%20').toLowerCase())) != -1) { \n";
$tblurb .= " owt=hones[iot].innerHTML.split('title='); \n";
$tblurb .= " ows=hones[iot].innerHTML.split('href='); \n owttwo=''; ";
$tblurb .= " if (owt.length > 1) { \n";
$tblurb .= " owttwo=(owt[1] + ' ').substring(1).split(owt[1].substring(0,1))[0].split('>')[0].replace('Permalink to','').trim(); } \n";

$tblurb .= " if (ows.length > 1) { \n";
$tblurb .= " owstwo=ows[1].substring(1).split(ows[1].substring(0,1)); \n";
$tblurb .= " if (ourhl != '' && owstwo[0].indexOf('?') != -1) { owstwo[0]+=('&highlight=' + ourhl); } \n";
$tblurb .= " else if (ourhl != '' && owstwo[0].indexOf('?') == -1) { owstwo[0]+=('?highlight=' + ourhl); } \n";
$tblurb .= " if ((ourtcprefix == '!' || tcprefix == '!') || (ourtcprefix == '|' || tcprefix == '|') || (ourtcprefix == '+' || tcprefix == '+') || (ourtcprefix == '*' || tcprefix == '*') || (ourtcprefix != '' || tcprefix != '') || (ourtcdelay != 0 || tcdelay != 0)) { if ((ourtcprefix == '!' || tcprefix == '!') || (ourtcprefix == '|' || tcprefix == '|') || (ourtcprefix == '+' || tcprefix == '+') || (ourtcprefix == '*' || tcprefix == '*')) { top.document.getElementById('seltc').style.display='block'; } else { optcol='lightgreen'; } top.document.getElementById('seltc').innerHTML += '<option id=\"tco' + iot + '\" onmouseover=\"getSws(event);\" onmouseout=\"yehbut();\" ontouchstart=\"getSws(event);\" ontouchend=\"yehbut();\" title=\"... you can wait for the long hover functionality for a Blog Post Preview\" style=\"background-color:' + optcol + ';\" value=\"' + owstwo[0] + '\">' + hones[iot].innerHTML + '</option>'; } else { if (1 == 1) { window.opener.offurls.push(jshow(owstwo[0],owttwo)); } else { window.open(owstwo[0], '_blank'); } } \n";
$tblurb .= " } \n";
$tblurb .= " } \n";
$tblurb .= " } console.log(' window.opener.offurls.length=' + window.opener.offurls.length); if (1 == 11) { setTimeout(jshowdet,1000); } else { document.getElementById('justshow').innerHTML=window.opener.document.getElementById('justshow').innerHTML; document.getElementById('justshow').style.display='none'; window.opener.document.getElementById('justshow').style.display='none'; } \n";
$tblurb .= " hones=docgetclass('nav-previous', 'div'); \n";
$tblurb .= " if (hones.length > 0 && ((tcprefix == '!' || tcprefix == '+' || tcprefix == '|' || tcprefix == '*'))) { \n";
if (strpos($nurl, "/page/2/") !== false || strpos($nurl, "paged=2") !== false) {
//$tblurb .= " location.href = '" . $nurl . "#' + window.opener.offurls.length; \n";
//$tblurb .= " offchild=window.open('" . $nurl . "#' + window.opener.offurls.length,'_self'); \n";
//$tblurb .= " document.getElementsByTagName('iframe')[0].src = '" . $nurl . "#' + window.opener.offurls.length; \n";
$tblurb .= " window.opener.backatparent('" . $nurl . "#' + window.opener.offurls.length); \n";

} else {
//$tblurb .= " location.href = '" . $nurl . "#' + window.opener.offurls.length; \n";
//$tblurb .= " offchild=window.open('" . $nurl . "#' + window.opener.offurls.length,'_self'); \n";
//$tblurb .= " document.getElementsByTagName('iframe')[0].src = '" . $nurl . "#' + window.opener.offurls.length; \n";
$tblurb .= " window.opener.backatparent('" . $nurl . "#' + window.opener.offurls.length); \n";

}
$tblurb .= " } else if (hones.length > 0) { \n";
//$tblurb .= " location.href = '" . $nurl . "#' + window.opener.offurls.length; \n";
//$tblurb .= " offchild=window.open('" . $nurl . "#' + window.opener.offurls.length,'_self'); \n";
//$tblurb .= " document.getElementsByTagName('iframe')[0].src = '" . $nurl . "#' + window.opener.offurls.length; \n";
$tblurb .= " window.opener.backatparent('" . $nurl . "#' + window.opener.offurls.length); \n";

$tblurb .= " } else { \n";
$tblurb .= " preprecc('wopenall'); \n";
$tblurb .= " } \n";
$tblurb .= " } \n";
if ($furl != "") $tblurb .= " if (hl == 0) { \n";
//if ($furl != "") $tblurb .= " location.href = '" . str_replace("wopenall=", "wopenallwas=", $furl) . "#' + window.opener.offurls.length; \n";
//if ($furl != "") $tblurb .= " offchild=window.open('" . str_replace("wopenall=", "wopenallwas=", $furl) . "#' + window.opener.offurls.length,'_self'); \n";
//if ($furl != "") $tblurb .= " document.getElementsByTagName('iframe')[0].src = '" . str_replace("wopenall=", "wopenallwas=", $furl) . "#' + window.opener.offurls.length; \n";
if ($furl != "") $tblurb .= " window.opener.backatparent('" . str_replace("wopenall=", "wopenallwas=", $furl) . "#' + window.opener.offurls.length); \n";

if ($furl != "") $tblurb .= " } \n";
$tblurb .= " } \n";
}
echo $tblurb;
}
?>
}


function jshow(inuis, inttwo) {
if (hgsuffix != '' && inuis.indexOf('highlight=') == -1) { if (inuis.indexOf('?') != -1) { inuis+='&highlight=' + encodeURIComponent(hgsuffix); } else { inuis+='?highlight=' + encodeURIComponent(hgsuffix); } }
if (inttwo == '') { inttwo=inuis; } // else if (inttwo.indexOf('bookmark') != -1 && inttwo.indexOf(' Tutorial') != -1) { inttwo=inttwo.split('bookmark')[1].substring(2).split(' Tutorial')[0] + ' Tutorial'; } else { alert(inttwo + ' ... ' + decodeURIComponent(inttwo)); }
if (hgsuffix != '') {
var wds=(' ' + inttwo + ' ');
var awds=wds.split(' ');
for (var iwds=1; iwds<awds.length; iwds++) {
if (awds[iwds].toLowerCase() == hgsuffix.toLowerCase().replace(/\`/g,"'")) {
inttwo=inttwo.replace(awds[iwds], '<mark>' + awds[iwds] + '</mark>');
}
}
}
if (window.opener.document.getElementById('justshow').innerHTML == '') {
window.opener.document.getElementById('justshow').innerHTML='<div id=theurls style=width:100%;></div>';

window.opener.document.getElementById('justshow').innerHTML=window.opener.document.getElementById('justshow').innerHTML.replace('</div>', '<details id=detl0><summary>' + inttwo + '</summary><iframe style=width:100%;height:900px; src=' + inuis + '></iframe></details><br></div>');
//window.opener.document.getElementById('justshow').style.display='block';
} else {
var huhd=window.opener.document.getElementById('justshow').innerHTML.split('<details').length;

window.opener.document.getElementById('justshow').innerHTML=window.opener.document.getElementById('justshow').innerHTML.replace('</div>', '<details id=detl' + huhd + ' onclick="document.getElementById(' + "'divl" + huhd + "'" + ').innerHTML=' + "'" + '<iframe style=width:100%;height:900px; src=' + inuis + '></iframe>' + "';" + '"><summary onclick="document.getElementById(' + "'divl" + huhd + "'" + ').innerHTML=' + "'" + '<iframe style=width:100%;height:900px; src=' + inuis + '></iframe>' + "';" + '">' + inttwo + '</summary><span id=divl' + huhd + '></span></details><br></div>');
}
//alert(window.opener.document.getElementById('justshow').innerHTML);
return inuis;
}


“; ?>

… and way back at the Search textbox and its associated radio buttons our user interaction “asker” code now goes

<?php echo ”

function reurl(inu) {
var newinu;
if (inu.indexOf('&') != -1 && inu.indexOf('?') == -1) { inu=inu.replace('&','?'); }
if (tcprefix != "") {
if (tcprefix.substring(0,1) == '!' || tcprefix.substring(0,1) == '+' || tcprefix.substring(0,1) == '|' || tcprefix.substring(0,1) == '*') {
newinu=inu.replace('window.open(', '').replace('location.href=', '').replace(';', '').replace(';', '').split(', "_blank');
//alert('NeWinu=' + newinu);
document.getElementById('tciframe').src=eval(newinu[0]) + "&tcprefix=" + tcprefix;
if (tcprefix.substring(0,1) == '|' || tcprefix.substring(0,1) == '*') setInterval(checkseltc, 1000);
if (tcprefix.substring(0,1) == '!' || tcprefix.substring(0,1) == '|') {
return "";
}
}
inu = inu; //.replace("wopenall", "tcprefix=" + tcprefix + "&wopenall");
}
if (tcdelay != 0) {
inu = inu; //.replace("wopenall", "&tcdelay=" + tcdelay + "&wopenall");
newinu=inu.replace('window.open(', '').replace('location.href=', '').replace(';', '').replace(';', '').split(', "_blank');
//alert('Newinu=' + newinu);
document.getElementById('tciframe').src=eval(newinu[0]) + "&tcdelay=" + tcdelay;
setInterval(checkseltc, 1000);
return "";
}
//alert(inu);
return eval('offchild=' + inu);
}

function preradiocc() {
if (document.getElementById('s').value != "" && radis != "") {
radiocc(radis);
}
}

function radiocc(tvis) {
var cok=1;
cwopen="";
radis=tvis;
document.getElementById('tagselis').style.display='none';
document.getElementById('catselis').style.display='none';
document.getElementById('s').style.display='inline';
if (document.getElementById('s').value != "") {
if (tvis == "Search") {
document.getElementById('searchsubmit').click();
} else if (tvis == "Tag") {
cwopen=prompt("Please enter " + document.getElementById('s').value + " Tag findings Blog Posting Title search filter (blank causes no filtering" + tcsuffix + " and optional suffix &highlight=[highlightSearchString] highlights)", document.getElementById('s').value);
if (cwopen != null) {
if (cwopen.indexOf('highlight=') != -1) {
hgsuffix=decodeURIComponent(cwopen.split('highlight=')[1].split('&')[0].split('#')[0]).replace(/\'/g, '`');
if (hgsuffix == '') { hgsuffix=cwopen.split('&')[0]; cwopen=cwopen.replace('highlight=', 'highlight=' + hgsuffix); }
}

precwopen = document.getElementById("s").value;
cwopen=reprompt(cwopen);
//if (document.getElementById('searchform').action.indexOf("/wordpress") != -1) {
if (document.getElementById('searchform').action.indexOf("/ITblog") != -1) {
if (1 == 1) {
reurl('window.open(document.getElementById("searchform").action + "?tag=" + precwopen.toLowerCase().replace("+","").replace("/","").replace(" ","-").replace("/","").replace(" ","-").replace("/","").replace(" ","-").replace("/","").replace(" ","-").replace("/","").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(/---/g,"-").replace(/--/g,"-") + "&wopenall=" + cwopen, "_blank");');
} else {
reurl('location.href=document.getElementById("searchform").action + "?tag=" + precwopen.toLowerCase().replace("+","").replace("/","").replace(" ","-").replace("/","").replace(" ","-").replace("/","").replace(" ","-").replace("/","").replace(" ","-").replace("/","").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(/---/g,"-").replace(/--/g,"-") + "&wopenall=" + cwopen;');
}
} else {
if (1 == 1) {
reurl('window.open(document.getElementById("searchform").action + "tag/" + precwopen.toLowerCase().replace("+","").replace("/","").replace(" ","-").replace("/","").replace(" ","-").replace("/","").replace(" ","-").replace("/","").replace(" ","-").replace("/","").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(/---/g,"-").replace(/--/g,"-") + "/?wopenall=" + cwopen, "_blank");');
} else {
reurl('location.href=document.getElementById("searchform").action + "tag/" + precwopen.toLowerCase().replace("+","").replace("/","").replace(" ","-").replace("/","").replace(" ","-").replace("/","").replace(" ","-").replace("/","").replace(" ","-").replace("/","").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(/---/g,"-").replace(/--/g,"-") + "/?wopenall=" + cwopen;');
}
}
}
} else if (tvis == "Category") {
//if (document.getElementById('searchform').action.indexOf("/wordpress") != -1) {
if (document.getElementById('searchform').action.indexOf("/ITblog") != -1) {
if (1 == 1 || (document.getElementById('s').value.substring(0,1) >= '0' && document.getElementById('s').value.substring(0,1) <= '9')) {
if (document.getElementById('s').value.substring(0,1) >= '0' && document.getElementById('s').value.substring(0,1) <= '9') {
incat='?cat=';
cwopen=prompt("Please enter " + document.getElementById('s').value + " Category (number) findings Blog Posting Title search filter (blank causes no filtering" + tcsuffix + " and optional suffix &highlight=[highlightSearchString] highlights)", "Tutorial");
} else {
cwopen=prompt("Please enter " + document.getElementById('s').value + " Category findings Blog Posting Title search filter (blank causes no filtering" + tcsuffix + " and optional suffix &highlight=[highlightSearchString] highlights)", "Tutorial");
}
if (cwopen != null) {
if (cwopen.indexOf('highlight=') != -1) {
hgsuffix=decodeURIComponent(cwopen.split('highlight=')[1].split('&')[0].split('#')[0]).replace(/\'/g, '`');
if (hgsuffix == '') { hgsuffix=cwopen.split('&')[0]; cwopen=cwopen.replace('highlight=', 'highlight=' + hgsuffix); }
}

precwopen = document.getElementById("s").value;
if (1 == 1) { cwopen=reprompt(cwopen); }
if (1 == 1) {
//reurl('window.open(document.getElementById("searchform").action + "?cat=" + precwopen.toLowerCase().replace("+","").replace("/","").replace(" ","-").replace("/","").replace(" ","-").replace("/","").replace(" ","-").replace("/","").replace(" ","-").replace("/","").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(/---/g,"-").replace(/--/g,"-") + "&wopenall=" + cwopen, "_blank");');
reurl('window.open(document.getElementById("searchform").action + incat + precwopen.toLowerCase().replace("+","").replace("/","").replace(" ","-").replace("/","").replace(" ","-").replace("/","").replace(" ","-").replace("/","").replace(" ","-").replace("/","").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(/---/g,"-").replace(/--/g,"-") + "&wopenall=" + cwopen, "_blank");');
} else {
//reurl('location.href=document.getElementById("searchform").action + "?cat=" + precwopen.toLowerCase().replace("+","").replace("/","").replace(" ","-").replace("/","").replace(" ","-").replace("/","").replace(" ","-").replace("/","").replace(" ","-").replace("/","").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(/---/g,"-").replace(/--/g,"-") + "&wopenall=" + cwopen;');
reurl('location.href=document.getElementById("searchform").action + incat + precwopen.toLowerCase().replace("+","").replace("/","").replace(" ","-").replace("/","").replace(" ","-").replace("/","").replace(" ","-").replace("/","").replace(" ","-").replace("/","").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(/---/g,"-").replace(/--/g,"-") + "&wopenall=" + cwopen;');
}
}
} else {
cok=0;
alert("Please enter the category as a number");
document.getElementById('s').value = '';
}
} else {
precwopen = document.getElementById("s").value;
cwopen=prompt("Please enter " + document.getElementById('s').value + " Category (alphabetic) findings Blog Posting Title search filter (blank causes no filtering" + tcsuffix + " and optional suffix &highlight=[highlightSearchString] highlights)", document.getElementById('s').value);
if (cwopen != null) {
if (cwopen.indexOf('highlight=') != -1) {
hgsuffix=decodeURIComponent(cwopen.split('highlight=')[1].split('&')[0].split('#')[0]).replace(/\'/g, '`');
if (hgsuffix == '') { hgsuffix=cwopen.split('&')[0]; cwopen=cwopen.replace('highlight=', 'highlight=' + hgsuffix); }
}

if (1 == 1) {
reurl('window.open(document.getElementById("searchform").action + "category/" + precwopen.toLowerCase().replace("+","").replace("/","").replace(" ","-").replace("/","").replace(" ","-").replace("/","").replace(" ","-").replace("/","").replace(" ","-").replace("/","").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(/---/g,"-").replace(/--/g,"-") + "/?wopenall=" + cwopen, "_blank");');
} else {
reurl('location.href=document.getElementById("searchform").action + "category/" + precwopen.toLowerCase().replace("+","").replace("/","").replace(" ","-").replace("/","").replace(" ","-").replace("/","").replace(" ","-").replace("/","").replace(" ","-").replace("/","").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(/---/g,"-").replace(/--/g,"-") + "/?wopenall=" + cwopen;');
}
}
}
}
if (cok == 1) {
document.getElementById('s').value = '';
radis="";
document.getElementById('searchform').innerHTML = formihis;
document.getElementById('s').onblur = preradiocc;
}
}
}

“; ?>

It’s worth a retry of “Search with Category/Tag radio button Search” functionality after today’s streamlining, we reckon!


Previous relevant WordPress Blog Search Within Search Overlay Tutorial is shown below.

WordPress Blog Search Within Search Overlay Tutorial

WordPress Blog Search Within Search Overlay Tutorial

Thought we were finished with “filter a search” (or “search within a search”) ideas yesterday … but how wrong were we? That wasn’t rhetorical.

Okay … be like that. Anyway, we realised with today’s work continuing on from yesterday’s WordPress Blog Search Within Search Ajax Tutorial, as shown below, that there is another “overlay” scenario we’d like to discuss (in our series of “overlay” blog postings). It is the way that, even ignoring any “absolute” positioning of HTML elements you can still “overlay” elements merely by lining them up “inline” but only turning on the visibility of any one of them at a time. So today’s scenario sees …

  1. textbox (ie. HTML input type=”text” element) for Search string … initially visible
  2. dropdown (ie. HTML select element) for list of Tags … initially invisible
  3. dropdown (ie. HTML select element) for list of Categories … initially invisible

… all lined up “relative” to each other, with the invisibility, or not, controlled by the clicking of newly created a tags where once there were only radio button labels … cutish huh?

Today’s “overlay” idea also illustrates another user experience (ux) ideal … an “ideal” in our books anyway … it goes like this, for us …

When there is an action that once involved definite use of both keyboard and mouse, if it can be arranged, even for just some user setting scenarios, that one or other of the keyboard or mouse is not needed, then this becomes an improved user experience.

… and so, with the added dropdowns, it can become the case that you can do some sophisticated search operations involving the new Tag and Category scenarios, that don’t require any keyboard involvement … even if it is for less than half the scenarios, it is still worth doing, we feel.

We hope you find this “overlay” idea of some help, and will leave you with changes to the WordPress blog’s TwentyTen theme’s header.php in blue bold itallic for today’s “overlay” changes and green bold itallic for yesterday’s Ajax changes and red bold itallic for the day before yesterday’s Preview changes and bold itallic for the two days before yesterday’s Implementation changes and bold for the three days before yesterday’s Primer (WordPress Blog Search Within a Search Primer Tutorial) changes below …



var spc=' ', cminus='-', fmtname='w411tform', fmcname='w411cform', edelim='/', radis="", formihis="";

var precwopen='', cwopen='', scmdis='', tcdelay=0, ourtcdelay=0, ourtcprefix='', tcprefix='', tcsuffix=' ... prefixes: @!@ just dropdown, @+@ additional dropdown, @|@ just open dropdown, @*@ additional open dropdown, @[secsDelay]@';
var iurlcnt=0, jurlcnt=0, urllist = new Array(), whenlist = new Array(), nextis=-1, optcol='yellow';


var catselis="", tagselis="";
function ovput(wois) {
document.getElementById('s').style.display='none';
if (wois.indexOf("ag") != -1) {
document.getElementById('tagselis').style.display='inline';
} else {
document.getElementById('catselis').style.display='inline';
}
}
function ovsel(iov, iovval) {
if (iovval.replace(' ') == '') {
iov.style.display='none';
document.getElementById('s').style.display='inline';
} else {
document.getElementById('s').value=iovval;
iov.style.display='none';
document.getElementById('s').style.display='inline';
if (iov.id.indexOf("ag") != -1) {
radiocc('Tag');
} else {
radiocc('Category');
}
}
}

function checkseltc() {
var wqe=document.getElementById('seltc').innerHTML.split('value=');
var zdelim=' ', zurllist;
jurlcnt=eval(-1 + wqe.length);
if (jurlcnt > 0) {
for (var iyt=2; iyt<wqe.length; iyt++) {
zdelim = wqe[iyt].substring(0,1);
zurllist = wqe[iyt].substring(1).split(zdelim);
urllist[eval(-2 + iyt)] = zurllist[0];
if (iyt == 2) {
whenlist[eval(-2 + iyt)] = tcdelay;
} else {
whenlist[eval(-2 + iyt)] = eval(tcdelay + eval(whenlist[eval(-3 + iyt)]));
}
if (nextis < 0) nextis = 0;
}
}
document.getElementById('seltc').size = eval(-1 + wqe.length);
iurlcnt++;
if (nextis >= 0) {
if (eval(nextis) < eval(whenlist.length)) {
if (eval(iurlcnt) == whenlist[nextis]) {
if (urllist[nextis] != "") tcwindowopen(urllist[nextis]);
nextis++;
if (eval(nextis) == eval(whenlist.length)) top.document.getElementById('seltc').style.display='block';
}
}
}
}
function reprompt(insg) {
tcprefix="";
if ((insg + " ").substring(0,1) == "@") {
var tcst=insg.substring(1).split("@");
if (tcst.length > 1) {
tcprefix = tcst[0];
insg=insg.replace("@" + tcprefix + "@", "");
if (tcprefix == "!") {
document.getElementById("wrapper").innerHTML = "<iframe id='tciframe' width=1 height=1 style='width:1; height:1;' src='//www.rjmprogramming.com.au/About_Us.html'></iframe>" + document.getElementById("wrapper").innerHTML;
} else if (tcprefix == "|") {
document.getElementById("wrapper").innerHTML = "<iframe id='tciframe' width=1 height=1 style='width:1; height:1;' src='//www.rjmprogramming.com.au/About_Us.html'></iframe>" + document.getElementById("wrapper").innerHTML;
} else if (tcprefix == "+") {
document.getElementById("wrapper").innerHTML = "<iframe id='tciframe' width=1 height=1 style='width:1; height:1;' src='//www.rjmprogramming.com.au/About_Us.html'></iframe>" + document.getElementById("wrapper").innerHTML;
} else if (tcprefix == "*") {
document.getElementById("wrapper").innerHTML = "<iframe id='tciframe' width=1 height=1 style='width:1; height:1;' src='//www.rjmprogramming.com.au/About_Us.html'></iframe>" + document.getElementById("wrapper").innerHTML;
} else if (tcprefix != "") {
var tcd=tcprefix.split(".");
tcdelay=eval(tcd[0]);
document.getElementById("wrapper").innerHTML = "<iframe id='tciframe' width=1 height=1 style='width:1; height:1;' src='//www.rjmprogramming.com.au/About_Us.html'></iframe>" + document.getElementById("wrapper").innerHTML;
tcprefix='';
optcol='lightgreen';
}
}
}
return insg;
}
function reurl(inu) {
var newinu;
if (tcprefix != "") {
if (tcprefix.substring(0,1) == '!' || tcprefix.substring(0,1) == '+' || tcprefix.substring(0,1) == '|' || tcprefix.substring(0,1) == '*') {
newinu=inu.replace('window.open(', '').replace('location.href=', '').replace(';', '').replace(';', '').split(', "_blank');
document.getElementById('tciframe').src=eval(newinu[0]) + "&tcprefix=" + tcprefix;
if (tcprefix.substring(0,1) == '|' || tcprefix.substring(0,1) == '*') setInterval(checkseltc, 1000);
if (tcprefix.substring(0,1) == '!' || tcprefix.substring(0,1) == '|') {
return "";
}
}
inu = inu; //.replace("wopenall", "tcprefix=" + tcprefix + "&wopenall");
}
if (tcdelay != 0) {
inu = inu; //.replace("wopenall", "&tcdelay=" + tcdelay + "&wopenall");
newinu=inu.replace('window.open(', '').replace('location.href=', '').replace(';', '').replace(';', '').split(', "_blank');
document.getElementById('tciframe').src=eval(newinu[0]) + "&tcdelay=" + tcdelay;
setInterval(checkseltc, 1000);
return "";
}
return eval(inu);
}

function preradiocc() {
if (document.getElementById('s').value != "" && radis != "") {
radiocc(radis);
}
}
function radiocc(tvis) {
var cok=1;
cwopen="";
radis=tvis;

document.getElementById('tagselis').style.display='none';
document.getElementById('catselis').style.display='none';
document.getElementById('s').style.display='inline';

if (document.getElementById('s').value != "") {
if (tvis == "Search") {
document.getElementById('searchsubmit').click();
} else if (tvis == "Tag") {
cwopen=prompt("Please enter " + document.getElementById('s').value + " Tag findings Blog Posting Title search filter (blank causes no filtering" + tcsuffix + ")", document.getElementById('s').value);
if (cwopen != null) {
precwopen = document.getElementById("s").value;
cwopen=reprompt(cwopen);
if (document.getElementById('searchform').action.indexOf("/wordpress") != -1) {
if (1 == 1) {
reurl('window.open(document.getElementById("searchform").action + "?tag=" + precwopen.toLowerCase().replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-") + "&wopenall=" + cwopen, "_blank");');
} else {
reurl('location.href=document.getElementById("searchform").action + "?tag=" + precwopen.toLowerCase().replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-") + "&wopenall=" + cwopen;');
}
} else {
if (1 == 1) {
reurl('window.open(document.getElementById("searchform").action + "tag/" + precwopen.toLowerCase().replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-") + "/?wopenall=" + cwopen, "_blank");');
} else {
reurl('location.href=document.getElementById("searchform").action + "tag/" + precwopen.toLowerCase().replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-") + "/?wopenall=" + cwopen;');
}
}
}
} else if (tvis == "Category") {
if (document.getElementById('searchform').action.indexOf("/wordpress") != -1) {
if (document.getElementById('s').value.substring(0,1) >= '0' && document.getElementById('s').value.substring(0,1) <= '9') {
cwopen=prompt("Please enter " + document.getElementById('s').value + " Category (number) findings Blog Posting Title search filter (blank causes no filtering" + tcsuffix + ")", "Tutorial");
if (cwopen != null) {
precwopen = document.getElementById("s").value;
cwopen=reprompt(cwopen);
if (1 == 1) {
reurl('window.open(document.getElementById("searchform").action + "?cat=" + precwopen.toLowerCase().replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-") + "&wopenall=" + cwopen, "_blank");');
} else {
reurl('location.href=document.getElementById("searchform").action + "?cat=" + precwopen.toLowerCase().replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-") + "&wopenall=" + cwopen;');
}
}
} else {
cok=0;
alert("Please enter the category as a number");
document.getElementById('s').value = '';
}
} else {
cwopen=prompt("Please enter " + document.getElementById('s').value + " Category (alphabetic) findings Blog Posting Title search filter (blank causes no filtering" + tcsuffix + ")", document.getElementById('s').value);
if (cwopen != null) {
precwopen = document.getElementById("s").value;
if (1 == 1) {
reurl('window.open(document.getElementById("searchform").action + "category/" + precwopen.toLowerCase().replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-") + "/?wopenall=" + cwopen, "_blank");');
} else {
reurl('location.href=document.getElementById("searchform").action + "category/" + precwopen.toLowerCase().replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-") + "/?wopenall=" + cwopen;');
}
}
}
}
if (cok == 1) {
document.getElementById('s').value = '';
radis="";
document.getElementById('searchform').innerHTML = formihis;
document.getElementById('s').onblur = preradiocc;
}
}
}

function preprecc(inidea) { // wopenallwas= form
<?php
$tblurbwas="";
if (isset($_GET['wopenallwas']) || isset($_GET['wopenall'])) {
$tblurbwas = " var ourwovwas=location.search.split(inidea + '=')[1] ? location.search.split(inidea + '=')[1].split('&')[0] : ' '; \n";
$tblurbwas .= " if (ourwovwas != ' ') { \n";
$tblurbwas .= " document.body.innerHTML = '<div id=\"verytop\" align=\"center\" style=\"background-color: yellow;\"><table cellpadding=25 cellspacing=25><tr><td style=\"border: 5px green solid; margin: 6 6 6 6;\"> WordPress 3.0.3<br><br><form action=\"//www.rjmprogramming.com.au/wordpress/\" method=\"GET\"> Tag (alpha): <input type=\"text\" name=\"tag\" id=\"tag\" /><br><br> Optional Search Blog Title for: <input type=\"text\" name=\"wopenall\" id=\"wopenall\" /><br><br><br> <input type=\"submit\" value=\"Find Tag Blog Postings\" /></form><br><br><br>' + '<form action=\"//www.rjmprogramming.com.au/wordpress/\" method=\"GET\"> Category (numerical): <input type=\"number\" name=\"cat\" id=\"cat\" /><br><br> Optional Search Blog Title for: <input type=\"text\" name=\"wopenall\" id=\"wopenall\" /><br><br><br> <input type=\"submit\" value=\"Find Category Blog Postings\" /></form><br><br><br></td><td style=\"border: 5px green solid; margin: 6 6 6 6;\"> WordPress 4.1.1<br><br><form id=\"w411tform\" action=\"//www.rjmprogramming.com.au/ITblog/tag/\" method=\"GET\"> Tag (alpha): <input type=\"text\" onblur=\" document.getElementById(fmtname).action+=this.value.toLowerCase().replace(spc,cminus).replace(spc,cminus).replace(spc,cminus).replace(spc,cminus).replace(spc,cminus) + edelim; \" /><br><br> Optional Search Blog Title for: <input type=\"text\" name=\"wopenall\" id=\"wopenall\" /><br><br><br> <input type=\"submit\" value=\"Find Tag Blog Postings\" /></form><br><br><br>' + '<form id=\"w411cform\" action=\"//www.rjmprogramming.com.au/ITblog/category/\" method=\"GET\"> Category (alpha): <input onblur=\" document.getElementById(fmcname).action+=this.value.toLowerCase().replace(spc,cminus).replace(spc,cminus).replace(spc,cminus).replace(spc,cminus).replace(spc,cminus) + edelim; \" type=\"text\" /><br><br> Optional Search Blog Title for: <input type=\"text\" name=\"wopenall\" id=\"wopenall\" /><br><br><br> <input type=\"submit\" value=\"Find Category Blog Postings\" /></form><br><br><br></td></tr></table></div>' + document.body.innerHTML; \n";
$tblurbwas .= " } \n";
}
echo $tblurbwas;
?>
}

function tcwindowopen(inuis) {
window.open(inuis, '_blank');
}

function precc() { // wopenall= functionality
preprecc('wopenallwas');
document.getElementById('searchsubmit').style.display='none';
var wbis=document.getElementById('searchform').action.indexOf("/wordpress");
var taglist, catlist;
var tagvar, tagvar2, catvar, catvar2;
if (wbis != -1) {
catvar=document.getElementById('categories-2').innerHTML.split("href=");
catvar2=document.getElementById('categories-2').innerHTML.split("title=");
} else {
catvar=document.getElementById('categories-2').innerHTML.split("href=");
catvar2=document.getElementById('categories-2').innerHTML.split("href=");
}
if (wbis != -1) {
tagvar=document.getElementById('tag_cloud-3').innerHTML.split("href=");
tagvar2=document.getElementById('tag_cloud-3').innerHTML.split("title=");
} else {
tagvar=document.getElementById('tag_cloud-2').innerHTML.split("href=");
tagvar2=document.getElementById('tag_cloud-2').innerHTML.split("title=");
}
var sparea, thedelim="", itc, tcval, tctitle;
catselis="<select onchange='ovsel(this, this.value);' id='catselis' style='display:none;'><option value=' '>Categories below ...</option><option value=''>Not shown below ...</option></select>";
tagselis="<select onchange='ovsel(this, this.value);' id='tagselis' style='display:none;'><option value=' '>Popular Tags below ...</option><option value=''>Not shown below ...</option></select>";
for (itc=1; itc<catvar.length; itc++) {
thedelim=catvar[itc].substring(0,1);
tctitle=catvar2[itc].substring(1).replace(">","<").split("<");
if (wbis != -1) {
sparea=catvar[itc].substring(1).split("?cat=");
tcval=sparea[1].split(thedelim);
} else {
sparea=catvar[itc].substring(1).split("/category/");
tcval=sparea[1].split("/");
}
catselis=catselis.replace("</select>", "<option value='" + tcval[0] + "'>" + tctitle[1] + "</option></select>");
}
for (itc=1; itc<tagvar.length; itc++) {
thedelim=tagvar[itc].substring(0,1);
tctitle=tagvar[itc].substring(1).replace(">","<").split("<");
if (wbis != -1) {
sparea=tagvar[itc].substring(1).split("?tag=");
tcval=sparea[1].split(thedelim);
} else {
sparea=tagvar[itc].substring(1).split("/tag/");
tcval=sparea[1].split("/");
}
tagselis=tagselis.replace("</select>", "<option value='" + tcval[0] + "'>" + tctitle[1] + "</option></select>");
}

formihis = document.getElementById('searchform').innerHTML.replace("</div>", tagselis + catselis + "<input style='display:none;' type='radio' name='stype' value=''><input onclick=\"radiocc('Search');\" type='radio' name='stype' value='Search'>Search<input onclick=\"radiocc('Tag');\" type='radio' name='stype' value='Tag'><a onclick=\"ovput('Tag');\" title=\"Overlay Tag dropdown ...\" href=\"#tagselis\">Tag</a><input onclick=\"radiocc('Category');\" type='radio' name='stype' value='Category'><a onclick=\"ovput('Category');\" title=\"Overlay Category dropdown ...\" href=\"#catselis\">Category</a><select id='seltc' style='display:none;' onchange=\"window.open(this.value,'_blank');\" size='1'><option value=''>Blog Postings below ...</option></select></div>");
formihis = formihis.replace("input id", "input onblur='preradiocc();' id");
document.getElementById('searchform').innerHTML = formihis;
document.getElementById('s').onblur = preradiocc;
<?php
$tblurb="";
if (isset($_GET['wopenall'])) {
$tpage=1;
$furl="";
$sru=explode("?", $_SERVER['REQUEST_URI']);
if (isset($_GET['paged'])) {
$tpage=$_GET['paged'];
$nurl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . str_replace("paged=" . $tpage, "paged=" . ($tpage + 1), $_SERVER['QUERY_STRING']);
$furl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . str_replace("paged=" . $tpage, "paged=1", $_SERVER['QUERY_STRING']);
} else if (isset($_GET['tag']) || isset($_GET['cat']) || isset($_GET['s'])) {
$nurl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . $_SERVER['QUERY_STRING'] . "&paged=2";
if (1 == 2) $furl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . $_SERVER['QUERY_STRING'] . "&paged=1";
} else if (strpos("/wordpress/", $_SERVER['REQUEST_URI']) !== false) {
$nurl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . str_replace("wopenall=", "s=", $_SERVER['QUERY_STRING']);
$tblurb = " location.href='" . $nurl . "'; \n";
} else {
$tstuff=explode("page/", $sru[0]);
if (sizeof($tstuff) > 1) {
$tstu=explode("/", $tstuff[1]);
$tpage=$tstu[0];
$nurl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . str_replace("/" . $tpage, "/" . ($tpage + 1), $sru[0]) . "?" . $_SERVER['QUERY_STRING'];
$furl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . str_replace("/" . $tpage, "/1", $sru[0]) . "?" . $_SERVER['QUERY_STRING'];
} else {
$nurl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "/page/2/" . "?" . $_SERVER['QUERY_STRING'];
if (1 == 2) $furl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "/page/1/" . "?" . $_SERVER['QUERY_STRING'];
}
}
if ($tblurb == "") {
$tblurb = " ourtcprefix=location.search.split('tcprefix=')[1] ? location.search.split('tcprefix=')[1].split('&')[0] : ''; \n";
$tblurb .= " ourtcdelay=location.search.split('tcdelay=')[1] ? location.search.split('tcdelay=')[1].split('&')[0] : 0; \n";
$tblurb .=
" var ourwov=location.search.split('wopenall=')[1] ? location.search.split('wopenall=')[1].split('&')[0] : ' '; \n";
$tblurb .= " var ows, owstwo, iot, hl=1; \n";
$tblurb .= " if (ourwov != ' ') { \n";
$tblurb .= " var hones=docgetclass('entry-title', 'h1'); \n";
$tblurb .= " hl=hones.length; \n";
$tblurb .= " if (hones.length > 0) { \n";
$tblurb .= " for (iot=0; iot<hones.length; iot++) { \n";
$tblurb .= " if (hones[iot].innerHTML.indexOf('Not Found') != -1) hl=eval(-1 + hl); \n";
$tblurb .= " if (ourwov == '' || hones[iot].innerHTML.toLowerCase().indexOf(decodeURIComponent(ourwov.replace('+', '%20').replace('+', '%20').replace('+', '%20').replace('+', '%20').toLowerCase())) != -1) { \n";
$tblurb .= " ows=hones[iot].innerHTML.split('href='); \n";
$tblurb .= " if (ows.length > 1) { \n";
$tblurb .= " owstwo=ows[1].substring(1).split(ows[1].substring(0,1)); \n";
$tblurb .= " if ((ourtcprefix == '!' || tcprefix == '!') || (ourtcprefix == '|' || tcprefix == '|') || (ourtcprefix == '+' || tcprefix == '+') || (ourtcprefix == '*' || tcprefix == '*') || (ourtcprefix != '' || tcprefix != '') || (ourtcdelay != 0 || tcdelay != 0)) { if ((ourtcprefix == '!' || tcprefix == '!') || (ourtcprefix == '|' || tcprefix == '|') || (ourtcprefix == '+' || tcprefix == '+') || (ourtcprefix == '*' || tcprefix == '*')) { top.document.getElementById('seltc').style.display='block'; } else { optcol='lightgreen'; } top.document.getElementById('seltc').innerHTML += '<option id=\"tco' + iot + '\" onmouseover=\"getSws(event);\" onmouseout=\"yehbut();\" ontouchstart=\"getSws(event);\" ontouchend=\"yehbut();\" title=\"... you can wait for the long hover functionality for a Blog Post Preview\" style=\"background-color:' + optcol + ';\" value=\"' + owstwo[0] + '\">' + hones[iot].innerHTML + '</option>'; } else { window.open(owstwo[0], '_blank'); } \n";
$tblurb .= " } \n";
$tblurb .= " } \n";
$tblurb .= " } \n";
$tblurb .= " hones=docgetclass('nav-previous', 'div'); \n";
$tblurb .= " if (hones.length > 0 && ((tcprefix == '!' || tcprefix == '+' || tcprefix == '|' || tcprefix == '*'))) { \n";
if (strpos($nurl, "/page/2/") !== false || strpos($nurl, "paged=2") !== false) {
$tblurb .= " location.href = '" . $nurl . "'; \n";
} else {
$tblurb .= " location.href = '" . $nurl . "'; \n";
}
$tblurb .= " } else
if (hones.length > 0) { \n";
$tblurb .= " location.href = '" . $nurl . "'; \n";
$tblurb .= " } else { \n";
$tblurb .= " preprecc('wopenall'); \n";
$tblurb .= " } \n";
$tblurb .= " } \n";
if ($furl != "") $tblurb .= " if (hl == 0) { \n";
if ($furl != "") $tblurb .= " location.href = '" . str_replace("wopenall=", "wopenallwas=", $furl) . "'; \n";
if ($furl != "") $tblurb .= " } \n";
$tblurb .= " } \n";
}
echo $tblurb;
}
?>
}

</script>
</head>
<body onload="precc(); courseCookies();" <?php body_class(); ?>>


Previous relevant WordPress Blog Search Within Search Ajax Tutorial is shown below.

WordPress Blog Search Within Search Ajax Tutorial

WordPress Blog Search Within Search Ajax Tutorial

The last aspect to “filter a search” (or “search within a search”) ideas is to do with Ajax functionality, because we discovered that, at least for non-mobile users, the onmouseover and onmouseout events work for the HTML option tag within a select (dropdown) tag, so that allows for the contextual help we last talked about with WordPress Blog Context Help Mode Toggler Primer Tutorial to be included in the functionality here, and with the WordPress 4.1.1 WordPress Blog Search Within Search Ajax Tutorial.

As we’ve mentioned before at this blog, Ajax techniques are useful to be able to perform more functionality without navigating to a new webpage, even, though, often, you are effectively accessing that new webpage. Today, we use Ajax for Preview purposes with that dropdown (HTML select) element of yesterday’s WordPress Blog Search Within Search Preview Tutorial as shown below.

Not everybody likes Ajax, and so we offer those users an “out”, in that you have to “hover” a long time to enact the Ajax functionality, so if you are hovering just to see the “title” wording of HTML elements, if you are fairly quick about it, the Ajax functionality will not happen.

So it pans out the WordPress blog’s TwentyTen theme’s header.php does not need to change much to do its bit as per the green bold itallic below, modifying yesterday’s red bold itallic


...
$tblurb .= " if ((ourtcprefix == '!' || tcprefix == '!') || (ourtcprefix == '|' || tcprefix == '|') || (ourtcprefix == '+' || tcprefix == '+') || (ourtcprefix == '*' || tcprefix == '*') || (ourtcprefix != '' || tcprefix != '') || (ourtcdelay != 0 || tcdelay != 0)) { if ((ourtcprefix == '!' || tcprefix == '!') || (ourtcprefix == '|' || tcprefix == '|') || (ourtcprefix == '+' || tcprefix == '+') || (ourtcprefix == '*' || tcprefix == '*')) { top.document.getElementById('seltc').style.display='block'; } else { optcol='lightgreen'; } top.document.getElementById('seltc').innerHTML += '<option id=\"tco' + iot + '\" onmouseover=\"getSws(event);\" onmouseout=\"yehbut();\" ontouchstart=\"getSws(event);\" ontouchend=\"yehbut();\" title=\"... you can wait for the long hover functionality for a Blog Post Preview\" style=\"background-color:' + optcol + ';\" value=\"' + owstwo[0] + '\">' + hones[iot].innerHTML + '</option>'; } else { window.open(owstwo[0], '_blank'); } \n";
...

Maybe you remember our contextual help blog postings (last one being WordPress Blog Context Help Mode Toggler Primer Tutorial), and how we have an external Javascript wajax.js arrangement for Ajax related functionality. Well, it changed to accomodate this last idea in this way. The mode of use of ignoring contextual help meant that nothing.js changed in exactly the same manner.


Previous relevant WordPress Blog Search Within Search Preview Tutorial is shown below.

WordPress Blog Search Within Search Preview Tutorial

WordPress Blog Search Within Search Preview Tutorial

Yesterday’s “filter a search” (or “search within a search”) ideas of WordPress Blog Search Within Search Implementation Tutorial as shown below, were improvements on the day before, but we feel as though the user lacks some controls that would be good on the functionality.

By that we mean that many windows may open without the chance for the user to review their findings. We think the user would feel more in control of things if it were possible for them to have a dropdown (HTML select) element that can review the findings, and then they can pick or choose what is interesting … after all, with yesterday’s scenario, they are not told what the resultant blog posting titles are ahead of having them come up in a new web browser tab already displayed, so, today, as an optionally available extra piece of functionality we allow in the Javascript Prompt window the additional prefixes of …

  • @!@ … just dropdown
  • @+@ … additional dropdown
  • @|@ … just open dropdown (ie. all the options are available to see, on a non-mobile platform)
  • @*@ … additional open dropdown
  • @[secsDelay]@ … stage the finding openings with a [secsDelay] seconds delay between new browser tabs opening

To make this happen, and not involve server files, and be able to handle the changes in the Javascript (written out by the PHP), we use an iframe element which can “look back” to top.document to alter the parent web page’s content … in this case, the parent webpage’s relevant dropdown (HTML select) element containing Blog Posting findings of interest picked up from our “filtered search” (or “search within a search”) functionality.

We hope you find this useful and will leave you with changes to the WordPress blog’s TwentyTen theme’s header.php in red bold itallic for the latest changes and in bold itallic for yesterday’s changes and just in bold for day before yesterday’s (WordPress Blog Search Within a Search Primer Tutorial) changes below …



var spc=' ', cminus='-', fmtname='w411tform', fmcname='w411cform', edelim='/', radis="", formihis="";

var precwopen='', cwopen='', scmdis='', tcdelay=0, ourtcdelay=0, ourtcprefix='', tcprefix='', tcsuffix=' ... prefixes: @!@ just dropdown, @+@ additional dropdown, @|@ just open dropdown, @*@ additional open dropdown, @[secsDelay]@';
var iurlcnt=0, jurlcnt=0, urllist = new Array(), whenlist = new Array(), nextis=-1, optcol='yellow';
function checkseltc() {
var wqe=document.getElementById('seltc').innerHTML.split('value=');
var zdelim=' ', zurllist;
jurlcnt=eval(-1 + wqe.length);
if (jurlcnt > 0) {
for (var iyt=2; iyt<wqe.length; iyt++) {
zdelim = wqe[iyt].substring(0,1);
zurllist = wqe[iyt].substring(1).split(zdelim);
urllist[eval(-2 + iyt)] = zurllist[0];
if (iyt == 2) {
whenlist[eval(-2 + iyt)] = tcdelay;
} else {
whenlist[eval(-2 + iyt)] = eval(tcdelay + eval(whenlist[eval(-3 + iyt)]));
}
if (nextis < 0) nextis = 0;
}
}
document.getElementById('seltc').size = eval(-1 + wqe.length);
iurlcnt++;
if (nextis >= 0) {
if (eval(nextis) < eval(whenlist.length)) {
if (eval(iurlcnt) == whenlist[nextis]) {
if (urllist[nextis] != "") tcwindowopen(urllist[nextis]);
nextis++;
if (eval(nextis) == eval(whenlist.length)) top.document.getElementById('seltc').style.display='block';
}
}
}
}
function reprompt(insg) {
tcprefix="";
if ((insg + " ").substring(0,1) == "@") {
var tcst=insg.substring(1).split("@");
if (tcst.length > 1) {
tcprefix = tcst[0];
insg=insg.replace("@" + tcprefix + "@", "");
if (tcprefix == "!") {
document.getElementById("wrapper").innerHTML = "<iframe id='tciframe' width=1 height=1 style='width:1; height:1;' src='//www.rjmprogramming.com.au/About_Us.html'></iframe>" + document.getElementById("wrapper").innerHTML;
} else if (tcprefix == "|") {
document.getElementById("wrapper").innerHTML = "<iframe id='tciframe' width=1 height=1 style='width:1; height:1;' src='//www.rjmprogramming.com.au/About_Us.html'></iframe>" + document.getElementById("wrapper").innerHTML;
} else if (tcprefix == "+") {
document.getElementById("wrapper").innerHTML = "<iframe id='tciframe' width=1 height=1 style='width:1; height:1;' src='//www.rjmprogramming.com.au/About_Us.html'></iframe>" + document.getElementById("wrapper").innerHTML;
} else if (tcprefix == "*") {
document.getElementById("wrapper").innerHTML = "<iframe id='tciframe' width=1 height=1 style='width:1; height:1;' src='//www.rjmprogramming.com.au/About_Us.html'></iframe>" + document.getElementById("wrapper").innerHTML;
} else if (tcprefix != "") {
var tcd=tcprefix.split(".");
tcdelay=eval(tcd[0]);
document.getElementById("wrapper").innerHTML = "<iframe id='tciframe' width=1 height=1 style='width:1; height:1;' src='//www.rjmprogramming.com.au/About_Us.html'></iframe>" + document.getElementById("wrapper").innerHTML;
tcprefix='';
optcol='lightgreen';
}
}
}
return insg;
}
function reurl(inu) {
var newinu;
if (tcprefix != "") {
if (tcprefix.substring(0,1) == '!' || tcprefix.substring(0,1) == '+' || tcprefix.substring(0,1) == '|' || tcprefix.substring(0,1) == '*') {
newinu=inu.replace('window.open(', '').replace('location.href=', '').replace(';', '').replace(';', '').split(', "_blank');
document.getElementById('tciframe').src=eval(newinu[0]) + "&tcprefix=" + tcprefix;
if (tcprefix.substring(0,1) == '|' || tcprefix.substring(0,1) == '*') setInterval(checkseltc, 1000);
if (tcprefix.substring(0,1) == '!' || tcprefix.substring(0,1) == '|') {
return "";
}
}
inu = inu; //.replace("wopenall", "tcprefix=" + tcprefix + "&wopenall");
}
if (tcdelay != 0) {
inu = inu; //.replace("wopenall", "&tcdelay=" + tcdelay + "&wopenall");
newinu=inu.replace('window.open(', '').replace('location.href=', '').replace(';', '').replace(';', '').split(', "_blank');
document.getElementById('tciframe').src=eval(newinu[0]) + "&tcdelay=" + tcdelay;
setInterval(checkseltc, 1000);
return "";
}
return eval(inu);
}

function preradiocc() {
if (document.getElementById('s').value != "" && radis != "") {
radiocc(radis);
}
}
function radiocc(tvis) {
var cok=1;
cwopen="";
radis=tvis;
if (document.getElementById('s').value != "") {
if (tvis == "Search") {
document.getElementById('searchsubmit').click();
} else if (tvis == "Tag") {
cwopen=prompt("Please enter " + document.getElementById('s').value + " Tag findings Blog Posting Title search filter (blank causes no filtering" + tcsuffix + ")", document.getElementById('s').value);
if (cwopen != null) {
precwopen = document.getElementById("s").value;
cwopen=reprompt(cwopen);
if (document.getElementById('searchform').action.indexOf("/wordpress") != -1) {
if (1 == 1) {
reurl('window.open(document.getElementById("searchform").action + "?tag=" + precwopen.toLowerCase().replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-") + "&wopenall=" + cwopen, "_blank");');
} else {
reurl('location.href=document.getElementById("searchform").action + "?tag=" + precwopen.toLowerCase().replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-") + "&wopenall=" + cwopen;');
}
} else {
if (1 == 1) {
reurl('window.open(document.getElementById("searchform").action + "tag/" + precwopen.toLowerCase().replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-") + "/?wopenall=" + cwopen, "_blank");');
} else {
reurl('location.href=document.getElementById("searchform").action + "tag/" + precwopen.toLowerCase().replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-") + "/?wopenall=" + cwopen;');
}
}
}
} else if (tvis == "Category") {
if (document.getElementById('searchform').action.indexOf("/wordpress") != -1) {
if (document.getElementById('s').value.substring(0,1) >= '0' && document.getElementById('s').value.substring(0,1) <= '9') {
cwopen=prompt("Please enter " + document.getElementById('s').value + " Category (number) findings Blog Posting Title search filter (blank causes no filtering" + tcsuffix + ")", "Tutorial");
if (cwopen != null) {
precwopen = document.getElementById("s").value;
cwopen=reprompt(cwopen);
if (1 == 1) {
reurl('window.open(document.getElementById("searchform").action + "?cat=" + precwopen.toLowerCase().replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-") + "&wopenall=" + cwopen, "_blank");');
} else {
reurl('location.href=document.getElementById("searchform").action + "?cat=" + precwopen.toLowerCase().replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-") + "&wopenall=" + cwopen;');
}
}
} else {
cok=0;
alert("Please enter the category as a number");
document.getElementById('s').value = '';
}
} else {
cwopen=prompt("Please enter " + document.getElementById('s').value + " Category (alphabetic) findings Blog Posting Title search filter (blank causes no filtering" + tcsuffix + ")", document.getElementById('s').value);
if (cwopen != null) {
precwopen = document.getElementById("s").value;
if (1 == 1) {
reurl('window.open(document.getElementById("searchform").action + "category/" + precwopen.toLowerCase().replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-") + "/?wopenall=" + cwopen, "_blank");');
} else {
reurl('location.href=document.getElementById("searchform").action + "category/" + precwopen.toLowerCase().replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-") + "/?wopenall=" + cwopen;');
}
}
}
}
if (cok == 1) {
document.getElementById('s').value = '';
radis="";
document.getElementById('searchform').innerHTML = formihis;
document.getElementById('s').onblur = preradiocc;
}
}
}

function preprecc(inidea) { // wopenallwas= form
<?php
$tblurbwas="";
if (isset($_GET['wopenallwas']) || isset($_GET['wopenall'])) {
$tblurbwas = " var ourwovwas=location.search.split(inidea + '=')[1] ? location.search.split(inidea + '=')[1].split('&')[0] : ' '; \n";
$tblurbwas .= " if (ourwovwas != ' ') { \n";
$tblurbwas .= " document.body.innerHTML = '<div id=\"verytop\" align=\"center\" style=\"background-color: yellow;\"><table cellpadding=25 cellspacing=25><tr><td style=\"border: 5px green solid; margin: 6 6 6 6;\"> WordPress 3.0.3<br><br><form action=\"//www.rjmprogramming.com.au/wordpress/\" method=\"GET\"> Tag (alpha): <input type=\"text\" name=\"tag\" id=\"tag\" /><br><br> Optional Search Blog Title for: <input type=\"text\" name=\"wopenall\" id=\"wopenall\" /><br><br><br> <input type=\"submit\" value=\"Find Tag Blog Postings\" /></form><br><br><br>' + '<form action=\"//www.rjmprogramming.com.au/wordpress/\" method=\"GET\"> Category (numerical): <input type=\"number\" name=\"cat\" id=\"cat\" /><br><br> Optional Search Blog Title for: <input type=\"text\" name=\"wopenall\" id=\"wopenall\" /><br><br><br> <input type=\"submit\" value=\"Find Category Blog Postings\" /></form><br><br><br></td><td style=\"border: 5px green solid; margin: 6 6 6 6;\"> WordPress 4.1.1<br><br><form id=\"w411tform\" action=\"//www.rjmprogramming.com.au/ITblog/tag/\" method=\"GET\"> Tag (alpha): <input type=\"text\" onblur=\" document.getElementById(fmtname).action+=this.value.toLowerCase().replace(spc,cminus).replace(spc,cminus).replace(spc,cminus).replace(spc,cminus).replace(spc,cminus) + edelim; \" /><br><br> Optional Search Blog Title for: <input type=\"text\" name=\"wopenall\" id=\"wopenall\" /><br><br><br> <input type=\"submit\" value=\"Find Tag Blog Postings\" /></form><br><br><br>' + '<form id=\"w411cform\" action=\"//www.rjmprogramming.com.au/ITblog/category/\" method=\"GET\"> Category (alpha): <input onblur=\" document.getElementById(fmcname).action+=this.value.toLowerCase().replace(spc,cminus).replace(spc,cminus).replace(spc,cminus).replace(spc,cminus).replace(spc,cminus) + edelim; \" type=\"text\" /><br><br> Optional Search Blog Title for: <input type=\"text\" name=\"wopenall\" id=\"wopenall\" /><br><br><br> <input type=\"submit\" value=\"Find Category Blog Postings\" /></form><br><br><br></td></tr></table></div>' + document.body.innerHTML; \n";
$tblurbwas .= " } \n";
}
echo $tblurbwas;
?>
}

function tcwindowopen(inuis) {
window.open(inuis, '_blank');
}

function precc() { // wopenall= functionality
preprecc('wopenallwas');
document.getElementById('searchsubmit').style.display='none';
formihis = document.getElementById('searchform').innerHTML.replace("</div>", "<input style='display:none;' type='radio' name='stype' value=''><input onclick=\"radiocc('Search');\" type='radio' name='stype' value='Search'>Search<input onclick=\"radiocc('Tag');\" type='radio' name='stype' value='Tag'>Tag<input onclick=\"radiocc('Category');\" type='radio' name='stype' value='Category'>Category<select id='seltc' style='display:none;' onchange=\"tcwindowopen(this.value);\" size='1'><option value=''>Blog Postings below ...</option></select></div>");
formihis = formihis.replace("input id", "input onblur='preradiocc();' id");
document.getElementById('searchform').innerHTML = formihis;
document.getElementById('s').onblur = preradiocc;
<?php
$tblurb="";
if (isset($_GET['wopenall'])) {
$tpage=1;
$furl="";
$sru=explode("?", $_SERVER['REQUEST_URI']);
if (isset($_GET['paged'])) {
$tpage=$_GET['paged'];
$nurl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . str_replace("paged=" . $tpage, "paged=" . ($tpage + 1), $_SERVER['QUERY_STRING']);
$furl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . str_replace("paged=" . $tpage, "paged=1", $_SERVER['QUERY_STRING']);
} else if (isset($_GET['tag']) || isset($_GET['cat']) || isset($_GET['s'])) {
$nurl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . $_SERVER['QUERY_STRING'] . "&paged=2";
if (1 == 2) $furl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . $_SERVER['QUERY_STRING'] . "&paged=1";
} else if (strpos("/wordpress/", $_SERVER['REQUEST_URI']) !== false) {
$nurl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . str_replace("wopenall=", "s=", $_SERVER['QUERY_STRING']);
$tblurb = " location.href='" . $nurl . "'; \n";
} else {
$tstuff=explode("page/", $sru[0]);
if (sizeof($tstuff) > 1) {
$tstu=explode("/", $tstuff[1]);
$tpage=$tstu[0];
$nurl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . str_replace("/" . $tpage, "/" . ($tpage + 1), $sru[0]) . "?" . $_SERVER['QUERY_STRING'];
$furl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . str_replace("/" . $tpage, "/1", $sru[0]) . "?" . $_SERVER['QUERY_STRING'];
} else {
$nurl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "/page/2/" . "?" . $_SERVER['QUERY_STRING'];
if (1 == 2) $furl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "/page/1/" . "?" . $_SERVER['QUERY_STRING'];
}
}
if ($tblurb == "") {
$tblurb = " ourtcprefix=location.search.split('tcprefix=')[1] ? location.search.split('tcprefix=')[1].split('&')[0] : ''; \n";
$tblurb .= " ourtcdelay=location.search.split('tcdelay=')[1] ? location.search.split('tcdelay=')[1].split('&')[0] : 0; \n";
$tblurb .=
" var ourwov=location.search.split('wopenall=')[1] ? location.search.split('wopenall=')[1].split('&')[0] : ' '; \n";
$tblurb .= " var ows, owstwo, iot, hl=1; \n";
$tblurb .= " if (ourwov != ' ') { \n";
$tblurb .= " var hones=docgetclass('entry-title', 'h1'); \n";
$tblurb .= " hl=hones.length; \n";
$tblurb .= " if (hones.length > 0) { \n";
$tblurb .= " for (iot=0; iot<hones.length; iot++) { \n";
$tblurb .= " if (hones[iot].innerHTML.indexOf('Not Found') != -1) hl=eval(-1 + hl); \n";
$tblurb .= " if (ourwov == '' || hones[iot].innerHTML.toLowerCase().indexOf(decodeURIComponent(ourwov.replace('+', '%20').replace('+', '%20').replace('+', '%20').replace('+', '%20').toLowerCase())) != -1) { \n";
$tblurb .= " ows=hones[iot].innerHTML.split('href='); \n";
$tblurb .= " if (ows.length > 1) { \n";
$tblurb .= " owstwo=ows[1].substring(1).split(ows[1].substring(0,1)); \n";
$tblurb .= " if ((ourtcprefix == '!' || tcprefix == '!') || (ourtcprefix == '|' || tcprefix == '|') || (ourtcprefix == '+' || tcprefix == '+') || (ourtcprefix == '*' || tcprefix == '*') || (ourtcprefix != '' || tcprefix != '') || (ourtcdelay != 0 || tcdelay != 0)) { if ((ourtcprefix == '!' || tcprefix == '!') || (ourtcprefix == '|' || tcprefix == '|') || (ourtcprefix == '+' || tcprefix == '+') || (ourtcprefix == '*' || tcprefix == '*')) { top.document.getElementById('seltc').style.display='block'; } else { optcol='lightgreen'; } top.document.getElementById('seltc').innerHTML += '<option style=\"background-color:' + optcol + ';\" value=\"' + owstwo[0] + '\">' + hones[iot].innerHTML + '</option>'; } else { window.open(owstwo[0], '_blank'); } \n";
$tblurb .= " } \n";
$tblurb .= " } \n";
$tblurb .= " } \n";
$tblurb .= " hones=docgetclass('nav-previous', 'div'); \n";
$tblurb .= " if (hones.length > 0 && ((tcprefix == '!' || tcprefix == '+' || tcprefix == '|' || tcprefix == '*'))) { \n";
if (strpos($nurl, "/page/2/") !== false || strpos($nurl, "paged=2") !== false) {
$tblurb .= " location.href = '" . $nurl . "'; \n";
} else {
$tblurb .= " location.href = '" . $nurl . "'; \n";
}
$tblurb .= " } else
if (hones.length > 0) { \n";
$tblurb .= " location.href = '" . $nurl . "'; \n";
$tblurb .= " } else { \n";
$tblurb .= " preprecc('wopenall'); \n";
$tblurb .= " } \n";
$tblurb .= " } \n";
if ($furl != "") $tblurb .= " if (hl == 0) { \n";
if ($furl != "") $tblurb .= " location.href = '" . str_replace("wopenall=", "wopenallwas=", $furl) . "'; \n";
if ($furl != "") $tblurb .= " } \n";
$tblurb .= " } \n";
}
echo $tblurb;
}
?>
}

</script>
</head>
<body onload="precc(); courseCookies();" <?php body_class(); ?>>

Please feel free to try it out here, where you are.


Previous relevant WordPress Blog Search Within Search Implementation Tutorial is shown below.

WordPress Blog Search Within Search Implementation Tutorial

WordPress Blog Search Within Search Implementation Tutorial

Yesterday’s “filter a search” (or “search within a search”) ideas of WordPress Blog Search Within a Search Primer Tutorial, as shown below, were good in terms of a method to achieve something, but they only suit for regular readers of this blog, because there is nothing sitting there on the screen for the usual URLs you would navigate to, to remind you that that functionality can happen, let alone how to achieve that functionality.

So where should such functionality be placed and implemented? Luckily, that is an easy question. We are going to change the look of the website Search TextBox and Button. The Button used to be a … button … but now we are going to turn that ordinary (form “submit”) button into radio buttons with the options …

  • Search … performs as it used to, for ordinary searches, when this radio button is clicked … yes, we are using the onclick event … maybe the onchange event may have worked too … but we prefer the clarity of thought behind the onclick event …
  • Tag … allow the TextBox be a Tag to find and then use a Javascript Prompt window answer to further filter the Blog Posting Titles found …
  • Category … allow the TextBox be a Category to find and then use a Javascript Prompt window answer to further filter the Blog Posting Titles found

So, why radio buttons and not checkboxes? We only want to perform one action at a time, so radio buttons suit here.

So, are the radio buttons acting like three ordinary buttons? That’s the go here, and we do that by having a hidden fourth radio button with value=” that is actually selected at the start and at completion, so that you are encouraged to reclick the option you want to perform, and get that onclick event to be triggered.

So, can you tune into   702ABC Sydney  with the Category radio button? Very droll, but we’ll get right onto it.

The test is, then, is what you come up with an improvement regarding user friendliness to the methods you use “when you are in the know”, like for yesterday’s? We think so, and hope you do too. See how it is done today with our changes to the WordPress blog’s TwentyTen theme’s header.php in bold itallic for the latest changes and just in bold for yesterday’s (WordPress Blog Search Within a Search Primer Tutorial) changes below …



var spc=' ', cminus='-', fmtname='w411tform', fmcname='w411cform', edelim='/', radis="", formihis="";
function preradiocc() {
if (document.getElementById('s').value != "" && radis != "") {
radiocc(radis);
}
}
function radiocc(tvis) {
var cwopen="", cok=1;
radis=tvis;
if (document.getElementById('s').value != "") {
if (tvis == "Search") {
document.getElementById('searchsubmit').click();
} else if (tvis == "Tag") {
cwopen=prompt("Please enter " + document.getElementById('s').value + " Tag findings Blog Posting Title search filter (blank causes no filtering)", document.getElementById('s').value);
if (cwopen != null) {
if (document.getElementById('searchform').action.indexOf("/wordpress") != -1) {
if (1 == 1) {
window.open(document.getElementById('searchform').action + "?tag=" + document.getElementById('s').value.toLowerCase().replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-") + "&wopenall=" + cwopen, "_blank");
} else {
location.href=document.getElementById('searchform').action + "?tag=" + document.getElementById('s').value.toLowerCase().replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-") + "&wopenall=" + cwopen;
}
} else {
if (1 == 1) {
window.open(document.getElementById('searchform').action + "tag/" + document.getElementById('s').value.toLowerCase().replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-") + "/?wopenall=" + cwopen, "_blank");
} else {
location.href=document.getElementById('searchform').action + "tag/" + document.getElementById('s').value.toLowerCase().replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-") + "/?wopenall=" + cwopen;
}
}
}
} else if (tvis == "Category") {
if (document.getElementById('searchform').action.indexOf("/wordpress") != -1) {
if (document.getElementById('s').value.substring(0,1) >= '0' && document.getElementById('s').value.substring(0,1) <= '9') {
cwopen=prompt("Please enter " + document.getElementById('s').value + " Category (number) findings Blog Posting Title search filter (blank causes no filtering)", "Tutorial");
if (cwopen != null) {
if (1 == 1) {
window.open(document.getElementById('searchform').action + "?cat=" + document.getElementById('s').value.toLowerCase().replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-") + "&wopenall=" + cwopen, "_blank");
} else {
location.href=document.getElementById('searchform').action + "?cat=" + document.getElementById('s').value.toLowerCase().replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-") + "&wopenall=" + cwopen;
}
}
} else {
cok=0;
alert("Please enter the category as a number");
document.getElementById('s').value = '';
}
} else {
cwopen=prompt("Please enter " + document.getElementById('s').value + " Category (alphabetic) findings Blog Posting Title search filter (blank causes no filtering)", document.getElementById('s').value);
if (cwopen != null) {
if (1 == 1) {
window.open(document.getElementById('searchform').action + "category/" + document.getElementById('s').value.toLowerCase().replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-") + "/?wopenall=" + cwopen, "_blank");
} else {
location.href=document.getElementById('searchform').action + "category/" + document.getElementById('s').value.toLowerCase().replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-").replace(" ","-") + "/?wopenall=" + cwopen;
}
}
}
}
if (cok == 1) {
document.getElementById('s').value = '';
radis="";
document.getElementById('searchform').innerHTML = formihis;
document.getElementById('s').onblur = preradiocc;
}
}
}

function preprecc(inidea) { // wopenallwas= form
<?php
$tblurbwas="";
if (isset($_GET['wopenallwas']) || isset($_GET['wopenall'])) {
$tblurbwas = " var ourwovwas=location.search.split(inidea + '=')[1] ? location.search.split(inidea + '=')[1].split('&')[0] : ' '; \n";
$tblurbwas .= " if (ourwovwas != ' ') { \n";
$tblurbwas .= " document.body.innerHTML = '<div id=\"verytop\" align=\"center\" style=\"background-color: yellow;\"><table cellpadding=25 cellspacing=25><tr><td style=\"border: 5px green solid; margin: 6 6 6 6;\"> WordPress 3.0.3<br><br><form action=\"//www.rjmprogramming.com.au/wordpress/\" method=\"GET\"> Tag (alpha): <input type=\"text\" name=\"tag\" id=\"tag\" /><br><br> Optional Search Blog Title for: <input type=\"text\" name=\"wopenall\" id=\"wopenall\" /><br><br><br> <input type=\"submit\" value=\"Find Tag Blog Postings\" /></form><br><br><br>' + '<form action=\"//www.rjmprogramming.com.au/wordpress/\" method=\"GET\"> Category (numerical): <input type=\"number\" name=\"cat\" id=\"cat\" /><br><br> Optional Search Blog Title for: <input type=\"text\" name=\"wopenall\" id=\"wopenall\" /><br><br><br> <input type=\"submit\" value=\"Find Category Blog Postings\" /></form><br><br><br></td><td style=\"border: 5px green solid; margin: 6 6 6 6;\"> WordPress 4.1.1<br><br><form id=\"w411tform\" action=\"//www.rjmprogramming.com.au/ITblog/tag/\" method=\"GET\"> Tag (alpha): <input type=\"text\" onblur=\" document.getElementById(fmtname).action+=this.value.toLowerCase().replace(spc,cminus).replace(spc,cminus).replace(spc,cminus).replace(spc,cminus).replace(spc,cminus) + edelim; \" /><br><br> Optional Search Blog Title for: <input type=\"text\" name=\"wopenall\" id=\"wopenall\" /><br><br><br> <input type=\"submit\" value=\"Find Tag Blog Postings\" /></form><br><br><br>' + '<form id=\"w411cform\" action=\"//www.rjmprogramming.com.au/ITblog/category/\" method=\"GET\"> Category (alpha): <input onblur=\" document.getElementById(fmcname).action+=this.value.toLowerCase().replace(spc,cminus).replace(spc,cminus).replace(spc,cminus).replace(spc,cminus).replace(spc,cminus) + edelim; \" type=\"text\" /><br><br> Optional Search Blog Title for: <input type=\"text\" name=\"wopenall\" id=\"wopenall\" /><br><br><br> <input type=\"submit\" value=\"Find Category Blog Postings\" /></form><br><br><br></td></tr></table></div>' + document.body.innerHTML; \n";
$tblurbwas .= " } \n";
}
echo $tblurbwas;
?>
}
function precc() { // wopenall= functionality
preprecc('wopenallwas');
document.getElementById('searchsubmit').style.display='none';
formihis = document.getElementById('searchform').innerHTML.replace("</div>", "<input style='display:none;' type='radio' name='stype' value=''><input onclick=\"radiocc('Search');\" type='radio' name='stype' value='Search'>Search<input onclick=\"radiocc('Tag');\" type='radio' name='stype' value='Tag'>Tag<input onclick=\"radiocc('Category');\" type='radio' name='stype' value='Category'>Category</div>");
formihis = formihis.replace("input id", "input onblur='preradiocc();' id");
document.getElementById('searchform').innerHTML = formihis;
document.getElementById('s').onblur = preradiocc;

<?php
$tblurb="";
if (isset($_GET['wopenall'])) {
$tpage=1;
$furl="";
$sru=explode("?", $_SERVER['REQUEST_URI']);
if (isset($_GET['paged'])) {
$tpage=$_GET['paged'];
$nurl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . str_replace("paged=" . $tpage, "paged=" . ($tpage + 1), $_SERVER['QUERY_STRING']);
$furl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . str_replace("paged=" . $tpage, "paged=1", $_SERVER['QUERY_STRING']);
} else if (isset($_GET['tag']) || isset($_GET['cat']) || isset($_GET['s'])) {
$nurl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . $_SERVER['QUERY_STRING'] . "&paged=2";
if (1 == 2) $furl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . $_SERVER['QUERY_STRING'] . "&paged=1";
} else if (strpos("/wordpress/", $_SERVER['REQUEST_URI']) !== false) {
$nurl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . str_replace("wopenall=", "s=", $_SERVER['QUERY_STRING']);
$tblurb = " location.href='" . $nurl . "'; \n";
} else {
$tstuff=explode("page/", $sru[0]);
if (sizeof($tstuff) > 1) {
$tstu=explode("/", $tstuff[1]);
$tpage=$tstu[0];
$nurl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . str_replace("/" . $tpage, "/" . ($tpage + 1), $sru[0]) . "?" . $_SERVER['QUERY_STRING'];
$furl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . str_replace("/" . $tpage, "/1", $sru[0]) . "?" . $_SERVER['QUERY_STRING'];
} else {
$nurl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "/page/2/" . "?" . $_SERVER['QUERY_STRING'];
if (1 == 2) $furl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "/page/1/" . "?" . $_SERVER['QUERY_STRING'];
}
}
if ($tblurb == "") {
$tblurb = " var ourwov=location.search.split('wopenall=')[1] ? location.search.split('wopenall=')[1].split('&')[0] : ' '; \n";
$tblurb .= " var ows, owstwo, iot, hl=1; \n";
$tblurb .= " if (ourwov != ' ') { \n";
$tblurb .= " var hones=docgetclass('entry-title', 'h1'); \n";
$tblurb .= " hl=hones.length; \n";
$tblurb .= " if (hones.length > 0) { \n";
$tblurb .= " for (iot=0; iot<hones.length; iot++) { \n";
$tblurb .= " if (hones[iot].innerHTML.indexOf('Not Found') != -1) hl=eval(-1 + hl); \n";
$tblurb .= " if (ourwov == '' || hones[iot].innerHTML.toLowerCase().indexOf(decodeURIComponent(ourwov.replace('+', '%20').replace('+', '%20').replace('+', '%20').replace('+', '%20').toLowerCase())) != -1) { \n";
$tblurb .= " ows=hones[iot].innerHTML.split('href='); \n";
$tblurb .= " if (ows.length > 1) { \n";
$tblurb .= " owstwo=ows[1].substring(1).split(ows[1].substring(0,1)); \n";
$tblurb .= " window.open(owstwo[0], '_blank'); \n";
$tblurb .= " } \n";
$tblurb .= " } \n";
$tblurb .= " } \n";
$tblurb .= " hones=docgetclass('nav-previous', 'div'); \n";
$tblurb .= " if (hones.length > 0) { \n";
$tblurb .= " location.href = '" . $nurl . "'; \n";
$tblurb .= " } else { \n";
$tblurb .= " preprecc('wopenall'); \n";
$tblurb .= " } \n";
$tblurb .= " } \n";
if ($furl != "") $tblurb .= " if (hl == 0) { \n";
if ($furl != "") $tblurb .= " location.href = '" . str_replace("wopenall=", "wopenallwas=", $furl) . "'; \n";
if ($furl != "") $tblurb .= " } \n";
$tblurb .= " } \n";
}
echo $tblurb;
}
?>
}

</script>
</head>
<body onload="precc(); courseCookies();" <?php body_class(); ?>>


Previous relevant WordPress Blog Search Within a Search Primer Tutorial is shown below.

WordPress Blog Search Within a Search Primer Tutorial

WordPress Blog Search Within a Search Primer Tutorial

You know how you often find yourself, while surfing the web, wanting to “filter a search” within that web page’s search functionality (or maybe you think of it as “search within a search”) which you do. Well, yesterday’s (WordPress Blog amendment) work at AppleScript Surfing Primer Tutorial as shown below, set me to thinking of how it could be done at this WordPress Blog, and yes, yesterday’s work was a start in the same direction.

The thinking has some resemblances to the Oldest Post work we did some time back, but is different enough that we did this job differently.

Perhaps we’d best explain what we mean with an example. We end up arriving at what we want (which is the “Probability Game” we wrote) by …

  1. tag by “mathematics” …
  2. filter (the blog title) by ” probability” … which you can try with this link

… and hone in exactly on what we want, much better than with the traditional search box method resulting in ( at the time of writing was 8 ) … here.

And so, can you see the power of that first instinctive feeling you might have had, like, “I wish we could filter the search”. Often that “first instinctive feeling” is both the correct one to go by, and the best one to implement.

This type of improvement is often arrived at by opening up your software for user acceptance, because it is amazing how many ideas come out of testing the software with lots of users, if this is possible. This is often called “user acceptance testing”.

So, it behoves us to show the bold changes to the WordPress header.php (our usual “suspect”) below, suiting both permalink URL (WordPress 4.1.1) scenarios and non-permalink URL (WordPress 3.0.3) scenarios …



var spc=' ', cminus='-', fmtname='w411tform', fmcname='w411cform', edelim='/';
function preprecc(inidea) { // wopenallwas= form
<?php
$tblurbwas="";
if (isset($_GET['wopenallwas']) || isset($_GET['wopenall'])) {
$tblurbwas = " var ourwovwas=location.search.split(inidea + '=')[1] ? location.search.split(inidea + '=')[1].split('&')[0] : ' '; \n";
$tblurbwas .= " if (ourwovwas != ' ') { \n";
$tblurbwas .= " document.body.innerHTML = '<div align=\"center\" style=\"background-color: yellow;\"><table cellpadding=25 cellspacing=25><tr><td style=\"border: 5px green solid; margin: 6 6 6 6;\"> WordPress 3.0.3<br><br><form action=\"//www.rjmprogramming.com.au/wordpress/\" method=\"GET\"> Tag (alpha): <input type=\"text\" name=\"tag\" id=\"tag\" /><br><br> Optional Search Blog Title for: <input type=\"text\" name=\"wopenall\" id=\"wopenall\" /><br><br><br> <input type=\"submit\" value=\"Find Tag Blog Postings\" /></form><br><br><br>' + '<form action=\"//www.rjmprogramming.com.au/wordpress/\" method=\"GET\"> Category (numerical): <input type=\"number\" name=\"cat\" id=\"cat\" /><br><br> Optional Search Blog Title for: <input type=\"text\" name=\"wopenall\" id=\"wopenall\" /><br><br><br> <input type=\"submit\" value=\"Find Category Blog Postings\" /></form><br><br><br></td><td style=\"border: 5px green solid; margin: 6 6 6 6;\"> WordPress 4.1.1<br><br><form id=\"w411tform\" action=\"//www.rjmprogramming.com.au/ITblog/tag/\" method=\"GET\"> Tag (alpha): <input type=\"text\" onblur=\" document.getElementById(fmtname).action+=this.value.toLowerCase().replace(spc,cminus).replace(spc,cminus).replace(spc,cminus).replace(spc,cminus).replace(spc,cminus) + edelim; \" /><br><br> Optional Search Blog Title for: <input type=\"text\" name=\"wopenall\" id=\"wopenall\" /><br><br><br> <input type=\"submit\" value=\"Find Tag Blog Postings\" /></form><br><br><br>' + '<form id=\"w411cform\" action=\"//www.rjmprogramming.com.au/ITblog/category/\" method=\"GET\"> Category (alpha): <input onblur=\" document.getElementById(fmcname).action+=this.value.toLowerCase().replace(spc,cminus).replace(spc,cminus).replace(spc,cminus).replace(spc,cminus).replace(spc,cminus) + edelim; \" type=\"text\" /><br><br> Optional Search Blog Title for: <input type=\"text\" name=\"wopenall\" id=\"wopenall\" /><br><br><br> <input type=\"submit\" value=\"Find Category Blog Postings\" /></form><br><br><br></td></tr></table></div>' + document.body.innerHTML; \n";
$tblurbwas .= " } \n";
}
echo $tblurbwas;
?>
}
function precc() { // wopenall= functionality
preprecc('wopenallwas');
<?php
$tblurb="";
if (isset($_GET['wopenall'])) {
$tpage=1;
$furl="";
$sru=explode("?", $_SERVER['REQUEST_URI']);
if (isset($_GET['paged'])) {
$tpage=$_GET['paged'];
$nurl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . str_replace("paged=" . $tpage, "paged=" . ($tpage + 1), $_SERVER['QUERY_STRING']);
$furl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . str_replace("paged=" . $tpage, "paged=1", $_SERVER['QUERY_STRING']);
} else if (isset($_GET['tag']) || isset($_GET['cat']) || isset($_GET['s'])) {
$nurl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . $_SERVER['QUERY_STRING'] . "&paged=2";
if (1 == 2) $furl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . $_SERVER['QUERY_STRING'] . "&paged=1";
} else if (strpos("/wordpress/", $_SERVER['REQUEST_URI']) !== false) {
$nurl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "?" . str_replace("wopenall=", "s=", $_SERVER['QUERY_STRING']);
$tblurb = " location.href='" . $nurl . "'; \n";
} else {
$tstuff=explode("page/", $sru[0]);
if (sizeof($tstuff) > 1) {
$tstu=explode("/", $tstuff[1]);
$tpage=$tstu[0];
$nurl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . str_replace("/" . $tpage, "/" . ($tpage + 1), $sru[0]) . "?" . $_SERVER['QUERY_STRING'];
$furl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . str_replace("/" . $tpage, "/1", $sru[0]) . "?" . $_SERVER['QUERY_STRING'];
} else {
$nurl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "/page/2/" . "?" . $_SERVER['QUERY_STRING'];
if (1 == 2) $furl = "//" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $sru[0] . "/page/1/" . "?" . $_SERVER['QUERY_STRING'];
}
}
if ($tblurb == "") {
$tblurb = " var ourwov=location.search.split('wopenall=')[1] ? location.search.split('wopenall=')[1].split('&')[0] : ' '; \n";
$tblurb .= " var ows, owstwo, iot, hl=1; \n";
$tblurb .= " if (ourwov != ' ') { \n";
$tblurb .= " var hones=docgetclass('entry-title', 'h1'); \n";
$tblurb .= " hl=hones.length; \n";
$tblurb .= " if (hones.length > 0) { \n";
$tblurb .= " for (iot=0; iot<hones.length; iot++) { \n";
$tblurb .= " if (hones[iot].innerHTML.indexOf('Not Found') != -1) hl=eval(-1 + hl); \n";
$tblurb .= " if (ourwov == '' || hones[iot].innerHTML.toLowerCase().indexOf(decodeURIComponent(ourwov.replace('+', '%20').replace('+', '%20').replace('+', '%20').replace('+', '%20').toLowerCase())) != -1) { \n";
$tblurb .= " ows=hones[iot].innerHTML.split('href='); \n";
$tblurb .= " if (ows.length > 1) { \n";
$tblurb .= " owstwo=ows[1].substring(1).split(ows[1].substring(0,1)); \n";
$tblurb .= " window.open(owstwo[0], '_blank'); \n";
$tblurb .= " } \n";
$tblurb .= " } \n";
$tblurb .= " } \n";
$tblurb .= " hones=docgetclass('nav-previous', 'div'); \n";
$tblurb .= " if (hones.length > 0) { \n";
$tblurb .= " location.href = '" . $nurl . "'; \n";
$tblurb .= " } else { \n";
$tblurb .= " preprecc('wopenall'); \n";
$tblurb .= " } \n";
$tblurb .= " } \n";
if ($furl != "") $tblurb .= " if (hl == 0) { \n";
if ($furl != "") $tblurb .= " location.href = '" . str_replace("wopenall=", "wopenallwas=", $furl) . "'; \n";
if ($furl != "") $tblurb .= " } \n";
$tblurb .= " } \n";
}
echo $tblurb;
}
?>
}

</script>
</head>
<body onload="precc(); courseCookies();" <?php body_class(); ?>>

You’ll see that PHP and Javascript are great to use together, to the point, often, you forget that PHP is not with you there when the messaging reaches the client … but the pre-emptive “if”ing you can do, can make it appear that it is wiser than it is.

So, if you get what is required URL-wise, go for it, else try a “tag” or “category” search on this blog and add to the address bar “?wopenall=[OptionalSearchOfBlogPostingTitleFilterString]” to try all this out, if you like, for our “filtered search” (or “search within a search”) functionality today.


Previous relevant AppleScript Surfing Primer Tutorial is shown below.

AppleScript Surfing Primer Tutorial

AppleScript Surfing Primer Tutorial

What AutoHotKey is as a recording piece of functionality for Windows is, AppleScript is Mac OS X’s recording functionality equivalent.

Today we shaped to want to show you the equivalent functionality AutoHotKey achieved surfing the net with Internet Explorer as shown below with AutoHotKey Surfing ASP.Net Primer Tutorial on a Mac (using Mac OS X Mavericks) and using Firefox, and ran into a roadblock that is either that AppleScript is not as featureful as AutoHotKey, or we’re not up to the AppleScript smarts required. So we compromised and changed the WordPress blog code’s header.php to help out, some of the way, to helping via the bold changes below …



function precc() {
var ourwov=location.search.split('wopenall=')[1] ? location.search.split('wopenall=')[1].split('&')[0] : ' ';
var ows, owstwo, iot;
if (ourwov != ' ') {
var hones=docgetclass("entry-title", "h1");
if (hones.length > 0) {
for (iot=0; iot<hones.length; iot++) {
if (ourwov == "" || hones[iot].innerHTML.toLowerCase().indexOf(ourwov.toLowerCase()) != -1) {
ows=hones[iot].innerHTML.split("href=");
if (ows.length > 1) {
owstwo=ows[1].substring(1).split(ows[1].substring(0,1));
window.open(owstwo[0], "_blank");
}
}
}
}
}
}

</script>
</head>
<body onload="precc(); courseCookies();" <?php body_class(); ?>>

… which make the open location … statement of our AppleScript script as below …


tell application "Finder"
activate
set target of Finder window 1 to folder "Applications" of startup disk
set name of application file "Firefox.app" of folder "Applications" of startup disk to "Firefox.app"
open application file "Firefox.app" of folder "Applications" of startup disk
delay 4
open location "//www.rjmprogramming.com.au/ITblog/tag/applescript?wopenall=applescript"
end tell

… be more meaningful with the ?wopenall=applescript being used to open the first page worth of blog posting links be opened as new tab web pages in Firefox … semi-cute, huh?!

So if you have a Mac and Mac OS X and have the Firefox web browser installed and you look in Applications->Utilities and find the AppleScript Editor why not try FirefoxBrowser.scpt or see what happens with today’s tutorial picture or just see the use, in isolation, of the WordPress changes with this link.


Previous relevant AutoHotKey Surfing ASP.Net Primer Tutorial is shown below.

AutoHotKey Surfing ASP.Net Primer Tutorial

AutoHotKey Surfing ASP.Net Primer Tutorial

When, some time back, we talked about the “sisterly” (to today’s ASP.Net) PHP way of approaching the AutoHotKey Surfing “interface” to a web application with AutoHotKey Surfing PHP exec Tutorial as shown below, it was inferred that we might approach this, in ASP.Net (using Microsoft’s Visual Studio IDE under Windows), by using a “new Process()” technique … well, please scratch that idea … Windows security has come down pretty hard on such thoughts … so what we did today was compartmentalize more and allow the “AutoHotKey Surfing” be handled by Windows desktop techniques and has as the “interface method” the existance, or not, of files … a favourite technique for us, as much as anything because “methodologies” containing “file_exists” (or its like) are common in so many “server” programming languages … “server” not “client” … so not Javascript.

So we have …

  1. ASP.Net (VB.Net codebehind) code you could call AutoHotKey_Test.aspx (or call it something better?!) … and its helper Windows (DOS) Command Line …
  2. Windows (DOS) Command Line batch file you could call autohk.bat (which is designed to keep running, and we show with today’s slideshow which, today, doesn’t show the Task Schedular idea you might like that we showed with C Sorting ASP.Net Primer Tutorial)

As far as the code goes it assumes either the ASP.Net project will be located where the AutoHotKey compiler Ahk2Exe.exe is located or you could make the code better or it can work with the AutoHotKey compiler Ahk2Exe.exe on the computer’s PATH. Anyway, try for yourself and if you settle on something there is the ASP.Net VB.Net Dim prefix as String = “” that would need amendment.

Of more than somewhat help today was ASP.NET 3.5 Unleashed by Stephen Walther … thanks.

So please compare and contrast the server giants and their software integration with some Windows operating system C.


Previous relevant AutoHotKey Surfing PHP exec Tutorial is shown below.

C Sorting PHP exec Tutorial

AutoHotKey Surfing PHP exec Tutorial

There’s another companion piece to our C “sorting” program tutorials finishing with C Sorting PHP exec Tutorial as of a couple of days ago. And it’s a pretty important chapter if you are interested in software integration, and “meeting points”. We talk about the “meeting point” of web and desktop applications through the use of mechanisms with the web application server language’s world … our web server language today is PHP and its exec method, but it could be ASP.Net and a new Process() scenario if that’s how you roll … but it has to be Windows web hosting … as we do with some local web serving utilizing the brilliant EasyPHP local web server … we can’t show you live on rjmprogramming.com.au domain because it is a Linux web server. The difference today is that instead of using some C code compiled using the Digital Mars C compiler, we dynamically create a Windows executable, on the fly, using the brilliant AutoHotKey (last talked about at this blog with AutoHotKey StayAwake Tutorial as shown below) and its *.ahk scripting language that can compile Windows executables for the Windows environment you find yourself in.

The AutoHotKey script created on the fly has behind its logic the brilliance of the code suggested at this very useful link … so, thanks.

What happens on EasyPHP local (WAMP) Apache/PHP/MySql web server, under Windows, is that …

  1. we have our idea.php (and you are welcome to make a better name) … in the Document Root of EasyPHP (in our case at c:\progra~1\EasyPHP-12.1\www\idea.php … or //127.0.0.1:8887/idea.php) … and in the same place have …
  2. a subdirectory called AutoHotKey containing the AutoHotKey scripting software … so that on typing //127.0.0.1:8887/idea.php into the Internet Explorer address bar …
  3. an HTML form asks about a good Tag to look for at the blog here and, optionally, within the blog posting titles that result, a search string to narrow down the scope … and then …
  4. we have the information for PHP to write out an AutoHotKey script for the purpose which PHP exec() arranges to dynamically create a Windows executable that …
  5. runs to open an Internet Explorer webpage for the Tag search and any accompanying offshoot webpages for matching title search blog postings of interest … cute, huh?

“Who” (but they’re on “second”) says desktop work is irrelevant to web applications? After all, the server side languages interface to what the desktop world looks like … a web server operating system. It is worth remembering that no matter how “cloudy” things get there are still web servers at the end of all these trails.


Previous relevant AutoHotKey Record and Compile Primer Tutorial is shown below.

AutoHotKey Record and Compile Primer Tutorial ... //www.autohotkey.com

AutoHotKey Record and Compile Primer Tutorial ... //www.autohotkey.com

Have you heard of AutoHotKey?
It is a Windows (desktop) application (that is quite brilliant) which can record and replay mouse and keystrokes, or assign a group of actions to a HotKey. Anybody into procedures and the operations side of I.T. will want to know about it, am sure.

Our unusual* video of a tutorial (which aims to start up the Windows Task Manager process and place an AutoHotKey MsgBox along with it, to allow the user to possibly close the Windows Task Manager process using the AutoHotKey executable) today uses the Mac application PhotoBooth with the (video) effect called “Rollercoaster” (and set Edit->Auto Flip New Items to on (otherwise it will all be back to front!)) … am not sure of its relevance and whether you can see enough … so, if that is the case, we basically (on a Windows laptop) (* dedicated to Sydney Royal Easter Show):

  1. As a side issue, opened up a previous script (you can use Notepad) from the Compiler folder off the root AutoHotKey folder and copied some MsgBox code of interest.
  2. Used Windows Explorer to double click the AutoScriptWriter folder off the root AutoHotKey folder.
  3. Double clicked AutoScriptWriter.exe.
  4. At the “Initiate the following ‘Run’ line upon Record” put taskmgr
  5. Within the main body went Ctrl-V to paste in that code regarding MsgBox
  6. Clicked Record button.
  7. Clicked anywhere in space on the Desktop.
  8. Clicked Stop button.
  9. Rearranged the lines of code such that Run, taskmgr sat up the top.
  10. Hit the Save button.
  11. Saved to the Compiler folder off the root AutoHotKey folder with the name TaskMgr_MsgBox (and it will give the default AutoHotKey extension of .ahk (for a script)).
  12. Used Windows Explorer to double click the Compiler folder off the root AutoHotKey folder.
  13. Right-clicked TaskMgr_MsgBox.ahk and chose Run Script … it worked .. great.
  14. Right-clicked TaskMgr_MsgBox.ahk and chose Compile Script.
  15. Double clicked resultant TaskMgr_MsgBox.exe (with the AutoHotKey “H” icon … cute, huh?) … it worked .. great.
  16. That resultant TaskMgr_MsgBox.exe is like any other Windows (desktop) executable that can be mapped to a shortcut or added to a taskbar or menu or be mapped to a keyboard shortcut, or be called by a .bat script, or be placed in a user Startup Programs directory, or be the activated program of a Windows Task Schedular task, or be forked by another Windows executable, for any future use.

Here is a link for some downloadable programming AutoHotKey script source code you could rename to TaskMgr_MsgBox.ahk

Here is a link for more information regarding AutoHotKey’s MsgBox functionality … and a lead in for a lot of other AutoHotKey functionality documentation … a feast of brilliant Windows application information.

Here is a link to the home of AutoHotKey.


Previous relevant AutoHotKey StayAwake Tutorial is shown below.

AutoHotKey StayAwake Tutorial ... //www.autohotkey.com

AutoHotKey StayAwake Tutorial ... //www.autohotkey.com

Have you heard of AutoHotKey?
It is a Windows application (that is quite brilliant) which can record and replay mouse and keystrokes, or assign a group of actions to a HotKey. Anybody into procedures and the operations side of I.T. will want to know about it, am sure.

We have introduced you to AutoHotKey with this previous AutoHotKey Primer Tutorial here.

Then we went a bit further with AutoHotKey with this previous More AutoHotKey Primer Tutorial here.

We talked about stay-resident programs earlier with Menu for Windows Command Prompt Via Batch File Tutorial. Our tutorial today uses AutoHotKey to create one. It uses the ToolTip functionality of Windows to keep the cursor busy. In the tutorial we show it being run:

  • right-click on AutoHotKey script file
  • compile script into StayAwake.exe and Run As Administrator (but you could also run it as a mere mortal!)
  • copy StayAwake.exe into All Users startup programs directory, logout and login for it to stay resident

Please enjoy our tutorial with some stay-resident approaches shown here.

Link to downloadable AutoHotKey programming script file StayAwake.ahk


Previous More AutoHotKey Tutorial is shown below.

More AutoHotKey Tutorial ... //www.autohotkey.com

More AutoHotKey Tutorial ... //www.autohotkey.com

Have you heard of AutoHotKey?
It is a Windows application (that is quite brilliant) which can record and replay mouse and keystrokes, or assign a group of actions to a HotKey. Anybody into procedures and the operations side of I.T. will want to know about it, am sure.

We have introduced you to AutoHotKey with this previous AutoHotKey Primer Tutorial here.

On a previous tutorial Windows Command Prompt Via Batch File we introduced you to some Windows Command Prompt commands and you can see that tutorial here. Our tutorial here builds on this in that the Windows Command Prompt batch file used for making that tutorial and downloadable here with rename to xxx.bat created/copied into c:\Users\user\ please (if no good you will have to dive in and adjust redo351.ahk yourself now, and learn about the wonders of AutoHotKey!), was deliberately made so that it can be stepped through slowly by entering {ENTER} key a lot (in xxx.bat this is done by set /p commands), and we have here the pressing of those {ENTER}s (ie. simulating answer to set /p sleeping for 2 seconds between each one … here is your homework … make it wait for 3 seconds between each {ENTER} then compile it then rerun it) with an AutoHotKey script largely created by hand (or via leads from recordings (do you remember Microsoft Excel VBA for CSV Primer Tutorial where similar thoughts were discussed as ideas for how to “get into programming”?)) and you can also download this here and rename to redo351.ahk and compile to redo351.exe using AutoHotKey’s compiler. If, when you do all that you run it and it stands there looking at you like a dead mullet it will be because your Command Prompt window for such a scenario does not end up being called “C:\Windows\system32\cmd.exe” and you will need to change this throughout redo351.ahk and then recompile (after stopping previous go (with Windows Task Manager maybe)) and test again. An AutoHotKey program called AU3_Spy.exe can help identify the names (or titles) of Windows, as required.

Please enjoy our tutorial with some recording functionality shown as well as the little “subplot” above (where the butler actually “did it”) here. The subplot is represented by the last 6 slides of the tutorial.


Previous tutorial AutoHotKey Primer Tutorial below …

AutoHotKey Primer Tutorial ... //www.autohotkey.com

AutoHotKey Primer Tutorial ... //www.autohotkey.com

Have you heard of AutoHotKey?

It is a Windows application (that is quite brilliant) which can record and replay mouse and keystrokes, or assign a group of actions to a HotKey. Anybody into procedures and the operations side of I.T. will want to know about it, am sure.

Don’t want to show my age, but first got keen about AutoHotKey because I couldn’t believe the day (was it when Windows 5 came out?) that Microsoft abandoned the cute program called Recorder, that came with Windows. For myself, this was a moment of deep mourning, like when Collingwood lost to Carlton in the 1970 Grand Final.

In this primer tutorial see a brief install then a record-compile-replay cycle.
In this link you can look at some of the personal usage of AutoHotKey.

If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.

Posted in Database, eLearning, Tutorials | Tagged , , , , , , , , , , , , , , , , | Leave a comment

Mac OS MAMP Timekeeping Web Application PHP Intranet Tutorial

Mac OS MAMP Timekeeping Web Application PHP Intranet Tutorial

Mac OS MAMP Timekeeping Web Application PHP Intranet Tutorial

It’s “Intranet” time again, this time the integration just “client side” based, and with a previously client only Mac OS X MAMP Timekeeping Web Application Email Tutorial web application’s …

  • Mac OS X operating system +
  • Existance of [/usr/sbin/]screencapture +
  • crontab active and editable via crontab -e +
  • One of …
    1. MAMP installed to, in our case, /Applications/MAMP/htdocs/ (as is mentioned in the relevant crontab background task that snapshots the user’s screen every quarter hour) that maps to the MAMP web application URL HTTP://localhost:8888/ … or …
    2. crontab directory mention that corresponds to a URL call of our web application like for our Google Chrome example (where the directory below, used, could be a place of your choosing (that matches what is in your crontab task entry)) …

      file:///Applications/MAMP/htdocs/HTMLCSS/quarter_hour_timer.html?localplace=

      … or just, via the web browser’s File -> Open File menu …

      file:///Applications/MAMP/htdocs/HTMLCSS/quarter_hour_timer.html

… today we’re changing that into

  • mac OS or Mac OS X operating system +
  • Existance of [/usr/sbin/]screencapture +
  • crontab (no longer relied upon) active and editable via crontab -e (replaced by inline calling of new quarter_hour_timer.php (which, as well as HTML below, should be downloaded to your MAMP’s $_SERVER[‘DOCUMENT_ROOT’] “HTMLCSS” folder)) …

    <?php
    // quarter_hour_timer.php
    // RJM Programming
    // December, 2021
    exec("/usr/sbin/screencapture -Cd -tjpg /Applications/MAMP/htdocs/screen-`date +\"%Y%m%d-%H%M\"`.jpg");
    exit;
    ?>

    +
  • One of …
    1. MAMP installed to, in our case, /Applications/MAMP/htdocs/ (as is mentioned in the relevant crontab background task that snapshots the user’s screen every quarter hour) that maps to the MAMP web application URL HTTP://localhost:8888/ (that incarnation called “Intranet style” from the public RJM Programming domain URL for quarter_hour_timer.html (and should be downloaded to your MAMP’s $_SERVER[‘DOCUMENT_ROOT’] “HTMLCSS” folder) which changed to cater for today’s rearrangements in this way) … or …
    2. crontab PHP directory mention that corresponds to a URL call of our web application like for our Google Chrome example (where the directory below, used, could be a place of your choosing (that matches what is in your crontab task entry)) …

      file:///Applications/MAMP/htdocs/HTMLCSS/quarter_hour_timer.html?localplace=

      … or just, via the web browser’s File -> Open File menu …

      file:///Applications/MAMP/htdocs/HTMLCSS/quarter_hour_timer.html

… for your “Intranet makeover”! Today’s work in that vein shows a (Javascript) client only approach …


var lportbit=getOS(':8888');
var imgn='imgm' + Math.floor(Math.random() * 1987656453) + '.gif';
var tryit='HTTP://localhost' + lportbit + '/' + imgn;
var thatone='', thattwo='';
var wowowo=null;

function getOS(inlp) {
var OSName = "Win Unknown";
if (window.navigator.userAgent.indexOf("Windows NT 11.0")!= -1) OSName="Windows 11";
if (window.navigator.userAgent.indexOf("Windows NT 10.0")!= -1) OSName="Windows 10";
if (window.navigator.userAgent.indexOf("Windows NT 6.3") != -1) OSName="Windows 8.1";
if (window.navigator.userAgent.indexOf("Windows NT 6.2") != -1) OSName="Windows 8";
if (window.navigator.userAgent.indexOf("Windows NT 6.1") != -1) OSName="Windows 7";
if (window.navigator.userAgent.indexOf("Windows NT 6.0") != -1) OSName="Windows Vista";
if (window.navigator.userAgent.indexOf("Windows NT 5.1") != -1) OSName="Windows XP";
if (window.navigator.userAgent.indexOf("Windows NT 5.0") != -1) OSName="Windows 2000";
if (window.navigator.userAgent.indexOf("Mac") != -1) OSName="Mac/iOS";
if (window.navigator.userAgent.indexOf("X11") != -1) OSName="UNIX";
if (window.navigator.userAgent.indexOf("Linux") != -1) OSName="Linux";
if (OSName.substring(0,3).toLowerCase() == 'win') { inlp=''; }
return inlp;
}


function calledlater() {
if (tryit != '') {
if (!inIframe() && document.URL.indexOf('https:') == 0 && document.URL.indexOf('localhost') == -1 && navigator.userAgent.toLowerCase().indexOf('safari/') > -1) {
location.href=document.URL.replace('https:','http:');
}
}
}

function windowopen(theone, thetwo) {
var asu=('&' + document.URL.replace(document.URL.split('?')[0],'').replace('?','')).replace(/^\&$/g,'');
wowowo=window.open('HTTP://localhost' + lportbit + '/HTMLCSS/quarter_hour_timer.html?imgname=' + imgn + asu,'xxlocit');
thatone=theone;
thattwo=thetwo;
setTimeout(postwo, 4000);
}


function postwo() {
if (tryit.trim() == tryit) {
return null;
}
wowo=window.open(thatone, thattwo);
}


function inIframe () { // thanks to https://stackoverflow.com/questions/326069/how-to-identify-if-a-webpage-is-being-loaded-inside-an-iframe-or-directly-into-t
try {
return window.self !== window.top;
} catch (e) {
return true;
}
}


function mamptry() {
if (!inIframe()) { if (document.URL.indexOf('httJUNKp:') == 0) { wowo=window.open('HTTP:/localhost' + lportbit + '/HTMLCSS/quarter_hour_timer.html','mamptry'); document.getElementById('mamptry').style.display='block'; } else if (document.URL.indexOf('localhost') == -1) { windowopen('HTTP:/localhost' + lportbit + '/HTMLCSS/quarter_hour_timer.html','blank'); } }
}

if ((location.search.split('imgname=')[1] ? (decodeURIComponent(location.search.split('imgname=')[1]).split('&')[0]) : '')) {
var asu=((document.URL.replace(document.URL.split('?')[0],'')).replace('?','').replace('&','?') + '?');
asu=('?' + asu.split('?')[1]).replace(/^\?$/g,'');
if (document.URL.indexOf('localhost') != -1) { window.open(document.URL.split('?')[0] + asu,'_blank'); }
}

function forceissue() {
var d1 = new Date();
if (document.URL.indexOf('localhost') != -1 && d1.toUTCString().replace(':15:',':00:').replace(':30:',':00:').replace(':45:',':00:').replace(':07 ',':08 ').replace(':09 ',':08 ').indexOf(':00:08 ') != -1) {
document.getElementById('xxxxlocit').src=document.URL.replace('.html','.php').replace('.htm','.php').split('?')[0] + '?rand=' + Math.floor(Math.random() * 1987656432);
} else {
document.getElementById('xxxxlocit').src=document.URL.replace('.html','.php').replace('.htm','.php').split('?')[0] + '?rand=' + Math.floor(Math.random() * 1987656432);
normok=false;
fillinmywork();
}
}

function lookforfifteen() {
var d1 = new Date();
if (document.URL.indexOf('localhost') != -1 && d1.toUTCString().replace(':15:',':00:').replace(':30:',':00:').replace(':45:',':00:').replace(':07 ',':08 ').replace(':09 ',':08 ').indexOf(':00:08 ') != -1) {
forceissue(); // document.getElementById('xxxxlocit').src=document.URL.replace('.html','.php').replace('.htm','.php').split('?')[0] + '?rand=' + Math.floor(Math.random() * 1987656432);
setTimeout(lookforfifteen, 5000);
} else {
setTimeout(lookforfifteen, 1000);
}
}


setTimeout(calledlater, 2000);
setTimeout(lookforfifteen, 1000);


Previous relevant Mac OS X MAMP Timekeeping Web Application Email Tutorial is shown below.

Mac OS X MAMP Timekeeping Web Application Email Tutorial

Mac OS X MAMP Timekeeping Web Application Email Tutorial

The practicalities of yesterday’s (Mac OS X MAMP Timekeeping Web Application Primer Tutorial) timekeeping Mac OS X Web Application, left as they are, would leave you with a somewhat useful web application whose use is only for the here and now, but what if you want it to be more accountable? Well, that is when we, here, at RJM Programming, like to use that tried and trusted email form of communication.

Today’s email methods spurn the use of server-side intervention, at least for now. So what is available to us as tools, if we don’t include Ajax nor jQuery in that list? Well, we have, to our minds …

  • mailto links (get us to the email client) +
  • the body section of that email can have a clipboard image pasted into it, for which we can utilize HTML5 canvas element’s toDataURL() method, teamed up with a window.open popup window of the toDataURL image data, which can be selected and copied, optionally, by the user themselves, should they wish this to make their email more self explanatory

We last discussed this thinking with Canvas Annotation Email Attachment Clipboard Tutorial.

We rely on the crontab functionality, being as there is no server-side help, to create the image file, whose contents eventually go to make up the contents that can be selected and copied and pasted by the user into the body section of the email (and sent off to whosoever they feel like sending it too, as you have the full power of the email client available to you with the interaction you have with an actual email client program).

Here is the HTML and Javascript quarter_hour_timer.html which changed to cater for today’s email functionality in this way, and, as per the Stop Press from yesterday, we’ll also have a live run link here today.


Previous relevant Mac OS X MAMP Timekeeping Web Application Primer Tutorial is shown below.

Mac OS X MAMP Timekeeping Web Application Primer Tutorial

Mac OS X MAMP Timekeeping Web Application Primer Tutorial

Sometimes when you program, especially for administrative type functionality, there are useful programs to write, that are able to become web applications, but in a limited set of platforms. So it is today with our timekeeping web application that relies on …

  • Mac OS X operating system +
  • Existance of [/usr/sbin/]screencapture +
  • crontab active and editable via crontab -e +
  • One of …
    1. MAMP installed to, in our case, /Applications/MAMP/htdocs/ (as is mentioned in the relevant crontab background task that snapshots the user’s screen every quarter hour) that maps to the MAMP web application URL HTTP://localhost:8888/ … or …
    2. crontab directory mention that corresponds to a URL call of our web application like for our Google Chrome example (where the directory below, used, could be a place of your choosing (that matches what is in your crontab task entry)) …

      file:///Applications/MAMP/htdocs/quarter_hour_timer.html?localplace=

      … or just, via the web browser’s File -> Open File menu …

      file:///Applications/MAMP/htdocs/quarter_hour_timer.html

… pretty restrictive, huh? … but pretty useful for our quarter hour timekeeping purposes today.

We want to have a web application that is running at the user’s discretion, and when first fired up, looks for outputs from crontab tasks above …


0,15,30,45 * * * * /usr/sbin/screencapture -Cd -tjpg /Applications/MAMP/htdocs/screen-`date +"\%Y\%m\%d-\%H\%M"`.jpg

… for the current day in question and if existant show …

  1. a date and time stamp +
  2. the snapshot of what you were doing at the quarter hour, that is clickable to make bigger for more in depth viewing +
  3. an HTML textarea element in which you can optionally type in more specifics about that quarter hour

So, as much as we like to think of Mac OS X Terminal application’s BSD (a unix derivative) operating system, as being a lot like Linux, there are some commands and usage that …

  • adds Mac OS X specific command line functionality to a Linux or unix base set of functionality, like for today’s screencapture command … and we’ve included another such example, below, with the command say featuring in Mac OS X Text to English Speech Primer Tutorial as shown below
  • changes switches on Linux or unix commands
  • won’t have some Linux or unix commands that other platforms do

In the great tradition of behoving … we behove … we behove thee quarter_hour_timer.html if you like, my liege. On this occasion you’ll have gleaned that there is no live run link, because the RJM Programming web server is not Mac OS X … so command line screencapture has no meaning for a CentOS web server’s operating system command line. You’ll see in the code that rather than use “Client Pre-emptive Iframe” concepts to check for existence of crontab screen capture images, we, instead use the onerror event for HTML img elements to check for non-existance.

Stop Press

Just noticed that, perhaps, after all, a live run from the RJM Programming website can make sense if you have a Mac OS X laptop, for instance, that is running that suggested crontab entry as explained in tutorial above. That type of live run managed to latch on to our local crontab screencaptures on my MacBook Pro.


Previous relevant Mac OS X Text to English Speech Primer Tutorial is shown below.

Mac OS X Text to English Speech Primer Tutorial

Mac OS X Text to English Speech Primer Tutorial

We’ve got a few new ideas today …

  1. Text to English Speech via Mac OS X’s command line say command used by PHP via exec to make say.php (which is useful as a download to a Mac OS X laptop using MAMP) which, today, does not have a live run because the web server of domain rjmprogramming.com.au is a CentOS Linux server … Linux equivalent of Mac OS X’s say? … read here
  2. Trying to present this brought up the usual movie production problem with iMovie overlaying the audio on top of the video (though you may want to try, and you could start reading with this link) versus QuickTime Player talent to catch both audio and video tracks (and that we ended up using), but not of the “screen goings on”, alas versus MPlayer OSX Extended which can play separately but not two tracks on top and doesn’t do any reconstituting … so …
  3. Improved on our inhouse Video/Audio synchronizing efforts by allowing audio_video.html supervisor (changed in this way) be able to be called to press one of its preconceived synchronization buttons onload which we do with (the newly added) Macbeth Act 1 Scene 1 … in a small celebration of the Bard … who, am thinking (in that Falstaff way), would have got a huge chuckle out of “anonymous” instead of “anon” during the Three Witches scene … we had to do something to say Happy Birthday

Along the way we tried filming the MacBook Pro with the iPad to a YouTube

… but weren’t happy with the audio quality, alas (too/two).

If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.

Posted in eLearning, Event-Driven Programming, Operating System, Tutorials | Tagged , , , , , , , , , , , , , , , , | Leave a comment

Pandoc Document Conversion Intranet Tutorial

Pandoc Document Conversion Intranet Tutorial

Pandoc Document Conversion Intranet Tutorial

Our recent intranet thinking had us return to another web application we envisaged you using on a local web server (like MAMP) rather than do the processing on the public RJM Programming domain’s PHP web application, that was mentioned in the previous Pandoc Document Conversion Email Tutorial related to Document Conversions. And so, today we not only want to …

  • detect, using the changed macos_textutil_convert.php (which should be downloaded into the $_SERVER[‘DOCUMENT_ROOT’] folder of MAMP) live run public RJM Programming domain link URL, the existence of a (local Apache web server) MAMP incarnation that has pandoc installed, and so should be redirected to … but also …
  • setup Windows client working PHP code, as well

The “Intranet” logic was easier this time around …

<?php

$lportbit=":8888";
$imgn='imgm' . rand(0,1298765434) . '.gif';

$user_agent = $_SERVER["HTTP_USER_AGENT"];
function getOS() { // thanks to https://www.daniweb.com/programming/web-development/threads/495588/getting-users-os-info-out-of-server-http-user-agent
global $user_agent, $lportbit;
$os_platform = "win Unknown OS Platform";
$os_array = array(
'/windows nt 10/i' => 'Windows 10',
'/windows nt 6.3/i' => 'Windows 8.1',
'/windows nt 6.2/i' => 'Windows 8',
'/windows nt 6.1/i' => 'Windows 7',
'/windows nt 6.0/i' => 'Windows Vista',
'/windows nt 5.2/i' => 'Windows Server 2003/XP x64',
'/windows nt 5.1/i' => 'Windows XP',
'/windows xp/i' => 'Windows XP',
'/windows nt 5.0/i' => 'Windows 2000',
'/windows me/i' => 'Windows ME',
'/win98/i' => 'Windows 98',
'/win95/i' => 'Windows 95',
'/win16/i' => 'Windows 3.11',
'/macintosh|mac os x/i' => 'Mac OS X',
'/mac_powerpc/i' => 'Mac OS 9',
'/linux/i' => 'Linux',
'/ubuntu/i' => 'Ubuntu',
'/iphone/i' => 'iPhone',
'/ipod/i' => 'iPod',
'/ipad/i' => 'iPad',
'/android/i' => 'Android',
'/blackberry/i' => 'BlackBerry',
'/webos/i' => 'Mobile'
);

foreach ($os_array as $regex => $value) {

if (preg_match($regex, $user_agent)) {
$os_platform = $value;
}

}

return $os_platform;
}

if (substr(strtoupper(getOS()),0,3) === 'WIN') { $lportbit=""; }

if (isset($_GET['imgname'])) {
echo "<html><body onload=\" var asu=(('" . $_SERVER['QUERY_STRING'] . "').replace('&','?') + '?'); asu=('?' + asu.split('?')[1]).replace(/^\?$/g,''); if (document.URL.indexOf('localhost') != -1) { window.open(document.URL.split('?')[0] + asu,'_blank'); }\"></body></html>";
exit;
}

echo "
blah
blah
blah
...
var asu=('&" . $_SERVER['QUERY_STRING'] . "').replace(/^\&$/g,'');
wowowo=window.open('HTTP://localhost" . $lportbit . "/macos_textutil_convert.php?imgname=" . $imgn . "' + asu,'xxlocit');
...
blah
blah
blah
...
<iframe name=xxlocit id=xxlocit style='display:none;' src=></iframe>
...
blah
blah
blah
";

?>

We found we needed to install pandoc then (the MiKteX version) of pdflatex, required for PDF conversions.


Previous relevant Pandoc Document Conversion Email Tutorial is shown below.

Pandoc Document Conversion Email Tutorial

Pandoc Document Conversion Email Tutorial

On top of yesterday’s Pandoc Document Conversion Command Line Tutorial Document Conversion progress we’ve been wondering how to offer assistance in our public realm up at the rjmprogramming.com.au domain. Today, as you can see with our YouTube video presentation, we’ve got it so that …

… offers that last Email and Download link to help out a user …

  • who is not interested in installing any PHP local Apache web servers … but …
  • is using macOS or Mac OS X (and so can access textutil) … and/or …
  • has installed (the Open Source) pandoc (with pdflatex perhaps)

… and who establishes an inhouse Downloads folder listener script such as our convert_this_please.ksh Korn Shell one that we execute (in the background) via …


ksh convert_this_please.ksh &

… and looks out for the Email Document(s) button functionality of …

… with the file naming conventions (after email attachment download(s)) …

Downloads Path
${HOME}/Downloads
Downloads Input Name
convert_this_please_[OutputExt]_[OriginalInput_Name].[OriginalInput_Ext]
Downloads Output Name
convertthisplease[OutputExt][OriginalInputName].[OutputExt]

… effectively bypassing any local PHP web server for direct command line processing via downloaded email attachments.

The changed macos_textutil_convert.php live run link calls on a changed client_browsing.htm and gets you to a “surfing the web” incarnation.

As intimated, below we show this functionality in action …


Previous relevant Pandoc Document Conversion Command Line Tutorial is shown below.

Pandoc Document Conversion Command Line Tutorial

Pandoc Document Conversion Command Line Tutorial

Yesterday’s Pandoc Document Conversion Multiple Tutorial intimated what direction we might be taking up today, when it said …

… still assuming the files selected are off your local web server’s Document Root (but more on that later down the track, maybe).

Considering this challenge, the “outside your usual thought pattern box”, perhaps, would be to remember that PHP’s modes of use can be…

  • surfing the web (with a web browser) …
  • curl (at command line) …
  • command line

… and it is introducing that “command line” PHP mode of use above that can strip out the relevance of $_SERVER[‘DOCUMENT_ROOT’] (per se) as a concept, so that in this mode of use, we effectively start from scratch asking the user for four pieces of information as per …

Description Default
Input path dirname(__FILE__)
Input filespec
Output path dirname(__FILE__)
Output file extension

This web application (now also command line app, given you have a local web server featuring PHP such as MAMP) suits this “command line” mode of use ahead of its “surfing the net” way for a couple of reasons (to us) …

  • we think “command line” gets conversions done faster …
  • as per yesterday’s challenge, given file permission allowances, you can read and write to places that aren’t within the $_SERVER[‘DOCUMENT_ROOT’] directory hierarchy
  • as a PHP programmer, these modes of use can be neatly separated … the “command line” mode of use code is totally self contained …
    <?php

    if (isset($argv)) { // command line
    $numargs = sizeof($argv);
    if ($numargs <= 4) {
    if (PHP_OS == 'WINNT') {
    echo '$ Input path ( eg. we will take blank to mean ' . dirname(__FILE__) . DIRECTORY_SEPARATOR . ' ) then *.pdf,*.doc,*.docx,*.htm,*.html,*.txt Input File(spec) then Output path ( eg. we will take blank to mean ' . dirname(__FILE__) . DIRECTORY_SEPARATOR . ' ) then .pdf,.doc,.docx,.htm,.html,.txt Output File Extension below ...' . "\n";
    $line = stream_get_line(STDIN, 1024, PHP_EOL);
    if (str_replace("\n", "", $line) == "") { $line=dirname(__FILE__) . DIRECTORY_SEPARATOR; }
    $lineinspec = stream_get_line(STDIN, 1024, PHP_EOL);
    $outline = stream_get_line(STDIN, 1024, PHP_EOL);
    if (str_replace("\n", "", $outline) == "") { $outline=dirname(__FILE__) . DIRECTORY_SEPARATOR; }
    $outlineinspec = stream_get_line(STDIN, 1024, PHP_EOL);
    } else {
    $line = readline('$ Input path ( eg. we will take blank to mean ' . dirname(__FILE__) . DIRECTORY_SEPARATOR . ' ) then *.pdf,*.doc,*.docx,*.htm,*.html,*.txt Input File(spec) then Output path ( eg. we will take blank to mean ' . dirname(__FILE__) . DIRECTORY_SEPARATOR . ' ) then .pdf,.doc,.docx,.htm,.html,.txt Output File Extension below ...' . "\n");
    if (str_replace("\n", "", $line) == "") { $line=dirname(__FILE__) . DIRECTORY_SEPARATOR; }
    $lineinspec = readline('');
    $outline = readline('');
    if (str_replace("\n", "", $outline) == "") { $outline=dirname(__FILE__) . DIRECTORY_SEPARATOR; }
    $outlineinspec = readline('');
    }
    $cmdsuff="";
    if ($verb != "textutil" && explode(".",$outlineinspec)[-1 + sizeof(explode(".",$outlineinspec))] == "pdf") {
    if (file_exists("/Library/TeX/Root/bin/x86_64-darwin/pdflatex")) {
    $cmdsuff=" --pdf-engine=/Library/TeX/Root/bin/x86_64-darwin/pdflatex";
    } else if (file_exists("/Library/TeX/texbin/pdflatex")) {
    $cmdsuff=" --pdf-engine=/Library/TeX/texbin/pdflatex";
    } else {
    $cmdsuff=" --pdf-engine=pdflatex";
    }
    }
    $openers="";
    $openersdelim="";
    foreach (glob($line . $lineinspec) as $filename) {
    $outnameis=$outline . str_replace("." . explode(".", basename($filename))[-1 + sizeof(explode(".", basename($filename)))], ".", basename($filename)) . str_replace(".", "", $outlineinspec);
    if (file_exists($outnameis)) {
    $sufext="_0";
    $iext=0;
    $rone="";
    $rtwo="";
    while (file_exists($outnameis . $sufext)) {
    $iext++;
    $sufext="_" . $iext;
    }
    $rtwo=$outnameis;
    $rone=$outnameis . $sufext;
    echo "Renaming " . $outnameis . " to " . $outnameis . $sufext . "\n";
    try {
    rename($outnameis, $outnameis . $sufext);
    } catch (Exception $e) {
    echo $e->getMessage() . "\n";
    }
    if (!file_exists($outnameis . $sufext)) {
    echo "Renaming did not happen." . "\n";
    }
    }
    if (explode(".",$outlineinspec)[-1 + sizeof(explode(".",$outlineinspec))] == "pdJUNKf") {
    echo ("php " . $argv[0] . " " . $line . " " . basename($filename) . " " . $outline . " " . $outlineinspec . "\n");
    passthru("php " . $argv[0] . " " . $line . " " . basename($filename) . " " . $outline . " " . $outlineinspec);
    } else {
    //echo ($verb . " " . $switchone . " " . $filename . " " . $switchtwo . " " . $outnameis . $cmdsuff . " > macos_textutil_convert.out 2> macos_textutil_convert.err");
    echo ($verb . " " . $switchone . " " . str_replace(".", "", $outlineinspec) . " " . $filename . " " . $switchtwo . " " . $outnameis . $cmdsuff . " > macos_textutil_convert.out 2> macos_textutil_convert.err \n");
    exec($verb . " " . $switchone . " " . str_replace(".", "", $outlineinspec) . " " . $filename . " " . $switchtwo . " " . $outnameis . $cmdsuff . " > macos_textutil_convert.out 2> macos_textutil_convert.err");
    if (file_exists("macos_textutil_convert.out") && file_exists("macos_textutil_convert.err")) {
    if (filesize("macos_textutil_convert.out") == 0 && filesize("macos_textutil_convert.err") != 0) {
    if ($rone != "" && $rtwo != "") {
    echo "Renaming " . $rone . " back to " . $rtwo . "\n";
    rename($rone, $rtwo);
    }
    echo "\n\n" . file_get_contents("macos_textutil_convert.err") . "\n\n";
    }
    }
    if (PHP_OS == "Darwin") { // && explode(".",$outlineinspec)[-1 + sizeof(explode(".",$outlineinspec))] != "pdf") {
    if (file_exists($outnameis)) {
    $openers.=$openersdelim . "open " . $outnameis;
    $openersdelim=" ; ";
    }
    }
    }
    }
    if (PHP_OS == "Darwin" && $openers != "") {
    echo "\n\nWill try to open successful (or old resurrected) files in 8 seconds ...\n";
    sleep(8);
    echo ($openers . " \n");
    exec($openers);
    }
    //echo "do the work";
    } else {
    $openers="";
    $openersdelim="";
    $line=trim($argv[1]);
    if (str_replace("\n", "", $line) == "") { $line=dirname(__FILE__) . DIRECTORY_SEPARATOR; }
    $lineinspec=$argv[2];
    $outline=trim($argv[3]);
    if (str_replace("\n", "", $outline) == "") { $outline=dirname(__FILE__) . DIRECTORY_SEPARATOR; }
    $outlineinspec=$argv[4];
    $cmdsuff="";
    if ($verb != "textutil" && explode(".",$outlineinspec)[-1 + sizeof(explode(".",$outlineinspec))] == "pdf") {
    if (file_exists("/Library/TeX/Root/bin/x86_64-darwin/pdflatex")) {
    $cmdsuff=" --pdf-engine=/Library/TeX/Root/bin/x86_64-darwin/pdflatex";
    } else if (file_exists("/Library/TeX/texbin/pdflatex")) {
    $cmdsuff=" --pdf-engine=/Library/TeX/texbin/pdflatex";
    } else {
    $cmdsuff=" --pdf-engine=pdflatex";
    }
    }
    foreach (glob($line . $lineinspec) as $filename) {
    $outnameis=$outline . str_replace("." . explode(".", basename($filename))[-1 + sizeof(explode(".", basename($filename)))], ".", basename($filename)) . str_replace(".", "", $outlineinspec);
    if (file_exists($outnameis)) {
    $sufext="_0";
    $iext=0;
    $rone="";
    $rtwo="";
    while (file_exists($outnameis . $sufext)) {
    $iext++;
    $sufext="_" . $iext;
    }
    $rtwo=$outnameis;
    $rone=$outnameis . $sufext;
    echo "Renaming " . $outnameis . " to " . $outnameis . $sufext . "\n";
    rename($outnameis, $outnameis . $sufext);
    }
    //echo ($verb . " " . $switchone . " " . $filename . " " . $switchtwo . " " . $outnameis . $cmdsuff . " > macos_textutil_convert.out 2> macos_textutil_convert.err");
    echo ($verb . " " . $switchone . " " . str_replace(".", "", $outlineinspec) . " " . $filename . " " . $switchtwo . " " . $outnameis . $cmdsuff . " > macos_textutil_convert.out 2> macos_textutil_convert.err \n");
    exec($verb . " " . $switchone . " " . str_replace(".", "", $outlineinspec) . " " . $filename . " " . $switchtwo . " " . $outnameis . $cmdsuff . " > macos_textutil_convert.out 2> macos_textutil_convert.err");
    if (file_exists("macos_textutil_convert.out") && file_exists("macos_textutil_convert.err")) {
    if (filesize("macos_textutil_convert.out") == 0 && filesize("macos_textutil_convert.err") != 0) {
    if ($rone != "" && $rtwo != "") {
    echo "Renaming " . $rone . " back to " . $rtwo . "\n";
    rename($rone, $rtwo);
    }
    echo "\n\n" . file_get_contents("macos_textutil_convert.err") . "\n\n";
    }
    }
    if (PHP_OS == "Darwin") { // && explode(".",$outlineinspec)[-1 + sizeof(explode(".",$outlineinspec))] != "pdf") {
    if (file_exists($outnameis)) {
    $openers.=$openersdelim . "open " . $outnameis;
    $openersdelim=" ; ";
    }
    }
    }
    if (PHP_OS == "Darwin" && $openers != "") {
    echo "\n\nWill try to open successful (or old resurrected) files in 8 seconds ...\n";
    sleep(8);
    echo ($openers . " \n");
    exec($openers);
    }
    //echo "Do the work ";
    }
    exit;
    }

    ?>

The changed macos_textutil_convert.php live run link gets you to a “surfing the web” incarnation.


Previous relevant Pandoc Document Conversion Multiple Tutorial is shown below.

Pandoc Document Conversion Multiple Tutorial

Pandoc Document Conversion Multiple Tutorial

For …

  • longer than we can remember we’ve really enjoyed batch processing …
  • as long as we can remember we’ve really enjoyed the File API that came with HTML5 …
  • ([as long as we can remember] – 2 months) we’ve really enjoyed the File API input type=file multiple attribute …

… and, adding to the recent Pandoc Document Conversion Primer Tutorial all get a guernsey today … yay !!!

It was the normal natural way to think, before GUI style operating systems, and the normal being command line, to achieve the most use of those precious (and more resource limited) computing resources to organize programs towards achieving procedural programmatical work for a “batch of data” if possible. Of course, batch processing is still performing a lot of the hard computing tasks being performed on servers around the world today, but you’d be hard pressed to hear about much of it in the public realm, which is so admiring of individual use and personalization. “Big data” thoughts though, bring thinking back to grouping those individual data sets together into a useful group analysis raison d’être (no doubt needing batch processing again).

To “sort of” meet the “batch processing” world with a web browser web application we have the File API input type=file multiple attribute to work with, and with our Document Conversion work (still focussed on local web server usage) the HTML …


<input type=file accept=".pdf,.doc,.docx,.htm,.html,.txt" multiple></input>

… along with the knowledge that even multiple files are selected from a single file path hidden from a File API coder but “localhost derivable” in that similar approach we used with the Haiku Creation web application (alas, only helping out macOS users (in this programmatical “in the background” approach), though Windows Pandoc’ers can fill the paths in within two new textboxes) …

<?php

if (isset($_GET['vsfs']) && isset($_GET['vsfn']) && isset($_GET['vsfi']) && isset($_GET['vsfu'])) {
$docroot=dirname(__FILE__);
if (file_exists("lookup_" . str_replace(")","",str_replace("(","",str_replace("+"," ",urldecode($_GET['vsfn'])))))) {
unlink("lookup_" . str_replace(")","",str_replace("(","",str_replace("+"," ",urldecode($_GET['vsfn'])))));
}
exec("find " . $_SERVER['DOCUMENT_ROOT'] . " -name '" . str_replace(")","*",str_replace("(","*",str_replace("+"," ",urldecode($_GET['vsfn'])))) . "' -exec ls -l {} \\; 2> /dev/null > lookup_" . str_replace(")","",str_replace("(","",str_replace("+"," ",urldecode($_GET['vsfn'])))));
if (file_exists("lookup_" . str_replace(")","",str_replace("(","",str_replace("+"," ",urldecode($_GET['vsfn'])))))) {
$infois=file_get_contents(("lookup_" . str_replace(")","",str_replace("(","",str_replace("+"," ",urldecode($_GET['vsfn']))))));
$lines=explode("\n", $infois);
for ($il=0; $il<sizeof($lines); $il++) {
$lines[$il]=str_replace("\r","",$lines[$il]);
if (strpos($lines[$il], " " . $_GET['vsfs'] . " ") !== false) {
//file_put_contents("look_" . str_replace(")","",str_replace("(","",str_replace("+"," ",urldecode($_GET['vsfn'])))), "thisplace=" . $docroot . "\n" . "rootplace=" . $_SERVER['DOCUMENT_ROOT'] . "\n" . "origplace=" . str_replace("+"," ",urldecode($_GET['vsfu'])) . "\n" . "foundplace=" . explode(" ", $lines[$il])[-1 + sizeof( explode(" ", $lines[$il]))] . "\n" . '<html><body onload=" parent.document.getElementById(' . "'" . str_replace("+"," ",urldecode($_GET['vsfi'])) . "'" . ").value='" . str_replace($_SERVER['DOCUMENT_ROOT'],explode("localhost",str_replace("+"," ",urldecode($_GET['vsfu'])))[0] . "localhost" . explode("/",explode("localhost",str_replace("+"," ",urldecode($_GET['vsfu'])))[1])[0] . "",explode(" ", $lines[$il])[-1 + sizeof( explode(" ", $lines[$il]))]) . "'; " . '"></body></html>');
if (strpos(explode(" ", $lines[$il])[-1 + sizeof( explode(" ", $lines[$il]))], $_SERVER['DOCUMENT_ROOT']) !== false) {
//file_put_contents("x7.x7",'<html><body onload=" if (parent.document.getElementById(' . "'" . 'eangle' . "'" . ')) { parent.document.getElementById(' . "'" . 'eangle' . "'" . ').value=' . "'" . $ort . "'" . '; } top.document.getElementById(' . "'" . str_replace("+"," ",urldecode($_GET['vsfi'])) . "'" . ").value='" . $ort . "'; " . '"></body></html>');
if (isset($_GET['turl'])) {
echo "<html><body onload=\" var tp='" . str_replace("junk" . $_SERVER['DOCUMENT_ROOT'],"juJUNKnk" . explode("localhost",str_replace("+"," ",urldecode($_GET['vsfu'])))[0] . "localhost" . explode("/",explode("localhost",str_replace("+"," ",urldecode($_GET['vsfu'])))[1])[0] . "",explode(" ", $lines[$il])[-1 + sizeof( explode(" ", $lines[$il]))]) . "'; " . " var tt='" . str_replace("+"," ",urldecode($_GET['vsfn'])) . "'; " . ' var ct=top.document.getElementById(' . "'" . 'cto' . "'" . ').value; ct=ct.replace(' . "'" . '*' . "'" . ',' . "'" . 'html' . "'" . '); top.document.getElementById(' . "'" . 'sin' . "'" . ').style.display=' . "'" . 'inline-block' . "'" . '; top.document.getElementById(' . "'" . 'path' . "'" . ").value=tp.replace(tt, ''); " . ' top.document.getElementById(' . "'" . 'opath' . "'" . ").value=tp.replace(tt, ''); " . ' top.selch(ct); "></body></html>';
} //else {
//echo '<html><body onload=" if (parent.document.getElementById(' . "'" . 'eangle' . "'" . ')) { parent.document.getElementById(' . "'" . 'eangle' . "'" . ').value=' . "'" . $ort . "'" . '; } top.document.getElementById(' . "'" . str_replace("+"," ",urldecode($_GET['vsfi'])) . "'" . ").value='" . $ort . "'; " . '"></body></html>';
//}
} //else if (isset($_GET['turl'])) {
//echo '<html><body onload=" top.document.getElementById(' . "'" . 'turl' . "'" . ").placeholder='" . str_replace($_SERVER['DOCUMENT_ROOT'],explode("localhost",str_replace("+"," ",urldecode($_GET['vsfu'])))[0] . "localhost" . explode("/",explode("localhost",str_replace("+"," ",urldecode($_GET['vsfu'])))[1])[0] . "",explode(" ", $lines[$il])[-1 + sizeof( explode(" ", $lines[$il]))]) . "'; " . ' top.document.getElementById(' . "'" . 'turl' . "'" . ').title=top.document.getElementById(' . "'" . 'turl' . "'" . ').placeholder; top.document.getElementById(' . "'" . 'thewords' . "'" . ').title=top.document.getElementById(' . "'" . 'thewords' . "'" . ').title.replace( top.document.getElementById(' . "'" . 'turl' . "'" . ').value, top.document.getElementById(' . "'" . 'turl' . "'" . ').placeholder); top.document.getElementById(' . "'" . 'thewords' . "'" . ').value=top.document.getElementById(' . "'" . 'thewords' . "'" . ').value.replace( top.document.getElementById(' . "'" . 'turl' . "'" . ').value, top.document.getElementById(' . "'" . 'turl' . "'" . ').placeholder); top.document.getElementById(' . "'" . 'turl' . "'" . ').value=top.document.getElementById(' . "'" . 'turl' . "'" . ').placeholder; top.document.getElementById(' . "'" . 'thewords' . "'" . ').value=top.document.getElementById(' . "'" . 'thewords' . "'" . ').value.replace( top.document.getElementById(' . "'" . 'turl' . "'" . ').value, top.document.getElementById(' . "'" . 'turl' . "'" . ').placeholder); "></body></html>';
//} else {
// echo '<html><body onload=" parent.document.getElementById(' . "'" . str_replace("+"," ",urldecode($_GET['vsfi'])) . "'" . ").value='" . str_replace($_SERVER['DOCUMENT_ROOT'],explode("localhost",str_replace("+"," ",urldecode($_GET['vsfu'])))[0] . "localhost" . explode("/",explode("localhost",str_replace("+"," ",urldecode($_GET['vsfu'])))[1])[0] . "",explode(" ", $lines[$il])[-1 + sizeof( explode(" ", $lines[$il]))]) . "'; " . '"></body></html>';
//}
unlink("lookup_" . str_replace(")","",str_replace("(","",str_replace("+"," ",urldecode($_GET['vsfn'])))));
} else {
unlink("lookup_" . str_replace(")","",str_replace("(","",str_replace("+"," ",urldecode($_GET['vsfn'])))));
}
}
}
exit;
}

?>

… still assuming the files selected are off your local web server’s Document Root (but more on that later down the track, maybe).

How do we reflect this multiple file (batch’y) processing talent with a way to display this in a web browser web application? We choose to hive off each single input/output Document Conversion data set into an individual popup window instance, and display there that output data as converted, if possible.

The changed macos_textutil_convert.php live run link calls on a changed client_browsing.htm to reflect on this “batch’y” style multiple file capable Pandoc or textutil Document Conversion functionality.


Previous relevant Pandoc Document Conversion Primer Tutorial is shown below.

Pandoc Document Conversion Primer Tutorial

Pandoc Document Conversion Primer Tutorial

Yesterday’s MacOS Document Conversion Primer Tutorial left off with a link, as per …

… read here

… and it was here and with help from other links below that we took a big interest in a great Open Source product (great at Document Conversions) called pandoc

… the reason for the interest in MikTeX being a wish to include pdflatex into the PATH as distinct from our preferred approach to add an additional switch …


--pdf-engine=[pathTo]pdflatex

… to try to match the success of pandoc at the Terminal application command line but not with PHP exec usage. This issue occurred with our macOS system after our two Homebrew install commands (in Terminal session) …


$ brew install pandoc
$ brew cask install basictex

… and, visually, you can see some of with today’s tutorial picture.

This Pandoc integration allows a way in for our web application to be operable for Windows or Linux servers where you have installed Pandoc, as well as pdflatex for Word to PDF conversions. Clearly, to open the door to more platforms is a step we welcome, and may spare us a Panadol?!

The changed macos_textutil_convert.php reflects this Pandoc integration.


Previous relevant MacOS Document Conversion Primer Tutorial is shown below.

MacOS Document Conversion Primer Tutorial

MacOS Document Conversion Primer Tutorial

A good thing about a “version control” or “source control” system is that you can …

  • “pick up” from any version …
  • “clone” to another name …
  • “branch off” immediately into a new version …

… to effectively “clone” the suitable progress point from a previous project as the start to a new project.

So on top of yesterday’s “way back when” MacOS Text to Audio Primer Tutorial early stage “progression point” of our “Voiceover Ideas” back to “macOS say” (just works with macOS and MacOS X underlying operating system under PHP “online presence”) interfacing, we “start off” a new “Document Conversion” web application (you guessed it) initially only working with macOS and MacOS X underlying operating system under PHP “online presence”.

Like for below, Document Conversion via Mac OS X’s command line textutil command used by PHP via exec to make macos_textutil_convert.php … cloned via macos_textutil_convert.php … (which is useful as a download to a Mac OS X laptop using MAMP) which, today, does not yet have a very interesting live run because the web server of domain rjmprogramming.com.au is a CentOS Linux server … Linux equivalent of Mac OS X’s textutil? … read here.


Previous relevant MacOS Text to Audio Primer Tutorial is shown below.

MacOS Text to Audio Primer Tutorial

MacOS Text to Audio Primer Tutorial

The previous Mac OS X Text to English Speech Primer Tutorial

  • lauded the …

    Text to English Speech via Mac OS X’s command line say command

  • and today we write some PHP (with its very useful exec conduit to “say”) to make use of the same (macOS) “say” and its Text to Audio talents (via its “-o” switch usage)

… and it’s at times like this we wish that the RJM Programming domain’s web server had a macOS operating system. Alas, “say” is a macOS and Mac OS X application, but not a Linux one.

None the less, we integrated …

… so that if you had a MAMP local Apache/PHP/MySql web server going, and you …

  • downloaded tutorial_to_animated_gif.php to same MAMP subdirectory as …
  • downloaded haiku_animated_gif.html to same MAMP place (which can be the same MAMP document root place as talked about below, in which case HTTP://localhost:8888/haiku_animated_gif.html is what you’d type into the web browser address bar to try this for yourself on a macOS or Mac OS X system) … and …
  • downloaded macos_say_record.php to MAMP document root (for us, equating to URL HTTP://localhost:8888/macos_say_record.php)

… then you would be in the position to see a Haiku creation scenario (where we used the Safari web browser) like with today’s tutorial picture, interesting, in our view, regarding the integration “tactics” …

  • parent Haiku window opens …
  • child (popup) PHP “say” helper web application … which …
  • passes back to parent …

    window.opener.document.getElementById('aurl').value=document.getElementById('result').value;
    window.opener.atab(window.opener.document.getElementById('aurl'));

… achieving functionality we often ask HTML iframe elements achieve for our code. HTML iframe does have a role today, though. It uses a favoured “client pre-emptive iframe” approach to determine whether we even try to open that popup window above via …

  • HTML …

    <div id=dif></div>
  • Javascript …

    var mampok=false, mampprefix='';

    if (document.URL.indexOf('/localhost') != -1) {
    mampprefix="HTTP://localhost" + document.URL.split('/localhost')[1].split('/')[0] + "/";
    document.getElementById('dif').innerHTML="<iframe onload='oicheck(this);' style='display:none;' src='HTTP://localhost" + document.URL.split('/localhost')[1].split('/')[0] + "/'></iframe>";
    }

    function oicheck(iois) {
    mampok=false;
    if (iois != null) {
    var aconto = (iois.contentWindow || iois.contentDocument);
    if (aconto != null) {
    if (aconto.document) { aconto = aconto.document; }
    if (aconto.body != null) {
    if (aconto.body.innerHTML.toLowerCase().indexOf('>not found<') == -1 && aconto.body.innerHTML.toLowerCase().indexOf("our home page for your perusal") == -1) { mampok=true; }
    }
    }
    }
    }

    // and then later when the textarea has text and its onblur event is triggered ...
    if (mampok) {
    if (wois) { wois.close(); wois=null; }
    wois=window.open(mampprefix + "macos_say_record.php?saythis=" + encodeURIComponent(document.getElementById('myta').value),"_blank","top=460,left=400,width=700,height=400");
    }

  • Previous relevant Mac OS X Text to English Speech Primer Tutorial is shown below.

    Mac OS X Text to English Speech Primer Tutorial

    Mac OS X Text to English Speech Primer Tutorial

    We’ve got a few new ideas today …

    1. Text to English Speech via Mac OS X’s command line say command used by PHP via exec to make say.php (which is useful as a download to a Mac OS X laptop using MAMP) which, today, does not have a live run because the web server of domain rjmprogramming.com.au is a CentOS Linux server … Linux equivalent of Mac OS X’s say? … read here
    2. Trying to present this brought up the usual movie production problem with iMovie overlaying the audio on top of the video (though you may want to try, and you could start reading with this link) versus QuickTime Player talent to catch both audio and video tracks (and that we ended up using), but not of the “screen goings on”, alas versus MPlayer OSX Extended which can play separately but not two tracks on top and doesn’t do any reconstituting … so …
    3. Improved on our inhouse Video/Audio synchronizing efforts by allowing audio_video.html supervisor (changed in this way) be able to be called to press one of its preconceived synchronization buttons onload which we do with (the newly added) Macbeth Act 1 Scene 1 … in a small celebration of the Bard … who, am thinking (in that Falstaff way), would have got a huge chuckle out of “anonymous” instead of “anon” during the Three Witches scene … we had to do something to say Happy Birthday

    Along the way we tried filming the MacBook Pro with the iPad to a YouTube

    … but weren’t happy with the audio quality, alas (too/two).

    If this was interesting you may be interested in this too.


    If this was interesting you may be interested in this too.


    If this was interesting you may be interested in this too.


    If this was interesting you may be interested in this too.


    If this was interesting you may be interested in this too.


    If this was interesting you may be interested in this too.


    If this was interesting you may be interested in this too.


    If this was interesting you may be interested in this too.

Posted in eLearning, Event-Driven Programming, Tutorials | Tagged , , , , , , , , , , , , | Leave a comment