Skip to content

Instantly share code, notes, and snippets.

@alecgorge
Created February 2, 2012 03:36
Show Gist options
  • Save alecgorge/1721264 to your computer and use it in GitHub Desktop.
Save alecgorge/1721264 to your computer and use it in GitHub Desktop.
fix the terrible calc chat ui
javascript:(function(){var a=loadSolution,b=!1,c=function(){b||(b=$("#loader-img")),b.show()},d=function(){b.hide()};loadSolution=function(){c(),a.apply(null,arguments)},$("#book-content-center,#book-content-right,#bottom-toolbar").remove(),$("#left-content-container,#book-content-left").css({width:"auto",height:"auto","float":"none",display:"block",overflow:"visible"}),$("<button>Next Problem</button>").click(function(){return $("#selExercises")[0].selectedIndex++,loadSolution(),!1}).appendTo($("#toolbar")),$("<button>Previous Problem</button>").click(function(){return $("#selExercises")[0].selectedIndex--,loadSolution(),!1}).appendTo($("#toolbar")),$("<span></span>").attr("id","loader-img").html(" &nbsp;&nbsp;Loading...").hide().appendTo($("#toolbar")),$("#solutionimg").load(d)})()
(function () {
var old = loadSolution
, loader = false
, showLoader = function () {
if(!loader) {
loader = $('#loader-img');
}
loader.show();
}
, hideLoader = function () {
loader.hide();
};
loadSolution = function () {
showLoader();
old.apply(null, arguments);
};
$('#book-content-center,#book-content-right,#bottom-toolbar').remove();
$('#left-content-container,#book-content-left').css({width:'auto',height:'auto',float:'none',display:'block',overflow:'visible'});
$('<button>Next Problem</button>').click(function () {
$('#selExercises')[0].selectedIndex++;
loadSolution();
return false;
}).appendTo($('#toolbar'));
$('<button>Previous Problem</button>').click(function () {
$('#selExercises')[0].selectedIndex--;
loadSolution();
return false;
}).appendTo($('#toolbar'));
$('<span></span>')
.attr('id', 'loader-img')
.html(" &nbsp;&nbsp;Loading...")
.hide()
.appendTo($('#toolbar'));
$('#solutionimg').load(hideLoader);
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment