2012-02-06 4 views
2

と交換してください。このケースを処理するためにJavaScriptを使用できると思います。は、ブラウザのCTRL + Fをオーバーライドし、誰もが、ブラウザのCTRL + Fをオーバーライドして、私を助け、Silverlightのカスタム検索に置き換えることができますSilverlightのカスタム検索

+0

1.ブラウザにctrl-Fの "イベント"をキャプチャしてください。 2. Silverlightスクリプトを呼び出します。 3. Silverlightで検索します。あなたはここに行く前にいくつかの仕事をすることが許されています。 (そして、あなたが困った時にあなたを助けるために私たちを依頼することが許可されます。あなたの仕事をするために私たちを頼むことは全く別のものです。) – Jasper

+1

私は彼がやって私を助けて」、彼のためにそれを行うために私たちを求めていたとは思いませんX "は簡単に"どこから始めるか教えてください "を意味します。また、あなたのコメントは、ブラウザでCTRL + Fイベントをキャプチャするための_how_を説明していません。これは私がここからgoogleに来たものです。役に立たない:( –

+0

あなたは検索機能のためにcodepen.ioのような他のソースからのコードを調べ、以下の私の答えのようにキーオーバーライドイベントにそれを追加することができます! – antimalwareprogram

答えて

0

あなたは検索機能を置き換えるために、これを試すことができます。

window.addEventListener("keypress",function (event) { /* Add keydown too */ 
    if ((event.keyCode == 114) || (event.ctrlKey && event.keyCode == 70)) { 
    // Block CTRL + F event 
     event.preventDefault(); 
    } 
}) 
0

私はそれのスクリプトと以下の作業のデモでは、このJSFiddleをも作成している、私のウェブサイト上で、このためのキーボードショートカットを作ってきましたこの郵便受け!デモはフィドルとまったく同じです!また、参考のためにスニペットに見られるように、自分のサイトのURLのソースは、方法によって、この1とは非常に異なっThis Link そして、私の他のスタックオーバーフローのポスト、あるthis URLあるとshortcut.jsのフィドルはthis one

<h1> Click In This Box and press ctrl+F </h1> 
 

 
    <a href https://antimalwareprogram.co/view-source:antimalwareprogram.co-pages_php.source-javascript_page.js tagret=blank>Click to see my site source if this fiddle is broken!</a> <p> 
 
<b></b>This is The Url: https://antimalwareprogram.co/view-source:antimalwareprogram.co-pages_php.source-javascript_page.js<b></b></p> 
 
    <h1> 
 
    Then Scroll down to the bottom then scroll up, or do ctrl+F there and inser this line: https://antimalwareprogram.co/shortcuts.js<h1> 
 
<h4> 
 
that and everything below it is part of my keyboard shortcuts</h4> 
 
<h1> 
 
The entire code is on the js panel</h1> 
 
<hr> 
 
<--The Javascript--> 
 

 

 
<script src="https://antimalwareprogram.co/shortcuts.js"> </script> <!-- Or Just open that script page and ctrl+A Then Ctrl+C and past it into your own site and change url to /filename.js -must save it as a .js extension! This script searches my site! To make it search your just change down below where it says --- 
 
document.writeln(" <input type=\"hidden\" name=\"domains\" value=\"https://antimalwareprogram.co\" checked=\"checked\"> "); 
 
document.writeln(" \t \t \t \t <input type=\"hidden\" name=\"sitesearch\" value=\"https://antimalwareprogram.co\" checked=\"checked\"> "); 
 

 
Just change the https://antimalwareprogram.co on both lines to https://yoursite or http://yoursite make sure not to remove the other slashes around it though or the script wont work, also this wont work if you have a script blocker blocker , so you can have a html meta no script redirect tag but nothing else will work if its not that meta tag for noscript! --> 
 

 
<script> 
 
