Skip navigation.

exploreopera

| Help

Sign up | Help

Lee Harvey's Target Range

1 Click Away

Posts tagged with "script"

UserJS to fix NFL.com RealPlayer video

, , , ...

For whatever reason, Opera disallows calling the DoStop(), DoPlay(), etc methods of the RealPlayer plug-in on nfl.com -- perhaps for security reasons, since the script which injects the tag is located on images.nfl.com, but the homepage is on www.nfl.com.

Anyhow, this latest script provides a work-around by rewriting the HTML inside the tag hosting the RealPlayer plug-in. In essence, it simply sets the autoplay attribute to true, which allows the video to play when users click a video link.

Download/view the nfl.js script
if (document.domain.match(/^(www\.|images\.)?nfl\.com$/)) {
  window.opera.defineMagicFunction("goMovie",
    function (a,b,selection) {
      var videoplayer = document.getElementById("videoplayer");
      if (!videoplayer) return;
      videoplayer.innerHTML = '<PARAM name="autostart" value="true"/> \
        <PARAM name="controls" value="imagewindow"/> \
        <PARAM name="src" value="' + selection + '"/> \
        <PARAM name="console" value="cons"/> \
        <PARAM name="nologo" value="true"/> \
        <EMBED name="videoplayer" type="audio/x-pn-realaudio-plugin" width="240" height="180" nologo="true" src="' + selection + '" controls="imagewindow" autostart="true" console="cons"/>';
    });
}

To learn how to install this User JavaScript, visit UserJS.org

Enjoy.

UserJS to fix Yahoo! Football Play by Play

, , , ...

Yes, Yahoo! stinks when it comes to web coding. Simply right-click any of their pages in Opera, select "Validate", and then watch the markup errors pile-up.

Anyhow, this latest script fixes their NFL and NCAA football play by play display in Opera.

For example:

yahooNFL.js
if (document.domain.match(/^sports\.yahoo\.com$/) && 
  window.location.href.match(/&page=plays/)) {
  document.addEventListener("load",
    function() {
      var yspMainContent = document.getElementById("yspMainContent");
      if (!yspMainContent) return;
      yspMainContent.innerHTML = yspMainContent.innerHTML.replace(/\<thead\>/gi, '<table width="560" border="0" cellpadding="0" cellspacing="0"><thead>');
      yspMainContent.innerHTML = yspMainContent.innerHTML.replace(/\<\/tbody\>/gi, '</tbody></table>');
      }, 0);
}

To learn how to install this User JavaScript, visit UserJS.org

Enjoy.

UserJS to fix NetFlix shrinking buttons

, , , ...

I've updated my initial NetFlix UserJS script to version 2.0. This new version includes a fix for their shrinking form buttons. You can view or download the new version from here, or simply copy-and-paste the relevant code fix for the shrinking buttons here:

if (document && 
    document.domain && 
    document.domain.match(/^(www\.)?netflix\.com$/)) { 

  document.addEventListener("load", 
    function(e) { 
      var inps = document.getElementsByTagName("INPUT"); 
      for (var n = 0, i; i = inps[ n ]; n++) { 
        if (!i.onmouseover && !i.onmouseout) continue; 
 
        var cn = i.className; 
        if ((cn != "bsub_primary") && 
            (cn != "bsub_secondary")) continue; 
 
        i.className = ""; 
        i.style.width = "auto"; 
        i.className = cn; 
      } 
    }, false);

}


For my fellow NetFlix subscribers, enjoy!

Opening file types without opening new page

, , , ...

For those of you who hate to see a "Blank page" appear when clicking links for certain file types, I present the following User JavaScript file...

Download/view pdfHandler.js
document.addEventListener("load",
  function(e) {
    if (!document.body) document.body = document.getElementsByTagName("body")[0];
    if (!document.body) return;
    if (!document.links) return;
    for (var i = 0; i < document.links.length; i++) {
      var href = document.links[ i ].getAttribute("href");
      if (!href) continue;
      if (!href.match(/\.pdf$/) &&
          !href.match(/\.doc$/) &&
          !href.match(/\.xls$/))
          continue;

      if (!document.blankIframeHandler) {
        document.blankIframeHandler = document.createElement("iframe");
        with (document.blankIframeHandler) {
          setAttribute("src", "about:blank");
          setAttribute("id", "blankIframeHandler");
          setAttribute("name", "blankIframeHandler");
          setAttribute("style", "display:none;visibility:hidden;");
        }
        document.body.appendChild(document.blankIframeHandler);
      }
      document.links[ i ].setAttribute("target", "blankIframeHandler");
    }
  }, false);


This User JavaScript creates a hidden inline frame (iframe element) on the current page, then targets all .pdf, .doc, and .xls links to open inside that hidden inline frame.

This technique seems fairly effective at opening file types with associated programs in Opera, such as .pdf files for Adobe Reader.

Enjoy.

Yahoo! is really PissingMeOff!

, , , ...

Yes, Yahoo! is really getting bad. I have more User JavaScript files to compensate for Yahoo! than any other website. Why is this? Who knows for sure, but they really have no excuse. After all, they've been in the Internet business longer than most, so they should know better...but they don't!

In the latest example, I often keep multiple live sporting events (hockey games) open at once. After about 15 minutes with Opera, Yahoo! starts serving-up stupid Error 999 pages. Have you ever seen them? The only way to get the page to serve-up its real contents is to continually reload the page URL until the error goes away. Hence, the latest addition to my UserJS collection for Yahoo!...

Dowload yahoo999.js
if (document.domain.match(/^sports\.yahoo\.com$/)) {
   if (window.location.href.indexOf("boxscore?gid=") > 27) {
      document.addEventListener("load",
         function(e) {
            if (document.title.indexOf("999") > 0) {
               window.location.reload(true);
            }
         }, true);
   }
}

If you are experiencing the Yahoo! Error 999 on another Yahoo! site, then you'll need to adjust my domain- and href-specific references above.

As you can see from above, this script continually reloads the page until the silly error 999 disappears from the page title.

Initial testing has revealed this simple technique works really well!

Enjoy.