You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
1.4 KiB
26 lines
1.4 KiB
4 years ago
|
|
||
|
# Escape JS to the safe JS for the inline JS in HTML tags ATTENTION! Use it only if want to paste JS into HTML tag - not in <script>
|
||
|
# USAGE: JSEscapeForHTMLInline(inJSStr="lTest=\"Hello World\"; alert(\"lTest\")")
|
||
|
def JSEscapeForHTMLInline(inJSStr):
|
||
|
lResult = inJSStr.replace("\"",""")
|
||
|
return lResult
|
||
|
|
||
|
# Generate HTML code of the simple URL link by the URL
|
||
|
# USAGE: Orchestrator.Web.Basic.HTMLLinkURL(inURLStr="test",inColorStr="orange")
|
||
|
# USAGE: Basic.HTMLLinkURL(inURLStr="test",inColorStr="orange")
|
||
|
def HTMLLinkURL(inURLStr, inTitleStr=None, inColorStr=None):
|
||
|
lCSSStyleStr = ""
|
||
|
if not inTitleStr: inTitleStr = inURLStr
|
||
|
if inColorStr: lCSSStyleStr=f"style=\"color:{inColorStr}\""
|
||
|
lResult=f"<a {lCSSStyleStr} href=\"{inURLStr}\">{inTitleStr}</a>"
|
||
|
return lResult
|
||
|
|
||
|
# Generate HTML code of the simple URL link by the JS when onclick
|
||
|
# USAGE: Orchestrator.Web.Basic.HTMLLinkJSOnClick(inJSOnClickStr="",inColorStr="orange")
|
||
|
# USAGE: Basic.HTMLLinkJSOnClick(inJSOnClickStr="test",inColorStr="orange")
|
||
|
def HTMLLinkJSOnClick(inJSOnClickStr, inTitleStr, inColorStr=None):
|
||
|
lCSSStyleStr = ""
|
||
|
if inColorStr: lCSSStyleStr=f"style=\"color:{inColorStr}\""
|
||
|
inJSOnClickStr= JSEscapeForHTMLInline(inJSStr=inJSOnClickStr) # Escape some symbols for the inline JS
|
||
|
lResult=f"<a {lCSSStyleStr} onclick=\"{inJSOnClickStr}\">{inTitleStr}</a>"
|
||
|
return lResult
|