Browsing all articles tagged with javascript
Jun
21

We’ve further improved JavaScript performance

With the vast majority of popular internet browsers (Chrome, Firefox, Safari, Internet Explorer / Edge, …) finally getting wide-spread support for some of the latest JavaScript features, we’ve decided to completely revamp our JavaScript code to bring it from the current “state-of-the-art” to absolutely “cutting-edge” status once again.

We’re always looking to squeeze every last bit of performance out of our code, be it with the back-end code that runs on our array of servers, or the front-end JavaScript code that runs inside our users’ browsers and helps them use Spin Rewriter to take care of all their unique content needs.

So, if you’ve noticed an improvement in responsiveness of forms / buttons / other interactive elements you come in contact with inside the Spin Rewriter control panel, now you know why. 😉 Enjoy!

Apr
20

(Even) faster JavaScript

We’re optimizing the JavaScript code that makes Spin Rewriter come to life inside your browser …

We’ve already made it 25-30% faster, but we’re not stopping there – I’m pretty certain that we’ll be rolling out a 40% overall faster version of Spin Rewriter in the next 4-5 business days.

Free of charge, of course. 😉

Aug
18

Prevent users from accidentally leaving the page [JavaScript]

Sometimes your users might lose important information that they’ve been working on by accidentally leaving the page. They can either press the “previous page” or “next page” button by accident, or they can hit the “backspace” key on their keyboard, inadvertently click a link etc.

Luckily you can prevent them from losing their progress by using the following bit of JavaScript code:

window.onbeforeunload = function() {
    if (your_users_might_lose_their_work) {
        dialog_text = "IMPORTANT: Are you sure you want to leave this page?\n\n";
        dialog_text += "WARNING: If you leave this page, you will lose all your current progress.";
        return dialog_text;
    }
};

This code works perfectly fine with all modern browsers, with one small disclaimer: Firefox will not show your custom warning to your users, instead it will simply state “This page is asking you to confirm that you want to leave – data you have entered may not be saved.” However, that’s exactly what you usually want to say in this situation anyway.

Jul
17

Get HTML of selection [JavaScript]

I just recently needed to get the actual HTML of what was selected in a browser. Selected as in “you drag your mouse across some text and it turns blue”. So I came up with this nifty piece of JavaScript code that works quite flawlessly across all major browsers (yes, including IE).

/**
 * gets the current selection, including HTML code
 * @return string
*/
function getSelectionHTML() {
	var userSelection;
	try {
		if (window.getSelection) {
			// W3C ranges
			userSelection = window.getSelection();
			if (userSelection.getRangeAt)
				var range = userSelection.getRangeAt(0);
			else {
				var range = document.createRange();
				range.setStart(userSelection.anchorNode, userSelection.anchorOffset);
				range.setEnd(userSelection.focusNode, userSelection.focusOffset);
			}
			var clonedSelection = range.cloneContents();
			var div = document.createElement("div");
			div.appendChild(clonedSelection);
			return div.innerHTML;
		} else if (document.selection) {
			// Internet Explorer selection
			userSelection = document.selection.createRange();
			return userSelection.htmlText;
		} else {
			return "";
		}
	} catch(e) {
		// an error occurred - supposedly nothing is selected
		return "";
	}
};
Feb
23

Okay, I give up – here’s my blog!

As many of you already know, I’ve been more than active in the online business for the last couple of years (has it really been 4 years already?!), but I was always simply posting comments to existing blogs of our projects / products / services, commenting on marketing and web-dev forums, and I never had my own blog.

Over the time, there were so many fellow internet marketers asking me to start a blog to write down my thoughts and code tutorials etc. that I eventually had to give it a thought. And here it is. Aaron’s blog about internet business in general, business principles, inspiration, search engine optimization, marketing, revenue generation and LOTS of code.

I hope you like it! 😉

Follow me on Twitter! Follow me on Twitter!
You can always stay up-to-date with our latest and craziest projects ...