Define your own shortcodes or entities to make your website more expressive. Easily place curly / fancy quotes and other non-typable characters on your website. The main function is x_press(). There are also many other helpful functions so that you can easily style your website the way you want. These functions are written in javascript, but you don&';t really need to know any (or much) javascript to use them on your website.
You can pass the id of the element that you want to update to several of these functions. If you don&';t pass it, x_press(), x_accent(), and x_emoji() will update the entire body of your webpage. If you&';re using javascript from some other source (payments / shopping cart, social media buttons, or others), they may not work with x_press (or x_accent or x_emoji). The easy solution is to separate the code so that it&';s outside of your main text. Then assign an id to a div which encompasses your text, but not that code. Then pass that id to x_press (or x_accent or x_emoji). You can also call x_press (...) multiple times. Calling it too many times might slow down your webpage. So I suggest calling it to change as much of your webpage at once, as you can.
&:zzzz;
, &2heartbeat;
- 2 beating hearts, &2heart;
- 2 hearts, &heart3;
- triple heart.document.write
which is degraded and may not work in Chrome.document.write
to the point that I needed to modify some x_press functions. Three functions required passing a target element as a new last parameter, so I created three new functions and left the others. That parameter is where you want the text to show up. x_d_w - shortcut for document.write was replaced by x_ih - shortcut for innerHTML. Does the same thing. x_script was replaced by x_script_ih. x_contact was replaced by x_contact_ih. There are still some document.writes in other functions, but that statement will only be executed if something else went wrong due to your code - can&';t find the element it&';s looking for. Hopefully Chrome isn&';t just scanning for document.write
.<level1>
thru <level10>
. These new tags will devolve back to <div>
. End level tags are required, as are end div tags. The level tags will help you keep track of how deeply nested your div is.<div id="smb"></div><script>if (window.location.protocol == 'file:'){smb.innerHTML='<p>***Social Media Buttons***</p>'}
else{smb.innerHTML='<div class="oss-widget-interface" style="padding-left:2em"></div><br>'}</script>
The style=...
is optional. If you just add their code <div class="oss-widget-interface"></div>
and test your page from your laptop/Windows, your page will just spin. You have to upload your webpage to see the social media buttons.:(
. Also added smile, frown, rarr, rArr, and ellipses to x_word_to_html. Also discontinued updating x_press.min.js. You can minify x_press.js on your own or just use x_press.js. It&';s still really tiny.If you want your website to be more expressive - use fancy/curly quotes, emoji, arrows, upside-down question marks, etc. - please use my x_press.js
javascript library. x_press.js does that and provides much more functionality. If you do use x_press.js, etc., attributions are helpful, links are more helpful, posting articles is most helpful, and donations (link at top of page) are always helpful. (Helpful to me and to others who could benefit from this library. Donations offset my webhosting and usage costs which go up when more people use my code.)x_press.js
contains several functions which are explained below. You have two options for using x_press.js. You can download files to your desktop and upload them to your website, or you can link directly to my code.<script src="yourpath/x_press.js"></script>
and <link rel="stylesheet" type="text/css" href="yourpath/x_press.css" /> in the
is where you upload these to on your website.<head>
of your html. yourpath<indent>
which indents 1em
.https://stubbart.com/computer_consulting/code/
in place of yourpath/
above.
Files to Download:
x_press.js is < 100KB which will load fast enough without being minified. Minifying won&';t reduce the total size much. And I&';d rather keep the code readable. The javascript code is explained here.
x_press_version
To use fancy quotes on your website &l"; &r"; &l'; &r';, you can use “
”
‘
and ’
respectively. (left-double-quote, right-double-quote, left-single-quote, right-single-quote.) &xxx;
are called HTML entities. However, if you have lots of apostrophes and want them to show as fancy right single quotes, it can be tedious to type lots of ’s.
What if you could just type &
';
instead. x_press provides the following x_press entities for fancy quotes &
';
(apostrophe), &
l';
(left-sigle-quote), &
r';
(right-single-quote), &
l";
(left-double-quote), &
r";
(right-double-quote). (Note: &
';
and &
r';
result in the same fancy right-single-quote.
“
, etc.) just mentioned) which you might find useful. ★
★ ▪
▪ ¢
¢ ✓
✓ ©
© °
° ⋄
⋄ &frowney;
&frowney; ≥
≥ (greaterthan/equalto) ≫
≫ (greaterthan/greaterthan) ℅
℅ ¡
¡ ¿
¿ ≤
≤ (lessthan/equalto) ≪
≪ (lessthan/lessthan) ≠
≠ (notequal) ☎
☎ ®
® &smiley;
&smiley; ♪
♪, ™
™ ↓
⇓ ←
← ⇐
⇐ →
→ ⇒
⇒ ↑
↑ ⇑
⇑ ↓
↓ ⇓
⇓ ½
½ ½
½ &...; ⅙
⅙ ⅛
⅛ ⅔
⅔ ⅖
⅖ ¾
¾ ⅗
⅗ ⅜
⅜ ⅘
⅘ ⅚
⅚ ⅝
⅝ ⅞
⅞. There are many more HTML entities. To use HTML entities, just place them in your HTML or Javascript text, starting with the &
and ending with the ;
. Don&';t forget the ;
. To spell out the HTML entity, replace the &
in the entity with &
. E.g. &rsquo;
. (As per usual.)
&
and end with ;
. x_press uses shorthand notation. Fancy quotes and dashes, other special punctuation, email, phone, emoji faces, arrows, pointing hands, hearts, and more are provided. The ones I most frequently use are &
';
(apostrophe) and &
n-;
(n-dash).For a complete list of x_press entities, keep reading. Note: x_press entities do not work at all places in javascript text, so test. To spell out the x_press entity, split it up with spans. E.g. <span>&</span><span>';</span>
.
<indent>
which indents one character, <bullet>
which writes a bullet followed by an indent, and <indbull>
which does an <indent><bullet;
slightly faster. These are stand-alone spans in that they don&';t need an end tag. To spell out these spans, replace the <
with <
(as per usual) and break up the tag with <spans> if necessary
.
<
indent>
as follows: I enclose sections of text in <p>
tags which I have the css set up to be indented and have a line after &n-; p{text-indent:1em;display:block;margin-top:0em;margin-bottom:1em;}
. Then for each paragraph within the <p>
block, I end a line with <br>
and start the next line with <
indent>
. This way the paragraphs within each section are single spaced and indented and each section has a line after and is indented. The last line of the section is ended with </p>
.
<
bullet>
to simulate <li>
with single spacing rather than double spacing. I usually precede <
bullet>
with <
indent>
.
To use x_press entities and spans, place <script>x_press_init()</script>
in the <head>
of your html and <script>x_press()</script>
right before <body>
. To test, place x_press('test')
after the element where you want the test to appear. This will write all the x_press entities in that element. If no element is specified as the second parameter x_press('test','here')
, the test will appear at the bottom of the document. To override any of these entities or add your own, create arrays x_press_extra_fr
and x_press_extra_to
(from and to) after calling x_press_init()
. x_presss_extra_fr
contains your changed and new x_press entities. x_press_extra_to
contains html entities, unicode, or other replacements to be written instead of the entity.
x_press_spans_extra_fr=[]
and x_press_spans_extra_to=[]
. If you typically use uppercase html tags, you can replace the lower case provided standalone spans by placing uppercase equivalents in x_press_spans_extra_fr=[]
. You can also add your own non-standalone spans by providing the corresponding end tags in x_press_spans_extra_frend=[]
and x_press_spans_extra_toend=[]
. You might want to add tags for company-specific icons or motto or commonly used short statement.
quotes: use ' or " preceded by l or r for left or right: &
'; &
l'; &
r'; &
l"; &
r"; &'; &l'; &r'; &l"; &r";
&
m-; &
n-; &m-; &n-;
&
...; &...; upside-down question-mark, exclamation-mark &
?v; &
!v; &?v; &!v;
&
env; &env; &
env@; or &
email; &env@; black phone, white phone, circled phone, mobile phone &
b@@; or &
phone; &b@@; &
w@@; &w@@; &
O@@; &O@@; &
m@@; &m@@;
&
:)); or &
grin; or &
lol; or &
rofl; &:)); &
:'); &:'); &
:); or &
smile; &:); &
heart); &heart); &
:((; or &
sad; &:((; &
:|; &:|; &
:*; &:*; &
:(; or &
frown; &:(; &
:zzz; &:zzz; &
:'(; &:'(; &
:O; &:O; &
:; &:;
&
l-; &
r-; &
u-; &
d-; &
lr-;&
ud-;&l-; &r-; &u-; &d-; &lr-; &ud-; left-down &
ld-; &ld-;
&
2l-; &
2r-; &
2u-; &
2d-; &
2lr-;&
2ud-;&2l-; &2r-; &2u-; &2d-; &2lr-; &2ud-;
&
hl-; &
hr-; &
hu-; &
hd-; &hl-; &hr-; &hu-; &hd-;
&
tu-; or &
thumbs_up; &
td-; &tu-; &td-;
&
hok; or &
ok; or &
aok; &
h/; &
hV; &
h^; &
^h:; &
^h:^h; &hok; &h/; &hV; &h^; &^h:; &^h:^h;
&
O:); &O:); &
O/:); &O/:); &
O/:(; &O/:(; &
:?; &:?; &
:)(:; &:)(:; &
:)heart(:; &:)heart(:;
&
heart; or &
ilu; or &
love; &heart; &
hearts; ♥ &
heartheart; &heartheart; &
heartheartheart; &heartheartheart; &
heartheartheartheart; &heartheartheartheart; &
heart/; &heart/; &
heart*; &heart*; &
heart-; &heart-;
&
)X; &
@X; &
:X; &)X; &@X; &:X;
&
c:); &c:); &
c:'); &c:'); &
cheart; &cheart; &
c:'(; &c:'(;
&
searchl; &searchl; &
searchr; &searchr;
&
menu; &menu; &
menu_dots; &menu_dots; &
menu_home; &menu_home; &
menu_home_garden; &menu_home_garden; &
menu_about; &menu_about; &
menu_about2; &menu_about2; &
menu_contact; &menu_contact; &
menu_contact_inbox; &menu_contact_inbox; &
menu_contact_email; &menu_contact_email; &
menu_contact_phone; &menu_contact_phone; &
menu_chat; &menu_chat; &
menu_cart; &menu_cart; &
menu_cart_bags; &menu_cart_bags; &
menu_search_left; &menu_search_left; &
menu_search_right; &menu_search_right;
To use emoji codes on your website, write the emoji code e.g. :\grin: :grin:. Call x_emoji_init()
in the <head>
of your html and x_emoji()
right before <body>
. You can pass a style for the emoji codes; e.g. x_emoji('font-size:1.5em;font-weight:bold;')
.
To use accented characters on your website such as &e'; and &e`;, write them as entities and call x_accent()
before </body>
. These entities have the format &
followed by the letter to be accented, followed by the accent mark, followed by ;
.
HTML Entities provide for styles of scripting letters: handwriting/script; outline/double-struck; old-english/black-letter; circle/encircled; scrunched; scrunched-stacked. This is intended for short phrases such as titles or subtitles, rather than for entire pages. People who use screen readers will not be able to tell what these characters are, so you may want to enclose them in a <div>
, <p>
, or <span>
which has a title=
attribute.To write script letters to your webpage, pass the string and style to output as script to x_script('string','style','element')
. Whereas x_press, x_emoji, and x_accent translate any characters within the webpage, x_script translates characters passed to it and outputs them to the element passed (replacing the element text) via innerHTML. The style can be passed as handwriting, script, outline, double-struck, old-english, black-letter, circle, encircled, scrunched, scrunched-stacked, scrunched-vowels, vertical. The style can be in upper, lower case, or mixed. Dashes can be written as spaces or omitted.
letter-spacing
style instead.
text-align:center;
for example.
x_script('This text is script','script','element')
results in .
x_script('This text is outlined','outline','element')
results in .
x_script('This text is Old English','old-english','element')
results in
x_script('This text is encircled 1 time','encircled','element')
results in .
x_script('The text is scrunched and small','scrunched','element')
results in .
x_script('The text is scrunched-stacked and small','scrunched-stacked','element')
results in .
x_script('The text is scrunched-vowels and small','scrunched-vowels','element')
results in .
x_script('The text is vertical','vertical','element')
results in
If you only want to script format a string rather than formatting it and writing it out, call x=x_script_fmt('string','style','element')
rather than x_script('string','style','element')
.
First, I wrote x_soc. There were issues with it &n-; didn&';t quite work the way I wanted it to. And I didn&';t want to try and keep up with changing requirements of various social network providers &n-; Facebook, et al. So I deprecated x_soc and eventually eliminated it. I recommended people use Social9 instead.
If you want to use x_social_share, first call x_social_init. This sets x_preferred_social_share_sites as an array of the social site buttons you want to display. This is set to ['fb', 'tw', 'pi', 'lk', 'wh', 'rd', 'em']. After calling x_social_init, you can override anything which is set before calling x_social_share. x_social_share_sites=['fb', 'tw', 'pi', 'lk', 'wh', 'em', 'pr', 'rd', 'te', 'ln', 'vk', 'wb'].
x_social_share_titles=['Facebook', 'Twitter', 'Pinterest', 'LinkedIn', 'WhatsApp', 'Email', 'Print', 'Reddit', 'Telegram', 'Line', 'VKontakte', 'Weibo']. You can use any two character code in x_social_sites in x_preferred_social_share_sites. If you want to add another social media site which is not included in x_social_sites, override x_social_sites and related variables and arrays. x_social_share_urls is an array of the social sharing links. Not all social media websites provide such a link. Facebook&';s is noticably slow. x_social_share_urls_url contains the identifier in the link for the url. Facebook sharing link is https://www.facebook.com/sharer.php?u=yourwebsite
. So, x_social_share_urls_url contains u for facebook. x_social_share_urls_title contains the title identifier in the link. Facebook doesn&';t have one, nor is that part of the link. Twitter uses text, Pinterest uses description. This is only of concern to you if you want to add other links. Find the social sharing link for that social media site and see how it&';s constructed..x_class_social_button{display:inline;float:left;height:1.25em;padding-right:.2em}
. x_social_share_font_icons contain the font icon information for Font Awesome (after version 4). If you&';re using version 4, override this array. If version 4, the font-awesome code for facebook sharing icon was fa fa-facebook-square, in version 5, it became fab fa-facebook-square. I haven&';t tested the icon fonts, but the code should work. And if you&';re using a different icon font than Font Awesome, you can override this array and it should still work. If it doesn&';t work, contact me. I&';ll see what I can do.
x_social_share(element_id,button_class). After you&';ve called x_social_init and possibly overridden arrays and variables, call x_social_share, passing the element where you want to display these buttons. I tried to make adding other social sharing buttons easy. However, Email, Print, Twitter, and Line required special handling. Twitter has the extra site parm. You pass your twitter handle to this. Line has no equivalent to facebook&';s u= parameter for the url. The url is the first parm. Best practice is to only us a few buttons. So, you probably don&';t need to add any. Most other social sharing links for social media buttons are similar in configuration.
x_social_connect(string_connector, end_string_connector, x_el,connect_follow). Similar to x_social_share. Call x_social_init first. x_date() formats and writes a date at the current place in the document. If you only want to date format a string rather than formatting it and writing it out, call If you don&';t pass a date, x_date defaults it to today. If you don&';t pass a format, x_date defaults it to 'dd-mmm-yyyy'. I wrote these x_press functions to help me write x_press. Since they&';re part of the x_press javascript library, you can use them also.
x_preferred_social_connect_sites
is set to ['fb', 'tw', 'lk', 'wh', 'ig']. x_social_connect_sites=['fb', 'tw', 'lk', 'wh', 'ig', 'te', 'ln', 'vk', 'wb', 'yt', 'sc', 'md']; x_social_connect_titles=['Facebook', 'Twitter', 'Pinterest', 'LinkedIn', 'WhatsApp', 'Instagram', 'Telegram', 'Line', 'VKontakte', 'Weibo', 'YouTube', 'snapchat', 'medium']
. Set x_preferred_social_connect_urls
to the urls of the profiles of your social media pages. string_connector
is what you want to connect the social media icons with &n-; typically comma followed by space. end_string connector usually adds the word and to string_connector = ', and '
.
The following allows you to add or override social media sites:
+
followed by a letter. That ensures that it&';s not in the list.
x_preferred_social_connect_urls
. The url of your profile on this social media site.
x_preferred_social_connect_titles
. Use ''
if this social media site is in x_social_connect_sites
. Otherwise, enter the title.
x_preferred_social_connect_buttons
. Use ''
if this social media site is in x_social_connect_sites
. Otherwise, enter the button image file.
x_preferred_social_connect_font_icons
Use ''
if this social media site is in x_social_connect_sites
. Otherwise, enter the font icon name.
connect_follow
as 'follow'
.
x_metas
x_metas is used by x_social_share. You can use it on its own, if you want. x_metas returns information in meta tags which use the property or name attribute. The name or property is turned into a variable. title
value (content) is placed in variable x_meta_title
. og:title
is placed in variable x_meta_og_titlex_date()
x_date(x_date_in, x_date_fmt_out, x_el)
. x_date_in
is the date &n-; can be a date or a string in any date format. x_date_fmt_out
is the format you want to write the date in. x_date_fmt_out
uses standard date format notation. yyyy
for four digit year, yy
for two-digit year. mmmm
for month name, mmm
for , mm
for the two-digit month. dddd
for the name of the day of week, ddd
for the three character day of week abbreviation, dd
for the two-digit day of month. hh24
for the 24-hour two-digit hour, hh
for the 12-hour two-digit hour. mi
or mn
for two-digit minutes. ss
for two-digit seconds &n-; if ss is zero, the preceding colon or period is suppressed and no seconds are written; to write the seconds even if zero, use sc
instead. Use am
, pm
, or ap
where am/pm should be written. Only the first occurrence of any format code is evaluated.
d=new Date();x_date(d,fmt,x_el);
.
x_date('2001/01/03','dddd mm/yy',element)
writes .
x_date('2001/01/03','ddd mm/dd/yyyy','element')
writes .x=x_date_fmt(x_date_in, x_date_fmt_out)
rather than x_date(x_date_in, x_date_fmt_out)
.x_tip
x_tip(x_tip_text,x_tip,x_tip_text_disp, x_el)
writes text with a tip at x_el element. x_tip(x_tip_text,x_tip,[x_tip_text_display],x_el)
x_tip required about 40k of code, so I created a separate javascript file for it x_press_tip.js
. More info.
x_hint(x_hint_text,x_hint,x_el)
. x_hint is a simple version of x_tip, so that you don&';t have to include x_press_tip.js, if you&';re only displaying simple hints (tips).
classes, x_class_modify
x_rounded_corners, x_rounded
x_transparency
x_reverse, x_reverse_lr
(left-right), x_reverse_ud
(up-down), x_reverse_lrud
x_reverse_text, x_reverse_text_lr, x_reverse_text_ud, x_reverse_text_lrud
x_class_modify(class,attribute,value)
attribute and value can be single values or arrays. attribute can be transparency, rather than opacity. If transparency, value is a percent between 1% and 99%. If color, one value sets color attribute. An array of two values sets background-color, then color. Call x_class_modify
after the last occurrence of the class.
x_flexbox, x_no_top_margin, x_no_bottom_margin, x_font_sans_serif, x_font_sans_serif_narrow, x_font_serif, x_font_monospace, x_font_cursive, x_font_bold, x_font_italic, x_font_underline
.
x_flexbox
is a class for an outer div
. The inner divs
then all line up nicely in rows. The other classes listed are pretty self-explanatory.x_contact
x_contact('contact_address','contact_msg','contact_type','span_start','span_end','element')
x_contact
is most often used for email links. Pass contact_address
, changing the @ to ! and adding in x&';s wherever. contact_msg
can be left empty if you want to show the email address; or it can contain some message such as click here to email me. contact_type
is email or empty. span_start
can be used for formatting &n-; or you can add some text or an email emoji.
element
is the target element where you want to place the contact info.
contact_address
is a phone number. Works best if phone number preceded by + and country code. Specify phone for contact_type
. You can specify a phone emoji.
'emoji'
in place of 'span_start'
.Other x_press functions
x_w(string,element)
. x_w will place your string into the element, replacing all else.
x_pad(string,length)
left-pads a string
with zeros, producing a string
of length
(unless string
is longer than length, in which case the resulting string is string
.
x=x_element(elementID)
will assign the element with elementID to x.
x=x_color(elementID,foreback)
will return the foreground or background color of the element. Foreback can be 'text','foreground', 'fore', 'fg' for foreground. Foreback can be 'background','back', 'bg' for background. Any other value will return the background color.
x=x_color_shift(rgb,redshift,greenshift,blueshift)
will shift the color. Use positive value for shift for lighter, negative for darker. Specifying 16 or -16 will go slightly lighter or darker.
x_color_primary_array
contains primary, secondary, and tertiary colors.x_color_primary_names_array
contains the names. x_color_primary_n_array and ... names array contain primary colors in sorted order where number of colors is n and n=5,8,18. Brown is actually a red-violet shade, so not included.
x_color_black
, x_color_white
- black and white, but you can change them to whatever you use for black and white. I was going to set x_color_text and x_color_background to document.body.style.text and document.body.style.backgroundColor, but these would be set in x_press_init. And x_press_init is usually called in <head>
. And document.body.style.... is undefined in head. You would need to set your own variables for these in a script after <body>
. You might also want to set a variable for document.body.style.borderColor. You can of course you document.body.style.... The only reason for corresponding variables, would be if you can&';t recall document.body.style....
x=x_color_convert(fromcolor,tocolor_type)
will convert color from one type to another. From type is name, hex, or rgb and is derived from fromcolor. tocolor_type needs to be specified if rgb, otherwise it defaults to hex. tocolor is the returned value.
x=x_color_random
returns a random color.
x=x_color_random_array_init(allowgray,allowblack,allowwhite,tooclose)
loads an array of up to 1000 random colors. allowgray
, allowblack
, allowwhite
, and tooclose
all default to 16. Set them higher to exclude more colors. But beware that setting them much high quickly reduces the number of colors in the array. Values of 48,64,16,24 work well, but only return about 200 colors in the array. To allow gray, black, white, set those values to 0. You can also set tooclose to 0, but you&';ll think you&';re getting duplicate colors even with that value set to 16. Increasing tooclose to 32 will only return about 100 colors in the array. tooclose is the parameter which really controls how many colors are returned.
x=x_color_contrast(color)
returns a contrasting color. Typically, you have a background color and you want to contrast the (foreground / text) color.
x=x_color_contrast_per_background(x_el,settextcolor=false,setbordercolor=false)
returns a contrasting color based on an element&';s background. Optionally sets text and/or border colors. This works for elements. It does not work for document.body. To set, document.body.style.color=x_color_contrast(document.body.style.backgroundColor)
x=x_fontsize(elementID,to_em_px)
will return the fontsize of the element in em or px.
x=x_is_stylesheet_used(x_stylesheet_filename_in)
returns true if filename is found in a linked stylesheet.
x=x_is_text_case(string,case)
returns the string in the specified case. If case=upper, Uppercase. lower, Lowercase. sentence, first character is uppercased. title, all words except those typically not capitalized -> first letter is uppercased. titleall, all words -> first letter is uppercased. For title, first word is also uppercased. camel does titleall, but lowercases first letter. camelall does camel and removes all space, _, and -. Actually camel case comes in lowercamel and uppercamel. So, I allowed for those variations. There is also snake case. CamelCase, grammatically speaking, only removes spaces between words. However programmers use camel case for lowercamel case. Snake case replaces spaces between words with hyphens. You can use snakeall to also replace - with _. And use can use snake- to replace spaces with -. snake all to also replace _ with -. Snake~ and Snake= work similarly.
x_word_to_html(string,convert as x_press entities)
will translate Word formatting to HTML formatting. Copy and Paste Word text and convert it to x_press or to html.
&
l';
; and &
';
if convert as x_press entities is true).
&
l";
and &
r';
).
x=x_repeat(string,n,m);
will repeat a string round(n/m) times. m is optional, defaults to 1. Alternatively you can pass Math.round(n/m)
for n.
x=x_replace_all(string, 'match', 'replace');
will replace all occurrences of 'match' in string with 'replace'. While you can use string.replace(/x/g, 'a')
to replace all occurrences of x with a in string in javascript, it gets hard to code the javascript replace function when you have non-printable characters and other characters that need to be enclosed in quotes or escaped.
x_css_display(element_id, x_css_display_property)
. Pass the elementID that you want to show/hide and the display property. x_css_display_property is none (hide), block, inline, inline-block. block is usually used to show divs, inline to show elements within divs, paragraphs, spans, buttons.
x=x_text_case(string,toCase);
will change a string to various text cases: upper, lower, sentence, title, titleall. sentence capitalizes first letter of string. title capitalizes first letter of every word except some small 1, 2, and 3 letter words. titleall capitalizes every word. words are strings of characters followed by a space (and the last set of characters following the last space.
x_emph(x_emphasis_attributes,x_el);
will change element x_el text, emphasizing it. Pass an array of emphasis attributes: bo:bold, it:italic, un:underline, ca:capitalize (every word), up:uppercase, lo:lowercase, sm:smallcaps, co:condensed, ex:expanded. The abbreviation or the entire name can be used in the array.
x=x_array_math(array_in,func)
returns the math function value for the array. E.G. If func='min', the minimum value in the array is returned. func can be 'min','max','avg','mean','mode','median','sum','product','antilog','powerproduct'. mean is the same as avg. mode is the most populous (favorite) value. median is the middle value after the array is sorted in ascending order. product takes takes the values in the array and multiplies them together. So product is same thing as sum, except it multiplies rather than adds. antilog and powerproduct are the same. These raise the first value to the second value and that result to the third value, etc. So, powerproduct is product, but uses power, rather than multiplication.
x=x_array_find(value_in, array_in, alternate_values_array_in)
. Finds the first occurrence of the value in the array and returns that index. If alternate_values_array_in is specified, the corresponding value in that array is returned.
x=x_array_find_in_range(value_in, range_array, return_values_array)
. range_array
contains the starting value of each range. The ending value of each range is just below the starting value of the next range. This routine looks for value within a range and returns the corresponding value from return_values_array
.
x=x_array_repeat(array_in,len,exclude_indexes_array)
. Repeats the array to the specified length, first excluding the indexes in exclude_indexes_array
.
x=x_array_randomize(array_in)
Returns an array with the elements of array_in randomized.
x=x_array_in_out(array_in,value_in,in/out/switch,index)
Generic Push, Pull, Shift, Unshift, Switch routine. Puts value
in array
or Gets value
from array
. Returns another array where [0]=value_from_array
, [1]=array_after_in/out/switch
. index
can be index, 'first', 'last'.value
and another for index
. Both value
and index
can be index, 'first', 'last'.
x=x_array_unique(array_in)
returns an array of unique values from all the values in array_in
.x_array_to_table(array_in,div_out,table_id,table_border_style,table_style_class,table_headings)
moves an array to a table. array_in
is the array. This array contains rows and columns just like the table. div_out
is the id of the div which will contain the table. table_id
is the id of the table. table_border
is the border styling for the table &n-; border:...
or however you want to specify it. table_style_class
is the rest of the styling style="..."
or the class class="..."
for the table. If there is none table_style_class=''
. table_headings
is an array containing the heading row.
table_headings
contains one column for each column in the table. Each column in this array is an array. The first item in this column array is the heading. Next is another array containing first the heading style or class and secondly the non-heading style or class. These might be the same, but normally the heading style will also contain font-weight:bold
. The last item tells what type of data this column contains &n-; value
,link
,combine_array
. value
means this column contains a value &n-; text / number / formatted date / etc. link
means this column contains a an array describing the link. combine_array
means that this column is an array and you want the values in the array listed as a comma-separated list in the table column.
array_in
. If a column contains a value, just enter that value. If a column contains a link, enter an array. The first item in this link array is the displayed value. The second is the url. The third is what&';s display when the user hovers of the link. Specify ''
if you don&';t want anything to be displayed. If a column contains a combined array, enter that array.
x_filter_table(filter_value,table_id,column_number)
filters a table. column_number
is 1,2,3,4,etc. column_number
is the column to search for filter_value
.x=x_who_won(high_low_wins,score_array,result_array)
Returns the index in score_array of the winning score. If result_array is specified, returns corresponding value in that array instead. high_low_wins
is high or low.
x_filter_table(filter_value,table_id,filter_column)
Filter&';s table based on value in column. Column is the column number, 1, 2, 3, 4, etc.x_storage
accesses storage which is a modern, simpler alternative to cookies. x_storage(getsetremoveclear,key,value,session)
. session
is true/false - keep key, value only for length of session. getsetremoveclear
is get, set, remove, or clear.x_webpage_parts(url)
returns an array containing protocol,domain,path,page,extension,searchparms,hash
x=x_to_unicode(str)
returns the unicode equivalent of an emoji string.x=x_styles_merge(style_class,style2)
combines two styles. style_class
is ''
for nothing, style="..."
, or class="..."
. style2
just contains the style border:...
for example.x=x_url_absolute(url_relative)
returns the absolute url, given a relative urlx=x_url_online(offline_url,offline_directory_for_domain,online_protocol,online_domain)
returns the online equivalent of an offline urlx_filter_table(filter_value,table_id,column_number)
filters an HTML tablex_copy_to_clipboard(copy_string,alert_msg)
copies a string to the clipboard. If alert_msg is not ''
, it then displays a message. This function does not work if alert messages are encountered before it copies to clipboard.x=x_mime_type_audio(ext)
, x=x_mime_type_image(ext)
, x=x_mime_type_video(ext)
return the mime type, given the extension.x=x_str_lengths(str)
returns array of [string length, unicode length, twitter length]
The x_press javascript code explained