Archive for September, 2009

Uservoice feedback widget: Changing its style

Wednesday, September 30th, 2009

I have a feedback tab that’s blocking vital content on a website. Here’s how to alter the style of the Uservoice Feedback Tab — for instance the vertical offset: You have to insert this AFTER your widget js code, so that it will effectively overwrite the CSS declarations generated by Uservoice. Also it’s pretty annoying that it shows up on printed media, so the last style block is to remove it from print.

<style type="text/css">
  body a#uservoice-feedback-tab,
  body a#uservoice-feedback-tab:link
  {
    margin-top: 10px !important;
  }
</style>
<style rel="stylesheet" type="text/css" media="print">
  body a#uservoice-feedback-tab,
  body a#uservoice-feedback-tab:link
  {
    display: none !important;
  }
</style>

MarkItUp Markdown footnote button

Wednesday, September 9th, 2009

Here’s a simple addition to markItUp, that will prompt the user for a footnote number, a footnote text and then insert the number after the selection and the footnote text at the end of the full text. As handy extra feature, the plugin will save the previous entered footnote and not ask for further numbers during the session, but instead increment the number each time the button is pressed.

Add this to your code to set.js inside your settings object:

{name:'Insert footnote',
	beforeInsert: function(h) {
		instructions = "Type in the number of the footnote:)";
		if (!h.last_footnote) {
			h.last_footnote = prompt(instructions);
		} else {
			if (!isNaN(h.last_footnote))
				h.last_footnote = parseInt(h.last_footnote) +1;
			else
				h.last_footnote = prompt(instructions);
		}
		h.footnote_content = prompt("Type in the text of the footnote:");
	},
	closeWith: function(h) {
		return '[^' + h.last_footnote + ']';
	},
	afterInsert: function(h) {
		h.textarea.value += '[^' + h.last_footnote + ']: ' +
			h.footnote_content;
	}},

And put this icon in the set’s images folder: footnote

After that be sure to modify style.css so it says something like (if 14 was the placement of the footnote button):

.markItUp .markItUpButton14 a	{
	background-image:url(images/footnote.png);
}