Greasemonkey - adjust an input field - greasemonkey

I want to manipulate the following code so that when you click in the search box it selects all the text in the box rather than having to double click or press ctrl+A
The current code is:
<input name="sysparm_search" id="sysparm_search" placeholder="Search"
type="search" class="form-control form-control-search">
Is this possible to do with greasemonkey scripts?

The most simple way would be the following (using jQuery):
$("#sysparam_search").click(function() {
$(this).select();
});
There are some drawbacks associated with this kind of selection, though. See this topic for more details: Selecting all text in HTML text input when clicked

Related

How to always open jscolor picker without clicking on button

I am using Jscolor.I want to always open the jscolorpicker without clicking on button. I need to default open.
<button name="newreportcolor" id="reportchosecolor-btn" class="jscolor
{valueElement:'valueInput', styleElement:'styleInput',closable:true,hash:true,closeText:'Close me!',onFineChange:'selectcolor(this)'} ">
Choose Color
</button>

Move cursor to beginning of MaskedTextBox on focus

When a user is tabbing through a form and focus gets set on a Kendo-Ui for Angular2 MaskedTextBox, the input cursor is at the end of the mask. This is very inconvenient for a user when doing data entry.
I have tried to use the onfocus event to reset the cursor, but the event does not seem to fire for this object.
<kendo-maskedtextbox
onfocus="console.log('focused'); this.setSelectionRange(0,0);"
class="form-control"
name="phone"
[(ngModel)]="phone.phoneNumber"
[mask]="phoneMask"
required>
</kendo-maskedtextbox>
Any suggestions are appreciated....
The most recent versions of the controls fixed my problems.

Change the title of the select control

I'm using a control in my application and I need to localize the title.
By default it shows "CHOOSE AN ITEM". How can I change it?
I tried to set the name, the title , etc..
And visual studio does not give me to possibility to look at the DOM while the select control is open.
code :
<select>
<option>option 1</option>
<option>option 2</option>
</select>
I don't think this title can be edited. The selection screen is something that comes from the OS.

How to change the background color to perticular word inside a h:inputTextarea

I made a from with input text area, and the value will come from database.
value is some thing like : A 2 year notice has bean applied by mycompany with effect from 12 December 2012.
I want to hilight 12 December 2012 with some different background color.
Note: value will come dinamycally from database.
<h:inputTextarea cols="60" rows="5" id="messageId" style="margin-top:3px;"
value="#{messageBean.textMessage}" />
How can i do this? Thanks !!
Since <h:inputTextarea generates <textarea
Its impossible
Take a look at this similar questions:
Change the Color Of Certain Words In Textarea using Jquery?
And
color codes in textarea using jquery
You can use some WYSIWYG text editor
Like this one used in Primefaes Editor
Or just integrate some third party js WYSIWYG text editor , like CKEditor or TinyMCE
You also can strip all the toolbars/buttons from the editor , so it will eventually look like almost like a textarea
No it is impossible.
But you can do a trick. You can make your <h:inputTextarea component transparent by using the css property background:transparent;. Then use another colored div and place it behind the word you want to highlight. Sometimes you may need to add display:inline-block; to your highlighter div if JSF doesn't render the div with the width you give. A negative z-index may also be needed.

How to have multiples matches for a snippet in Vim's snipMate plugin (with a dropdown menu)

snipmates expands div as <div id = " "> . I want snipmate to show a dropdown menu where I can choose between div id ="" and div class="" (after creating the second one).
The documentation says:
snippet trigger A description of snippet #1
expand this text
snippet trigger A description of snippet #2
expand THIS text!
but this effectively opens a small window below where I choose a number and then press enter. But is there a way to make it a dropdown menu?
No, there isn't a way to make the current implementation use a popup menu like is used for completion. You could file a feature request against snipMate and see if the author can change it to do that, but I'm not sure that'd be easy to do.
I like to use:
<div ${1:id}="${2}">
</div>
This allows me to replace id with class when needed, then tab to the value placeholder.
This doesnt answer your question directly, but if you dont get a definite answer from others consider making two keys words for the two snippets. Something like ..
divi --> <div id=""
divc --> <div class=""

Resources