Google Plus Comment for WordPress

Google Plus Introduced Social comment plugin(unofficially). so I just made a small shortcode based plugin for wordpress to test the baby.

BTW, I noticed about this from google plus.

Download from bellow:

[download id=”36″]

Demo:
Please check here .

Shortcode:
[gpluscomment]

For more technical people
'url' => '', // leave empty for current post
'width' => '500',
'js' => 1,
'showarchive' => false,
'showhome' => false

My Test results screenshots:

Self Help+Push+Pull = Success

Problem: A man wants to climb a high wall, let see how he can do this 🙂

Step 1: Self Help + Passion + Self Motivation , yes I must do it, I just need to do it 😀

Step 2: Take help from a Friend 1 who can push from land, there may be someone , just search a bit 😛

Step 3: Take help from a Friend 2 who can pull from top of wall, and you are done.

BTW, I tried to help myself with pen & paper to draw the pictures, so don’t laugh if they looks funny 😛

jQuery Masonry doesn’t work with Bootstrap Hidden Tab

Ref: jQuery Masonry
I think many of you face issue with bootstrap hidden. After a hidden tab is made visible many things doesn’t work for the new visible content as it’s container was hidden, jquery or other js library fails to get various property, example: height, width etc and even some common issues like scrollbar, masonry etc script doesn’t work. So I have a solution for this.

Here is the common declaration about a bootstrap based tab.

[code language=”html”]
<div class="tabbable"> <!– Only required for left/right tabs –>
<ul class="nav nav-tabs">
<li class="active"><a href="#tab1" data-toggle="tab">Section 1</a></li>
<li><a href="#tab2" data-toggle="tab">Section 2</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tab1">
<p>I’m in Section 1.</p>
</div>
<div class="tab-pane" id="tab2">
<p>Howdy, I’m in Section 2.</p>
</div>
</div>
</div>
[/code]

The above code will make a tabber based on BT. So now suppose in tab content pane we added Jquery Masonry. On first load the first tab will be visible and it’s masonry will work properly and 2nd tab will not as it should be actually but you will be unhappy about it and tear … 🙂 So here I am trying to how we can make this possible to work properly.

Let For adding masonry the html code for tab here.

[code language=”html”]
<div class="tabbable"> <!– Only required for left/right tabs –>
<ul class="nav nav-tabs">
<li class="active"><a masonid="mymasontabcon1" href="#tab1" data-toggle="tab">Section 1</a></li>
<li><a masonid="mymasontabcon1" href="#tab2" data-toggle="tab">Section 2</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tab1">
<div id="mymasontabcon1">
<div class="itembox">hi there</div>
<div class="itembox">hi there</div>
<div class="itembox">hi there</div>
</div>
</div>
<div class="tab-pane" id="tab2">
<div id="mymasontabcon1">
<div class="itembox">hi there</div>
<div class="itembox">hi there</div>
<div class="itembox">hi there</div>
</div>

</div>
</div>
</div>
[/code]

Check in the above code for each anchor in li(tab) I added something like
masonid=”mymasontabcon1″ here attribute masonid is the div id of the div which we want to apply masonry. So suppose on dom ready we added masonry once.

Here we I did is calling the reload method of jquery masonry script but that need to be done after the tab’s container is shown. Otherwise we will not get proper output. I did this for each toggle of any tab, same thing is coded in the tab’s plugin included with BT.

[code language=”javascript”]
jQuery(document).ready(function(){
//this will certain happen when tab show method is done, that means we reload the masonry after the tab container is shown.
jQuery(‘body’).on(‘click.tab.data-api’, ‘[data-toggle="tab"], [data-toggle="pill"]’, function (e) {
e.preventDefault();
var mytarget = jQuery(this).attr(‘cbmasonid’);
//it is taken that already masonry is added in each tab.
jQuery("#"+mytarget).masonry(‘reload’ ); //here we call the reload method.
})
});
[/code]

Linkify url and hashtag for linkedin Status and share api

