Expandable Section in your Post on Blogger

Did you ever wanted to have sections inside your post body which is optional for the reader to read or see ?

In some cases you might feel need for a section of your article to be hidden and only visible when the readers wants it to be. But in basic option we get in Blogger or any other WYSIWG editor this is not possible. But wait, it doesn't mean it can't be done.

Before you proceed to the tutorial, check this demo :
Expandable Section Demo

There's nothing special, it just a hide/show box inside which you can put content of your choice. It's not something that everyone might need for their blog posts but when you need it isn't easy to find easy-to-follow instruction on the Internet so I decided to create such a box and put up its instructions for blogger.

Let's start

This tutorial requires you to work with codes, here work means just copying-pasting and editing some parts of the code. So it will be easier for you to work if you open a plain text editor like Notepad.

Including the jQuery Library

This step is optional, you might not need to perform this step if your template already has a jQuery library included. If you are using a custom designed template, as your web dev. if they've already added it. If not you may continue with the steps

  1. Go to your Blogger Dashboard -> Template -> Edit HTML
  2. When inside the code box press CTRL+F to open a search box
  3. Search for </head> in the template
  4. Once you find it in the template, paste the following code immediately above </head>
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>

That is how you add jQuery to your blog.
Always remember to add the jQuery script code above any script (including the one I am going to provide for this widget) in the template depends on jQuery.

JavaScript/jQuery Code

The first thing you will add in the template to make our expandable section work is the code that handles it hiding and showing. It's a small jQuery dependent JavaScript code. Following is the code you need :

<script type='text/javascript'>
$(document).ready(function(){
$(".sh-section-btn").on("click",function(){
$(this).parent().children(".h-section-cont").slideToggle(200);
});
});
</script>

The code above simply tells the browser to show hidden content if the "show" button is clicked, and if the content box is already visible it simply hides.

To apply this code go to the Blogger Dashboard -> Template -> Edit HTML -> Use CTRL+F to find </body> and paste the JavaScript code immediately above/before it and save.

Adding the CSS

The event handling part is done. Now let's style our expendable box so that it looks good and the reader notices it.  Here's the CSS that styles the complete box.

/* Expandable Box CSS */

.hidden-section-container {
background-color:rgba(187, 187, 187, 0.93);
box-shadow:0 2px 10px rgba(0,0,0,0.2);
}

.sh-section-btn {
font-size:18px;
color:#fff;
text-shadow:1px 1px 0px rgba(0,0,0,0.2);
padding:5px 10px;
cursor:pointer;
}

.h-section-cont {
padding:10px 10px;
background-color:#eee;
display:none;
}

If you aren't sure how to add this CSS to your Blog, check my tutorial on adding CSS in blogger.

HTML for the box

After we've got the two main things for this box we can now actually use it in our blog posts. Using it is simple. The HTML for box may contain your text or any other content you want inside it. But before we add the content let's see what's the basic HTML for this box.

<div class='hidden-section-container'>
<div class='sh-section-btn'><span>Show</span></div>
<div class='h-section-cont shw-box'>
<!-- All your text/html below this -->

<p>All your content here</p>

<!-- All your text/html above this -->
</div>
</div>

You don't need to make much changes to this. All you need to change is the title and the content. Let's see how you will do it :

  1. Title Text - This is the text that will appear as the title of that expandable box. See the second line of the code. Change the text "Show" to anything you want as the title.
  2. Content - After the line 4 you can add anything possible with HTML inside the hidden box. Add text, images, links etc. using its HTML markup.
Once your HTML for the expandable box is ready you are all set to put it in your post body. But you can't simply paste HTML code in your post editor. In order to prevent the HTML from being shown just as plain text you will first need to switch to the HTML mode in the post editor. 

Open your Post Editor, now select the HTML tab next to the 'Compose' tab to switch to HTML mode. Now you can paste your code anywhere you want the box to appear.

This is how simple it is to get such cool features in Blogger. If you face any difficulty while implementing this widget feel free to comment here or email me for help.

Creativeness with Box-Shadow CSS Property

Web technologies like HTML and CSS have come a long way and now it is now used more than just creating simple web pages.
Almost every site you see on the web is writing in HTML and styled with CSS and those languages are way very simple than complex languages like ActionScript or C++, but despite of its simplicity it can be used to create masterpiece.

Following two examples shows what todays web technologies can be used for. What we really showcase here is the use of box-shadow CSS property which is usually used to create shadows on HTML elements <-- Just like on this.

The people who wrote the property's specification may have never thought what it can be used to create. Let's take a look at the amazing.

Mona Lisa in Pure CSS

One of the most discussed and popular portrait now re-created in CSS. CSS as you know is the styling language of the web, the thing using which you  make your website fancy :)
See it in action!

