w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Does emacs support multi column editing?
I'm not sure if this fits your requirements, but you might take a look at Two Column Editing.

Categories : Emacs

Disable column editing in devexpress MVC Grid View
Try adding a readonly attribute to your column in the Partial View: settings.Columns.Add(column => { column.FieldName = "MyField"; column.ReadOnly = true; });

Categories : Asp Net Mvc

How to show complete column as editable in extjs grid(cell editing)?
Wait for the beforeedit event and then ... Ext.grid.plugin.CellEditing', { clicksToEdit: 1, listeners: { beforeedit: function( oEditor, oOptions ) { // for each record start the edit mode 'startEdit()' } } Check the doc: startEdit()

Categories : Extjs

Kendo Grid - Line Editing Using A Drop-Down List Editor (Editing Custom Editor)
Try changing the following. var Category = [ { 'CategoryName': 'Beverages', 'CategoryID': 1 }, { 'CategoryName': 'Condiments', 'CategoryID': 2 }, { 'CategoryName': 'Confections', 'CategoryID': 3 }, { 'CategoryName': 'Dairy Products', 'CategoryID': 4 }, { 'CategoryName': 'Grains/Cereals', 'CategoryID': 5 }, { 'CategoryName': 'Meat/Poultry', 'CategoryID': 6 }, { 'CategoryName': 'Produce', 'CategoryID': 7 }, { 'CategoryName': 'Seafood', 'CategoryID': 8 } ]; and as the datasource use $('<input required data-text-field="CategoryName" data-value-field="CategoryID" data-bind="value:' + options.field + '"/>') .appendTo(container) .kendoDropDownList({ autoBind: fal

Categories : Javascript

How would I remove a DIV if there are no IDs using Greasemonkey?
We might need to see the whole page to work out robust selectors for those <div>s. But, if they always contain iframes with src attributes to undesirable content, then you can use those iframes to hunt down the dastardly divs. Make a list of key text snippets in the bad iframe src attributes. I'm also using jQuery and waitForKeyElements(), in case this content is added by AJAX. So, the script looks something like this: // ==UserScript== // @name _Remove bad divs containing bad iframes // @include http://YOUR_SERVER.COM/YOUR_PATH/* // @require http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js // @require https://gist.github.com/raw/2625891/waitForKeyElements.js // @grant GM_addStyle // ==/UserScript== /*- The @grant directive is needed to work around a de

Categories : Javascript

How to change var value in greasemonkey
If I understand you correctly, this should be an easy fix. You can simply overwrite the variable: So replace myInfo { "plusActive":true; } with plusActive = true; You shouldn't need to run any sort of a function, assuming the variable in question is not read until the page is loaded (which is far from certain).

Categories : Misc

GreaseMonkey @include for about:newtab
See the docs at "Include and exclude rules, Extra schemes". for a script to run on blank tabs, you must now explicitly set @include about:blank. For example: // ==UserScript== // @name _Very noisy script // @include about:blank // @include * // ==/UserScript== alert ("Fire on blank"); However, Firefox now uses about:newtab by default, and Greasemonkey currently doesn't consider about:newtab to be "Greaseable". (It should though, and I'll look into getting a pull-request accepted for this.) So, to get scripts firing on blank tabs, you currently must set those blank tabs back to using about:blank. Do that by opening about:config and setting browser.newtab.url to about:blank.

Categories : Javascript

greasemonkey currency converter
You need to recurse or loop through just the nodes that have the dollar values. Never use replace() or RegExp on .html() or innerHTML. Not only will this trash the target page, but you will have a devil of a time getting the desired results. Recurse through the page using DOM methods. Note that currency values come in many formats, so converting them can get complex. Here's moderately robust code for the whole page (sans iframes) You can see it in action at jsFiddle: // ==UserScript== // @name _Global currency converter, dollars to rupees // @include http://YOUR_SERVER.COM/YOUR_PATH/* // @grant GM_xmlhttpRequest // ==/UserScript== GM_xmlhttpRequest ( { method: "GET", url: 'http://rate-exchange.appspot.com/currency?from=USD&to=INR', //Google sends m

Categories : Javascript

How to set the swf path of TableTools when using it with Greasemonkey
If one examines the source code of dataTables.Tabletools.js, while initializing a datatable, tabletools uses the TableTools.DEFAULTS objects and combines them with your tables custom settings. At line no 1158 , as per the version (1.0.4-Tabletools2) that i have, the code sets the moviePath for ZeroClipboard_TableTools, which i am assuming, is a singleton. Now if you have multiple tables on the page, this object ends up taking the value of swfpath specified for the last table , or Default "sSwfPath": "../swf/copy_csv_xls_pdf.swf" , if not specified. /* Flash file location */ this.s.swfPath = this.s.custom.sSwfPath; if ( typeof ZeroClipboard_TableTools != 'undefined' ) { ZeroClipboard_TableTools.moviePath = this.s.swfPath; } So, i c

Categories : Misc

Preventing pop-up box from being displayed using Greasemonkey
A Greasemonkey question is probably better asked over at userscripts.org Anyways... it seems like you just want to hide elements. CSS is probably the best way. There's a cool extension called Stylish that does this really well. Just use normal FF tools or Firebug to inspect what element pops up and try, using CSS rules, to hide it with Stylish. It's better that way, because dealing with Gmail using JavaScript could be really frustrating.

Categories : Javascript

Only target non-active buttons with Greasemonkey
Try this: waitForKeyElements ("a.action-button:not(.active)", triggerMostButtons); The first parameter here works like a jquery selector. It finds: "a" tags (a) with a class of "action-button" (.action-button) without a class of "active" (:not(.active)) Note that the "." character is CSS notation for a class identifier. Here's the jquery reference for "not": http://api.jquery.com/not-selector/

Categories : Javascript

How to use userscripts in a site?(How does Greasemonkey work)
Greasemonkey and Userscripts.org are meant to provide kind of lightweight extensions for the browser, not for the webpages. I.e. you install them as the user inside your browser. Some of the trivial scripts might be incorporated into webpages, but in general, Greasemonkey has some "superpowers" to do things that ordinary JavaScript can't do due to security constraints. For instance, issuing (and reading response of) cross-domain XMLHttpRequest, interactions between frames from different origin etc. Normally Greasemonkey scripts are executed when DOMContentLoaded is fired by the browser (this can be changed using @run-at directive to execute the script before anything is loaded). If the script has @grant none in its GM meta section, then it could be perhaps incorporated into your site, b

Categories : Javascript

How do I find out when a tab I've opened with greasemonkey is loaded?
I found a way around the problem... oddly enough, I couldn't do it when using GM_openInTab to create the window, but using mywin2=window.open("http://www.aywas.com/message/notices/9801049/", "my_win2"); allowed me to use the following code to detect the load and close the tab only after it was loaded enough for my purposes! (Although the 'window title' bit of that code above didn't seem to do anything...) mywin2.addEventListener('load', function() { mywin2.close() }, false);

Categories : Javascript

Convert a greasemonkey Script after E4x is not supported
If there is a dependency on e4x, try including the JavaScript implementation: e4x.js As an alternative, here are other questions which cover mapping e4x syntax to XPath or XML to JSON: What is the Flex/AS3/E4X equivalent of this xpath query? Howto convert E4X XML Elements into JSON Notation In addition, you can continue to use e4x by accessing the data via yql: Using e4x with yql

Categories : Javascript

greasemonkey simple string manipulation
var url = "www.something.com/item/4563/"; var matches = url.match(/item/(d+)/); var itemNumber = matches && parseInt(matches[1], 10); console.log(itemNumber); // => 4563

Categories : Misc

Prevent Greasemonkey script from inserting div into iframe
if ( window.self === window.top ) { not in a frame } else { in a frame } check the above condition first before your code of inserting div original link: How to identify if a webpage is being loaded inside an iframe or directly into the browser window?

Categories : Javascript

Click many links, in one page, with a Greasemonkey script?
var all = document.getElementsByClassName("delete"); for(var i=0; i<all.length; i++) { var deleteUrl = all[i].href; var ifr = document.createElement("IFRAME"); document.body.appendChild(ifr); ifr.src = deleteUrl; } You could run a simple script like the above in the browser's JavaScript console or make it a bookmarklet.

Categories : Javascript

Can latest Tampermonkey / Greasemonkey still not use jQuery AJAX?
jQuery AJAX works fine with Tampermonkey and Greasemonkey, with only one limitation compared to jQuery use in a web page. For example, this cross-origin script works in both Tampermonkey and Greasemonkey: // ==UserScript== // @name _Demonstrate jQuery AJAX from Tampermonkey // @include http://stackoverflow.com/questions/18546180/* // @require http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js // @grant GM_addStyle // ==/UserScript== /*- The @grant directive is needed to work around a design change introduced in GM 1.0. It restores the sandbox. */ $.ajax ( { type: 'GET', url: 'https://api.stackexchange.com/2.1/users/621338?site=stackoverflow&filter=!)2R0ltXnW6.fyPDiHJm', dataType: 'JSON', success: function (apiJson) {

Categories : Jquery

Including a Greasemonkey script across multiple domains
Reference: Greasemonkey Include and exclude rules Match Patterns Match patterns and globs The solutions that work on Greasemonkey (which is Firefox), may be different on Chrome and on Tampermonkey. Three basic approaches: Use 30 different @include lines: While this may be unpalatable in terms of cut-and-paste coding, it is the one approach that will work the same across browsers and the one that will have the best browser performance. The other approaches require the browser to do (more) checks against possibly every page or iframe visited. Use a regex @include: @include /^http://(1stDomain.com|2ndDomain.com|3rdDomain.net|etc.)/(admin/edit|blog|user/.+?/history)/ This is one line, and performs fairly well, but the line can get unwieldy, and this will only work on Greasemonkey an

Categories : Misc

How can I submit this form properly with javascript/greasemonkey?
With jQuery you could submit this form like this: In this function you can process the data of the form. $(document).on("submit", "form", function(e){ e.preventDefault(); // get the data of the form var url = $(this).attr("action"), _csrf_token = $(this).find("input name=['_csrf_token']).val(); // jquery ajax call for example $.ajax( ); });

Categories : Javascript

Watch for element creation in greasemonkey script?
MutationObservers are called for more things than just adding nodes, including changes to attributes and removing nodes. So watch out for mutation.addedNodes returning null - in which case this code will fail. Try: if (mutation.addedNodes && mutation.addedNodes[0].getAttribute('class') === 'nav') { ... The mutation object also has a 'type' attribute that you can use to get more info; have you read the API docs on MDN? There are some good examples there.

Categories : Javascript

replacing text between two strings in javascript using greasemonkey
The easiest way to do this would be with a regular expression. var comment = "[youtube]http://www.youtube.com/embed/XGSy3_Czz8k[/youtube]", match = comment.match(/[youtube]([^[]*)[/youtube]/); if (match) { var iframe = document.createElement("iframe"); iframe.src = match[1]; document.body.appendChild(iframe); }

Categories : Javascript

jQuery .ready not getting called from within Greasemonkey script
The alert doesn't fire for two reasons: The browser is redirected from www.ted.com to www.youtube.com right away -- long before the ready event can fire on ted.com. The script is not set to fire on youtube.com at all. If you want the script to fire on both domains, adjust the @include (or @match) directives and then use checks like: if (location.hostname == "www.ted.com") { var url = window.location.href; var talk_name = url.split("/").pop(); talk_name = talk_name.substring(0, talk_name.lastIndexOf('.html')); var youtube_search_url = 'http://www.youtube.com/user/TEDtalksDirector/search?query=' + talk_name; window.location.href = youtube_search_url; } to alter the script's behavior, per domain. Because @grant none is used, the GM script's jQuery c

Categories : Javascript

Greasemonkey script seems to execute lines out of order
Try this .. setTimeout(function(){$("#cat_1").attr("checked",true);},0); If it is a race condition of some kind this will put your command at the bottom of the stack.

Categories : Javascript

How to transform an XML file with XSLT, using a Greasemonkey script?
I would have added this in a comment, but I don't have the relevant reputation. There are two things that I would check. Especially if this is working on a string, and not a file from the server like you said Make sure that what you are getting from the server is a string, and not an object Make sure the xml you are getting from the server is correct. If you aren't getting a string, you can do an ajax request to get the text from the xml. And then load that as your new xml var. And if you really just wanted to make your xml user friendly, I would suggest checking out http://code.google.com/p/vkbeautify and http://google-code-prettify.googlecode.com/svn/trunk/README.html Those should maintain the xml format while stylizing it to make it easy to read. Plus, you won't have to mess with

Categories : Javascript

How can I save greasemonkey outputs across numerous tabs
Most UserScript environments provide the very useful GM_setValue and GM_getValue functions. You do have to be careful about race conditions though, so I would be tempted to have each tab generate a random number (perhaps based on time) and then put their stuff in a key based upon that value. Then, at the end, concatenate the strings together and display one large string at the end that can be cut-and-pasted. Or, if you'd rather not cut-and-paste, you can generate a massive string and use the HTML5 download attribute. Edit, based on OP's comment (Typed on the fly, untested.) // The documentation talks about the second parametere here -- a default value. var value = GM_getValue("value", ""); value += str + " "; GM_setValue("value", value); While all UserScript methods should underst

Categories : Javascript

Greasemonkey renaming texts from array only works once
for(var i = 0; i<(array.length-1); i=i+2) Might be part of your problem... The array length is 4.... you start counting at 0 which means that you only go to 3 on the list (I think), and then i=i+2 means that you are only processing every other one (I think).. try for(var i = 0; i<(array.length-1); i=i++) or for(var i = 0; i<(array.length); i=i++) Wait.......... when it executes does it show the first array value or the last? It may be looping too fast to see all of them, since you are replacing one with the next

Categories : Arrays

How to change the default metadata in new Greasemonkey scripts?
I see you have already opened a feature request, which is the correct way to handle this long term. For a quick-and dirty, temporary fix -- that will work only for you and only until the next Greasemonkey update, you can do the following: Shut down Firefox. Find your Firefox profile folder. To be extra safe, save a backup copy of your profile folder. Find the Greasemonkey extension package. It will be in the extensions sub folder and is normally named {e4a8a97b-f2ed-450b-b12d-ee082ba24781}.xpi. Using a zip-file tool, like 7-Zip, open the .xpi file. Find and extract content ewscript.js. Just before line 124, script.push("// @version 1");, add the following lines: script.push("// @require http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"); script.push("// @author

Categories : Jquery

Calling a local WCF service via Scriptish or Greasemonkey
I figured out how to do it via a GET request thanks to M.Babcock for pushing me in that direction (unimportant parts intentionally left out to save space). Service.svc: [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] public class Service : IService { [WebGet(ResponseFormat = WebMessageFormat.Json)] public bool MatchPartial(string partialFilename) { ... } } Web.config: <configuration> ... ... <system.web> <compilation debug="true" targetFramework="4.5" /> <httpRuntime targetFramework="4.5" /> </system.web> <system.webServer> <httpProtocol> <customHeaders> <!-- IMPORTANT FOR THIS TO WORK USING JQUERY GET OR AJA

Categories : C#

Greasemonkey script does not load external JS and CSS file
That linked answer was from 2011, and Greasemonkey has changed a lot since then. (Note, I just now updated that answer to reflect the changes.) Basically, you need to use @grant directives now. If you looked on Firefox's error console (CtrlShiftJ), you might have seen error messages like: GM_addStyle is not defined Here is a bare-bones addition of jQuery-UI to demonstrate the process: // ==UserScript== // @name _YOUR_SCRIPT_NAME // @include http://YOUR_SERVER.COM/YOUR_PATH/* // @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js // @require http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js // @resource jqUI_CSS http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css // @grant GM_addStyle // @grant GM_getResou

Categories : Javascript

Removing CSS Borders with javascript in greasemonkey/tampermonkey for facebook
border-right is a style property, not an element attribute, so removeAttribute won't work. Instead try this: document.getElementById("mainContainer").style.borderRight = "none"; (Note that border-right becomes borderRight for JavaScript, and make sure you spell names exactly.) However you might prefer user stylesheets. Browser extensions such as Stylish let you write CSS that is applied automatically, instead of going through script. (You can hide things using display: none, or mute them with opacity: 0.5.)

Categories : Javascript

"TypeError: can't convert undefined to object" with GreaseMonkey script
You are using .trigger() incorrectly, you need to pass at least the event type argument. $('#triggerAllButton').click(function(e){ e.preventDefault(); $(".btn.trigger").trigger("click"); //.each is implicit on all jQuery methods });

Categories : Javascript

Make Greasemonkey throw error on undefined variable
Unfortunately, Greasemonkey - and javascript in general, along with at least a few other non-compiled languages - do not give very good debugging errors... I can't count the number of times it tells me there is a missing ) at the end of an argument list that doesn't exist, and it turns out my error is elsewhere... When a script of mine won't run I add an alert after any value assignments and if they don't alert or alert the wrong data I have found the problem... for your example above I would debug by: this=self; alert(self); Although I would probably see the problem when I went to add the alert, but if I didn't notice - the alert either wouldn't pop up or it would have the wrong value... and if it didn't pop up, the error console would likely say self not defined.

Categories : Misc

Use Greasemonkey to change row format based on one cell's contents?
This one's a little easier than the linked example, I think. The key is understanding jQuery selectors and then using jQuery's .css() function. Assuming the page doesn't use AJAX, here's a complete script that works on the HTML you provided: // ==UserScript== // @name _Format the "not checked" rows // @include http://YOUR_SERVER.COM/YOUR_PATH/* // @require http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js // @grant GM_addStyle // ==/UserScript== /*- The @grant directive is needed to work around a design change introduced in GM 1.0. It restores the sandbox. */ //--- The 'Not Checked' is case-sensitive var notChkdRows = $( "tr.dataRow:has(th.booleanColumn img[title='Not Checked'])" ); //--- Use whatever CSS you wish notChkdRows.css ( { "background":

Categories : Javascript

Add images and a mouseover event in a loop, in a Greasemonkey script?
Do not use anonymous functions in a loop like that. That leads to memory and performance problems. Anyway, use the return value of insertBefore(). like so: var anchors = document.evaluate ( '//a[@target]', document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null ); var icon4 = document.createElement('img'); icon4.src = '...'; for (var a = 0; a < anchors.snapshotLength; a++) { if (anchors.snapshotItem(a).href.substring(0, 16) != location.href.substring(0, 16)) { var newNode = anchors.snapshotItem(a).parentNode.insertBefore ( icon4.cloneNode (true), anchors.snapshotItem (a) ); newNode.addEventListener ('mouseover', myMouseInOutHandler, false); newNode.addEventListener ('mouseout', myMouseInOutHandler, false); } } funct

Categories : Javascript

Replace specific table values using a Greasemonkey script
this javascript code let's you replace the content of a TD by it's index where 0 is the first element. var tbl=document.getElementsByTagName("table")[0]; //get the first TABLE var trs=tbl.getElementsByTagName('tr'); //get all TR's in that table var replaceTD=function(TRindex,TDindex,value){ trs[TRindex].getElementsByTagName('td')[TDindex].innerHTML=value; // replaced with innerText }; to change the second TD of the first TR that is not a title (so the third) your indexes will be TRindex=2 cause it starts from 0 ... and the TDindex=1 and the function you will call is : replaceTD(2,1,'WHATEVER');

Categories : Javascript

Use Greasemonkey to change Text to Images (on a static site)?
I am not much of a userscript expert, but I had a script from here. The original site is down, but here's the script. // ==UserScript== // @name Inline Image Relinker // @namespace /web/20070712085327/http://www.sitzmar.com // @description Replaces links to images with the actual image // @include * // ==/UserScript== (function() { function getXPath(p, context) { var arr = new Array(); var xpr = document.evaluate(p,context,null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); for(i = 0;item = xpr.snapshotItem(i); i++) { arr.push(item); } return arr; } doc = window.document; var xpath = "//A[(contains(@href, '.jpg') or contains(@href, '.jpeg') or contains(@href, '.gif') or cont

Categories : Javascript

addEventListener and setInterval fail silently in a Greasemonkey script
Update (Now that target page was given): The question code did not match the structure of the actual page. It typically would throw TypeError: iTags[3] is undefined errors. Using DOM methods, to get the desired info, does the job. A working script is: // ==UserScript== // @name _KROQ, song info to page title // @include http://betaplayer.radio.com/player/* // @grant GM_addStyle // ==/UserScript== /*- The @grant directive is needed to work around a design change introduced in GM 1.0. It restores the sandbox. */ if (window.top != window.self) //-- Don't run on frames or iframes. return; window.addEventListener ('load', function () { setInterval (setTitle, 5000); }, false); function setTitle () { var songInfoNode = document.querySelector ( "#play_info

Categories : Javascript

How do I modify an existing button's onclick to open a new tab using Greasemonkey?
You can just do this: <button onClick="window.open('*my-url*');">Stock in Shop</button> There is no way to force a new tab -- the browser will respect the user's setting whether to create a new tab or a new window. I've created a JavaScript fiddle for you so that you can see for yourself how simple this is: http://jsfiddle.net/Fnz9R/ Good luck!

Categories : Javascript

Injecting a document.write call from a Greasemonkey script causes nothing to load
The smartest/best(est) thing to do is to avoid document.write(). Use DOM techniques. Here's a complete script: // ==UserScript== // @name _Replace a target page using DOM techniques // @include http://YOUR_SERVER.COM/YOUR_PATH/* // @grant GM_addStyle // ==/UserScript== /*- The @grant directive is needed to work around a design change introduced in GM 1.0. It restores the sandbox. */ var D = document; var newDoc = D.implementation.createHTMLDocument (""); D.replaceChild ( D.importNode (newDoc.documentElement, true), D.documentElement ); D.body.innerHTML = '<h1>TEST</h1>' Greasemonkey normally fires on DOMContentLoaded, not when the page has fully completed loading. Chrome fires later than that, by default. Anyway, at DOMContentLoaded, in

Categories : Javascript



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.