IF you are working with linkedin api and parsing status and share items for any user or company page then this small code will help to parse the status or share text (comes from api) to 1. linkify 2. Tagging 3. Linkify hashtag
Please note that linkedin doesn’t support any native @ handle for it’s own user based but all @ handle are for twitter user.
[code language=”php”]
/**
* Linkify url and hashtag
*
* @param type string $status_text
* @return type string
*/
function linkify_linkedin_status($status_text){

// linkify URLs
$status_text = preg_replace(
‘/(https?:\/\/\S+)/’,
‘<a href="\1">\1</a>’,
$status_text
);

// linkify twitter users
//please note that any thing tagged using @ in linkedin takes to twitter
$status_text = preg_replace(
‘/(^|\s)@(\w+)/’,
‘\1@<a target="_blank" href="http://twitter.com/\2">\2</a>’,
$status_text
);

// linkify hash tags
$status_text = preg_replace(
‘/(^|\s)#(\w+)/’,
‘\1#<a target="_blank" href="http://www.linkedin.com/signal/?keywords=%23\2">\2</a>’,
$status_text
);

return $status_text;
}
[/code]

jQuery TinyScrollbar doesn’t work in hidden container or tab or div : Why ?

Q: jQuery TinyScrollbar doesn’t work in hidden container or tab or div : Why ?

Answer:

I think this is problem  with jquery or as how the DOM works. When any parent div is hidden using css property display:block;  jquery can not determine the width, height etc for any child element (example div)  and this also happens for jquery tinyscrollbar plugin. I wasted almost 4/5 hours to get what the hell is happening as I was trying to add custom scrollbar in a tabber, tab tab tab … pa pa pa. But it was not working for inactive tabs (divs)

Solutions: After debuging jquerytinyscrollbar plugin’s js code I found

for method “update” it had code like

[code language=”javascript”]
oViewport[ options.axis ] = oViewport.obj[0][ ‘offset’+ sSize ];
oContent[ options.axis ] = oContent.obj[0][ ‘scroll’+ sSize ];
[/code]

and for hidden tab those oViewport.obj[0][ ‘offset’+ sSize ] and oContent.obj[0][ ‘scroll’+ sSize ] gives wrong height or width or just 0. So tha scrolling ratio doesn’t work which is calculated just after that like
[code language=”javascript”]
oContent.ratio = oViewport[ options.axis ] / oContent[ options.axis ];
[/code]

What we tried is we used another jquery plugin named jquery Actual which helps to get actual attributes of hidden element.
http://dreamerslab.com/blog/en/get-hidden-elements-width-and-height-with-jquery/

https://github.com/dreamerslab/jquery.actual/blob/master/jquery.actual.js

So add the jquery actual plugin first then include the jquery tinyscrollbar plugin. Now you need to be little brave to modify the jquery tinyscrollbar plugin.
So now update the update method like this

[code language=”javascript”]
oViewport[ options.axis ] = oViewport.obj[0][ ‘offset’+ sSize ];
oContent[ options.axis ] = oContent.obj[0][ ‘scroll’+ sSize ];

sSizecb = sAxis ? ‘width’ : ‘height’;
var oViewportaxis = $(oWrapper).children(‘div.viewport’).actual(sSizecb) ;
var oContentaxis = $(oWrapper).children(‘div.viewport’).children(‘div.overview’).actual(sSizecb) ;

oViewport[ options.axis ] = oViewportaxis;
oContent[ options.axis ] = oContentaxis;

[/code]

Download the full source code from here.

Also while adding tinyscrollbar I used some extra care, for inactive tabs more careeeeeeeeeeee.

Here are more sample codes if that helps ,
Please note that for making the scrollbar compatible with tinyscrollbar we need to add some extra div like “overview”