Mona Lisa Painting Recreated in CSS3's Box-Shadow
Now one may think why this is so special, a little experienced Photoshop guy can make that in minutes but note that this is done using a CSS property called box-shadow , the designer who created this wrote each and every pixel of the complete photo to produce this.
Da Vinci would have loved this..

Unicode Person Pixel Art in Box-Shadow

How about something simple ? As being a 90's gamer I always had a love for pixel arts and this caught my example:

Unicode Person Example

This simple image of a cute face raising hands is also created with the same technology that was used to create the 'Mona Lisa' example. And do I need to repeat it ? It's created in box shadow!



Now if you are wondering why this guy is so excited about images created in box-shadow then read about it here and you will understand why : https://developer.mozilla.org/en-US/docs/Web/CSS/box-shadow 

Confirming Facebook Group Membership Request At Once

If you have a popular Facebook group where you receive hundreds of membership requests then it becomes a tough job to accept all of them one by one.

You may already know about the "Select All Friends" code using which you can select all your friends to invite them to a Facebook event. We covered that topic in this post:
http://www.stramaxon.com/2012/02/how-to-select-all-friends-at-once-to.html

Facebook now provides a new "Add All" function for confirming all group membership requests at once, so there's no need to use this trick/code.

I wanted to post less on Facebook's topic but as you know it's a hot topic so one in a month is not a big problem.

Anyways, let's get back to the main topic, how would you accept multiple group requests at once. Actually you can disable the approval system for group request but that will enable everyone to join the group, fake and spam profiles too. Such profiles don't target groups with approval system turned-on.

How do you do that ?

The trick is to manipulate clicks on selected buttons using JavaScript. JavaScript is webpage scripting language and you can manipulated static pages by running scripts.
But to run the script you have to open the Developer Tools in your browser, it's not present in old and even some new browsers. I recommend Chrome, Safari or Mozilla - the latest version.

Code

Update: Facebook recently changed the layout of it's group membership request page, so the old code stopped working. I have updated the code which works with the current site. Thanks to A Suzy Meow for informing us about this change.

Copy this small code :

javascript:var cont = document.getElementById('Group_member_request_pagelet');
var ul = cont.childNodes[0];
var li = ul.getElementsByTagName('li'); // iterate on this

for (var i = 0; i < li.length; i++) {
var btnCont = li[i].getElementsByClassName('rfloat');
var ancHors = btnCont[0].getElementsByTagName('a');
ancHors[0].click(); // make the click
}

The code tells the browser click on the "Add" button next to each item (membership request item) in the list.


How to use the code?

For a person not familiar with scripting consoles, it might be tough for them to run the code. I wrote a step-by-step tutorial to make it easy for you :
  1. Open the membership request page of the group in a modern web browser (Chrome, Firefox or Safari)
  2. To open script console on different browsers :
    • Google Chrome - press CTRL+SHIFT+J
    • Mozilla Firefox - press CTRL+SHIFT+K
    • Apple Safari - press CTRL + ALT + I and when the developer tools appear, press ESC or click "Show Console" button to bring up the Console window


    • If you still didn't understand how to use the console, this article has more for you to learn and understand how to use Developer Tools Console.
  3. Once you have opened the Console in your browser, paste the JavaScript code (provided above) and hit enter. When you paste the code inside the console it would look like this (The code you must enter is not the same as shown in the picture) : 


  4. Just hit enter and the code will start doing it's job. It will automatically click on every "Confirm" button one-by-one on the group membership approval page until the number of buttons becomes 0. 
This was it, this small block of code can save you a lot of clicks and time. That's what code are for, to make the users life easier.  But depending on the number of request it may take some time to complete its job, leave the page opened and it will keep doing its job.

This code is very similar to the code to select multiple friends at once for Facebook events but with a little modification it works like a charm on  membership confirmation.

For any queries use the comment form below :) And thanks for reading.

Why Get A Flash Free Website

Some years back, flash-based websites were a trend as web technologies were not capable of creating interactive designs so it was the only choice. But should you design your business site in Flash ?


When the web was relatively new and HTML was just used to create simple text documents then site owners had no other option to create an interactive web page so they used Flash but today when HTML5 is even capable of creating games site owners yet get Flash based sites for their business or hobby even after paying hundreds of Dollars.

But today there are many disadvantages of a flash based website especially if it's a business site. So when you hire a web designer the first thing you must make sure is if he's not doing it in Flash, and if his plans go for Flash-based site, say no to him and find a better web designer, often web design companies provide poor designs and services (not always) so make sure to check their portfolio and check if they use the new standards, you can do that by comparing some professional sites like CSS-tricks, SmashingMagazine etc. they uses some of the latest web technologies to design and develop their site.

It's often good if you hire a freelance web designer but check their portfolio too before giving them the work and money.

