Articles by "Blogger Tricks"
Showing posts with label Blogger Tricks. Show all posts
Find latest Tips and Tricks, Blogger Widgets, Videos, Online News Channels, News Papers, Poetry, Watch Online Dramas and much more that you need....

Today I have come with a new recipe on behalf of jQuery community to teach blogger templates, widgets developers a new lesson. Here is how to keep templates or widgets footer credit not removable so that users must have to give credits to original developers. If you’re a blogger template developer, widget or plugin developer then you must need to know this trick how exactly URLs redirect automatically if credited links are removed. I think it will be very interesting article to you all specially newbie will learn an effective lesson from here.
Note: If you’re an expart jQuery developer and have great experience on jQuery then please don’t forget to share yours.

Writing Our Target Scripts?

First of all we will write following code
<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.0.min.js"></script><script type="text/javascript">//<![CDATA[$(document).ready(function(){if($("#mycredit").attr("href")!="<b>http://mthpakistan.blogspot.com/</b>"){window.location.href="<b>http://mthpakistan.com</b>";}});//]]></script> <p>Copyright &#169; by I'm Big Deals 2014. All rights reserved. Designed By <a href='<b>http://mthpakistan.blogspot.com/</b>' id='mycredit'>I'm Big Deals</a></p>
Explanations:
This is a simple jQuery function which will only run once the page Document Object Model (DOM) is ready for JavaScript code to execute. We have used a simple loop and that is for the anchor text http://mthpakistan.blogspot.com/ which is harvested under id=’mycredit’. If http://mthpakistan.blogspot.com/ is not matched under id=’mycredit’ then the script reloads the page and directs tohttp://mthpakistan.com.
The script must be embedded after jQuery embed and if the combinations are misplaced then the script will not function properly.

How to Install The Code on Blogger?

  1. First of all go to blogger.com and login your account
  2. Select any of your blogs and navigate to Template section
  3. Backup or Restore your template
  4. Now click on Edit HTML
  5. Search for </head>
  6. Now copy following code and paste right before it.

<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script type="text/javascript">
//<![CDATA[
$(document).ready(function()
{
if($("#mycredit").attr("href")!="<b>http://imbigdeals.blogspot.com/</b>")
{
window.location.href="<b>http://thewildblogger.com</b>";
}
});
//]]>
</script>
7.Again search for </body>
8. Now copy following code and paste right before </body> tag.
<div class='mycontent'> <p>Copyright &#169; by MTH Pakistan 2014. All rights reserved. Designed By <a href='<b>http://mthpakistan.blogspot.com/</b>' id='mycredit'>MTH Pakistan</a></p> </div>
Make Following Changes:
  • Change http://mthpakistan.blogspot.com/ with the blog URL you’re installing this script
  • Change http://mthpakistan.com with your target domain URL where you want to get credit
9. Finally save this template and you’re almost done

How to Make The Script More Complex So That Any Newbie Can’t Find The Code and Remove Credited URL? − [Extra Feed]

Very good question, and i like to teach you this method that how experts harvest the URL so that any newbie can’t detect the URL and remove from the template.
Suppose you have made a blogger template which includes some scripts (written by you or any third party) that run some important widgets of this template. It appears that if the scripts are removed then the entire template seams to be broken so users could never remove it if he/she wants to use the style of that template.
Now what you will need to do just elongate your script by adding the copyrights code > Write the entire code within one line > Save on a .js file > Upload on a server and use the script link on your template, which appears to be very hard for a newbie blogger user to remove the credit link.
Theories appear to be complicated? Don’t worry i will make it more understandable for your ease, read below carefully…
Suppose, I use a custom designed template which shows post summary on item pages and home page on this template to show post labels, archives, search terms etc. blogger features. I use following script to show post summary.


<script type='text/javascript'>//<![CDATA[
function removeHtmlTag(strx,chop){if(strx.indexOf("<")!=-1){var s = strx.split("<");for(var i=0;i<s.length;i++){if(s[i].indexOf(">")!=-1){s[i] = s[i].substring(s[i].indexOf(">")+1,s[i].length);}}strx = s.join("");}chop = (chop < strx.length-1) ? chop : strx.length-2;while(strx.charAt(chop-1)!=' ' && strx.indexOf(' ',chop)!=-1) chop++;strx = strx.substring(0,chop-1);return strx+'[...]';}
function createSummaryAndThumb(pID){var div = document.getElementById(pID);var imgtag = "";var img = div.getElementsByTagName("img");var summ = summary_noimg;if(img.length>=1) {imgtag = '<span style="float:left; height: 180px;  margin-right: 15px; margin-top:4px; "><img src="'+img[0].src+'" width="'+img_thumb_width+'px" height="'+img_thumb_height+'px"/></span>';summ = summary_img;}
var summary = imgtag + '<div>' + removeHtmlTag(div.innerHTML,summ) + '</div>';div.innerHTML = summary;}
//]]></script>
Now i will use copyrights code within this script and it appears like this.


