Showing posts with label javascript. Show all posts
Showing posts with label javascript. Show all posts

Wednesday, October 19, 2011

Include MTG autocard popup in websites for non .blogspot domains


Some months ago we explained how to include MTG autocard popup by including directly our script from Google Sites. This mode is actually used by some MTG sites like Magic no MolaThought Experiment or MTG Fiction.

Unfortunately, scripts hosted in Google Sites can be included directly in your website only if you're using Blogger or other Google's tools, for the other sites, the direct access it's protected. So if you've tried to include the script and no popups appeared, this is your post.

To have those great popups into your non-blogger site, you need to include the autocard script and gatherer helper, so download them and upload them into your server. You will need to change the reference to gatherer helper in autocard script, just in this line (48):



var GATHERER_HELPER = "https://sites.google.com/site/themunsonsapps/mtg/gatherer_helper.js";

Other way is to download the Standalone script, that doesn't need reference changes but won't be updated (you can perfectly do it).
If you don't have a server to host javascripts, you can use free javascript hosting services like Your Javascript, which allows you to host and free access to it. So to replace the bold url with your hosted script or just leave it like this, it will work even in no blogger servers:


<script type="text/javascript">
     URL_START = "http://xxxx.com"; 
</script>    

<script src="http://yourjavascript.com/31200217801/autocard_standalone.js" type="text/javascript">
  
</script>

For the linking rules, follow the lines described on the old post.

Continue reading »

Saturday, April 23, 2011

Blogging tips: Open all external links in a new page

I posted some days ago about opening all links in your website in a new tab or window by default (old post here). The problem of that solution is that all internal links are opened in a new tab, even the "home" button. This is so disgusting for the users of your website.

Here there is a solution to open all external links in a new tab or window (if the target is a tab or a window depends on the browser). Include this lines into your website and the job is done:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript">
//<![CDATA[
jQuery('a').each(function() {
    // Let's make external links open in a new window.
    var href = jQuery(this).attr('href');
    
    if (typeof href != 'undefined' && href != "" && (href.indexOf('http://') != -1 || href.indexOf('https://') != -1) && href.indexOf(window.location.hostname) == -1) {
        jQuery(this).attr("target", "_blank");
    }
});
//]]>
</script>

If you are using blogger, you can include this by inserting it before the </body> tag (Dashboard -> Template -> Edit HTML, search the </body> with Ctrl+F and insert it before the tag closes. Remember to save always a backup of the HTML before change it) or inserting in a HTML/Javascript widget element.

With this feature, all links other than adSense and your domain, will open in a new tab (if you're using blogger, all links to other blogger sites won't be affected and will open with the default properties).


Source: Challenges that each developer faces every day
Continue reading »

Monday, January 24, 2011

MTG Finder 0.3

The new version of MTG Finder Chrome Extension has been released, the features are listed below:
  • Added options page to switch between magiccards.info and wizards search. While the magiccards.info search does a full access to the website (here you can also see the rulings, prices and more), wizards search displays only the card image (screenshot 2).
  • Wizards search works only for english card names.
  • Fixed a problem with the queries of card names with apostrophes.
  • Added Google analytics support


Continue reading »

Tuesday, November 16, 2010

MTG Finder 0.2

The first application presented in the blog is about Magic the Gathering (mtg), a famous trading card game.

If you have heard something about mtg, you will know that in there are thousands and thousands of different cards, is practically impossible to know all of them, the pictures, the formats where it's allowed, the artists, the updated text and a lot of another features.

Actually, there are some websites hosting databases with all the cards (such as magiccards.info), but if you are reading an article related you should open a new tab or window and do the query into the website. This is very uncomfortable, at least for me.

MTG Finder is a Chrome Extension done to find magic cards in magiccards.info and show them same window that you are looking without opening new tabs, windows or typing long words, you need only to select the card name and click the extension icon.

Figure that you are viewing a magic website that names a card that you've never seen before, named for exmple, "Ancient Ziggurat". As we can see in the Figure below, we only need to select it and click the button of the extension. A popup with the content of the magiccards.inf query appears and show us the desired card.

MTG Finder looking for Ancient Ziggurat
This Chrome Extension is available and downloadable for free on the Google Chrome Extensions website: MTG magic single cards finder.

I'm working on the options panel and keyboard shortcuts to do more accessible the query. If you try it and think that you need some feature, all your comments and suggestions for improvements are welcome.
Continue reading »