inherit
257655
0
May 21, 2023 0:09:51 GMT -8
lemonlooe
9
February 2019
lemonlooe
|
Post by lemonlooe on Sept 28, 2021 22:06:31 GMT -8
I need some help, the style tag isnt working for me? I tried switching out different themes to see if that was the problem and it's still showing like this? hereI'd suggest disabling the vdice replacer plugin DETAILS:It looks like a vdice replacer plugin has taken liberties and modified the native array prototype causing the style plugin to encounter an error when it tries iterating over an array (not expecting this new property) Array.prototype.cleanvcustom = function() { for (var i = 0; i < this.length; i++) { deleteValue=''; if (this[i] == deleteValue) { this.splice(i, 1); i--; } } return this; };
The line of code in the style plugin where the error occurs is item.classList.add(values[j]); when j gets the value of 'cleanvcustom' going through the for..in loop. StylePost.prototype.doStyle = function(item){ if(style_tag.regex.attr.test(item.innerHTML)){ var current_html = item.innerHTML; var result = style_tag.regex.attr.exec(current_html); while(result != null){ var attr = result[1]; var value = result[2]; if(attr == "class"){ if(value.indexOf(" ") === -1){ item.classList.add(value); } else { var values = value.split(" "); for(var j in values){ item.classList.add(values[j]); /* ERROR !! */ } } } else { if(attr == "style"){ value = value.replace(style_tag.regex.bad,""); } item.setAttribute(attr, value); } current_html = current_html.replace(style_tag.regex.attr,""); result = style_tag.regex.attr.exec(current_html); } item.innerHTML = current_html; } };
Yes! That was the issue, thank you so much!
|
|
inherit
97216
0
Nov 23, 2024 12:51:52 GMT -8
Bennett 🚀
Formerly iPokemon.
3,622
January 2007
catattack
iPokemon's Mini-Profile
|
Post by Bennett 🚀 on Sept 29, 2021 6:13:17 GMT -8
I'd suggest disabling the vdice replacer plugin DETAILS:It looks like a vdice replacer plugin has taken liberties and modified the native array prototype causing the style plugin to encounter an error when it tries iterating over an array (not expecting this new property) Array.prototype.cleanvcustom = function() { for (var i = 0; i < this.length; i++) { deleteValue=''; if (this[i] == deleteValue) { this.splice(i, 1); i--; } } return this; };
The line of code in the style plugin where the error occurs is item.classList.add(values[j]); when j gets the value of 'cleanvcustom' going through the for..in loop. StylePost.prototype.doStyle = function(item){ if(style_tag.regex.attr.test(item.innerHTML)){ var current_html = item.innerHTML; var result = style_tag.regex.attr.exec(current_html); while(result != null){ var attr = result[1]; var value = result[2];
if(attr == "class"){ if(value.indexOf(" ") === -1){ item.classList.add(value); } else { var values = value.split(" "); for(var j in values){ item.classList.add(values[j]); /* ERROR !! */ } } } else { if(attr == "style"){ value = value.replace(style_tag.regex.bad,""); } item.setAttribute(attr, value); } current_html = current_html.replace(style_tag.regex.attr,""); result = style_tag.regex.attr.exec(current_html); } item.innerHTML = current_html; } };
Yes! That was the issue, thank you so much! I've pushed a new version (2.3.2) to the plugin database that will fix this issue so you can continue to use the VDice plugin! Should be available in a few days, however long it takes for them to approve the plugin.
|
|