external

jquery: how to include other .js-files into .js

江枫思渺然 提交于 2019-11-29 05:43:01
问题 Is there any jquery plugin (instead of incldeMany) or simple function to include js-files on demand ? for example: $.include('myscript.js'); ? 回答1: How about jQuery.getScript()? It's built in to jQuery and works like so: $.getScript('ajax/test.js', function() { alert('Load was performed.'); }); 回答2: Not exactly a jQuery plugin, but you might try looking into RequireJS. Especially the "How to use RequireJS with jQuery" section. I don't have much experience with this solution yet, but from what

Java - Android - Split Activity/Class into multiple files for better organization (solution)

允我心安 提交于 2019-11-29 04:04:01
I'm not PRO in JAVA , but I found myself of getting crazy with Android activities getting too large. After a few pages of code length I found myself of permanently scrolling back and forth! Not only OnClickhandlers can grow huge, just a lot of code tends to sum up in a bigger activity. Fragments were no solution for me. In general Java does not allow to split up a class into several files so a hack is needed. I browsed through a lot of stackoverflow threads regarding that, not one had a solution. I solved it anyway, maybe this helps others. This is a bit Android focused as I got anoyed by my

read file from external storage

感情迁移 提交于 2019-11-29 02:04:36
I simply cannot find how to get one specified file from the external storage. I know that with getExternalStoragePublicDirectory(), you get the external storage directory but I can't get further. I need some kind of method where you have to give the name of the file and it returns the file. Thanx Better than using File.separator is this, which is standard Java: final File file = new File(Environment.getExternalStorageDirectory() .getAbsolutePath(), filename); You can just do this: File f = new File(Environment.getExternalStorageDirectory() .getAbsolutePath() + File.separator + fileName);

Receive POST from External Form

十年热恋 提交于 2019-11-29 01:36:12
问题 I have a form on another website (using a different backend) that I want to be able to POST to my Rails application (on a different domain). How do I generate a valid authenticity token for the external form so that my Rails app will accept it? Assuming I can do the answer to the above question--is there anything else special I need to do to make this work? Apart from the authenticity token, the rest of it seems pretty straightforward to me... Thanks for the help! 回答1: You can't generate an

grails / external configuration / grails.config.locations - absolute path file “Does not exist”?

五迷三道 提交于 2019-11-28 20:54:38
I'm trying to use Grails' built-in mechanism for loading external configuration files (*.groovy and *.properties) outside the deployed WAR file. The documentation implies this is just a case of setting grails.config.locations with the appropriate classpath: or file: paths. I've configured Config.groovy with: String externalConfigLocation = System.getProperty("SYSTEM_PROPERTY_KEY") if (!grails.config.locations || !(grails.config.locations instanceof List)) { grails.config.locations = [] } if (classpathExternalConfigLocation) { String pathToResource = "\"file:${basedir}" + File.separator +

How to know if browser tab is already open using Javascript?

混江龙づ霸主 提交于 2019-11-28 19:39:48
How to know or check if the two browser tab is already open and if those tab are open, the user will receive an alert box or msg box saying that 'the url is already open', something like that, in pure/native JavaScript? This browser tab is contain an external website which is I don't have any privileges to manipulate or change it. Thanks Example URLs yahoo.com and google.com I want to alert the user if there's already open tab for yahoo.com and google.com And I want to use tabCreate to open the url like this: tabCreate("http://maps.google.com/", "tabMapsPermanentAddress"); mean to open a new

External JavaScript file is not getting added when running on Flask

眉间皱痕 提交于 2019-11-28 19:34:01
问题 I have an HTML file named showMap.html : <!DOCTYPE html> <html> <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <title>Map</title> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"> </script> <script type="text/javascript" src="js/map.js"></script> </head> <body onload="showPosition()"> <div id="map_canvas" style="width:500px;height:500px;"></div> </body> <

Javascript and WebGL, external scripts

。_饼干妹妹 提交于 2019-11-28 18:18:08
Just curious; How do I place my webgl shaders, in an external file? Currently I'm having; <script id="shader-fs" type="x-shader/x-fragment"> #ifdef GL_ES precision highp float; #endif void main(void) { gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0); } </script> <script id="shader-vs" type="x-shader/x-vertex"> attribute vec3 aVertexPosition; uniform mat4 uMVMatrix; uniform mat4 uPMatrix; void main(void) { gl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0); } </script> In my html header, how do I link in this from an external file? - I tried the usual javascript approach; <script type=

Loading external script with jinja2 template directive

孤街浪徒 提交于 2019-11-28 17:17:06
I'm very new to jinja2 and the use of templates in general so I was wondering if there's an easy way to load an external javascript. I was thinking of using: {% block javascript %} <script src="myscript.js"></script> {% endblock %} But I can't help to ask: Is there a way of loading this script directly from within a template directive? Sean Vieira You have two choices here -- the first is the way you did it -- simply add the appropriate markup into a template (or a block if you want to be able to override it in templates which extend your first template.) The second way is to use Jinja2's

Using $compile on external template (templateURL) in Angular directive

旧巷老猫 提交于 2019-11-28 16:49:21
I've got a recursive Angular directive that uses a template variable and gets compiled in the link function. Problem is, that my template has gotten really long and out of control and I want to externalize it in an external HTML file (it would also make it easier for example to auto-indent). How can you load an external template into a directive that can be used inside the $compile ? I've seen templateURL , but that doesn't let me name the variable and pass it to the $compile function. var template = "<p>My template</p>"+ "<this-directive val='pass-value'></this-directive>"; return { scope: {