We were talking about disadvantages of Flash, yup, it can be really harmful to your sites in terms of search rankings and page performance. Following are some of the reason you must never get your business site created in Flash.

Not Search Engine Friendly

Flash content is not text and a search engine can just read text. So if you have your important text content in flash search engines won't be able to read it and rank your pages according to it. It's a total loss to get your website in Flash when you are trying to make it popular.

Not User Friendly too!

Flash player is not inbuilt in browser, an additional plugin is required to view flash content and when you have your complete site made in flash, an user without the plugin won't be able to see the website at all. And even if you prompt the visitor to install Flash plugin, 90% won't do it.

It does make beautiful animation but also makes the user's PC slow and sometimes lags which is not too beautiful. But today with HTML5, jQuery and CSS3 cool animations are possible without any extra plugin but with small lines of codes which is user friendly too.

Now People are used to Flash free sites

Yup, that's true, even when I am searching for something online and click on a link that leads me to a flash-based website I just feel it's better to leave the site. Not only me but most of the online traffic are a victim of Flash-phobia and that can affect your business.

Waste of Money

If you pay even $10 for a Flash website it's too much for that! One can create a flash based site with little knowledge of web languages as Flash objects are created with a tool called Adobe Flash Maker and the designer don't even have to write a single line of code to design the site body whereas designers who design sites in new web technologies writes 10s of thousands codes to make a site effective.

The Decision is Yours

We tried our best to explain your why you shouldn't pay for a Flash-based site for your business and also tried to mention their disadvantages here. Because when you are paying you must get the best, not just anything.

But the final decision depends on you and what you want. Anyways, thanks for reading, 


Google Trolls their users on April Fools day 2013

Google the Internet giant surprised their user with the launch of a product called "Google Nose". It offers the user to small what they search for but there's more for your surprise. 

Ever wanted to smell something online ? Smelling is Believing. That's the tag line of Google Nose, first when I visited the product page of Google Nose, I almost believed it's true but yet I had some doubts because the day was not an ordinary day.

Here's the page where you can try Google Nose (beta) https://www.google.com/intl/en/landing/nose/

And click the "Try Google Nose" button to try the new search feature and on the right side of the page click on smell, a dialog box may appear just click enter and you might get the smell of the thing you searched for. Isn't it awesome ? You can smell a perfume online before buying it, that's what it's made for !

But wait, did it worked ? No ? Ohh, too bad but wait, check their help page https://www.google.com/intl/en/landing/nose/help.html 


Update: Have you tried Google Maps in treasure mode ? Try it now https://maps.google.com/maps?t=8

April Fool! When Google trolls, they do it in their own way, haha.

But wait, there's more Google got for you, they won't stop now. Stay alerted this April Fools' day.



Have a great day!

Getting a Blog Address Already Taken but not Used

You all know Blogger is a free service and you need to pay nothing to get a free blog with your own unique blog address (with a .blogspot.com prefix) but not everyone's not that lucky to get their favourite blog address.
Blog address i s not a major issue but yet people badly wants their desired address for their blog. If you were not able to get a blog address because it's already taken but not used by the current owner, it's obvious to get frustrated. You want that address but you can't get it just because someone else owns it and they don't even write anything on it.

Contact the blog owner

Blogger don't delete a blog even it haven't been updated since 10 years , blogger doesn't delete a blog for inactivity. But don't lose hope you there are still chances to get the desired address. If you can find contact information on their blog, blogger profile or any other social networking site and if he/she is a friendly person you can ask him/her to transfer the blog address to your account.

But why transfer, Can't he just delete it and then I can create the blog with that address ? No! Don't do it or you will have to wait 3 months or more to get that blog address. When you delete a blog on blogger, it isn't deleted instantaneously, the user have 90 days to undelete it. So the blog address doesn't become available before 90 daysr. Read more here :
http://www.stramaxon.com/2012/07/blog-removed-url-not-available-blogger.html

And to learn how to transfer blogs between two accounts read this
http://www.stramaxon.com/2012/03/transfer-blog-from-one-account-to.html
http://support.google.com/blogger/bin/answer.py?hl=en&answer=41448

Can't contact the owner?

If there's no way to contact the blog owner you have less chances to get that blog address. Many people on Blogger Help Forum request Blogger to get them their desired blog address even if it's being used for an other blog, but blogger can't do it. Blogger can't harass owner for the blog address.

What should I do now?

I believe a blog address doesn't matter that much for a blog. You couldn't get a neat blog address like
flower.blogspot.com try something different like my-flower.blogspot.com there's no advantage or disadvantage in using any of those blog address, what readers really want is content. Read this
http://blogging.nitecruzr.net/2009/05/value-of-your-blog-is-based-upon.html


But if you still want a your desired blog address, consider buying a custom domain, which cost not more than $10 per year. Try GoDaddy, search for a domain from here



