Dyskusja MediaWiki:Gadget-sel t.js

message: Class(object): sel_t – manipulation of selection in an input field.

message: === public ===
* .version – version of the script
=== private ===
DO NOT USE THEM!
* .isWikEdOn
* .noSelection
* .range
* .sel_e
* .sel_s
thread_title:  attributes 

message: * .version – version of the script
thread_title:  public 

message: DO NOT USE THEM!
* .isWikEdOn
* .noSelection
* .range
* .sel_e
* .sel_s
thread_title:  private 

message: === public ===
==== getSelStr(input,nonempty) ====
In short: returns selected string in the given input.
Additionally if nothing is selected and nonempty is true then it returns full contents of the input; otherwise it returns an empty string.
==== setSelStr(input, str, nonempty) ====
In short: replaces current selection in the given input with str.
Additionally if nothing is selected and nonempty is true then it replaces all of the contents of the input; otherwise it inserts the string at the end.
Note: this method runs ScrollIntoView so you don't have to.
==== qsetSelStr(input, str, nonempty) ====
In short: replaces selection previously found with getSelStr.
Works the same as setSelStr but is quicker and must be used only after calling getSelStr.
Note: this method runs ScrollIntoView so you don't have to.
==== getSelBound(input) ====
Returns an object with boundaries of selection in the input. Returned object has following attributes:
* start – 0 based postion of the start of the selection
* end – 0 based postion of the end of the selection
This is aimed to work the same in all browsers (well IE) as selectionStart/End attributes of textarea does in other browsers. Should work the same in all of them.
==== setSelBound(input, sel_boundaries, scroll) ====
In short: set boundaries (sel_boundaries) of a selection in the input.
Optionally it can scroll the selection into view.
The sel_boundaries must have the following attributes:
* start – 0 based postion of the start of the selection
* end – 0 based postion of the end of the selection
Note: this is very similar to setSelRange.
==== setSelRange(input, sel_start, sel_end) ====
Selects the given range of text in the given input.
For backward compatibility only. Use setSelBound instead.
=== private ===
==== ScrollIntoView(input, sel_start, sel_end) ====
This method is used internally for Firefox to scroll selection into View.
For IE (if you are sure that selection is in the wanted input) you can use:
document.selection.createRange().scrollIntoView(true)
thread_title:  functions 

message: ==== getSelStr(input,nonempty) ====
In short: returns selected string in the given input.
Additionally if nothing is selected and nonempty is true then it returns full contents of the input; otherwise it returns an empty string.
==== setSelStr(input, str, nonempty) ====
In short: replaces current selection in the given input with str.
Additionally if nothing is selected and nonempty is true then it replaces all of the contents of the input; otherwise it inserts the string at the end.
Note: this method runs ScrollIntoView so you don't have to.
==== qsetSelStr(input, str, nonempty) ====
In short: replaces selection previously found with getSelStr.
Works the same as setSelStr but is quicker and must be used only after calling getSelStr.
Note: this method runs ScrollIntoView so you don't have to.
==== getSelBound(input) ====
Returns an object with boundaries of selection in the input. Returned object has following attributes:
* start – 0 based postion of the start of the selection
* end – 0 based postion of the end of the selection
This is aimed to work the same in all browsers (well IE) as selectionStart/End attributes of textarea does in other browsers. Should work the same in all of them.
==== setSelBound(input, sel_boundaries, scroll) ====
In short: set boundaries (sel_boundaries) of a selection in the input.
Optionally it can scroll the selection into view.
The sel_boundaries must have the following attributes:
* start – 0 based postion of the start of the selection
* end – 0 based postion of the end of the selection
Note: this is very similar to setSelRange.
==== setSelRange(input, sel_start, sel_end) ====
Selects the given range of text in the given input.
For backward compatibility only. Use setSelBound instead.
thread_title:  public 

message: In short: returns selected string in the given input.
Additionally if nothing is selected and nonempty is true then it returns full contents of the input; otherwise it returns an empty string.
thread_title:  getSelStr(input,nonempty) 

message: In short: replaces current selection in the given input with str.
Additionally if nothing is selected and nonempty is true then it replaces all of the contents of the input; otherwise it inserts the string at the end.
Note: this method runs ScrollIntoView so you don't have to.
thread_title:  setSelStr(input, str, nonempty) 

message: In short: replaces selection previously found with getSelStr.
Works the same as setSelStr but is quicker and must be used only after calling getSelStr.
Note: this method runs ScrollIntoView so you don't have to.
thread_title:  qsetSelStr(input, str, nonempty) 

message: Returns an object with boundaries of selection in the input. Returned object has following attributes:
* start – 0 based postion of the start of the selection
* end – 0 based postion of the end of the selection
This is aimed to work the same in all browsers (well IE) as selectionStart/End attributes of textarea does in other browsers. Should work the same in all of them.
thread_title:  getSelBound(input) 

message: In short: set boundaries (sel_boundaries) of a selection in the input.
Optionally it can scroll the selection into view.
The sel_boundaries must have the following attributes:
* start – 0 based postion of the start of the selection
* end – 0 based postion of the end of the selection
Note: this is very similar to setSelRange.
thread_title:  setSelBound(input, sel_boundaries, scroll) 

message: Selects the given range of text in the given input.
For backward compatibility only. Use setSelBound instead.
thread_title:  setSelRange(input, sel_start, sel_end) 

message: ==== ScrollIntoView(input, sel_start, sel_end) ====
This method is used internally for Firefox to scroll selection into View.
For IE (if you are sure that selection is in the wanted input) you can use:
document.selection.createRange().scrollIntoView(true)
thread_title:  private 

message: This method is used internally for Firefox to scroll selection into View.
For IE (if you are sure that selection is in the wanted input) you can use:
document.selection.createRange().scrollIntoView(true)
thread_title:  ScrollIntoView(input, sel_start, sel_end)