Google Answers Logo
View Question
 
Q: Write me a greasmonkey script/adds contents of another page to view ( No Answer,   1 Comment )
Question  
Subject: Write me a greasmonkey script/adds contents of another page to view
Category: Computers > Programming
Asked by: grrarrgh-ga
List Price: $35.00
Posted: 08 May 2006 11:37 PDT
Expires: 09 May 2006 09:15 PDT
Question ID: 726614
I've already got the @include and @exclude statements down.
I need:

For a page of form:
https://www.YYY.com/public/lend/listing.aspx?listingID=15344
(where YYY is some static domain name that I will decide on later)
I want to display the 
http://ZZZ.wikispaces.com/15344
underneath the contents of the first page.
(where ZZZ is some static domain name that I will decide on later,
testbed.wikispaces.com is the standin for now.)

or more generally this script should for every page of the form,
https://www.YYY.com/public/lend/listing.aspx?listingID=XYZ
add the contents of 
http://ZZZ.wikispaces.com/XYZ

underneath the contents of the first page (in a frame if possible).

and XYZ is some number (not necessarily 3 digit)

One way to implement this would be to add the text contents (or the
page itself, whichever is easier) of the 2nd page in a frame at the
bottom of the first.

Again, I will fill in the ZZZ and YYY domains on my own later, and
those will stay fixed.  The only dynamic element is the # at the end
of the url.

As simple as this is, I'd also want you to relinquish claims to
copyright on this scriptlet.

Clarification of Question by grrarrgh-ga on 08 May 2006 11:38 PDT
you may find this chunk of code useful:

var href = window.location.href;
var loanarr= href.split("=");
var loan = loanarr[1];
Answer  
There is no answer at this time.

Comments  
Subject: Re: Write me a greasmonkey script/adds contents of another page to view
From: zarembisty-ga on 09 May 2006 09:13 PDT
 
this should do the trick; it doesn't add a frame, but an iframe below
whatever element you want

// ==UserScript==
// @name            Frame Adder
// @namespace       
// @description     
// @include         YOUR SITE GOES HERE
// ==/UserScript==


(function() {

    var addFrame =
    {
        go: function()
        {

	    var listingID =  window.location.href.split("=")[1];

	    //change this to whatever element you want the frame to be added
to (usually a DIV or SPAN)
            var thisNode = document.getElementById("ELEMENTS_ID");

	    var ifrID = "wiki";
	    var targetNode = thisNode;
	    var br = document.createElement("br");
	    var ifr = document.createElement("iframe");
	    ifr.id = ifrID;
	    ifr.src = "http://ZZZ.wikispaces.com/" + listingID;
	    ifr.style.marginTop = "5px";
	    ifr.style.width = "100%";
	    ifr.style.height = "500px";
	    ifr.style.display = "block";
	    ifr.style.visibility="visible"

	    targetNode.appendChild(br);
	    targetNode.appendChild(ifr);

        }
    }

    addFrame.go();

})();

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy