[From qianxun network] Right-click and add the "Accept as you see it" Function

Source: Internet
Author: User

During the past two days, I saw a brother in the garden introduce qianxun. Then I went to visit the garden and accidentally found the function of "Accept as you see it.
Originally, it was written to the Registry. Right-click and add the menu "send to qianxun if you have any feelings ".
Usage:
1,

Script for writing to the Registry

REGEDIT4

[HKEY_CURRENT_USER \ Software \ Microsoft \ Internet Explorer \ MenuExt]

[HKEY_CURRENT_USER \ Software \ Microsoft \ Internet Explorer \ MenuExt \ send to qianxun]
@ = Http: // localhost/fb/FavoriteBlog.htm

 

Script for deleting the corresponding key value from the Registry

REGEDIT4

[HKEY_CURRENT_USER \ Software \ Microsoft \ Internet Explorer \ MenuExt]

[-HKEY_CURRENT_USER \ Software \ Microsoft \ Internet Explorer \ MenuExt \ send to qianxun]

2. Right-click any text on the page and select "send to qianxun ". Then call a page, which is mainly a js function:

<Script language = "JavaScript">
Var content = "";
Var ArticleWindow;
Function Init ()
{
If (external. menuArguments)
{
Var parentwin = external. menuArguments;
Var srcEvent = external. menuArguments. event;
Var doc = parentwin.doc ument;
Var eventElement = doc. elementFromPoint (srcEvent. clientX, srcEvent. clientY );

// If you select an area, copy the HTML of the selected area to the clipboard.
If (doc. selection)
{
Var content = doc.selection.createRange().html Text;

If (content. length! = 0)
{
Var cpb = parentwin. clipboardData;
| );

ArticleWindow = window. open ("FavoriteBlogTemp.htm ","","");
}
}
}
Else
{
History. go (-1 );
}
}
</Script>
Then the body onload calls:
<Body onload = "Init ()"> </body>

You can see that the favoriteblogtemp.htmpage is opened at the same time in the script. Then you can see the content of the favoriteblogtemp.htm page: <script language = "Javascript">
Function PostToArticle (cont)
{
Var obj = document. getElementById ("txt_Text ");
// Obj. value = cont;
// Alert (cont );

Obj. focus ();
Document.exe cCommand ('paste ');
Window. clipboardData. setData ('text ','')

If (oIndexTop (). GetCurrentUserID (). value! = "-1 ")
Document. forms [0]. submit ();
Else
Document. getElementById ("div_Login"). style. display = "";
}
Function AfterLogin ()
{
Document. forms [0]. submit ();
}
</Script>
</Head>
<Body onload = "PostToArticle ();" style = "margin: 0px; overflow: hidden;">
<Form id = "form1" action = "/Blog/WriteArticle. aspx" method = "post">
<Textarea id = "txt_Text" name = "txt_Text" style = "width: 1px; height: 1px; overflow: hidden;" rows = "1"> </textarea>
<Input name = "IsCollectors" type = "hidden" value = "1"/>
</Form>
<Div id = 'div _ login' style = "height: 214px; width: 100%; display: none;">
.

Read data from the clipboard, paste it to textarea, and then document. forms [0]. submit ();
Finished!
Although the entire process is very simple, it is very convenient to achieve a good function.

Copyright:
All the Code involved in this article belongs to qianxun. I am only used for learning. If the design copyright is incorrect, delete it immediately.
No one is authorized to use this code without the permission of qianxun. Any problems involving copyright disputes are irrelevant to me.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.