JQuery to Add Code Tags to Selected Text


 
Thread Tools Search this Thread
The Lounge What is on Your Mind? JQuery to Add Code Tags to Selected Text
# 1  
Old 09-10-2018
JQuery to Add Code Tags to Selected Text

Hey.

Someone find or write some jQuery code where we can select text with our mouse and then click or double click the highlighted / selected text and then it will wrap code tags around the highlighted text (in our editors).

Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Web Development

Turning jQuery Code into Vue.js

The following is some code I am working on the replace our navbar (someday) with a Vue component. Vue.component("unix-navbar", { template: `<div class="neo-table-border vuenavbar"><div class="flex-item" style="margin-bottom:10px;padding-top:13px;"><a class="vuenavbarhome"... (19 Replies)
Discussion started by: Neo
19 Replies

2. What is on Your Mind?

JQuery and CSS Flex Code for Responsive Forum Home Page

So far, I have completed making the home page more responsive (except for the forum stats at the top and the WOL box at the bottom, they still use scroll bars). xevV3_iZ8-s For full screen use the link below and set your YT resolution to 1080p60 HD https://youtu.be/xevV3_iZ8-s Here is... (1 Reply)
Discussion started by: Neo
1 Replies

3. What is on Your Mind?

JQuery and CSS Flex Code for Responsive WOL Page

I have just wrote this jQuery to the WOL page, so the table of users on line will not need scrollbars and will instead transform into a responsive table: <script> jQuery(document).ready(function (){ jQuery("#neo-who-flex-tcat"). css({"display":"flex","flex-flow":"row wrap", ... (0 Replies)
Discussion started by: Neo
0 Replies

4. Shell Programming and Scripting

Using Linux Commands on selected text

Hi I have a XML file as shown below: <Text Text_ID="10155645315850165_10155645333075165" From="460350337463650" Created="2014-10-16T17:05:37+0000" use_count="536">This is the first text</Text> <Text Text_ID="10155645315850165_10155645317025165" From="1626711840908498"... (10 Replies)
Discussion started by: my_Perl
10 Replies

5. Shell Programming and Scripting

To display the selected part in text file of unix

0400903071220312 20120322 20:21 1TRANTELSTRAFLEXCAB22032012CMP201323930000812201108875802100A003485363 12122011AUS 182644 000C2 8122011 0000 000 1TRANTELSTRAFLEXCAB22032012CMP201323930000812201108875802100A003485363 12122011AUS ... (6 Replies)
Discussion started by: rammm
6 Replies

6. Shell Programming and Scripting

Awk to add selected row column data

Looks at the most efficient way to add up the column of data based off of the rows. Random data Name-Number-ID Sarah-2.0-15 Bob-6.3-15 Sally-1.0-10 James-1.0-10 Scotty-10.7-15 So I would select all those who have ID = 15 and then add up total number read - p "Enter ID number" Num ... (3 Replies)
Discussion started by: Ironguru
3 Replies

7. Shell Programming and Scripting

trying to print selected fields of selected lines by AWK

I am trying to print 1st, 2nd, 13th and 14th fields of a file of line numbers from 29 to 10029. I dont know how to put this in one code. Currently I am removing the selected lines by awk 'NR==29,NR==10029' File1 > File2 and then doing awk '{print $1, $2, $13, $14}' File2 > File3 Can... (3 Replies)
Discussion started by: ananyob
3 Replies

8. Shell Programming and Scripting

want to add the size of the selected list of file

i have a files in the dir as below. ls -lR ./.snapshot 5649600512 ./.snapshot/backup/data20080707 6006923264 ./.snapshot/backup/data20080708 5321129984 ./.snapshot/backup/data20080709 6686597120 ./.snapshot/backup/data20080710 7312855040 ... (4 Replies)
Discussion started by: mail2sant
4 Replies
Login or Register to Ask a Question
Jifty::Manual::JavaScript(3pm)				User Contributed Perl Documentation			    Jifty::Manual::JavaScript(3pm)

NAME
Jifty::Manual::JavaScript - JavaScript programming guide for Jifty DESCRIPTION
jQuery took over Prototype and becoming the core of Jifty's Javascript development. Besides re-implementing core javascript libraries with jQuery, some good refactor is also being done. This document is written to help JavaScript programmers working for a Jifty project to understand what's the different before jQuery landed, and provide a quick reference for Prototypism believers to learn the new wave of JavaScript programming in Jifty. Migration to jQuery This section provides a simple guide through jQuery's core functions that's used to replace Prototype javascript library. Selecting elements with jQuery() Invoking the jQuery function with exactly one string argument will return a jQuery object that represents a list of elements. The string is a CSS selector. For example: jQuery("span.message") This works very similar to Prototype's $$() function, but with one difference. The return value is not an Array, it's a jQuery object that acts likes a Enumerable object (but still, not one). If you really want a Array, you can do: var array_of_message = jQuery("span.message").get() For most cases, "jQuery("#" + id).get(0)" can be a replacement pattern to "$(id)". Selecting elements with "jQuery()" function always returns a jQuery object, but not element it self. There are two notice especially for Jifty world. First of all, Jifty developers should always use "Jifty.$". Deep in the design of Jifty, there are many kind of elements with ":" character in their id. Sadly it is a feature in jQuery to do more powerful selection with ":" character. For example, this selects current mouse- overed elements: jQuery(":hover") "jifty.js" internally use "Jifty.$" as the direct replacement to "$()" function defined in the Prototype library. However, for application developers it's quite safe to use "jQuery("#id")" to select elements they created. Document ready with jQuery() The way to do execute some javascript right after the DOM is ready is to bind a handler for "ready" event on the "document" object: jQuery(document).ready(function() { ... }); Since is done quite often, there's a shortcut: jQuery(function() { ... }); METHODS
This section list those public functions under "Jifty" namespace. They are defined in jifty.js. Jifty.$( element_id ) This is a shorthand of "document.getElementById" function, like the "$" function defined in Prototype library. It is also internally used a lot because many form specific element ID does not get along with jQuery's selector, which expect the ":" character is used for special purpose. element_id should be a string. If not, element_id itself is returned. Therefore, this convention: element = Jifty.$(element) Can work when the variable "element" is either a string, or a HTML element object. Jifty.Effect(element, effect_name, option) When called, instantly perform a js effect on the given element. "element" is an element object. The last arg "option" is a hash. Currently it's only used for specifying callbacks. There are two possible callbacks, before and after. You may specify them like this: Jifty.Effect(element, "Fade", { duration: 2.0 }, { before: function() { ... }, after: function() { ... } }); The "before" callback is called right before the effect starts. The "after" callback is called right after it's started, but not necessarily ended. This function is written to make it possible that a Jifty plugin can override default effects with other fancy javascript libraries. By default, it delegates all the real work to jQuery's built-in effect functions. Jifty.Form.getElements(element) Given a form element, returns all input fields inside this form. That includes INPUT, SELECT, tags. The returned value is an array of HTML elements. Jifty.Form.getActions(element) Given a form element, returns a array of elements that are defined as Jifty actions. Jifty.Form.clearPlaceholders(element) Jifty.Form.Element.getMoniker( element ) Given an element, or an element id, return a string representing a moniker of this element. It returns null if the given element is considered having no moniker at all. Jifty.Form.Element.getAction( element ) Takes an element or an element id. Get the action for this form element. The returned value is an Action object. Jifty.Form.Element.getType( element ) Takes an element or an element id, returns the type associated with this element. Possible return values are "registration", "value", "fallback", or null if the element does not belongs to any of these types. Jifty.Form.Element.getField( element ) Takes an element or an element id, returns the name of it. Returns null if the element given does not have a name. Jifty.Form.Element.getValue( element ) Takes an element or an element id, returns the element value. If the element is a CHECKBOX or a RADIO button but it's unchecked, returns null. Jifty.Form.Element.validate( element ) Validates the action this form element is part of. Jifty.Form.Element.disableValidation( element ) Temporarily disable validation. Jifty.Form.Element.enableValidation( element ) Re-enable validation. Jifty.Form.Element.getForm( element ) Look up the form that this element is part of. This is sometimes more complicated than you'd think because the form may not exist anymore, or the element may have been inserted into a new form. Hence, we may need to walk the DOM. Upon the failure of searching, null is returned. Jifty.Form.Element.buttonArguments( element ) Takes an element or an element id that is considered as a "button", which can be an <INPUT type="submit"> tag, or a <A> tag, returns the arguments on this element. If none, an empty object is returned. Jifty.Form.Element.buttonActions( element ) Takes an element or an element id that is considered as a "button", return array of actions on this element. If none, an empty array is returned. Jifty.Form.Element.buttonFormElements( element ) Takes an element or an element id that is considered as a "button", return an array of form elements that's just constructed based on the arguments on this element. If none, an empty array is returned. Jifty.Form.Element.clickDefaultButton( element ) Click the first button that will submit the action associated with the form element. Jifty.Form.Element.handleEnter( event ) Trap "Enter" key, and prevent it from doing any browser default behaviours. Jifty.update(options) This function is used to handle most Jifty-related ajax requests. It handles the submission of actions, manipulation of continuations, and modification of page regions. Whenever building "onclick" or other Jifty::Web::Form::Element event handlers, this method is generally used. The "options" are passed as an object where the following attributes are available. actions This is an object declaring the monikers you wish to submit with the update. These actions will be taken based upon the form inputs and also the values described in "action_arguments". The values assigned to each moniker should be "1" to signify that that moniker should be submitted. For example, Jifty.update({ 'actions': { 'new_entry': 1 } }); action_arguments This specifies any additional arguments to submit with the action. These are specified as a object where the fields are the names of the monikers to submit arguments for. The values are objects describing the parameters to pass to the action. For example, Jifty.update({ 'actions': { 'new_entry': 1 }, 'action_arguments': { 'new_entry': { 'foo': 42, 'bar': 'blah' } } }); This would submit the action for moniker "new_entry" with whatever form elements are included on the page along with setting the parameter "foo" to "42" and the parameter "bar" to "blah". continuation TODO Please document this... fragments This is an array describing modifications to make to page regions. Each element of the array is an object describing a single modification. The fields that are valid for each include the following: region This is the fully-qualified name of the region to manipulate. args These are the arguments to pass to the server. These are passed as an argument where the field names are the keys to pass. The values may be a typical string value to pass in or may be one of the special values listed in Jifty::Request::Mapper, which will set the values based upon action results and other values in the request. (Those values will need to be produced using the JavaScript analog of the descriptions in Perl. Specifically, hashes are JavaScript objects and actions must be given as action monikers.) path This is the path of the fragment to use when modifying the region. element This is a special "jQuery" selector to use to choose an element to update. If this is given, the "region" value will be ignored and the first element matching this selector will be used instead. mode This determines what kind of update to perform. It may be one of the following: Replace The contents of the region or selected element will be completely replaced by the server response. Top The server response will be inserted within the region or selected element before the rest of the content. Bottom The server response will be inserted within the region or selected element after the rest of the content. Before The content returned by the server will be inserted immediately before and outside the given region or element. After The content returned by the server will be inserted immediately after and outside the given region or element. effect This is used to select the "Jifty.Effect" to use when performing the modification. This is a string naming the effect. REFERENCE
jQuery in 15 minutes http://www.slideshare.net/simon/jquery-in-15-minutes/ <http://www.slideshare.net/simon/jquery-in-15-minutes/> Learning jQuery in 30 minutes http://www.slideshare.net/simon/learning-jquery-in-30-minutes/ <http://www.slideshare.net/simon/learning-jquery-in-30-minutes/> Prototype jQuery going from one to the other http://www.slideshare.net/remy.sharp/prototype-jquery-going-from-one-to-the-other/ <http://www.slideshare.net/remy.sharp/prototype- jquery-going-from-one-to-the-other/> jQuery Official Documentation <http://docs.jquery.com/> perl v5.14.2 2010-12-08 Jifty::Manual::JavaScript(3pm)