Updates from March, 2010 Toggle Comment Threads | Keyboard Shortcuts

  • Shafiul Azam 11:44 am on March 30, 2010 Permalink | Reply
    Tags: automatically shorten my web site link, easy method to use bit.ly, how to dynamically shorten my links, how to short any link of my site, how to shorten a dynamic link of my site, how to shorten my links by javascript, how to shorten my website easily, how to use bit.ly by ajax, how to use bit.ly by javascript, how to use bit.ly in my site   

    Auto Shorten dynamic URL by javascript 

    Live Demo

    Thinking of using bit.ly Url Shortening service in your site? You can use a simple javascript code in any page of your site, specially if it is a dynamic page. For example, look at a dynamic page of my online code compiling site:

    The link of a dynamic page is somewhat this: http://shafiul.progmaatic.com/hostcode/compiled.php?i=wRZWM&c=252&ext=11

    The link is too long. So, I automatically shortened the links, and gifted it to the viewers! ;)

    how to use bit.ly in your site

    How to use bit.ly service in your site

    First, you need an account on http://bit.ly. To create one, go to the site and register.

    Once you’ve registered, login and go to your Account page. There, you will find your API key.

    Now, we’ve all the resources. Let’s go to the code section

    The Code

    Between the <HEAD> and </HEAD> tag of your page, place the following code:

    	
  • <script type="text/javascript" charset="utf-8" src="http://bit.ly/javascript-api.js?version=latest&login=******&apiKey=*****************"></script>
  • Replace the first ***** by your bit.ly username and second ************** by your bit.ly API key!

    Now, place the following code anywhere of your page. It is nothing but a text-input field, where shortened link will be placed. You can use anything instead of a text area, perhaps a <div>tag to display the shortened link!

    <h3>Link to this page</h3><br>
    Use this link to tell others about this page! <input onclick = "this.select()" type = 'text' id = "qlink" style = "width:100%;">
    
    <br><br>
    
    

    Now, the final task. Place the following code just before </BODY> the tag of you page:

    <script>
    	// Bit.ly API
    	BitlyCB.shortenResponse = function(data) {
    			var sss = '';
    			var first_result;
    			// Results are keyed by longUrl, so we need to grab the first one.
    			for     (var r in data.results) {
    					first_result = data.results[r]; break;
    			}
    			sss = first_result["shortUrl"].toString();
    			document.getElementById("qlink").value = sss;
    	}
    	BitlyClient.shorten(window.location, 'BitlyCB.shortenResponse');
    </script>
    
    

    Yeah, you’re done! Now anyone entering the page with any query string, the link of the page with the query string will be automatically shortened :D

     
    • Ali 11:59 am on December 15, 2010 Permalink | Reply

      Nice Article,

      Is this only for one URL or we can use multiple, if we want multiple then do we have to code like this for each URL?

      Thanks

      • Shafiul Azam 7:15 pm on December 15, 2010 Permalink | Reply

        This works for multiple urls – the code automatically detects the page’s url and shortens it.

    • Shafiul Azam 1:41 pm on December 27, 2010 Permalink | Reply

      Code for the broke.

      
      
  • Shafiul Azam 10:41 pm on March 5, 2010 Permalink | Reply
    Tags: 64 districts of bangladesh, add Bangladesh districts in my site, adding all districts of bangladesh, all zilla of bangladesh, জাভাস্ক্রিপ্ট, বাংলাদেশ, বাংলাদেশের জেলা চয়নকারী, বাংলাদেশের সকল জেলা, বাংলাদেশের ৬৪ জেলা, bangladesh district, bangladesh district by javascript, Choose bangladeshi district, choose district by javascript, choose visitors district, how to dynamically insert all districts of bangladesh, insert all districts of bangladesh,   

    Insert All 64 Districts of Bangladesh By JavaScript 

    Want to add all 64 Districts of Bangladesh by JavaScript in your web page?

    Perhaps you need to place a Choise box (<select> element) on your webpage, where a Bangladeshi can choose his/her district.

    You’ll be happy, I’ve coded it. Enjoy

    The Code

    The code is pretty self explanatory, view live or download from here. If you have questions, or can’t understand how to use it, you’re always welcome to ask me by commenting.

    Others

    How to add all Country & State list by javascript

     
  • Shafiul Azam 10:16 pm on March 5, 2010 Permalink | Reply
    Tags: how to automatically set id to text area, how to dynamically set id, how to loop through all text elements, how to set id, , javascript get element by tag name, javascript get id, javascript set dynamic id, javascript set id   

    JavaScript: How to set ID Attribute to all text inputs/textarea of a page 

    Well, sometimes we need to use ID Attributes of some HTML Elements of a web page. But, if any element lacks ID attribute, we’ll face trouble. So here is a script to automatically set IDs to all of your text <input type = “text”> tags and <textarea> Elements ;)

    Tasks:

    First we’ll check if the element already has an ID attribute [i.e <input type = "text" id = "myId">]

    If it does has an ID, we will not change it. Else, we will set an ID dynamically to the content.

    What we actually do?

    • Loop through all input elements
    • Check if it is a text field. If yes, we check if it already have an ID
    • If yes, continue. Else, dynamically set an iD

    The Code

    Here goes the code snippet, enjoy :)

     
  • Shafiul Azam 8:16 pm on February 28, 2010 Permalink | Reply
    Tags: greasemonkey on opera, how to install greasemonkey script in opera, how to run javascript on opera, opera greasemonkey support, user javascript on opera, user script on opera   

    How to install Greasemonkey (User javascripts) In Opera 

    Please note that not all Greasemonkey scripts run on Opera. However, most of them works just fine :)

    These scripts are called User JavaScripts on Opera.

    How to install an User JavaScript:

    Step 1

    Create a folder any where in your computer. Name it as you like (exapmle: MyOperaScript).

    Step 2

    Copy user script file on that folder.

    Step 3

    Launch Opera. Then Go to:

     Tools > Preferences  > Advanced > Content>JavaScript Option

    select the folder created in step 1.

    Click “OK” and exit preference window.

    Opera Greasemonkey Support

    That’s so simple! :D

     
    • Eric 11:11 am on July 6, 2010 Permalink | Reply

      http://files.myopera.com/c69/blog/how-to-enable-user-javascript-in-opera.png

      bigger picture

  • Shafiul Azam 9:40 am on January 20, 2010 Permalink | Reply
    Tags: cheet sheet, cheetsheet, CSS, CSS2, CSS3, HTML, HTML5, , JQuery, manual, quick reference, Web Development, web development quick reference, XHTML   

    Quick Reference & Cheet Sheet for HTML5 XHTML HTML CSS3 CSS JQuery JavaScript & more 

    These Quick Reference sheets can be quite helpful to be used as a web development tookit. Thanks to webdesignledger for helping out with the cheet sheets :)

    HTML 5 Quick Reference Guide

    XHTML Reference Guide

    HTML 5 Visual Cheet Sheet

    HTML 5 Canvas Quick Reference Guide

    HTML Reference Guide

    CSS 2 Quick Reference

    CSS Quick Guide

    CSS3 Cheet Sheet

    JavaScript Cheet Sheet

    JQuery 1.4 Quick Reference

    JQuery Cheet Sheet

    View Live or download PDF for offline use!

    Thanks to:

    addedbytes.com/

    webdesignledger.com/

    woorkup.com

     
    • Alex 2:40 am on May 29, 2010 Permalink | Reply

      That’s exactly what I needed thank you! Will come in great handy with my web developing ;)

c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
l
go to login
h
show/hide help
shift + esc
cancel
Follow

Get every new post delivered to your Inbox.