Or if you want a self hosted website, GoDaddy has those services too

Put your business on the Web for a buck a month!

Disable Left Click on Images in Blogger Posts

In Blogger, when someone clicks an image (added from blogger image uploader) in blog posts the image are opened in new tab.

This is the default behaviour of posted images in Blogger, it's specially designed for image lightbox but if the lightbox is disabled images are opened in new tabs, it's because the images you add in post editor are automatically wrapped in an anchor element with a link to the original image which makes the image a link to the its source.

There's no settings in Blogger Dashboard to turn this function on or off so you have do some extra work to prevent images from opening in new tab if it's clicked. There are two ways to do that.

Editing HTML of each and every post

When you upload a image in your blogger post the image is automatically wrapped inside an anchor tag to the original image file. That's the reason images you post on bloggers are clickable, if you remove the anchor tag, the image becomes unclickable.

Open your blogger post editor, upload an image in a blank post and then switch to the HTML mode (use the buttons on top left). This is what you will see :

<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhznKbe8n4NWLjdnO0F8EMr_7a_cp173eTGSBxCaQqonuuqjAVEft16uWcw1iOno4VX-nTT8QZI3EZJu5rpdVOICse55G_hlrOFkdx17VATGfadfSuKSU7V4MqHsWT-bhyphenhypheneQMKL0NpwMcAl/s1600/301804_419266174773556_195336197166556_1276547_1117941733_n.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;">
<img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhznKbe8n4NWLjdnO0F8EMr_7a_cp173eTGSBxCaQqonuuqjAVEft16uWcw1iOno4VX-nTT8QZI3EZJu5rpdVOICse55G_hlrOFkdx17VATGfadfSuKSU7V4MqHsWT-bhyphenhypheneQMKL0NpwMcAl/s320/301804_419266174773556_195336197166556_1276547_1117941733_n.jpg" width="286" />
</a>
</div>

Deleting those two highlighted lines (2 and 4) will do the job or in the compose mode click on the image and then the Link option on the format toolbar, it will remove the link.

But you have to do this every single time you upload an image which is a difficult and if you have hundreds of posts with thousands of images then this is going to be a boring job for you.    

The JavaScript way

With a small code of JavaScript on your blog, you can disable left click on all the images inside posts on your blog it means you don't have to edit each image to remove it's link. However this JavaScript don't remove the link from the image, it just disables left click on the images.

Adding the jQuery Library first

Note: If jQuery is already added in your template, skip this step.
Before we add the main JavaScript code, let's include the jQuery framework in the template. It's a JavaScript framework. Here's the HTML code for the jQuery framework :
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>

To add this HTML in your template go to your Blogger Dashboard -> Template -> Edit HTML -> Press CTRL+F (CMD+F on Mac) and search for <head> and paste the JavaScript/HTML immediately below it. It may then look like this
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
.....
........
Once the code is on the right place, click on Save Template and the first step is done. Now move onto the next step for the real action.

The jQuery Function Code

This small jQuery code disables left click on images (or anything else you want) inside the post body. So even if you have your images wrapped inside a clickable anchor link, and even if you click it, nothing will happen.
<script type='text/javascript'>
$(document).ready(function(){
$('.post-body a img:not(.clickEnabled)').click(function(e) {
if (e.which === 1) {
e.preventDefault();
}
});
});
</script>
To make this code work for your blog you have to add this in the template. Follow the instruction to add it :
  1. Go to your Blogger Dashboard
  2. Select the Template tab
  3. Click on Edit HTML and proceed
  4. Now use CTRL+F or CMD+F on Mac
  5. Search for </head> in the template and then paste the jQuery/JavaScript code just above it and Save the template. 
This is what the code should look like on it's correct place
<script type='text/javascript'>
$(document).ready(function(){
$('.post-body a img:not(.clickEnabled)').click(function(e) {
if (e.which === 1) {
e.preventDefault();
}
});
});
</script>
</head>
Note that this will disable left click on all the linked images in post body of your blog, but if you ever want an image to be clickable then just add the clickEnabled class to the img tag. So a click enabled image should look like this (just notice the class name)
<img src='some-image.png' title='An amazing image' class='clickEnabled'/>
This will stop the code from running on this particular image, you can do this on any number of image in your posts.

Not only on blogspot, you can use this snippet of code on any website you want Wordpress, Tumblr etc. just change the selector (the .post-body a img:not(.clickEnabled) thing) but if you aren't sure about it you can contact me to know the correct selector for you site or blog. 

This code simply stops the browser from doing anything when the link images inside post body are clicked, simple, isn't it ? 



If you are facing problems implementing this code into your blog, do let us know in the comments, also remember to include your blog address with the comment. If you have any suggestions, comments are welcomed.