<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.0.min.js"></script><script type='text/javascript'>//<![CDATA[$(document).ready(function(){if($("#mycredit").attr("href")!="http://imbigdeals.blogspot.com/"){window.location.href="http://thewildblogger.com";}
});function removeHtmlTag(strx,chop){if(strx.indexOf("<")!=-1){var s = strx.split("<");for(var i=0;i<s.length;i++){if(s[i].indexOf(">")!=-1){s[i] = s[i].substring(s[i].indexOf(">")+1,s[i].length);}}strx = s.join("");}chop = (chop < strx.length-1) ? chop : strx.length-2;while(strx.charAt(chop-1)!=' ' && strx.indexOf(' ',chop)!=-1) chop++;strx = strx.substring(0,chop-1);return strx+'[...]';}
function createSummaryAndThumb(pID){var div = document.getElementById(pID);var imgtag = "";var img = div.getElementsByTagName("img");var summ = summary_noimg;if(img.length>=1) {imgtag = '<span style="float:left; height: 180px;  margin-right: 15px; margin-top:4px; "><img src="'+img[0].src+'" width="'+img_thumb_width+'px" height="'+img_thumb_height+'px"/></span>';summ = summary_img;}
var summary = imgtag + '<div>' + removeHtmlTag(div.innerHTML,summ) + '</div>';div.innerHTML = summary;}
//]]></script>
Of course yellow highlighted jQuery script must go before our target script to help it functions properly.
Now we will write the entire code within one line.


<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.0.min.js"></script><script type='text/javascript'>//<![CDATA[
$(document).ready(function(){if($("#mycredit").attr("href")!="http://imbigdeals.blogspot.com/") { window.location.href="http://thewildblogger.com"; }});function removeHtmlTag(strx,chop){if(strx.indexOf("<")!=-1){var s = strx.split("<");for(var i=0;i<s.length;i++){if(s[i].indexOf(">")!=-1){s[i] = s[i].substring(s[i].indexOf(">")+1,s[i].length);}}strx = s.join("");}chop = (chop < strx.length-1) ? chop : strx.length-2; while(strx.charAt(chop-1)!=' ' && strx.indexOf(' ',chop)!=-1) chop++;strx = strx.substring(0,chop-1);return strx+'[...]';}function createSummaryAndThumb(pID){var div = document.getElementById(pID);var imgtag = "";var img = div.getElementsByTagName("img");var summ = summary_noimg;if(img.length>=1) { imgtag = '<span style="float:left; height: 180px;  margin-right: 15px; margin-top:4px; "><img src="'+img[0].src+'" width="'+img_thumb_width+'px" height="'+img_thumb_height+'px"/></span>'; summ = summary_img; } var summary = imgtag + '<div>' + removeHtmlTag(div.innerHTML,summ) + '</div>'; div.innerHTML =summary; }
//]]></script>
Now we will save the only script without <script></script> tag on a JavaScript file and upload on any server i.e. Google Drive, Google Code or Google Appcloud


// Blogger summary tag and copyrights by thewildblogger.com
// Copyright (c) 2014 Ahmed Shawan - info@thewildblogger.com
// Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
$(document).ready(function(){if($("#mycredit").attr("href")!="http://imbigdeals.blogspot.com/") { window.location.href="http://thewildblogger.com"; }});function removeHtmlTag(strx,chop){if(strx.indexOf("<")!=-1){var s = strx.split("<");for(var i=0;i<s.length;i++){if(s[i].indexOf(">")!=-1){s[i] = s[i].substring(s[i].indexOf(">")+1,s[i].length);}}strx = s.join("");}chop = (chop < strx.length-1) ? chop : strx.length-2; while(strx.charAt(chop-1)!=' ' && strx.indexOf(' ',chop)!=-1) chop++;strx = strx.substring(0,chop-1);return strx+'[...]';}function createSummaryAndThumb(pID){var div = document.getElementById(pID);var imgtag = "";var img = div.getElementsByTagName("img");var summ = summary_noimg;if(img.length>=1) { imgtag = '<span style="float:left; height: 180px;  margin-right: 15px; margin-top:4px; "><img src="'+img[0].src+'" width="'+img_thumb_width+'px" height="'+img_thumb_height+'px"/></span>'; summ = summary_img; } var summary = imgtag + '<div>' + removeHtmlTag(div.innerHTML,summ) + '</div>'; div.innerHTML = summary; }
 Suppose that i have saved the code on Google Code and it gives me following link
https://cloudfired.googlecode.com/svn/summary.js

Now i will make it run on XML extensible format
<script src='https://cloudfired.googlecode.com/svn/summary.js' type='text/javascript'/>
 The final code will be:

<script src='http://code.jquery.com/jquery-1.11.0.min.js' type='text/javascript'/>
<script src='https://cloudfired.googlecode.com/svn/summary.js' type='text/javascript'/>
So we have again put the jQuery before our target copyright script so that it can function continuously.
Now if users can find the code and tries to remove the link then the template layout will be broken and he/she could not do so. Only experts can do it but nebies will never reach out anyway.
jQuery developers use this trick to exact out credits from their templates, gadgets and they get thousands of backlinks contiously so they get strong PR very soon.
If you have more scripts you then can fetch them all and for such case add following jQuery code right after <head> tag so it can function on all scripts
<script src='http://code.jquery.com/jquery-1.11.0.min.js' type='text/javascript'/>
If you wish you can convert single quote within JavaScript into x27 and double quote into x22 characters. So it will make the script more complex to understand the property easily.

How Did You Get The Article?

I think you have learned a good lesson from this article and now you can start getting credit backlinks to your blog or website from your templates and gadgets applying this method. But don’t add multiple links this might cause link scheme and Google checks every inbound link very carefully so once get caught Google will never let you go without taking manual spam attack on your site.
So be careful in link building and wish you all happy blogging day. Don’t forget to share this article with your friends around blogger sphere. 


?