Help with Code
3 posters
Page 1 of 1
Help with Code
Hello @Ange Tuteur or @JScript i was wonder if it is possible to make this code from this post so you don't have to deactivate optimize CSS?
Warning button for Administrators and Moderators
I really like having this option.
Regards
FrOsTyXi
Warning button for Administrators and Moderators
I really like having this option.
Regards
FrOsTyXi
Re: Help with Code
@FrOsTyXi
Try this JS, no need to add anything to your CSS:
JS
Try this JS, no need to add anything to your CSS:
- Code:
$(function() {
var sCSS =
'<style>' +
'/* Warning buttons */' +
'.mod_mess, .adm_mess {' +
' margin: 5px auto;' +
' width: 90%;' +
' -webkit-border-radius: 4px;' +
' -moz-border-radius: 4px;' +
' border-radius: 4px;' +
'}' +
'.mod_mess a.postlink, .adm_mess a.postlink {' +
' color: #FFF !important;' +
' text-decoration: underline !important;' +
'}' +
'/* Administrator bb-Code - message block */' +
'.adm_mess {' +
' background: #e54858;' +
' background: -moz-linear-gradient(left, #e54858 0%, #f5b57a 100%);' +
' background: -webkit-gradient(linear, left top, right top, color-stop(0%, #e54858), color-stop(100%, #f5b57a));' +
' background: -webkit-linear-gradient(left, #e54858 0%, #f5b57a 100%);' +
' background: -o-linear-gradient(left, #e54858 0%, #f5b57a 100%);' +
' background: -ms-linear-gradient(left, #e54858 0%, #f5b57a 100%);' +
' background: linear-gradient(left, #e54858 0%, #f5b57a 100%);' +
' filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#e54858", endColorstr="#f5b57a", GradientType=1);' +
' -webkit-box-shadow: 4px 4px 0px 0px #352727;' +
' -moz-box-shadow: 4px 4px 0px 0px #352727;' +
' box-shadow: 4px 4px 0px 0px #352727;' +
'}' +
'/* Administrator bb-Code - title */' +
'.adm_mess .titl {' +
' font-size: 15px;' +
' font-weight: bold;' +
' padding: 5px;' +
' border-bottom: 1px dashed #B60505;' +
'}' +
' /* Administrator BB-Code - text presentation */' +
'.adm_mess .titl + div {' +
' display: block;' +
' margin-left: 10px;' +
' padding: 25px 5px 25px 80px;' +
' background: transparent url(http://i33.servimg.com/u/f33/17/37/83/89/gnome-10.png) no-repeat left center;' +
'}' +
'/* Moderator BB-Code - message block */' +
'.mod_mess {' +
' background: #5c93f5;' +
' background: -moz-linear-gradient(left, #5c93f5 0%, #afcfda 100%);' +
' background: -webkit-gradient(linear, left top, right top, color-stop(0%, #5c93f5), color-stop(100%, #afcfda));' +
' background: -webkit-linear-gradient(left, #5c93f5 0%, #afcfda 100%);' +
' background: -o-linear-gradient(left, #5c93f5 0%, #afcfda 100%);' +
' background: -ms-linear-gradient(left, #5c93f5 0%, #afcfda 100%);' +
' background: linear-gradient(left, #5c93f5 0%, #afcfda 100%);' +
' filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#5c93f5", endColorstr="#afcfda", GradientType=1);' +
' -webkit-box-shadow: 4px 4px 0px 0px #352727;' +
' -moz-box-shadow: 4px 4px 0px 0px #352727;' +
' box-shadow: 4px 4px 0px 0px #352727;' +
'}' +
'/* Moderator BB-Code - title */' +
'.mod_mess .titl {' +
' font-size: 15px;' +
' font-weight: bold;' +
' padding: 5px;' +
' border-bottom: 1px dashed #0D4DD3;' +
'}' +
'/* Moderator BB-Code - text presentation */' +
'.mod_mess .titl + div {' +
' display: block;' +
' margin-left: 10px;' +
' padding: 25px 5px 25px 80px;' +
' background: transparent url(http://i33.servimg.com/u/f33/17/37/83/89/gnome610.png) no-repeat left center;' +
'}' +
'</style>';
$(sCSS).appendTo("head");
var modButton = true,
admButton = true,
modImage = 'http://i39.servimg.com/u/f39/18/21/41/30/bouton11.png',
admImage = 'http://i39.servimg.com/u/f39/18/21/41/30/bouton10.png';
if (_userdata.user_level != 0 && modButton === true) {
$("#text_editor_textarea").before("<img src='" + modImage + "' title='Moderator warning' id='mod-b'/>");
$('#mod-b').click(function() {
$('#text_editor_textarea').sceditor('instance').insertText('[mod]', '[/mod]')
});
}
if (_userdata.user_level === 1 && admButton === true) {
$("#text_editor_textarea").before("<img src='" + admImage + "' title='Admin warning' id='adm-b'/>");
$('#adm-b').click(function() {
$('#text_editor_textarea').sceditor('instance').insertText('[adm]', '[/adm]')
});
}
$('div.postbody div').each(function() {
if ($(this).text().indexOf('[adm]') != -1) $(this).html($(this).html().replace(/\[adm\](.+?)\[\/adm\]/gi, '<div class="adm_mess"><div class="titl">Administrator Warning</div><div>$1 </div></div>'));
if ($(this).text().indexOf('[mod]') != -1) $(this).html($(this).html().replace(/\[mod\](.+?)\[\/mod\]/gi, '<div class="mod_mess"><div class="titl">Moderator Warning</div><div>$1 </div></div>'));
});
});
JS
Similar topics
» When i paste a long code via [code][/code] the page expands
» I add a new Forum widget for my Affiliates code but I want to remove the code that shows there!
» Hide Code? or Post to See Content Code?
» what's the code to customize the quote/code color for phpbb3?
» help in this code . the effect on code > add button to Put under the colored writing
» I add a new Forum widget for my Affiliates code but I want to remove the code that shows there!
» Hide Code? or Post to See Content Code?
» what's the code to customize the quote/code color for phpbb3?
» help in this code . the effect on code > add button to Put under the colored writing
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum