Jquery detect commands/Custom BBcode

So I want to be able to detect what a user on my forums writes in a post and change its CSS accordingly. For example, hl color:yellowexample testhl should apply a hightlight to the text: style=background-color: yellow I want the jQuery code to detect hl color: if successful, save the value between the […]

Why my div cant FadeIn on Scroll

I have one container div and I want to FadeIn when scroll position on him. I dont know why my code doesnt work. Here is link on JSFIDDLE http://jsfiddle.net/Q2TYv/2195/ HTML <div class=container-fluid contact nopadding hideme id=contact> <div class=mainContainer> <div class=contacttitle> <hr class=hrtitle><h2 class=fontraleway>CONTACT US<h2><hr class=hrtitle> <div> <span class=subtitle>Wanna ask us something? Use the form below.<span> […]

Сounting vowels in javascript

I use this code to search and count vowels in the string, a = run forest, run; a = a.split( ); var syl = 0; for (var i = 0; i < a.length 1; i++) { for (var i2 = 0; i2 < ai.length 1; i2++) { if (aouie.search(aii2) > -1) { syl++; […]

How to show the “Are you sure you want to navigate away from this page?” when changes committed?

Here in stackoverflow, if you started to make changes then you attempt to navigate away from the page, a javascript confirm button shows up and asks: Are you sure you want to navigate away from this page? blee blah bloo Has anyone implemented this before, how do I track that changes were committed? I believe […]

Does bluebird have a convince function for wrapping functions in promises?

I have an object of functions. These functions arent always fully promises. For example function helloWorld(string){ if(string == foo) throw new Error(string is foo) return aPromise(string) } If the string is foo then this will throw an error that will not be caught with the catch call. Id rather write cleaner code like above instead […]

How to test values on scope of directive with inline controller

I have the following directive which I want to unit test: use strict; angular.module(gameApp) .directive(gmGravatar, gmGravatar); gmGravatar.$inject = $routeParams, playersService; function gmGravatar() { var directive = { restrict: E, template: <img gravatar-src=gravatar.email alt= id=gravatar class=img-rounded style=margin: auto; display: block;>, controller: function($routeParams, playersService) { var vm = this; var playerId = $routeParams.playerId; playersService.getPlayerInfo({ playerId: playerId }).$promise.then(function(player) […]

IE11 not accepting string(variable) as parameter to localStorage.setItem()

Does anyone knows why IE does not accept a string-variable as a parameter to the method setItem? Works fine on Chrome. Example on IE: This works: var itemName = anyname; localStorage.setItem(itemName, anything); This doesn´t: var itemName = anyname; var stringName = some string content; localStorage.setItem(itemName, stringName ); This gives Invalid argument error. Any help on […]