[code language=”javascript”]
jQuery(document).ready(function(){
//height is asumed 200px
//for scrollbar one, element id scrollbar1
jQuery(‘#scrollbar1’).children().wrapAll(‘<div class="viewport"><div class="overview"></div></div>’);
jQuery(‘#scrollbar1’).prepend(‘<div class="scrollbar"><div class="track"><div class="thumb"><div class="end"></div></div></div></div>’);
jQuery(‘#scrollbar1’).tinyscrollbarcb();

for scrollbar two , element id scrollbar2,
jQuery(‘#scrollbar2’).children().wrapAll(‘<div class="viewport"><div class="overview"></div></div>’);
jQuery(‘#scrollbar2’).prepend(‘<div class="scrollbar"><div class="track"><div class="thumb"><div class="end"></div></div></div></div>’);

jQuery(‘#scrollbar2’).children(‘div.viewport’).css({height:"200px"});
jQuery(‘#scrollbar2’).children(‘div.scrollbar’).css({height:"200px"});

jQuery(‘#scrollbar2’).children(‘div.scrollbar’).children(‘div.track’).css({height:"200px"});
jQuery(‘#scrollbar2’).tinyscrollbarcb();

});
[/code]

Thanks for reading.

āĻ•āĻĒāĻžāϞ ! āϞ⧋āĻ•āϜāύ āϕ⧇āĻŽāύ⧇ āĻŦ⧁āĻāϞ āφāĻŽāĻŋ āĻŦāĻĄāĻŧ āĻŽāύāĻŋāĻĻ⧇āϰ āĻ­āĻŋāĻĄāĻŋāĻ“ āĻĻ⧇āĻ–āĻ›āĻŋ āĻ…āĻŽā§āĻ• āϏāĻžāχāĻŸā§‡ !!

“āĻ•āĻĒāĻžāϞ ! āϞ⧋āĻ•āϜāύ āϕ⧇āĻŽāύ⧇ āĻŦ⧁āĻāϞ āφāĻŽāĻŋ āĻŦāĻĄāĻŧ āĻŽāύāĻŋāĻĻ⧇āϰ āĻ­āĻŋāĻĄāĻŋāĻ“ āĻĻ⧇āĻ–āĻ›āĻŋ āĻ…āĻŽā§āĻ• āϏāĻžāχāĻŸā§‡ !!”  āĻāχ āϰāĻ•āĻŽ āĻ…āύ⧁āĻ­ā§‚āϤāĻŋ āϝ⧇ āĻ•āĻžāϰ⧋ āĻšāϤ⧇ āĻĒāĻžāϰ⧇āĨ¤ āϤāĻŦ⧇ āϕ⧇āύ  āĻāĻŦāĻ‚ āĻ•āĻŋāĻ­āĻžāĻŦ⧇ āĻ…āĻ¨ā§āϝ āϕ⧇āω āĻŦ⧁āĻā§‡ āĻĢ⧇āϞāϛ⧇ āĻĨāϞ⧇āϰ āĻŦāĻŋāĻĄāĻŧāĻžāϞ 🙂 āĻāĻŽāύ āĻĒā§āϰāĻļā§āύ āĻŽāύ⧇ āφāϏāϤ⧇āχ āĻĒāĻžāϰ⧇āĨ¤

āϝāĻžāχ āĻšā§‹āĻ• āĻāϤāĻ•ā§āώāύ āĻŽāϜāĻž āĻ•āϰāĻ›āĻŋāϞāĻžāĻŽāĨ¤ āϤāĻŦ⧇ āϘāϟāύāĻž āĻšāĻšā§āϛ⧇ āĻ…āύ⧇āϕ⧇āχ āĻ…āύ⧇āĻ• āϏāĻžāχāĻŸā§‡ āĻāĻ•āϟāĻž āύāĻŋāωāϜ āĻĒāĻĄāĻŧāϛ⧇ āĻŦāĻž āĻ­āĻŋāĻĄāĻŋāĻ“ āĻĻ⧇āĻ–āϛ⧇ āĻŦāĻž āĻŦā§āϞāĻ— āĻĒāĻĄāĻŧāϛ⧇ āϤāĻž āφāĻŦāĻžāϰ āĻ…āĻ¨ā§āϝ āĻĢ⧇āϏāĻŦ⧁āĻ• āĻŦāĻ¨ā§āϧ⧁āϰāĻž āĻœā§‡āύ⧇ āϝāĻžāĻšā§āϛ⧇āĨ¤ āϝ⧇āĻŽāύ āĻāĻ•āϟāĻž āωāĻĻāĻžāĻšāϰāĻŖ āĻĻ⧇āĻ“āϝāĻŧāĻž āϝāĻžāĻ•āĨ¤ āĻšāĻ āĻžā§Ž āφāĻĒāύāĻžāϰ āĻĢ⧇āϏāĻŦ⧁āϕ⧇āϰ āĻšā§‹āĻŽ āĻĒāĻžāϤāĻžāϝāĻŧ āĻĻ⧇āĻ–āϞ⧇āύ āĻāĻ•āϟāĻž āĻĒā§‹āĻ¸ā§āϟ

“Mr. X watched a video on Dailymotion”

Continue reading

āϏāĻŽā§āĻ­āĻžāĻŦāύāĻžāĻŽāϝāĻŧ āύāϤ⧁āύ āϤāĻŋāύāϟāĻŋ āϏ⧋āĻ¸ā§āϝāĻžāϞ āύ⧇āϟāĻ“āϝāĻŧāĻžāĻ°ā§āĻ•

āĻĢ⧇āϏāĻŦ⧁āĻ• āĻ•āĻŋāĻ‚āĻŦāĻž āϟ⧁āχāϟāĻžāϰ āĻĻā§€āĻ°ā§āϘāĻĻāĻŋāύ āϧāϰ⧇ āϰāĻžāϜāĻ¤ā§āĻŦ āĻ•āϰ⧇ āϝāĻžāĻšā§āϛ⧇ āφāϰ āϏ⧇āχ āϏāĻžāĻĨ⧇ āϗ⧁āĻ—āϞ āĻĒā§āϞāĻžāϏ āĻāϏ⧇ āύāĻŋāĻœā§‡āϰ āĻŦā§āϝāĻ°ā§āĻĨ āĻ…āĻŦāĻ¸ā§āĻĨāĻžāύ āϤ⧈āϰāĻŋāϰ āĻšā§‡āĻ¸ā§āϟāĻž āĻ•āϰ⧇ āϝāĻžāĻšā§āϛ⧇āĨ¤ āĻāϤ⧋āĻĻāĻŋāύ āφāĻŽāϰāĻž āĻāĻ•āϟāĻž āϏ⧋āĻ¸ā§āϝāĻžāϞ āύ⧇āϟāĻ“āϝāĻŧāĻžāĻ°ā§āϕ⧇āχ āĻ•ā§āώ⧁āĻĻā§āϰ/āĻŦāĻĄāĻŧ āĻŦāĻžāĻ°ā§āϤāĻž āĻļ⧇āϝāĻŧāĻžāϰ(āĻ¸ā§āĻŸā§āϝāĻžāϟāĻžāϏ āφāĻĒāĻĄā§‡āϟ), āĻ›āĻŦāĻŋ āĻļ⧇āϝāĻŧāĻžāϰ, āĻ­āĻŋāĻĄāĻŋāĻ“ āĻļ⧇āϝāĻŧāĻžāϰ āχāĻ¤ā§āϝāĻžāĻĻāĻŋ āĻ•āϰāϤāĻžāĻŽ… āϝ⧇āĻŽāύ āĻĢ⧇āϏāĻŦ⧁āϕ⧇ āĻāĻ•āχ āϏāĻžāĻĨ⧇ āĻ¸ā§āĻŸā§āϝāĻžāϟāĻžāϏ āφāĻĒāĻĄā§‡āϟ, āĻ›āĻŦāĻŋ, āĻ“āĻĄāĻŋāĻ“, āĻ­āĻŋāĻĄāĻŋāĻ“, āύ⧋āϟ āϞ⧇āĻ–āĻž, āϗ⧇āĻŽ āϖ⧇āϞāĻžāϏāĻš āĻ…āύ⧇āĻ•āĻ•āĻŋāϛ⧁ āĻ•āϰāĻž āϝāĻžāĻšā§āϛ⧇āĨ¤ āĻ•āĻŋāĻ¨ā§āϤ⧁ āφāĻŽāĻžāϰ āĻŽāύ⧇ āĻšāĻšā§āϛ⧇ āφāĻ—āĻžāĻŽā§€āϤ⧇ āĻāχ āϧāĻžāϰāĻž āĻ…āϚāĻŋāϰ⧇āχ āĻāϞ⧋āĻŽā§‡āϞ⧋ āĻšāϝāĻŧ⧇ āϝāĻžāĻŦ⧇… āĻļ⧁āϰ⧁ āĻšāĻŦ⧇ āĻ›āĻŦāĻŋ āĻļ⧇āϝāĻŧāĻžāϰ āύ⧇āϟāĻ“āϝāĻŧāĻžāĻ°ā§āĻ•, āĻ­āĻŋāĻĄāĻŋāĻ“ āĻļ⧇āϝāĻŧāĻžāϰāĻŋāĻ‚ āύ⧇āϟāĻ“āϝāĻŧāĻžāĻ°ā§āĻ• … āĻāĻ•āϟāĻž āĻŦā§āϝāĻžāĻĒāĻžāϰ āĻšāĻšā§āϛ⧇ āĻāχ āϧāϰāύ⧇āϰ āϏāĻžāχāϟ āĻ•āĻŋāĻ¨ā§āϤ⧁ āφāϛ⧇ āϝ⧇āĻŽāύ āĻĢā§āϞāĻŋāĻ•āĻžāϰ āĻ•āĻŋāĻ‚āĻŦāĻž āχāωāϟāĻŋāωāĻŦ āϤāĻŦ⧇ āĻāĻ–āĻžāύ⧇ āϝāϤāύāĻž āĻŦ⧇āĻļāĻŋ āĻļ⧇āϝāĻŧāĻžāϰ āĻšāϝāĻŧ āϤāĻžāϰ āĻĨ⧇āϕ⧇ āύ⧇āϟāĻ“āϝāĻŧāĻžāĻ°ā§āĻ•āĻŋāĻ‚ āĻŦāĻž āĻĢāϞ⧋āϝāĻŧāĻŋāĻ‚-āĻĢāϞ⧋āϝāĻŧāĻžāϰ āϏāĻŽā§āĻĒāĻ°ā§āĻ• āĻāϰ āϟāĻžāύāĻžāĻĒā§‹āĻĄāĻŧ⧇āύ āύāĻŋāϤāĻžāĻ¨ā§āϤāχ āĻ•āĻŽāχ āĻšāϝāĻŧāĨ¤ āφāϰ āϤāĻžāχ āϖ⧁āĻŦ āĻ•āĻŽ āϏāĻŽāϝāĻŧ⧇ āϤāĻŋāύāϟāĻŋ āϏ⧋āĻ¸ā§āϝāĻžāϞ āύ⧇āϟāĻ“āϝāĻŧāĻžāĻ°ā§āĻ• āύāϤ⧁āύ āĻ•āϰ⧇ āϜāĻžāϝāĻŧāĻ—āĻž āĻ•āϰ⧇ āύāĻŋāĻšā§āϛ⧇ āϝāĻžāϰāĻž āϝāĻĨāĻžāĻ•ā§āϰāĻŽā§‡ āĻ›āĻŦāĻŋ, āĻ­āĻŋāĻĄāĻŋāĻ“ āĻāĻŦāĻ‚ āĻ“āĻĄāĻŋāĻ“ āĻļ⧇āϝāĻŧāĻžāϰāĻŋāĻ‚ āϏ⧋āĻ¸ā§āϝāĻžāϞ āύ⧇āϟāĻ“āϝāĻŧāĻžāĻ°ā§āĻ• …

āĻĒāĻŋāĻ¨ā§āϟāĻžāϰ⧇āĻ¸ā§āϟ(http://pinterest.com/)

āϚāĻŋāϞ(http://chill.com)

āĻĻāĻŋāϜāχāϜāĻŽāĻžāχāĻœā§āϝāĻžāĻŽ(http://www.thisismyjam.com/)

Break long url or word using css to prevent overflow of div container

First of all I am not design expert, not a designer but I learnt many thing about design I mean css, html while working with website projects. Something gave me pain when I found a long url is getting outside of a box(div) in google chrome. After a google search I found a solution… need to use word break though it doesn’t support all browser.

See how a long url go outside of a div box

I found a solution
[code language=”css”]
.box{
white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;
}
[/code]

thanks