// For Firefox's Web Console, creates the functions showAsPrint() and undoShowAsPrint() // to roughly emulate print media and revert function showAsPrint(){ var docSS = document.styleSheets, ss, oldMedia, newMedia, rules; var p2s = function(media){ if (media.indexOf('all') > -1) return media; //no need to change if (media == 'print') return 'all, wasprint'; //show on screen, too if (media.indexOf('print') > -1 && media.indexOf('screen') > -1) return media; //no need to change if (media == 'screen') return 'wasscreen'; //hide these rules if (media.indexOf('screen') > -1) return media.replace('screen', 'wasscreen'); //hide these rules if (media.trim().slice(0,1) == '(' && media.trim().slice(-1) == ')') return media; //too hard to parse return media + ', WTF'; //for debugging only } for (var i=0; i -1) return media.replace('wasscreen', 'screen'); //undo hiding return media; // otherwise, we didn't mess with it } for (var i=0; i