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

liferay resource within included javascript file
I can think of two options for you. To use JSP tags and EL in a JavaScript file, you will need to serve it from a JSP. I've done this in portlets before by using the serveResource method to serve the JavaScript file. This way you can use the same portlet tags in your JavaScript JSP. In your portlet JSP <portlet:resourceURL var='portletJS' id='javascriptResourceID' /> <script type='text/javascript' src='${portletJS'></script> In your portlet's serveResource method. if (request.getResourceID == "javascriptResourceID) { //render JSP for JavaScript } The other option is to set a JavaScript variable in your portlet and then use that variable in your static JavaScript file. In your portlet JSP <script type='text/javascript'> var portletAjaxURL = '<por

Categories : Jquery

ClassNotFoundException even though the class is included in a jar file included in the buildpath
You need to add correspoinding jar to a Classpath as below for Eclipse plugins: Open you plugin.xml Goto Runtime tab Under classpath section click on "Add" and select the jar file which you have placed in folder under your project (say under lib). Now clean and build the project When you do that it will add corresponding entry to MANIFEST.MF as below: Bundle-ClassPath: lib/foobar.jar, . The way you add jars to classpath in eclipse plugins is different from ordinary java projects, since it's based on OSGi. You can learn more about classpath for eclipse plugins from this link. Hope this helps.

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

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

JavaScript Not Working When Included Elsewhere
Ah ok I think I know what the problem is. You're not adding the Javascript to the correct place. Instead of simply adding it anywhere within the module, use the following method: $document = JFactory::getDocument(); $document->addScriptDeclaration(' // your code goes here '); Assuming you have kept to the standards for Joomla modules, add this code inbetween the <?php ?> tags at the top. Hope this helps

Categories : Javascript

How prevent browser from caching XML file served by Apache? (My htaccess file is included)
I discovered the answer but I'm not sure why it's required and how to change this behavior in Apache. If I unlink (i.e. delete) the XML file first and then recreate it (instead of just writing over it), then both browsers see the fresh version! //This causes a fresh version unlink( $xmlFileLocation ); //Now creating it will result in a non-cached version being sent $f = fopen( $xmlFileLocation, "wb" ); fwrite(, $xmlFileLocation, $xml ); fclose( $xmlFileLocation ); If I do the above without unlink, then it gets changed and the modified date is updated on disk, but Apache continues to serve the old version!! Why?

Categories : Xml

If no functions included in a header file are used, does the compiler still compile this file?
Use of pre-processor directive #include for a header file with no parseable code will not increase the size of the compiled binary. Typically a header file will only usually include declarations - not definitions. So the inclusion of a C header file will not normally increase the size of the binary anyway. For example - in a header file this statement int maxlines; would create the definition of a variable which would be stored in the compiled binary file. The inclusion of the definition would increase the size of the binary. Function declarations and pre-processor tokens such as int parseFiles(const char *file); and #include MAX_LINES 80 however will not increase the program size. One effect of keeping the #include statement will be to increase the time taken to compile slightly.

Categories : C

Javascript Manipulation on included DOM element
Your tag mentioned jQuery, so I hope a jQuery solution is acceptable. A standard $("#NextSWPDate").text("whatever"); worked just fine for me. http://jsfiddle.net/pCx9K/

Categories : Javascript

Dynamically Included Javascript and Dependencies
Commendable that you are taking on such an educational project. However, you won't be able to pull it off quite the way you want to do it. The good news is: No need to know what file you are in No need to mess with eval. You actually have everything you need right there: A function reference. A callback, if you will. A rough P-code for your using function would be: function using(modules, callback) { var loadedModules = [] // This will be an ajax call to load things, several different ways to do it.. loadedModules[0] = loadModule(modules[0]); loadedModules[1] = loadModule(modules[1]); // Great, now we have all the modules // null = value for `this` callback.apply(null, loadedModules); }

Categories : Javascript

Javascript files are not included from manifest
Are you using Ruby v2.0? Try downgrading to 1.9. Symptom: The JavaScript manifest file does not compile, no errors are shown; however, a mysterious semi-colon ; appears at the end of the file after "preprocessing" the assets. Solution: Downgrade to Ruby v1.9.3! See two other posts on the same topic. My Rails Javascript manifest file doesn't compile nor include any required files Javascript manifest file "application.js" is not processed What a sorry mess it is to be programming in 2013!

Categories : Ruby On Rails

Pick an element from included PHP using Javascript
Use on and try. Not tested but that may be the problem here. Try $(document).ready(function() { $(document).on('click', '#nav ul li', function(e) { //Your code }); }); Also make sure that you included jQuery library <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>

Categories : PHP

.NET 4.5 Web Forms Included Javascript - What are these files?
This blog about the Asp.Net scriptManager may help for your issue. ASP.NET 4.5 ScriptManager Improvements in WebForms

Categories : Javascript

How to correct bind javascript/jquery to included php files
Because you are using a submit button for your live click you need to disable the form submission. There are two solutions: 1, Return false on the click event: $('#lookup_domain').live("click", function() { // all of your code return false; }) 2, add an onsubmit attribute to your form: <form action="#" method="get" class="domain_form" onsubmit="return false;"> </form>

Categories : PHP

g++: Is there a way to warn if header file is not included in file?
Not exactly answering the question, but using forward declarations and keeping includes in headers minimal might help in avoiding such problems. If you only use forward declarations in your hpp files, they would be independent from each other, and you will be forced to include specific .hpp files into each .cpp unit being compiled.

Categories : C++

my CSS moves a div to the left when using javascript .Toggle (included screen-shot)
This is happening because the div #mobilemenu-catdrop is actually beyond the width of #mobilemenu since you're using padding with 100% width. use the border-box you're using on the header with that div instead: #mobilemenu-catdrop { width: 100%; background: #1e6291; color: #FFF; padding: 10px; display: block; -webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */ -moz-box-sizing: border-box; /* Firefox, other Gecko */ box-sizing: border-box; /* Opera/IE 8+ */ }

Categories : Android

How can I check if a JS file has been included already?
Not using any framework (that I know of), you can only do so by checking if a certain variable in the global scope has already been declared. You could declare a variable var include1 = true; inside include1.js, and do something like if (window.include1 !== true) { // load file dynamically }

Categories : Javascript

PHP variable undefined in included file
When page.php is executed by the php processor, it knows nothing about the apache include - that just looks like an HTML comment to it. So it just executes the php code that it sees, and then writes out the rest as html, producing something like this: <body> <!--#include virtual="file.php" --> </body> In the next step apache, will see the #include and try to execute file.php. But at that stage the $text variable has long since gone. Since file.php is executed as a standalone file, it's obviously going to generate an error when you try to access the $text variable.

Categories : PHP

Is it possible to figure out which functions are from an included PHP file?
I think you're looking for debug_print_backtrace() From the manual: debug_print_backtrace() prints a PHP backtrace. It prints the function calls, included/required files and eval()ed stuff This might actually not be a solution, there's an interesting answer to a similar question here: that might also be of help.

Categories : PHP

Read parent URL from included file
Your examples use filesystem paths, not "URLs";I am assuming the filepath of the parent file is what you actually want. You don't need to "pass" the variable on each included page. It will automatically be available to the code on the new page. (If it is not, you may not be in the right scope: e.g., if you're inside a class or function, you'll need to pass it deliberately or use some other method - global, maybe, or even define the filename as a constant instead of a variable.) main script $parent_filename = __FILE__; // alternatively // define( 'PARENT_FILENAME',__FILE__ ); include "other-file.php"; other-file.php include "other-dir/somefile.php"; other-dir/somefile.php print $parent_filename; // alternatively // print PARENT_FILENAME; /* prints something like: /path/to/ma

Categories : PHP

Break out of loop from included file?
If I understand your question properly, it appears you want to get a result from the included file that signals what you want to do (break,continue) and then a simple switch statement to allow an inner loop to break an outer loop. The break control structure will allow you to do this. calling_file.php <?php $includes = array ('included_file1.php', 'included_file2.php', 'included_file3.php'); const CONTROL_BREAK = 3; const CONTROL_CONTINUE = 7; // declare variables that need to be accessed in included_files.php foreach($includes as $include) { print "Including $include "; $result = include($include); switch ($result){ case CONTROL_BREAK: break 2; case CONTROL_CONTINUE: default: continue 2; } } included_file1.php &l

Categories : PHP

How to use PDF.js to load file included in web app (not from "file:" URL?
node make generic outputs to the build/generic directory. This directory contains two subdirectories, "build" and "web". "build" contains "pdf.js", which is the actual PDF engine. "web" contains a viewer, similar to the one at http://mozilla.github.io/pdf.js/web/viewer.html. After copying both of those previous directories to your app, you should be able to load the PDF file using chrome.extensi/web/viewer.html?file=path%2Fto%3Ffile.pdf PDF.js does not require localStorage.It's used if available for persisting settings such as scroll position, but if unavailable, PDF.just continues to work without it. There is one significant issue though: PDF.js loads the localization files using synchronous XMLHttpRequest. This is not allowed in a Chrome app. You could solve this issue by serializing

Categories : Javascript

PHP class private variable set from different (included) file
Set them in the construct method __construct(), like this: private $languages; private $special; public function __construct() { $this->languages = $generated['languages']; $this->special = $generated['special']; }

Categories : PHP

g++ doesn't find the file included with -I argument
Add in your CMakeLists.txt (eventually in the CMakeLists.txt in the src directory) include_directories(/usr/local/lib/python2.7/dist-packages/) and of course remove it from your cmake call. If it doesn't work, please post also the CMakeLists.txt in the src directory.

Categories : Ubuntu

How to prevent an included file to generate output in PHP?
use output buffering, if the included script isnt actually generating content (like doesnt have echos etc) use below ob_start(); include("myscript.php"); ob_end_clean(); if it does generate needed content, the generated content will be in $content. ob_start(); include("myscript.php"); $content = ob_get_contents(); ob_end_clean();

Categories : PHP

In .asp, constructor does not recognize function from included .js file
Use developer tools to monitor the traffic received from the server. Verify that each and every one of your scripts is loaded without any 404 errors. Chrome Developer Tools, Firebug and Internet Explorer F12 Tools all offer this capability.

Categories : Asp Net

Cakephp AppError file under Lib folder not getting included
App/lib directory is mostly used to override all the core functionality of cakePHP (refer here), you can create a component and use it in your case. Thanks :)

Categories : PHP

Visual Studio 2012 (C++) - Use included .png file
I'm not sure that it's a good idea to store game assets in windows resource file. But if you really want to try it: Method 1. D3DXCreateTextureFromResource() and D3DXCreateTextureFromResourceEx() functions looks exactly what are you want. Use case: // suppose we have resource `IDB_SPRITE1` in resource file linked in current executable // and properly initialized g_pD3dDevice LPDIRECT3DTEXTURE9 sprite1_texture = 0; HRESULT hr = D3DXCreateTextureFromResource( g_pD3dDevice, GetModuleHandle(NULL), MAKEINTRESOURCE( SPRITE1 ), &sprite1_texture ); if(FAILED(hr)) { // there was error. Check `hr` for error description } // no errors: now you can use `sprite1_texture` Method 2. use LoadImage() function. Pass resource via MAKEINTRESOURCE macro. Get H

Categories : C++

Will b always override a when setting (a || b) in Javascript?
It's more complicated than that, but first thing to do is realize that "b" has to go first: param: b || a If "b" has a value (is not undefined) and it's not null, 0, NaN, "", or false, then the value of the "param" property will be set to the value of "b". The || operator works for situations like this so long as legitimate "good" values for "b" can't be a JavaScript "falsy" value.

Categories : Javascript

My javascript (for randomizing css3 animation delays) doesnt fire in IE 10 and Opera...Jsfiddle Included
From looking at your example in JSFiddle this error appears to be the CSS line: @keyframes bounceInDown{0%{opacity:0;transform:translateY(-2000px)}60% {opacity:1;transform:translateY(30px)}80%{transform:translateY(-10px)}100%{transform:translateY(0)}}.bounceInDown{-webkit-animation-name:bounceInDown;-moz-animation-name:bounceInDown;-o-animation-name:bounceInDown;animation-name:bounceInDown} I'd expect the above to use the non moz (animation-name instead of moz-animation-name) and webkit (animation-name instead of webkit-animation-name) prefixes. Also, what's the significance of the @-o-keyframes statement?

Categories : Javascript

How do I reference Django 1.5 URLs that are "named" in an included URL file?
Get rid of the $ in your url(r'^accounts/$', include('accounts.urls'), call. Note that the regular expressions in this example don’t have a $ (end-of-string match character) but do include a trailing slash. https://docs.djangoproject.com/en/dev/topics/http/urls/#including-other-urlconfs

Categories : Django

error "Cannot open include file", but it's not included in code
C++11 is enabled by default in VS2012. From boost headers #if !defined(BOOST_NO_0X_HDR_INITIALIZER_LIST) #include <initializer_list> #endif You may try to define BOOST_NO_0X_HDR_INITIALIZER_LIST, or find initializer_list header location. // config/suffix.hpp #if defined(BOOST_NO_INITIALIZER_LISTS) && !defined(BOOST_NO_0X_HDR_INITIALIZER_LIST) # define BOOST_NO_0X_HDR_INITIALIZER_LIST #endif // config/compilers/visualc.hpp #if _MSC_VER <= 1500 || !defined(BOOST_STRICT_CONFIG) // 1500 == VC++ 9.0 # define BOOST_NO_INITIALIZER_LISTS #endif BOOST_STRICT_CONFIG may be commented in config/user.hpp. However, it looks like you have no modern Visual C++ headers, that is strange since you have VS2012 (initializer_list header will be added in VS2010 actually).

Categories : C++

Included file outside of div, even though inside tags in the HTML code
is there css rules applied in "footer-wrapper"? try this css and see if it works... div:after { content:"."; clear:both; visibility:hidden; display:block; height:0px; }

Categories : HTML

Access smarty loop property in included file?
Basically no. But maybe you can use a mixed syntax. You add a name to the foreach and try to access its properties via {$smarty.foreach.name.property}. http://www.smarty.net/docs/en/language.variables.smarty.tpl (search for $smarty.foreach.)

Categories : PHP

C++ Invalid arguments using a function from class included from different file
EDIT: Before the OP's edit, it was impossible to tell if barcode was an integer. This answer may, therefore, be invalid: It looks like you're trying to call the function removeFromAlbum() with a type that isn't an int. Ensure that barcode is actually cast as an int.

Categories : C++

How can I pass the currently defined variables into an included file by a function
Are you sure your correctly including? And remember PHP is case sensitive: $Test = "String"; $TEst = "String"; Both completely different variables.. Furthermore, don't just echo out a variable, wrap it within in a isset condition: if (isset($greeting)){ echo $greeting; } // Will only echo if the variable has been properly set.. Or you could use: if (isset($greeting)){ echo $greeting; }else{ echo "Default Greeting"; }

Categories : PHP

TypeError: $(...) is null error for included JS file on page
Removed comments revealed that the following autocomplete files were used: http://digitarald.de/project/autocompleter/ This is not a jquery library at all, if you want to use jquery as well then you need to use noconflict for jquery. If you don't use jquery then do not include it in your page. You do need to include mootools for this to work, look at the source of this page http://digitarald.de/project/autocompleter/1-1/showcase/request-html/ And you see that javascripts included look a lot like yours but the first one is: mootools-1.2-core-nc.js My guess is that's the one your site is missing. These libraries come from here: http://digitarald.de/project/autocompleter/ and say you need mootools wich can be found here: http://mootools.net/

Categories : Javascript



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