shortcut.add("Ctrl+F",function() { 
 
\t 
 

 

 
document.writeln(" <link href=\"https://docs.google.com/static/document/client/css/3164405079-KixCss_ltr.css\" type=\"text/css\" rel=\"stylesheet\"> "); 
 
document.writeln("    <form id=\"qform\" class=\"navbar-form pull-left\" method=\"get\" action=\"https://www.google.com/search\" role=\"search\"> "); 
 
document.writeln(" "); 
 
document.writeln(" "); 
 

 
document.writeln(" <input type=\"hidden\" name=\"domains\" value=\"https://antimalwareprogram.co\" checked=\"checked\"> "); 
 
document.writeln(" \t \t \t \t <input type=\"hidden\" name=\"sitesearch\" value=\"https://antimalwareprogram.co\" checked=\"checked\"> "); 
 

 
document.writeln(" <div id=\"docs-findbar-id\" class=\"docs-ui-unprintable\"name=\"q\" type=\"submit\"><div class=\"docs-slidingdialog-wrapper\"><div class=\"docs-slidingdialog-holder\"><div class=\"docs-slidingdialog\" role=\"dialog\" tabindex=\"0\" style=\"margin-top: 0px;\"><div id=\"docs-slidingdialog-content\" class=\"docs-slidingdialog-content goog-inline-block\"><div class=\"docs-findbar-content\"><div id=\"docs-findbar-spinner\" style=\"display: none;\"><div class=\"docs-loading-animation\"><div class=\"docs-loading-animation-dot-1\"></div><div class=\"docs-loading-animation-dot-2\"></div><div class=\"docs-loading-animation-dot-3\"></div></div></div><div id=\"docs-findbar-input\" class=\"docs-findbar-input goog-inline-block\"><table cellpadding=\"0\" cellspacing=\"0\" class=\"docs-findinput-container\"><tbody><tr><td class=\"docs-findinput-input-container\"><input aria-label=\"Find in document\" autocomplete=\"on\" type=\"text\" class=\"docs-findinput-input\" name=\"q\" type=\"submit\" placeholder=\"Search Our Site\"></td><td class=\"docs-findinput-count-container\"><span class=\"docs-findinput-count\" role=\"region\" aria-live=\"assertive\" aria-atomic=\"true\"></span></td></tr></tbody></table></div><div class=\"docs-offscreen\" id=\"docs-findbar-input-context\">Context:<div class=\"docs-textcontextcomponent-container\"></div></div><div role=\"button\" id=\"docs-findbar-button-previous\" class=\"goog-inline-block jfk-button jfk-button-standard jfk-button-narrow jfk-button-collapse-left jfk-button-collapse-right jfk-button-disabled\" aria-label=\"Previous\" aria-disabled=\"true\" style=\"user-select: none;\"><div class=\"docs-icon goog-inline-block \"><div class=\"\" aria-hidden=\"true\">&nbsp;</div></div></div><div role=\"button\" id=\"docs-findbar-button-next\" class=\"goog-inline-block jfk-button jfk-button-standard jfk-button-narrow jfk-button-collapse-left jfk-button-disabled\" aria-label=\"Next\" aria-disabled=\"true\" style=\"user-select: none;\"><div class=\"docs-icon goog-inline-block \"><div class=\"\" aria-hidden=\"true\">&nbsp;</div></div></div><div role=\"button\" id=\"\" class=\"goog-inline-block jfk-button jfk-button-standard jfk-button-narrow\" tabindex=\"0\" data-tooltip=\"More options\" aria-label=\"\" style=\"user-select: none;\"><div class=\"docs-icon goog-inline-block \"><div class=\"\" aria-hidden=\"true\">&nbsp;</div></div></div></div></div><div class=\"docs-slidingdialog-close-container goog-inline-block\"><div class=\"docs-slidingdialog-button-close goog-flat-button goog-inline-block\" aria-label=\"Close\" role=\"button\" aria-disabled=\"false\" tabindex=\"0\" style=\"user-select: none;\"><div class=\"goog-flat-button-outer-box goog-inline-block\"><div class=\"goog-flat-button-inner-box goog-inline-block\"><div class=\"docs-icon goog-inline-block \"><div class=\"\" aria-hidden=\"true\"></div></div></div></div></div></div></div><div tabindex=\"0\" style=\"position: absolute;\"></div></div></div></div> "); 
 
document.writeln(" <a href=\"#\" onClick=\"window.location.reload();return false;\"></a> "); 
 
document.writeln(" "); 
 
document.writeln("    </form> "); 
 
document.writeln(" "); 
 
document.writeln(" <h1> Press esc key to cancel searching!</h1> "); 
 
    
 
shortcut.add("Ctrl+F",function() { 
 
\t alert("Already Searching! Press the esc key to stop searching!"); 
 
}); 
 
    shortcut.add("esc",function() { 
 

 
    location.reload(); 
 

 
    
 
}); 
 

 
}); 
 
</script>

です