Simple Machine Codes

Forum Coding => SMF For Free Codes => Topic started by: Agent Moose on June 28, 2009, 12:06:53 pm



Title: Add more Fonts
Post by: Agent Moose on June 28, 2009, 12:06:53 pm
Footers:
Code:
<script type="text/javascript">
var FontFace = new Array();var w = 0;
FontFace[w++] = "Arial";
FontFace[w++] = "Arial Black";
FontFace[w++] = "Arial Narrow";
FontFace[w++] = "Book Antiqua";
FontFace[w++] = "Century Gothic";
FontFace[w++] = "Comic Sans MS";
FontFace[w++] = "Courier New";
FontFace[w++] = "Fixedsys";
FontFace[w++] = "Franklin Gothic Medium";
FontFace[w++] = "Garamond";
FontFace[w++] = "Georgia";
FontFace[w++] = "Lucida Console";
FontFace[w++] = "Lucida Sans Unicode";
FontFace[w++] = "Microsoft Sans Serif";
FontFace[w++] = "Palatino Linotype";
FontFace[w++] = "System";
FontFace[w++] = "Tahoma";
FontFace[w++] = "Times New Roman";
FontFace[w++] = "Trebuchet MS";
FontFace[w++] = "Verdana";

var Options = "";
//Created by Agent Moose (revolutionx.smfforfree3.com)
for(x=0;x<FontFace.length;x++){
Options += "<option value='" + FontFace[x] + "'>" + FontFace[x] + "</option>";
};
$("a img[src*='bbc/face.gif']").each(function(){
var Selection = "<select id='FONT' style='margin-bottom: 1ex;'><option value='' selected='selected'>Change Font</option>" + Options + "</select>";
$(this).parent().after(Selection);
this.parentNode.style.display = "none";
});
$("#FONT option").click(function(){
surroundText('[font=' + this.value.toLowerCase() + ']', '[/font]', document.forms.postmodify.message); this.selectedIndex = 0; document.forms.postmodify.message.focus(document.forms.postmodify.message.caretPos);
});
</script>

Original Request: http://revolutionx.smfforfree3.com/index.php/topic,796.0.html

This code will replace the Font Face type ((http://images.smfboards.com/Themes2/default/images/bbc/face.gif)) with a selection box, alowing you to choose a font that you would like to use.

Easy and Effective :)

If you would like to add more fonts, add more of these lines:
FontFace[w++] = "FONT NAME";

If you would like to remove any of the fonts that are already in the code, you may go ahead and do so.

Enjoy :)