Skip to content

Instantly share code, notes, and snippets.

@walterdavis
Created February 14, 2011 17:31
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 walterdavis/826216 to your computer and use it in GitHub Desktop.
Save walterdavis/826216 to your computer and use it in GitHub Desktop.
// jQuery
$(document).ready(function() {
var mouseX = 0;
var mouseY = 0;
$("#mytext").mousemove(function(e) {
// track mouse position
mouseX = e.pageX;
mouseY = e.pageY;
});
$("#mytext").mousedown(function() {
$("#menu").fadeOut("1000");
});
// get the mouse position and show the menu
$("mytext").select(function() {
if ($('#news').attr('checked'))
$("#menu").css("top", mouseY - 30).css("left", mouseX + 10).show().fadeIn("1000");
});
// Begining of webyep popup menu buttons //
// 1 wrap selected text in a WebyYep tag //
$("#bold").click(function() {
formatText(document.getElementById('mytext'),'<BOLD ','>')
$("#menu").fadeOut("1000");
});
//End of webyep popup menu buttons//
});
// Prototype (also need Scriptaculous Effects to do the fade/appear stuff)
document.observe('dom:loaded',function(){
var mouseX = 0;
var mouseY = 0;
Event.observe(window,'mousemove',function(e){
// track mouse position
mouseX = e.pageX;
mouseY = e.pageY;
});
$("mytext").observe('mousedown',function() {
$("menu").fade();
});
// get the mouse position and show the menu
$("mytext").observe('mouseup',function(evt) {
if ($('news').checked)
$("menu").setStyle({top: (mouseY - 30), left: (mouseX + 10)}).appear();
});
// Begining of webyep popup menu buttons //
// 1 wrap selected text in a WebyYep tag //
//
//
// Is formatText part of jQuery or of WebYep? I don't recognize it...
//
//
$("bold").observe('click',function() {
formatText($('mytext'),'<BOLD ','>')
$("menu").fade();
});
//End of webyep popup menu buttons//
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment