w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
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

Adding javascript to a XML file transformed with XSLT using a Greasemonkey script
Don't use onclick. This goes triple for userscripts, as there are additional scope and/or sandbox conflicts. Also, it's a poor idea to try and add JS into the XSLT file/text, and there is no need for script injection in this case either. Use the script to do whatever JS manipulation you have in mind. For example: // ==UserScript== // @name _XML Renderer with javascript functionality // @description Stylesheet and javascript for xml results // @include http://YOUR_SERVER.COM/YOUR_PATH/*.xml // @resource xslFile Q_17998446_transform.xsl // @grant GM_getResourceText // ==/UserScript== var xsl_str = GM_getResourceText ("xslFile"); var processor = new XSLTProcessor (); var dataXSL = new DOMParser ().parseFromString (xsl_str, "text/xml"); processor.importSty

Categories : Javascript

Get path including GET variables using javascript
window.location.search.replace( "?", "" ); this will return the get variables. LINK=http://www.javascriptkit.com/jsref/location.shtml Answer to your question->no,there is no any built in function ,we have to make our custom function and parse it. Get URL parameter with jQuery

Categories : Javascript

GWT/GXT adding nocache.js file, in the header or after the body?
From my point of view there are 2 cases: If you use GWT to only enhance your page that is generated on the server side then put the <script> at the end. That allows your browser to render the initial content of the page before parsing the JS code. If you built a single page application that is completely generated by GWT on the client side, there's no content to be initially shown. In that case you can put the <script> to the head. Be aware that 1. also applies if you implemented a loading animation or placeholder content to be initially shown.

Categories : Java

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

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

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

Error when including the same file in 2 files and then including them in another file (in c)
Enclose the content of each header file in preprocessor guards: /* a.h */ #ifndef A_H_ #define A_H_ /* content of a.h goes here */ #endif Same for the other headers: /* b.h */ #ifndef B_H_ #define B_H_ /* content of b.h goes here */ #endif and so on. That's the usual way to ensure that each header content is read only once. (When the file is read for the first time, the symbol [e.g. B_H_] has not yet been defined, so ifndef is true, and the content is read. From the second time on, the symbol is defined, and the content is skipped.) Note that the name of the symbol A_H_ is arbitrary, but usually people use the name of the header written in capital letters. Hence the mechanism fails as soon as you include two different headers with the same name, unless you use different names f

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

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

GWT - How to generate the *.nocache.js
You need not to generate it manually and not encouraged by google too. Once you compile your gwt project,It generates.

Categories : Java

Post javascript variables to separate .PHP file (Using Ajax?)
Edit: You mentioned in a comment on another answer that you're using jQuery, so I've edited the below. Is this possible to do with out ajax? Yes, but you probably don't want to. You'd do it by creating a form element, setting its action, setting its method, adding fields to it, and submiting it: var form; form = $("<form>") .attr("action", "/path/to/php/file.php") .attr("method", "POST"); $("<input type=hidden>") .attr("name", "fieldName1") // I'm assuming hardcoded field names .val(fieldValue1) // And values coming from variables .appendTo(form); $("<input type=hidden>") .attr("name", "fieldName2") .val(fieldValue2) .appendTo(form); form[0].submit(); // Note the [0], so we're using `submit` on the actual HTMLFormElement

Categories : PHP

"Hardcode" passed variables from JQuery/Javascript into a PHP file
Why not insert all values sent into a database retrieve all values in a new email.php file and run a loop that sends all reports? That sounds like a solution to me and you can cron the email.php file

Categories : PHP

JavaScript including another one
Did getScript work for you? var auto_refresh = setInterval(function(){ $('#LiveNow').fadeOut('slow'); $.getScript('http://djspinnercee.servemp3.com:32768/php-cgi/scaststatus_x.php?index=5&host=<?php echo (RADIO_ADDRESS); ?>&port=<?php echo (RADIO_PORT); ?>', function () { $('#LiveNow').fadeIn("slow"); }); }, 10000);

Categories : Javascript

Converting Java file:// URL to File(...) path, platform independent, including UNC paths
Java (at least 5 and 6, java 7 Paths solved most) has a problem with UNC and URI. Eclipse team wrapped it up here : http://wiki.eclipse.org/Eclipse/UNC_Paths From java.io.File javadocs, the UNC prefix is "////", and java.net.URI handles file:////host/path (four slashes). More details on why this happens and possible problems it causes in other URI and URL methods can be found in the list of bugs at the end of the link given above. Using these informations, Eclipse team developed org.eclipse.core.runtime.URIUtil class, which source code can probably help out when dealing with UNC paths.

Categories : Java

including multiple variables in multiple get variables
Just do as you would in a regular URL: var url = "http://example.com/example.php?a="+document.domain + "&b=" + "..." + "&c=" + "..."; It's also a good idea to properly encode your values with encodeURIComponent

Categories : Javascript

iFrame browser issue while including a JSP file inside another JSP file
In chrome and IE, you may not load http:// content inside https:// page directly unless user acknowledges it. Make sure you have SSL certificate for your https:// urls. You can check the error in chrome console.

Categories : Java

Wrong JavaScript Including
This maybe an issue caused due to wrong order of placing javascript files. Call jquery.dynatree.js first then organization.js like below. <script src='#{applicationBean.resourcePath}/admin/js/jquery.dynatree.js' type='text/javascript'></script> <script src='.../organization.js'type='text/javascript'></script> From your updated question: "sometimes" it works, but sometimes gives "'treeDiv.dynatree' is not a function" There maybe an issue caused by some other js files.

Categories : Javascript

Magento: Including a file in Easytabs template file
Right after next line <block type="catalog/product_view_tabs" name="product.info.tabs" as="info_tabs"> Please add next line of code <block type="core/template" name="my_product_finder" as="my_product_finder" template="templatedir/productfinder.phtml"/> hope this will sure help you.

Categories : Magento

EventListeners not firing (even after including JavaScript at the end)
Try this document.getElementById('testing').addEventListener('click', function(){alert("now displaying")}, false); or document.getElementById('testing').addEventListener('click',display, false);

Categories : Javascript

Including phonegap.js breaks javascript
I would have to assume that the calls you are making using the device object are causing the rest of your scripts to break. Not including the phonegap.js tag will allow the app to work because the device just skips over the device calls. Can you show more code so I can assist further?

Categories : Jquery

ASP.NET MVC 4 issues with including external javascript
Add this line instead of using your script registration, @Scripts.Render("~/bundles/jquery") @Scripts.Render("~/bundles/treeview") Note: treeview should register after the jQuery reference.

Categories : Javascript

Including CSS, Javascript with my Laravel 4 framework
Have you dumped the assets in the header anywhere?? like this... <head> {{Asset::styles();}} </head> But I think that only works with Laravel 3.... It is my understanding that assets are called differently in L4 Anyway.... I just echo them directly into my header views...Like so... echo asset('css/yourcssfile.css'); or, if you're using Blade templating.. {{asset('css/yourcssfile.css')}} Also...assuming your css folder is directly in the public folder like public/css Then the path to your image background would change to this... .banner-image{background:transparent url('../assets/images/hires_080820-F-5957S-987c.jpg') no-repeat center center;-webkit-background-size:cover;-moz-background-size:cover;background-size:cover; height:800px; min-width: 1200px;}

Categories : PHP

wordpress plugin including javascript
I would suggest using wp_localize_script instead of attempting to dynamically generate your script. This will allow you to access any variables you build in your script within the rendered javascript. For example: wp_register_script('woo_tool_js', plugins_url('tooltip.js', __FILE__) ); wp_localize_script('woo_tool_js', 'my_data', array( 'key' => 'value' )); wp_enqueue_script('woo_tool_js'); ...will allow you to access the my_data array as an object in your javascript: console.log(my_data);

Categories : Jquery

How to save variables to a file so that those variables are loaded the next time the site runs?
You can use local storage or even cookies. local storage is your best bet, although it doesn't work in older browsers. cookies are (more) limited in their capacity (4KB vs 5MB for local storage) and also are sent to the server with each request, which may not be what you want. Alternatively, you can store the state on your server (you'll need some server side scripting as well), and only store a user/gamer id in a cookie.

Categories : Javascript

Including JavaScript/jQuery Object Data in Tag
Better use an attribute like data-jquery. All data- attributes are designed to add, well, additional data (it's part of the HTML5 specification). Browsers won't complain. Just make sure to escape the code to avoid issues using escape(), then use unescape() before parsing the JSON.

Categories : Javascript

Including JavaScript Conditionally on Magento Pages
There are a dozen different ways you can do it (probably more). From what you are describing, you should probably be adding it via XML. There are specific tags in many of the XML layout files for specific pages. The layout files are in app/design/frontend/foodesign/default/layout. In this directory, make a file called local.xml if it doesn't exist. Now you need to find out the proper label for where you want your css/js to show. Some examples below: <catalog_category_default translate="label"> <!--Non-Anchor Category View--> <catalog_category_layered translate="label"> <!--Anchor Category View--> <catalog_product_view translate="label"> <!--Default Product View--> <!--Product View for Specific Types--> <PRODUCT_TYPE_simple translate="label

Categories : Magento

including javascript and jquery code in rails 3
add tweets.js in app/assets/javascripts folder and include that into the view by <% javascript_include_tag "tweets" %> See more here

Categories : Javascript

Passing around function including its context in javascript
d.c is like an unbound instance method. You can use Function.prototype.bind to create a new function that's bound to d (the first argument to .bind is the this argument): var e = d.c.bind(d); Or call e with d as the this argument: e.call(d);

Categories : Javascript

how to call a function of another file without including that file
You can't. You'll probably get a function not defined error. What you can do, and what most modern frameworks do, is use autoloading. But you need to use classes for this. On php.net: http://php.net/autoload As per usual, don't look at the code samples on php.net too much, they're bad. auto_prepend_file is another possibility. I would not recommend using this.

Categories : PHP

Are there any disadvantages to concatenating all JavaScript files (including vendor)
The main reason is to minimise the number of http requests. In a bigger project if you are using some pattern like MV* you might want to abstract each module in an external .js file. This can result in many files 30-40 for example. In that case you might want to concat then into single file. In a smaller project where you are going to have 3-4 js file, you use then without concatenation. I use requirejs to define modules as AMD and have each module in external file. Then I use requirejs build script to manage dependency and concatenated deployment file. Good tools to automate this process RequireJS GruntJS

Categories : Javascript

Javascript and Ajax - Including a calledback variable in an interval
Try changing charge = charge+<?php print $n_gr; ?>; // $n_gr = 1; to charge = (+charge)+(+<?php print $n_gr; ?>); // $n_gr = 1;

Categories : Javascript

WARNING: /%3C%=request.getContextPath()%%3E/trailpath/trailpath.nocache.js: java.lang.NumberFormatException: =r
At first sight, I'd say that you're referencing the trailing.nocache.js files from your Trail.html page using JSP syntax, but Trail.html is not evaluated as a JSP by the server (by default, only *.jsp files are treated as JSP). The NumberFormatException: =r comes from the server when evaluating the URL (%3C%=request) where it expects %=r (from %=request) to evaluate as a URL escape. The NumberFormatException thus comes from trying to parse =r as an hexadecimal number. Solution: remove the JSP syntax from your Trail.html page, or change that page to be evaluated as JSP (e.g. rename it to Trail.jsp)

Categories : Java

Is it ok to place all JS / jQuery variables at top of file? Global variables?
Global variables are scoped to the program, so if you pull in other javascript that also uses the same global variable names you will almost certainly encounter bugs. If you're writing something fairly small there's certainly nothing (technically) wrong with declaring all of your variables as global, but if you're writing something that's going to grow it might be to your benefit to use some form of module pattern to provide another level of scope to your variables and minimize the use of Globals. With a module pattern you can usually reduce your global variables down to the Module namespace, with what would normally be globals, scoped only up to the module.

Categories : File

How do I recover the full html of a page, including what is generated by javascript
You can't just do this with HttpWebRequest, all that does is download the raw HTML and non of the linked JavaScript files. It also wouldn't run the JavaScript or give you any kind of DOM to inspect. You'd really need to use WebBrowser or perhaps something like Awesomium.

Categories : C#

Sending php variables to Javascript variables
If you use $.ajax to make the submission to php you won't need to refresh the page. The code for the example on that page would look like this var javascriptVariable = "John"; $.ajax({ url: '/myphpfile.php', type: "GET", dataType: "json", data: { name: javascriptVariable, }, success: function( data ) { // do success function here }, error:function( xhr, ajaxOptions, thrownError ) { // handle errors here } }, "json");

Categories : PHP

how to obtain html page including all tags and element values using javascript
Have you tried this? alert($('html').html()); It will alert the whole HTML element except the DOCTYPE.

Categories : Javascript

Including jsp images within a jsp file
I'm not sure that you've provided enough details about the context to suggest what approach might be the most appropriate. But some options that come to mind are, instead of placing the image in a file: Use the data scheme, to include the image bytes literally. Use a custom taglib to create and include the image data.

Categories : Jsp

Why could a header file be including itself?
Yes, if you are trying to win the International Obfuscated C Code Contest. Here's a nice example (the source file is called isaak.c): main(){} #define P define #P U ifdef #P main Si #U y #undef y #include "isaak.c" Pb #else char*K="4499999;8 9+jW*':'TZhD m:*h.4-j'9(z7Q>r*:G#FS]mATIdMZY^HaKFZZ JyJw:X49@eJj1,Z'\c^jGU@IXTF@9P2i:gAZx0pD*W3\<ZZs1:.~Z8U:P<\:ZOI0GBPZ7",*H ,S[5202],*B="oA9BA6iN`]`Ph>5F4::M6A69@6I{g[Za__]NPV``aV177E4C5CG;4C<BEJG; ?LGlSZ[Y_!oYi@uXPzLFyPOYP][]`RTaQo86564CAHCG4ES",*F,N;int Bk,V;Y #endif #P C K/16-2 (){char*H;F O=-263;for(H="$+---+|||";*++H;)*(F O=(*H+5&129)+1)= *H;F #P W sprintf( O= -132;}I/**/r(){if((N= *IO/**/O%(21 O -5)+81 O 16)==107)N+= #undef I *K++&15;*F++=N;return*K;} #undef O #P I K #P O + #U N exit(N){F=WH=S,"%5060d")+385;while(Br(),

Categories : C

Wordpress not including my php file
Either of these built-in wordpress functions should work instead of a plain include: get_template_part ('progress_chart'); or include locate_template('progress_chart.php'); http://codex.wordpress.org/Function_Reference/get_template_part http://codex.wordpress.org/Function_Reference/locate_template EDIT: Use "include locate_template()" if you want progress_chart to be able to access variables from the file n which it's being included. For some reason get_template_part doesn't allow that.

Categories : PHP



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