+function ($) { var VoiceHub = function() { this.project = 'madbob/VoiceHub'; this.container = $('
') .attr('class', 'voicehub') .css('padding', '10px') .css('position', 'absolute') .css('top', '40%') .css('width', '300px') .css('right', '-300px') .css('background-color', '#FFF') .css('border-top-left-radius', '10px') .css('border-bottom-left-radius', '10px') .appendTo('body').append('

Do you have some feedback? Write and send it from here!

'); this.tab = $('
') .css('position', 'absolute') .css('top', '40%') .css('right', this.container.outerWidth() - 30) .css('-webkit-transform', 'rotate(270deg)') .css('-moz-transform', 'rotate(270deg)') .css('-o-transform', 'rotate(270deg)') .css('writing-mode', 'lr-tb') .css('padding', '10px') .css('background-color', '#99E432') .text('FEEDBACK') .appendTo(this.container) .click( function() { if (window.voicehub.container.hasClass('open')) window.voicehub.container.animate({'right': '-300px'}, 300).removeClass('open'); else window.voicehub.container.animate({'right': '0'}, 300).addClass('open'); } ); this.form = $('
') .attr('method', 'POST') .attr('action', 'http://vh.madbob.org/vh.js.php?project=madbob/VoiceHub') .appendTo(this.container) .submit( function(e) { e.preventDefault(); $(this).find('button').text('Wait...').attr('disabled', 'disabled'); $.ajax($(this).attr('action'), { method: $(this).attr('method'), data: { project: window.voicehub.project, title: $(this).find('[name=title]').val(), contents: $(this).find('[name=contents]').val() }, dataType: 'json', success: function(response) { window.voicehub.container.empty().append('

Your note has been saved here

Thanks for your contribution!

'.replace('URL', response.url)); }, error: function(response) { window.voicehub.container.find('.intro').text("Oops... An error occourred..."); window.voicehub.container.find('form button').text('Send!').removeAttr('disabled'); } }); return false; } ); this.title = $('') .attr('type', 'text') .attr('name', 'title') .attr('placeholder', "Brief title") .css('padding', '10px') .css('width', '100%') .css('display', 'block') .appendTo(this.form); this.content = $('