Skip to content

Instantly share code, notes, and snippets.

@satyr
Created April 30, 2010 01:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save satyr/384566 to your computer and use it in GitHub Desktop.
Save satyr/384566 to your computer and use it in GitHub Desktop.
<body style="width:160%; height:160%">
<div id="bespin" class="bespin" style="width:80%; height:80%"></div>
<script>
function onBespinLoad(){
var div = document.getElementById("bespin");
var editor = div.bespin.editor;
// fix
if(location.search)
editor.textView.textInput.domNode.setAttribute('style', (
'position: absolute; z-index: -9999; '+
'width: 0; height: 0; margin: 0; border-width: 0'));
editor.focus = false;
scrollTo(1, 1);
editor.focus = true;
var ok = scrollX === 1 && scrollY === 1;
if(ok){
editor.focus = false;
scrollTo(1e4, 1e4);
editor.focus = true;
var rect = div.getBoundingClientRect();
ok = rect.top >= 0 && rect.left >= 0;
}
document.title = editor.value = ok ? 'OK' : 'NG';
}
</script>
<script src="BespinEmbedded.js"></script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment