Is there a CDN for jqGrid? - jqgrid

Anyone know if there is a CDN for jqGrid?
Thanks!

Here is CDN for JQgrid ; not min version, though.
http://www.jsdelivr.com/#!jqgrid
Once you get to the website, click on the Integration button and it will give you the JS code snippet you need to include to use the CDN.

There's none that I could find, sorry.
You could take a look here: Hosting Javascript/CSS file on CDN similar to Google hosting jQuery

You can try submitting a request to http://www.jsdelivr.com

You could always link to the raw files on the Master branch at GitHub:
CSS: https://raw.github.com/tonytomov/jqGrid/master/css/ui.jqgrid.css
JS: https://github.com/tonytomov/jqGrid/tree/master/js
CSS is a clear win, but JS would need to include each individual module. That probably erodes the benefit of sourcing the include to an external site.
[update]
I wouldn't advocate doing this anywhere outside of development. In the long run, I think tools like Grunt/Bower are going to make CDNs less essential-unless you have multi-page apps.

Related

Riot API How to get summoner profile icon image

I found out i can get Summoner Icon image using this url:
https://ddragon.leagueoflegends.com/cdn/11.14.1/img/profileicon/934.png
The basic form of this is:
https://ddragon.leagueoflegends.com/cdn/{version}/img/profileicon/{profileIconId}.png
i know i can get the second value of {profileIconId} through Riot API but how do i know when i should update the version value? I don't want my app to crash when the version should be changed.
You should not be referencing ddragon for displaying icons or images. In fact, DataDragon specifically requests that you download the archive (.tgz) for each patch/version and host the assets locally or on your own CDN.
Websites like op.gg do this for all of the assets and host the images on their own CDN. They have to update their CDN every patch. You can automate updating the CDN using scripts, but for most small projects the work to automate this process may not be worth it.
Generally, it is considered rude to piggyback off of someone else's CDN without explicit permission to do so. Riot goes a step further and explicitly asks that you do not do this.
If someone is using the data dragon (ddragon) cdn, you can know the latest version looking at this json that they provide:
https://ddragon.leagueoflegends.com/api/versions.json
Just take the first element of the array and you are good to go without any scripting.

Website store JS and CSS on client side without any framework

I am making a website in Codeigniter and not using any client side framework like angularJS. However I need some features of angularJS like downloading the JS and CSS once at the client rather than downloading it for each page. As my website content is much dependent on the server, should I use angularJS? I read that it makes tha application slower.
your question is not about angular at all!
I recommend you to read something about build systems like require, grunt, yeoman...
What you want to do is ajaxifying your website, as Stever said it's not about angular at all..
you may use RequireJS to load the script when a page need it.
For a best perfomance, use grunt for running any task like : minifying, compressing your stylesheet and so on..

How to include a html or template file into a .html file?

is it possible, or how could I make it so, I can include my topbar file into my page, I'd prefer it not to be with php since I am not hooked up with localhost yet.
Thanks for all help in advance!
HTML5 now allows you to include html files like you can already include a css file via an import. However, this would only be helpful for during your development stages and not for the final production version since the feature currently is only available in Chrome and will take time for the other browsers to adopt: http://www.html5rocks.com/en/tutorials/webcomponents/imports/
If you don't want to use PHP nor any other server-side scripting language,
you can use either <iframe> or <frameset> tags, which are deprecated, or perform an AJAX request using Javascript that embeds your HTML page dynamically. Second approach will work only if the page you're trying to attach is located within the same domain due to XSS protection in modern browsers.
It's more of a server thing, so to speak, so you would have to rely on the server more for this. Because, you cannot simply do this using static script, like HTML. There's no "built-in function" that can do this, it's not HTML's thing.
I mean, server will offer you more than one option, for example:
You can:
Use SSI (Server-side Includes) if server supports it.
Use PHP or ASP includes.
Otherwise, you can use AJAX for this, won't cost you as much as the above options.
If you mean "header" by saying "topbar", I think it's not a good idea to use iframes.
Files which are truly HTML parsed files can not include another file to my knowledge.
If you web server will parse php you could simply change the extension of the the main file to .php and include() the topbar file:
mv index.html index.php
index.php:
include_once("topbar.html");
Use <!--#include file="footer_text.html" -->
inside html page.
Plz, check below url for details.
https://www.lifewire.com/include-html-file-in-another-3469529

Javascript: achieving the Google Ad AJAX effect

I need to create a portable script to give to others to implement on their websites that will dynamically show content from my database (MySQL).
I know AJAX has a cross-site problem, but it seems that Google's ad's somehow manage the effect in a cross-browser / cross-site fashion.
Knowing that I have to give people a simple cut/paste snippet to put in their website...how can I achieve this? How did Google?
They use an <iframe>, so the ad is served from their server, and can talk to their database. I'm not actually sure that they use any sort of AJAX from their ads, though; they appear to just be mostly static content, with a few scripts for tweaking the formatting (which are optional, since they want their ads to be visible even if users have JS turned off).
Remember, you can always look into this on your own, and see what they did. On Firefox, use Firebug to explore the html, css, and scripts on a site. On WebKit based browsers (Safari, Chrome, and others), you can use the Web Inspector.
Google's ad code is loaded via a script tag that calls a remote javascript file. The AJAX restrictions that are generally enforced with xmlhttp, iframe, and similar AJAX requests don't apply when it comes to loading remote javascript files.
Once you've loaded the javascript file, you can create iframes in your page that link back to the actual hosted content on your server (and feed them any data about the current page that you wish).
jQuery has built in support for jsonp in their ajax calls. You may want to lookin in to using that if you are really needing to use ajax.
http://api.jquery.com/
http://docs.jquery.com/Ajax
You don't need iFrames and you don't need AJAX. It's really, really simple!
You pull in a remote JS file that is actually a constructed file from php/asp/whatever. In your JS file you have a document.write script that writes the content. It's that simple.
We do this all the time with media stored on separate sites. Here's an example.
YOUR SERVER: file.php (which outputs js)
<script>
document.write("I'm on a remote server");
</script>
OTHER SITE:
<script src='http://www.yourserver.com/file.php'></script>
And it will output the content generated by the script. To make the content customized you can put in script vars above the script call that will adjust what your file pulls out. From there it's pretty straightforward.
I realize this question is a year old, but I've written a library that can help with the document.write part of the problem (whether this is a TOS violation, I don't know) writeCapture.js. It's pretty simple:
$('#ads').writeCapture().html('<script src="whatever-your-adsense-code-is"> </script>');
The example uses jQuery, but you can use it standalone as well.

How to place a banner on webpage with one application to all pages of a website

How can I place a banner on webpage with one application to all pages of a website?
One way of doing this is to put your banner into a file, then include that one on each of your other pages. This way, you only have to change the code in one place to update the banner site-wide.
So, a PHP example would be:
banner.inc.php:
<?php
// echo out banner here...
?>
Then, on your other pages:
include("banner.inc.php");
You can just create a header file that you include in all your pages, and include the banner code in it. The solution is pretty much the same in all languages. If your host allows server-side includes, you can even do exact same thing with (nearly) pure HTML. You can also do it with JavaScript pretty easily.
Do you have a global template for all your pages? Something where the basic structure of all your pages is defined while the specific stuff is filled into parts of the body? If you had something like this you could modify the global template to have the banner you want and it would show on all your pages.
Google "html templating" for more.
I recommend using master pages. That way if you have something that has to be changed globally across the project you only have to change it in one place. And they are really simple to use.
If your web server is IIS, and you know a smidge of CSS you can do this without perl, without touching any other files, but at the cost of some performance.
IIS allows you to insert an HTML snippet into anything served:
http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/e27f918e-89a9-45a8-8604-2ad2ded09d64.mspx?mfr=true
If said footer file, had CSS which shoved it to the top, then you would get the behavior you are looking for.
Please note, that this is NOT an ideal solution, but it is a quick and dirty patch until you can go back and retrofit all of your pages with a master page or something similar.
If it really should be on every page of your site, I'd argue that it's part of the site design rather than the content itself. In this case, you are easily justified in setting a background-image in your css. Of course, you probably then still have to have some sort of place-holder element in your html, but at least you could update the whole site together.
Well, hopefully you would have designed the website so that if you need to change something globally, you can just edit a header or footer file.
If not, I would use Perl to go through all the files, and do a search and replace.

Resources