Greasemonkey 'Component Is Not Available'
Dec 27, 2006I'm new to Greasemonkey, and have no idea how to fix this. I would post elsewhere, but I couldn't find a forum for user script development help....
View 4 RepliesI'm new to Greasemonkey, and have no idea how to fix this. I would post elsewhere, but I couldn't find a forum for user script development help....
View 4 RepliesYou have an AJAX request and the response is mixed HTML + JavaScript. The javascript is referring to elements in the HTML component. Currently the JavaScript gets evaluated first thing when success is triggered and the HTML is returned as a parameter. Obviously this is not going to work ( in this scenario anyway ). As a previous Mootools user I was used to Request.HTML's responseJavaScript parameter and evalScripts option. None of there options are available in the $.ajax implementation.
P.S. I know I could make the javascript a file and load it separately. I know I can make my response JSON and have the js and html in separate properties of the JSON object. I want neither.
I'm using the following code in a Greasemonkey script.
var start, newElement;
start = document.body;
newElement = document.createElement('b');
newText = document.createTextNode("The Greasemonkey salutes you!");
newElement.appendChild(newText);
start.appendChild(newElement);
Can anyone tell me: 1) why my string appears twice; 2) how to make it
appear just once?
I'm trying to insert code at the top of every viewed page. Obviously,
document.body appends the string to the closing body tag which is not
what I want. What could I use to insert my code as the first childnode
under 'body'?
I'm trying to write a script (my first) that loops through some table
rows and gets some data from another page using gm_xmlhttprequests. It
works if I keep the loop to one, but if I try and loop through all the
rows, and therefore have say 10-20 gm_xmlhttprequests, the script just
seems to fail. But if I put an alert inside each gm_xmlhttprequest, and
wait a bit before dismissing the alert, the gm_xmlhttprequest will
succeed and the data gets updated as planned. It seems as if the
gm_xmlhttprequests don't block, or the script keeps executing without
waiting for the requests to finish. I don't have any listeners on the
script, I just want it all to load when the page loads. Also, I looked
at the javascript console and it doesn't have any errors about the
gm_xmlhttprequests.
Without getting into whether I should or shouldn't do this, I'm hoping someone can help me disable greasemonkey on my site.
I've tried the two methods I could find via Google, but neither worked code...
Is there actually a way to prevent Greasemonkey from loading on your page?
I am trying to learn some javascript at the moment and thought a simple greasemonkey script might be a good way to start.What I want the script to do is to replace an existing url on a website with a different url from another location within the website.
E.G. replace "/mailbox.php?inbox" with "/account.php?action=mybookmarks"
There are a lot of examples of replacing existing urls with different ones on the web but they all use id's to locate and replace urls.
This script is for a site I visit often and since I dont own it I dont have the ability to add id tags to the appropriate a tags, this makes writing this script a lot more difficult.This is the code I have so far;
Code:
// ==UserScript==
// @name NZBmatrix mailbox url replace
// @include http://nzbmatrix.com/
[code]....
would like to know a tool that could give me a clue on where is the error in a greasemonkey script that i'm working on. I'm using notepad, what tool could "run" the script and tell me where is the error?
View 4 Replies View Relatedjavascript:(function(){var k,x,t,i,j,p; for(k=0;x=document.links[k];k+
+){t=x.href.replace(/[%]3A/ig,':').replace(/[%]2f/
ig,'/');i=t.lastIndexOf('http');if(i>0){ t=t.substring(i);
j=t.indexOf('&'); if(j>0)t=t.substring(0,j); p=/https?://[^
s]*[^.,;'%22>s)]]/.exec(unescape(t)); if(p) x.href=p[0]; } else if
(x.onmouseover&&x.onmouseout){x.onmouseover(); if (window.status &&
window.status.indexOf('://')!=-1)x.href=window.status;
x.onmouseout(); } x. x. }})();
What I would like to do is watch a countdown timer on a page, like the ones on swoopo.co.uk and then perfom an action depending on what time is left on the timer.
I've installed DOM inspector on Firefox and poked around with javascript shell and I think I've figured out how to read the timer and assign that to a variable, something like this -
var timer=document.getElementById('counter_index_page_162980').innerHTML;
Now I need to watch that so I guessed this would do -
while (timer!=="00:00:01")
{
var timer=document.getElementById('counter_index_page_162980').innerHTML;
}
alert('timer at 1 sec!');
But that just brings up an "unresponsive script" error in my browser.
Am I even close to the mark? I know I'm not going to win any auctions with this but I've already paid for the bids so I may as well use them now.
I'm using this script:
[URL]
source code:
[URL]
but it's showing no checkboxes. Here's the code related to that:
Code:
function rp_villageSelector() { //adds Village checkboxes
FM_log(3,"rp_villageSelector() called");
//get Travian Version
[code]....
I'm a newbie to JavaScript and Greasemonkey and just started learning
with 'Dive Into Greasemonkey'. I looked for an example on the web, but
unfortunately I'm still missing something...
I have a text file which is a simple database:
Key01 Text01 Url01
Key02 Text02 Url02
....
I'd like to insert after
<a href="anUrl" class="thisClass">Key01<a>
the element
<a href="Url01">Text01<a>
I tried to reuse the "Dumb Quotes" from 'Dive Into Greasemonkey' by
replacing
replacement = {
"Key01":"Key01</a><a href="Url01">Text01",
"Key02":"Key02</a><a href="Url01">Text02"
};
Unfortunately, this doesn't work, since </a><a href...is not
interpreted as a HTML tag.
So I tried this:
nodes = document.evaluate(
"//text()",
document,
null,
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
null);
for (var i = 0; i < nodes.snapshotLength; i++) {
node = nodes.snapshotItem(i);
text = node.data;
for (key in replacements) {
if(s==key)
helpkey=key;
}
newLink = document.createElement('a');
// newLink.href = 'Url0x' ????
// newLink.appendChild(document.createTextNode(Text0x )); ???
newLink.parentNode.insertBefore(newLink, node.nextSibling);
}
I'm really lost.
I've just started some JavaScript development, but have run into a bit of a problem with a Greasemonkey script I'm working on. This script is for personal use. I'm doing a variety of things on a page, including auto-refreshing it. I want to display the number of clicks (preferably just on links) since the last refresh.
View 1 Replies View RelatedFully commented...
<?XML version="1.0"?>
<component>
<?component error="true" debug="true"?>
<comment>-------------------------------------------------------------
'HTA Window Glue' script component (file name: HTAWnGlue.wsc)
Description:
a tacky attempt at persisting 'window settings', to restore
size/position at run time (within available screen space)
Usage:
include a link element inside an HTA element, like so:
<!--
<HTA:APPLICATION APPLICATIONNAME="someUniqueName">
<link style="behavior:url(HTAWnGlue.wsc)">
</HTA:APPLICATION>
-->
(no need for '<!--' these '-->' outside of this file)
Behavior:
*.xml is saved to the 'Application Data' directory (by default), in
a folder entitled 'HTAWnGlueData' the xml files are named/retrieved,
according to each HTA's APPLICATIONNAME value
the HTA's WINDOWSTATE attribute must be kept to its default value of
"normal" for the adhesion behavior to stick, so to speak...
Settings:
there are three 'resource' tags in this component:
"glueDir"
sets the top-level directory, where the data folder
is created; this can be changed in the text of that
tag, for example:
<!--
<resource id="glueDir">C:Temp</resource>
-->
currently that is: 0x1a
(- the shell special folder constant for 'ssfAPPDATA')
"minWidth" and "minHeight"
set minimum dimensions of a window...
Notes:
white-space counts as data in the resource tags
the initial resize can be hidden from view, if a seperate script is
included immediately below the opening <!-- <head> --> tag of
the HTA, like so:
<!--
<script type="text/JScript">
try{moveTo(-32000,-32000)}catch(e){}
</script>
-->
- "normal" WINDOWSTATE is important in this context
all things considered, the component is probably best suited for
resizable HTA's without minimize and maximize buttons...
------------------------------------------------------------</comment>
<implements type="Behavior" id="GlueCode" />
<resource id="glueDir">0x1a</resource>
<resource id="minWidth">100</resource>
<resource id="minHeight">100</resource>
<script language="JScript">
<![CDATA[
GlueCode.attachNotification(function(message)
{
if(message != "documentReady")
return;
var HTA, appName;
if(!((HTA = GlueCode.element.parentElement) && HTA.windowState == "normal" &&
(appName = sysConvention(HTA.applicationName)).length && !external))
return;
var IShellDispatch, IXMLDOMDocument;
if(!((IShellDispatch = AXO("Shell.Application")) &&
(IXMLDOMDocument = AXO(["Msxml2.DOMDocument.4.0","Msxml2.DOMDocument","Microsoft.XMLDOM"]))))
return;
var N, Folder, persist, FolderItem, storageDir = "HTAWnGlueData";
if(!(Folder = IShellDispatch.NameSpace(isNaN(N = +(Folder = attempt(function()
{return getResource("glueDir");}))) ? Folder : N)))
return;
Folder.NewFolder(storageDir);
Folder = IShellDispatch.NameSpace(Folder.Self.Path + "" + storageDir);
var client = document.body, availWidth = screen.availWidth, availHeight = screen.availHeight;
window.attachEvent("onbeforeunload",function()
{
if(!persist)
return;
root = IXMLDOMDocument.documentElement;
root.setAttribute("left", screenLeft);
root.setAttribute("top", screenTop);
root.setAttribute("width", client.offsetWidth);
root.setAttribute("height", client.offsetHeight);
attempt(function(){IXMLDOMDocument.save(IXMLDOMDocument.url || Folder.Self.Path + "" + appName);});
});
IXMLDOMDocument.async = false;
if(!(FolderItem = Folder.ParseName(appName = appName + ".xml")))
{
persist = IXMLDOMDocument.loadXML("<HTAWindow left="" top="" width="" height="" />");
return schedule(function(){
moveTo((availWidth - client.offsetWidth) / 2, (availHeight - client.offsetHeight) / 2);});
}
if(!(persist = IXMLDOMDocument.load(FolderItem.Path)))
return;
var m = 32000;
schedule(function(){moveTo(-m,-m);},function()
{
var
root = IXMLDOMDocument.documentElement,
persistLeft = +root.getAttribute("left"),
persistTop = +root.getAttribute("top"),
persistWidth = +root.getAttribute("width"),
persistHeight = +root.getAttribute("height"),
borderWidth = screenLeft + m,
captionHeight = screenTop + m,
minWidth = (isNaN(minWidth = Math.abs(parseInt(attempt(function()
{return getResource("minWidth")}))))) ? 100 : minWidth,
minHeight = (isNaN(minHeight = Math.abs(parseInt(attempt(function()
{return getResource("minHeight")}))))) ? 100 : minHeight,
size = function()
{resizeTo(Math.max(minWidth, Math.min(availWidth, persistWidth + (borderWidth * 2))),
Math.max(minHeight, Math.min(availHeight, persistHeight + captionHeight + borderWidth)));},
move = function()
{moveTo(Math.max(0, Math.min(persistLeft - borderWidth, availWidth - (client.offsetWidth + (borderWidth * 2)))),
Math.max(0, Math.min(persistTop - captionHeight, availHeight - (client.offsetHeight + captionHeight + borderWidth))));};
schedule(size,function(){schedule(move);});
});
function sysConvention(filename){
var
p1 = /[x00-x1f<"/?*|:>]/g,
p2 = /^[. ]+|[. ]+$/g,
p3 = RegExp("(^AUX$|^CLOCK$$|^COM1$|^COM2$|^COM3$|^COM4$|^COM5$|^COM6$|^COM7$|^COM8$|^COM9$|" +
"^CON$|^LPT1$|^LPT2$|^LPT3$|^LPT4$|^LPT5$|^LPT6$|^LPT7$|^LPT8$|^LPT9$|^NUL$|^PRN$)","i");
return filename.replace(p1,"").replace(p2,"").replace(p3,"$1_");}
function attempt(method,test){
try{throw method();}catch(result){return result instanceof Error ? null : result || test;}}
function schedule(method,next){
!attempt(method,true) ? setTimeout(function(){schedule(method,next);},55) : attempt(next);}
function AXO(progId,loc){
if(!(progId instanceof Array))
return bind(progId);
function bind(pId){
try{
throw loc ? new ActiveXObject(pId,loc) : new ActiveXObject(pId);}
catch(obj){
return obj instanceof Error ? null : obj;}}
var retval, p, i = -1;
while(p = progId[++i])
if(retval = bind(p))
break;
return retval;}
});
]]>
</script>
</component>
Info on script components... http://msdn.microsoft.com/library/en-us/dnclinic/html/scripting091399.asp
HTA:APPLICATION Element: http://msdn.microsoft.com/workshop/author/hta/reference/objects/hta.asp
I am newly using Jquery. I have a script here like :
[Code]...
This opens up a text box which when clicked, my date picker will pop up. If clicked elsewhere it will disappear again. But I might have done something wrong, as presently this is not happening.
I am trying to build this interface where there are icons and onmouseover, it displays menu choices for the corresponding. Instead of fixing the position of the menu box, is there a way to specify the left and top of that, relative to the icon that is being hovered? Here is part of my code:
<table width="100%" style="">
<tr align="center">
<td>
<img id="imgHead1" src="images/ccd.ico" alt="Info Center"
[Code]....
Firebug gives me the below error message:
component.singularize is not a function [Break on this error] var component = component.singularize();
This is what I have:
var component = window.location.hash.replace('#', '');
var component = component.singularize();
alert("The component name is " + component);
[Code]....
I have a problem. I have a div component where I'll drag multiple images. This part is working perfectly. But I am not able to read the order of these images played in the component. What happens, I can play any position in the image of the div component, however, like to read in order as they are, from left to right.
I believe it is possible, but the solution must be complicated. Some of his friends could help me in the routine javascript to read this?
[Code]...
I got a page with 2 <select> the second one is populated by the 1st selected item. I want to know how can I reload just the second <select>.
View 2 Replies View RelatedAm just starting a new site and this morning noticed my header background image (logo) was missing.
Started out with normal CSS/HTML navigation menu.
www.westernwebdesign.com.au/pelican/index.html
Then I added a Vista buttons navigation menu:
http://www.westernwebdesign.com.au/p...cal/index.html
and the logo was gone. Not exactly sure at what point it disappeared yesterday as I didn't notice it missing until this morning. The navigation is about the only point of difference so I think this is the issue but have no idea why.
building an HTML/CSS component that would:
1) Feature a small set of icons that would be placed on the right-side of a div
2) If someone clicked on one of the icons, the component would slide out towards the right, featuring various UI elements (i.e. descriptive text and form elements). The component slides out to match the width of the content (not fixed width)
3) The slider slides back if the user clicks on the "X" in top right corner or moves their mouse/clicks outside the slider area.
4) A nice to have would be if the component is towards the right side of the screen, the component slides out left (so it does not go outside the screen area or show a horizontal slider on the bottom of the screen window).
A visual of what I am trying to accomplish can be found in the attached file.
I have made a ActiveX control for commericial application. A Drag and
Drop component for Mail server.
I need to host the component in Internet Explorer.
When a user opens a mail it should prompt the user to download and
register the Drag and Drop activeX component.
This should be a trivial program. Please let me know how is it done.
Advanced DHTML Dropdown List component (Javascript,ASP,.NET,PHP)
enhances usability of large dropdown lists with type & select feature.
It suggests possible matches for entries you type in the input box.
Works in all browser with DIV, CSS and JavaScript support: IE5+,
Netscape6+, Mozilla, Opera. The script allows full customization with
style sheets, single and multiple select mode. Code:
looking for a script or list component that allow to change order by drag & drop
View 2 Replies View RelatedAre there any good web UI component libraries -open source or commercial - that you can recomment? They need to be cross browser compatible and have good documentation. Jquery UI is very good but limited in number of controls it offers. YUI is very verbose and very hard to use. extJs only other one I can think of. Any others you use and like?
View 2 Replies View RelatedI am needing some help with an error I'm getting from a project I'm working on. First off let me preface this all with the fact that I'm a total javascript noob. I'm really trying to understand what I'm doing wrong. So any help or advice is MORE than welcome. Here's what is happening. I found this code that will duplicate a row in a table and modifiy the name of a input in the row. Well for my purposes I have two different tables I need to work with. (each one idividually) So I changed the code a bit to make it accecpt a variable to use for the table name. (before it was static) and now I'm getting a error. Error: uncaught exception: [Exception... "Component returned failure code: 0x80004003 (NS_ERROR_INVALID_POINTER)" nsresult: "0x80004003 (NS_ERROR_INVALID_POINTER)" location: "JS frame :: http://www.tourandtravelnow.com/admin/scripts/faxPageScript.js :: addRow :: line 14" data: no] This is the old code that would work (only for one of the tables)
[Code]...
I am having trouble getting my expanding menu to work in Firefox and Opera. It works fine in IE though. I did not write the javascript myself, as I am fairly new to JS, but I did all the HTML and CSS. I used the error console on FF, and also used FireBug. They both returned the following error:
[Code]...