How to add Bower component when it’s not in the repository?

Sometimes component that you want to use in your project isn’t available in Bower repo. There is a way to install it, even in very specified version. Go to project’s Github, in my case it’s here. Copy URL from the browser, and paste it somewhere. Now go to relases and click commit id that you’re interested in (this random blue colored string):

After that you’ll see full commit id, in this case it’s fef978b279c546923ad4f4118acea4d503e7596c. Paste that to the end of repository URL you’ve copied earlier. Remember to prefix it with # char and add .git to the URL:

Finally mix it with your bower.json file. Here’s full example:

	"name": "Realhero report",
	"description": "Report template based on New Age",
	"main": "index.js",
	"authors": ["Konrad Fedorczyk"],
	"license": "ISC",
	"homepage": "",
	"private": true,
	"ignore": ["**/.*", "node_modules", "bower_components", "test", "tests"],
	"dependencies": {
	    "bootstrap": "^3.3.7",
	    "font-awesome": "^4.6.3",
   	 	"jquery": "^1.11.3",
   	 	"simple-line-icons": "^2.3.2",
   	 	"morris.js": "^0.5.1",
   	 	"jqvmap-fedek6": "",
   	 	"Counter-Up": ""

Look at the last line of dependencies part, here’s component that I’ve added.

How to change mass edit limit in Vtiger 6.5

Sometimes you need to make mass operation on houndreds of records in Vtiger. Well in this case it’s 500 ones maximum… Well this is kinda stupid because it can surely handle up to thousands. How do I know? I’ve hacked the code and successfully converted 2000 leads 🙂 Well it takes some time but it definitely works!

Let us return to the merits. You need to edit a file from root folder of your Vtiger 6.5 CRM, placed here /layouts/vlayout/modules/Vtiger/resources/List.js. Simply find the code below and edit number according to your needs:

File: List.js

		var selectedCount = this.getSelectedRecordCount();
		if(selectedCount > 2000) {
		    var params = {
			    title : app.vtranslate('JS_MESSAGE'),
			    text: app.vtranslate('JS_MASS_EDIT_LIMIT'),
			    animation: 'show',
			    type: 'error'

Simpliest way to obfuscate e-mail address using jQuery

Here is a simpliest jQuery code to protect e-mail addresses on your website from spam bots. Just put this in a script tag into the head section:

$(window).load(function() {			
	// anti spam
	var r='random-string';
	$('.'+r).each(function() {
	var $this = $(this),
		value = new String($this.text());
		value = value.replace('['+r+']', '@');
		$this.replaceWith($('').text(value).attr('href', 'mailto:'+value));

Now replace random-string with any really aleatory set of characters eg. dhhIDu338

And here is the HTML part. Publish every e-mail address on your page using this code:

Contact: <span class="random-string">johndoe[random-string]</span>

How to programmatically select option in a HTML list using jQuery?

This is very simple solution to select specified option in a HTML select list.

You just need to use the val function on a select element to set it’s value. It’s simple like that:

$('select#identificator').val('value of existing option value');

Check working example on the JSFiddle:

How to check visibility state in jQuery toggle function?

Here is a quick tip how to check visibility state of a toggled element in jQuery:

$('#element').toggle('slow', function() {
  if($(this).is(':hidden')) {
    $(this).text('This element is hidden.');
  else {
    $(this).text('This element is visible.');