Post by oddnanref on Jun 3, 2018 23:13:05 GMT
I just tried posting code on the forums but I got an error instead
===stack===
===content===
===settings===
===template===
===data===
source:bbcode/setContent
Several errors, also I was using [ U ] in the code for ::U:: and [ B ] for ::B:: which translated into underline and black the code.
SyntaxError: Unexpected identifier
===stack===
SyntaxError: Unexpected identifier
at new Function (<anonymous>)
at a (http://storage.proboards.com/forum/js/proboards.combined_656.js:1:316315)
at Function.template (http://storage.proboards.com/forum/js/proboards.combined_656.js:1:320084)
at Function.tmpl (http://storage.proboards.com/forum/js/proboards.combined_656.js:1:319596)
at compileBBCode (http://storage.proboards.com/6915389/js/zSNfAHMFVoYSdr00XYnp.js:930:12)
at Object.bbcode_setContent [as setContent] (http://storage.proboards.com/6915389/js/zSNfAHMFVoYSdr00XYnp.js:233:12)
at r.(anonymous function).(anonymous function).setContent (http://storage.proboards.com/forum/js/proboards.combined_656.js:1:567197)
at HTMLTextAreaElement.<anonymous> (http://storage.proboards.com/forum/js/proboards.combined_656.js:1:99160)
at Function.each (http://storage.proboards.com/forum/js/proboards.combined_656.js:1:10299)
at init.each (http://storage.proboards.com/forum/js/proboards.combined_656.js:1:6874)
at new Function (<anonymous>)
at a (http://storage.proboards.com/forum/js/proboards.combined_656.js:1:316315)
at Function.template (http://storage.proboards.com/forum/js/proboards.combined_656.js:1:320084)
at Function.tmpl (http://storage.proboards.com/forum/js/proboards.combined_656.js:1:319596)
at compileBBCode (http://storage.proboards.com/6915389/js/zSNfAHMFVoYSdr00XYnp.js:930:12)
at Object.bbcode_setContent [as setContent] (http://storage.proboards.com/6915389/js/zSNfAHMFVoYSdr00XYnp.js:233:12)
at r.(anonymous function).(anonymous function).setContent (http://storage.proboards.com/forum/js/proboards.combined_656.js:1:567197)
at HTMLTextAreaElement.<anonymous> (http://storage.proboards.com/forum/js/proboards.combined_656.js:1:99160)
at Function.each (http://storage.proboards.com/forum/js/proboards.combined_656.js:1:10299)
at init.each (http://storage.proboards.com/forum/js/proboards.combined_656.js:1:6874)
===content===
I have another keyword which I wanted to program. It is related to the color of the card.
[spoiler=Code]If {p1 := to_lower(remove_tags(card.card_color))
p2 := replace(p1, match:"hybrid,", replace:"")
p3 := replace(p2, match:"horizontal", replace:"")
p4 := replace(p3, match:"multicolor,", replace:"")
c1 := filter_text(p4, match:",")
n1 := length(c1)
if contains(card.card_color, match:"white") then ::W:: else ""}{
p5 := replace(p4, match:"white,", replace:"")
c1 := filter_text(p5, match:",")
n1 := length(c1)
if n1 == 1 and contains(p4, match:"white") then " or " else if n1 > 1 and contains(p4, match:"white") then ", " else ""}{
if contains(card.card_color, match:"blue") then ::U:: else ""}{
p6 := replace(p5, match:"blue,", replace:"")
c1 := filter_text(p6, match:",")
n1 := length(c1)
if n1 == 1 and contains(p4, match:"blue") then " or " else if n1 > 1 and contains(p4, match:"blue") then ", " else ""}{
if contains(card.card_color, match:"black") then ::B:: else ""}{
p7 := replace(p6, match:"black,", replace:"")
c1 := filter_text(p6, match:",")
n1 := length(c1)
if n1 == 1 and contains(p4, match:"black") then " or " else if n1 > 1 and contains(p4, match:"black") then ", " else ""}{
if contains(card.card_color, match:"red") then ::R:: else ""}{
p8 := replace(p7, match:"red,", replace:"")
c1 := filter_text(p8, match:",")
n1 := length(c1)
if n1 == 1 and contains(p4, match:"red") then " or " else if n1 > 1 and contains(p4, match:"red") then ", " else ""}{
if contains(card.card_color, match:"green") then ::G::" style="max-width:100%;"] else ""} was spent to cast, {if is_spell() then "then:" else "when this permanent enters the battlefield it:"}
[/spoiler]
I would appreciate help in reducing the amount of code this requires.
Also, another question is there a way to have variable v := 12 then reduce the number in the variable like v := v - 1.
===settings===
{
"bbcode_list": [
{
"tag": "noubbc|noparse",
"replacement": "$[directive.mode-bbcode]\n$[directive.phase-submit]\n$[tag.comment.\n********************************************\n DO NOT DELETE\n wrap noubbc and noparse tags so they\n can be recognized in HTML once posted\n THE PLUGIN NEEDS THIS TO WORK PROPERLY\n********************************************\n]\n[span style=\"font-family:$[tag.name]-bbcode inherit;\"]$[tag.outerBBC][/span]",
"open_delim": "[",
"close_delim": "]"
},
{
"tag": "span",
"replacement": "$[directive.reuse-for-all-endtags]\n$[directive.mode-bbcode]\n$[directive.phase-init]\n$[tag.comment.\n********************************************\n DO NOT DELETE\n unwraps noubbc and noparse tags on wysiwyg\n load so they look normal in bbcode tab\n THE PLUGIN NEEDS THIS TO WORK PROPERLY\n********************************************\n]\n{if $[tag.attributes.style.indexOf(noparse-bbcode)] != -1 || $[tag.attributes.style.indexOf(noubbc-bbcode)] != -1 }\n$[tag.comment. ===remove the span===]\n{else}\n$[tag.match]\n{/if}",
"open_delim": "[",
"close_delim": "]"
},
{
"tag": "table|tbody|tr|td|th|tfoot|thead",
"replacement": "$[directive.reuse-for-all-endtags]$[directive.strict-space]$[directive.phase-set]$[directive.mode-bbcode]$[tag.comment.******************************************** Format bbcode tables for easier editing ********************************************]{if $[tag.name]==\"td\" || $[tag.name]==\"th\"}{if !$[tag.closed]}
{/if}$[tag.match]{else}{if $[tag.name]==\"tr\" || $[tag.name]==\"thead\" || $[tag.name]==\"tfoot\"}
$[tag.match]{else}{if $[tag.name]==\"table\"}{if $[tag.closed] != \"1\"}
{/if}$[tag.match]{/if}{if $[tag.name]==\"tbody\"}{if $[tag.closed]}
{/if}$[tag.match]{/if}{/if}{/if}",
"open_delim": "[",
"close_delim": "]"
},
{
"tag": "align",
"replacement": "[div align=\"$[tag.attributes.default]\"][/div]",
"open_delim": "[",
"close_delim": "]"
},
{
"tag": "ul|ol|li",
"replacement": "$[directive.reuse-for-all-endtags]$[directive.strict-space]$[directive.phase-set]$[directive.mode-bbcode]$[tag.comment.******************************************** Format bbcode lists for easier editing ********************************************]{if $[tag.name]==\"li\" }{if !$[tag.closed]}
{/if}$[tag.match]{else}{if $[tag.name]==\"ol\" || $[tag.name]==\"ul\"}
$[tag.match]{/if}{/if}",
"open_delim": "[",
"close_delim": "]"
},
{
"tag": "dohtml",
"replacement": "$[tag.comment.\n*****************************************\nPreserves carriage returns and line feeds \nfor contents of the DOHTML tag during conversion\nfrom bbcode to html to avoid them being\nautomatically converted to <br> by WYSIWYG\n*****************************************\n]\n$[directive.strict-space]\n$[directive.mode-bbcode]\n$[directive.phase-get]\n[dohtml $[tag.attributes]]$[tag.innerBBC.eolsave][/dohtml]",
"open_delim": "[",
"close_delim": "]"
}
],
"html_list": [
{
"tag": "dohtml",
"replacement": "$[directive.mode-visual]\n$[directive.phase-submit]\n$[directive.phase-set]\n$[directive.strict-space]\n$[tag.comment.\n********************************************\n This will allow html in post if the browser \n supports the sandbox and srcdoc properties\n********************************************\n]\n{if 'sandbox' in document.createElement('iframe') && 'srcdoc' in document.createElement('iframe')}\n<iframe src=\"about:blank\" class=\"user-content\" seamless srcdoc=\"<html><head></head><body>$[tag.innerBBC.eolrestore.quot]</body></html>\" \n{if $[tag.attributes.height]} height=\"$[tag.attributes.height]\"{else}height=\"500\"{/if}\n{if $[tag.attributes.width]} width=\"$[tag.attributes.width]\"{else}width=\"100%\"{/if}\n{if $[tag.attributes.style]} style=\"$[tag.attributes.style]\"{/if}\n{if $[tag.attributes.sandbox]}sandox=\"$[tag.attributes.sandbox]\"{else}sandbox{/if} >\n$[directive.content-end]</iframe>\n{else}\n<div class=\n\"ui-dialog ui-widget ui-widget-content ui-corner-all ui-draggable ui-resizable\"\ntabindex=\"-1\" role=\"dialog\" aria-labelledby=\n\"ui-dialog-title-error-message\" style=\n\"display: block; z-index: 1005; outline: 0px; height: auto; width: 300px;\">\n<div class=\n\"ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix\">\n<span class=\"ui-dialog-title\" id=\n\"ui-dialog-title-error-message\">DOHTML</span><a href=\"#\" class=\n\"ui-dialog-titlebar-close ui-corner-all\" role=\"button\" onclick=\"$(this).closest('.ui-dialog').slideUp(); return false\"><span class=\n\"ui-icon ui-icon-closethick\">close</span></a></div>\n<div id=\"error-message\" class=\"ui-dialog-content ui-widget-content\"\nstyle=\"width: auto; min-height: 102px; height: auto;\">This browser cannot safely show embedded HTML</div>\n</div>\n{/if}\n\n$[tag.comment.\n*********************************************\n The sandbox attribute can take one or more\n of the following so you can control just what\n any content loaded in an iframe by a member can do:\n\n allow-same-origin (e.g. needed for cookie access)\n allow-scripts\n allow-popups\n allow-forms\n allow-top-navigation \n allow-pointer-lock\n*********************************************\n]\n$[directive.attribute-deny-sandbox:allow-top-navigation]\n$[directive.attribute-default:srcdoc]",
"open_delim": "[",
"close_delim": "]"
},
{
"tag": "img",
"replacement": "$[tag.comment.\n********************************************\n This will allow images in the shoutbox\n********************************************\n]\n$[directive.mode-shoutbox]\n$[directive.phase-shoutbox_receive]\n$[directive.tag-no-end]\n<img $[tag.attributes] >",
"open_delim": "[",
"close_delim": "]"
},
{
"tag": "card",
"replacement": "$[directive.content-end][a href=\"https://scryfall.com/search?q=$[tag.innerBBC.encodeURI]\"]$[tag.innerBBC][/a]",
"open_delim": "[",
"close_delim": "]"
},
{
"tag": "~test",
"replacement": ""
}
],
"bbcode_inputs": [
"textarea:not(.wysiwyg-textarea)[name=\"message\"]",
"textarea:not(.wysiwyg-textarea)[name=\"message\"]"
],
"custom_inputs": "",
"html_outputs": [
".item.post .message",
".item.message .message",
".item .signature, .form_user_status .content-box.center-col:last",
".container.boards .title-bar.bbcode .title_wrapper"
],
"custom_outputs": ""
}
===template===
{
"tag": "ul|ol|li",
"replacement": "$[directive.reuse-for-all-endtags]$[directive.strict-space]$[directive.phase-set]$[directive.mode-bbcode]$[tag.comment.******************************************** Format bbcode lists for easier editing ********************************************]{if $[tag.name]==\"li\" }{if !$[tag.closed]}
{/if}$[tag.match]{else}{if $[tag.name]==\"ol\" || $[tag.name]==\"ul\"}
$[tag.match]{/if}{/if}",
"open_delim": "[",
"close_delim": "]"
}
I have another keyword which I wanted to program. It is related to the color of the card.
[spoiler=Code]If {p1 := to_lower(remove_tags(card.card_color))
p2 := replace(p1, match:"hybrid,", replace:"")
p3 := replace(p2, match:"horizontal", replace:"")
p4 := replace(p3, match:"multicolor,", replace:"")
c1 := filter_text(p4, match:",")
n1 := length(c1)
if contains(card.card_color, match:"white") then ::W:: else ""}{
p5 := replace(p4, match:"white,", replace:"")
c1 := filter_text(p5, match:",")
n1 := length(c1)
if n1 == 1 and contains(p4, match:"white") then " or " else if n1 > 1 and contains(p4, match:"white") then ", " else ""}{
if contains(card.card_color, match:"blue") then ::U:: else ""}{
p6 := replace(p5, match:"blue,", replace:"")
c1 := filter_text(p6, match:",")
n1 := length(c1)
if n1 == 1 and contains(p4, match:"blue") then " or " else if n1 > 1 and contains(p4, match:"blue") then ", " else ""}{
if contains(card.card_color, match:"black") then ::B:: else ""}{
p7 := replace(p6, match:"black,", replace:"")
c1 := filter_text(p6, match:",")
n1 := length(c1)
if n1 == 1 and contains(p4, match:"black") then " or " else if n1 > 1 and contains(p4, match:"black") then ", " else ""}{
if contains(card.card_color, match:"red") then ::R:: else ""}{
p8 := replace(p7, match:"red,", replace:"")
c1 := filter_text(p8, match:",")
n1 := length(c1)
if n1 == 1 and contains(p4, match:"red") then " or " else if n1 > 1 and contains(p4, match:"red") then ", " else ""}{
if contains(card.card_color, match:"green") then ::G::" style="max-width:100%;"] else ""} was spent to cast, {{if is_spell() then "then:" else "when this permanent enters the battlefield it:"}}
[/spoiler]
I would appreciate help in reducing the amount of code this requires.
Also, another question is there a way to have variable v := 12 then reduce the number in the variable like v := v - 1.
===data===
{}
Several errors, also I was using [ U ] in the code for ::U:: and [ B ] for ::B:: which translated into underline and black the code.