Tweaked the popup positioning code to prevent popups from getting smashed into the right side of the page. Removed (broken) images from downloaded HTML.
This commit is contained in:
parent
4bbebc4400
commit
cfc1c18a55
4
NEWS
4
NEWS
|
@ -1,7 +1,9 @@
|
||||||
1.4.1: June ?, 2008:
|
1.4.1: June 16, 2008:
|
||||||
* Implemented support for embedded images within wiki notes.
|
* Implemented support for embedded images within wiki notes.
|
||||||
* You can now open a link pulldown by simply hovering the mouse over a link
|
* You can now open a link pulldown by simply hovering the mouse over a link
|
||||||
for a few seconds.
|
for a few seconds.
|
||||||
|
* Tweaked the popup positioning code to prevent popups from getting smashed
|
||||||
|
into the right side of the page.
|
||||||
* Updated tools/set_plan.py to automatically update a user's group
|
* Updated tools/set_plan.py to automatically update a user's group
|
||||||
membership.
|
membership.
|
||||||
* Removed Google AdWords <script> tag from distributed Luminotes tarball,
|
* Removed Google AdWords <script> tag from distributed Luminotes tarball,
|
||||||
|
|
|
@ -2488,10 +2488,6 @@ function Pulldown( wiki, notebook_id, pulldown_id, anchor, relative_to, ephemera
|
||||||
addElementClass( this.div, "invisible" );
|
addElementClass( this.div, "invisible" );
|
||||||
|
|
||||||
appendChildNodes( document.body, this.div );
|
appendChildNodes( document.body, this.div );
|
||||||
var position = calculate_position( anchor, relative_to );
|
|
||||||
setElementPosition( this.div, position );
|
|
||||||
|
|
||||||
removeElementClass( this.div, "invisible" );
|
|
||||||
|
|
||||||
if ( this.ephemeral ) {
|
if ( this.ephemeral ) {
|
||||||
// when the mouse cursor is moved into the pulldown, it becomes non-ephemeral (in other words,
|
// when the mouse cursor is moved into the pulldown, it becomes non-ephemeral (in other words,
|
||||||
|
@ -2503,7 +2499,12 @@ function Pulldown( wiki, notebook_id, pulldown_id, anchor, relative_to, ephemera
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function calculate_position( anchor, relative_to ) {
|
Pulldown.prototype.finish_init = function () {
|
||||||
|
Pulldown.prototype.update_position.call( this );
|
||||||
|
removeElementClass( this.div, "invisible" );
|
||||||
|
}
|
||||||
|
|
||||||
|
function calculate_position( node, anchor, relative_to ) {
|
||||||
var anchor_dimensions = getElementDimensions( anchor );
|
var anchor_dimensions = getElementDimensions( anchor );
|
||||||
|
|
||||||
// if the anchor has no height, use its first child (if any) instead
|
// if the anchor has no height, use its first child (if any) instead
|
||||||
|
@ -2525,10 +2526,18 @@ function calculate_position( anchor, relative_to ) {
|
||||||
// position based on how far the page is scrolled.
|
// position based on how far the page is scrolled.
|
||||||
if ( /MSIE/.test( navigator.userAgent ) )
|
if ( /MSIE/.test( navigator.userAgent ) )
|
||||||
position.y -= getElement( "html" ).scrollTop;
|
position.y -= getElement( "html" ).scrollTop;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var node_dimensions = getElementDimensions( node );
|
||||||
|
|
||||||
|
// if the position is on the right half of the page, then align the right edge of the node with
|
||||||
|
// the right edge of the anchor
|
||||||
|
if ( position.x > getViewportDimensions().w * 0.5 ) {
|
||||||
|
if ( node_dimensions )
|
||||||
|
position.x = position.x - node_dimensions.w + anchor_dimensions.w;
|
||||||
|
}
|
||||||
|
|
||||||
// if we still don't have a height, move the position down a bit by an arbitrary amount
|
// if we still don't have a height, move the position down a bit by an arbitrary amount
|
||||||
if ( anchor_dimensions.h == 0 )
|
if ( anchor_dimensions.h == 0 )
|
||||||
position.y += 8;
|
position.y += 8;
|
||||||
|
@ -2539,7 +2548,7 @@ function calculate_position( anchor, relative_to ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Pulldown.prototype.update_position = function () {
|
Pulldown.prototype.update_position = function () {
|
||||||
var position = calculate_position( this.anchor, this.relative_to );
|
var position = calculate_position( this.div, this.anchor, this.relative_to );
|
||||||
setElementPosition( this.div, position );
|
setElementPosition( this.div, position );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2564,6 +2573,8 @@ function Options_pulldown( wiki, notebook_id, invoker, editor ) {
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
connect( this.startup_checkbox, "onclick", function ( event ) { self.startup_clicked( event ); } );
|
connect( this.startup_checkbox, "onclick", function ( event ) { self.startup_clicked( event ); } );
|
||||||
|
|
||||||
|
Pulldown.prototype.finish_init.call( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
Options_pulldown.prototype = new function () { this.prototype = Pulldown.prototype; };
|
Options_pulldown.prototype = new function () { this.prototype = Pulldown.prototype; };
|
||||||
|
@ -2593,6 +2604,7 @@ function Changes_pulldown( wiki, notebook_id, invoker, editor ) {
|
||||||
|
|
||||||
if ( !editor.user_revisions || editor.user_revisions.length == 0 ) {
|
if ( !editor.user_revisions || editor.user_revisions.length == 0 ) {
|
||||||
appendChildNodes( this.div, createDOM( "span", "This note has no previous changes." ) );
|
appendChildNodes( this.div, createDOM( "span", "This note has no previous changes." ) );
|
||||||
|
Pulldown.prototype.finish_init.call( this );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2624,6 +2636,8 @@ function Changes_pulldown( wiki, notebook_id, invoker, editor ) {
|
||||||
appendChildNodes( this.div, link );
|
appendChildNodes( this.div, link );
|
||||||
appendChildNodes( this.div, createDOM( "br" ) );
|
appendChildNodes( this.div, createDOM( "br" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Pulldown.prototype.finish_init.call( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
Changes_pulldown.prototype = new function () { this.prototype = Pulldown.prototype; };
|
Changes_pulldown.prototype = new function () { this.prototype = Pulldown.prototype; };
|
||||||
|
@ -2671,6 +2685,7 @@ function Link_pulldown( wiki, notebook_id, invoker, editor, link, ephemeral ) {
|
||||||
if ( link.target ) {
|
if ( link.target ) {
|
||||||
this.title_field.value = link.href;
|
this.title_field.value = link.href;
|
||||||
replaceChildNodes( this.note_summary, "web link" );
|
replaceChildNodes( this.note_summary, "web link" );
|
||||||
|
Pulldown.prototype.finish_init.call( this );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2683,18 +2698,21 @@ function Link_pulldown( wiki, notebook_id, invoker, editor, link, ephemeral ) {
|
||||||
if ( title == "search results" ) {
|
if ( title == "search results" ) {
|
||||||
this.title_field.value = title;
|
this.title_field.value = title;
|
||||||
this.display_summary( title, "current search results" );
|
this.display_summary( title, "current search results" );
|
||||||
|
Pulldown.prototype.finish_init.call( this );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( title == "share this notebook" ) {
|
if ( title == "share this notebook" ) {
|
||||||
this.title_field.value = title;
|
this.title_field.value = title;
|
||||||
this.display_summary( title, "share this notebook with others" );
|
this.display_summary( title, "share this notebook with others" );
|
||||||
|
Pulldown.prototype.finish_init.call( this );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( title == "account settings" ) {
|
if ( title == "account settings" ) {
|
||||||
this.title_field.value = title;
|
this.title_field.value = title;
|
||||||
this.display_summary( title, "account settings" );
|
this.display_summary( title, "account settings" );
|
||||||
|
Pulldown.prototype.finish_init.call( this );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2706,8 +2724,10 @@ function Link_pulldown( wiki, notebook_id, invoker, editor, link, ephemeral ) {
|
||||||
},
|
},
|
||||||
function ( result ) {
|
function ( result ) {
|
||||||
// if the user has already started typing something, don't overwrite it
|
// if the user has already started typing something, don't overwrite it
|
||||||
if ( self.title_field.value.length != 0 )
|
if ( self.title_field.value.length != 0 ) {
|
||||||
|
Pulldown.prototype.finish_init.call( self );
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
if ( result.note ) {
|
if ( result.note ) {
|
||||||
self.title_field.value = result.note.title;
|
self.title_field.value = result.note.title;
|
||||||
self.display_summary( result.note.title, result.note.summary );
|
self.display_summary( result.note.title, result.note.summary );
|
||||||
|
@ -2717,6 +2737,7 @@ function Link_pulldown( wiki, notebook_id, invoker, editor, link, ephemeral ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
Pulldown.prototype.finish_init.call( this );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2726,6 +2747,7 @@ function Link_pulldown( wiki, notebook_id, invoker, editor, link, ephemeral ) {
|
||||||
if ( iframe ) {
|
if ( iframe ) {
|
||||||
this.title_field.value = iframe.editor.title;
|
this.title_field.value = iframe.editor.title;
|
||||||
this.display_summary( iframe.editor.title, iframe.editor.summarize() );
|
this.display_summary( iframe.editor.title, iframe.editor.summarize() );
|
||||||
|
Pulldown.prototype.finish_init.call( this );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2739,8 +2761,10 @@ function Link_pulldown( wiki, notebook_id, invoker, editor, link, ephemeral ) {
|
||||||
},
|
},
|
||||||
function ( result ) {
|
function ( result ) {
|
||||||
// if the user has already started typing something, don't overwrite it
|
// if the user has already started typing something, don't overwrite it
|
||||||
if ( self.title_field.value.length != 0 )
|
if ( self.title_field.value.length != 0 ) {
|
||||||
|
Pulldown.prototype.finish_init.call( self );
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
if ( result.note ) {
|
if ( result.note ) {
|
||||||
self.title_field.value = result.note.title;
|
self.title_field.value = result.note.title;
|
||||||
self.display_summary( result.note.title, result.note.summary );
|
self.display_summary( result.note.title, result.note.summary );
|
||||||
|
@ -2750,6 +2774,8 @@ function Link_pulldown( wiki, notebook_id, invoker, editor, link, ephemeral ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Pulldown.prototype.finish_init.call( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
Link_pulldown.prototype = new function () { this.prototype = Pulldown.prototype; };
|
Link_pulldown.prototype = new function () { this.prototype = Pulldown.prototype; };
|
||||||
|
@ -2844,6 +2870,7 @@ function Upload_pulldown( wiki, notebook_id, invoker, editor, link, ephemeral )
|
||||||
addElementClass( this.progress_iframe, "undisplayed" );
|
addElementClass( this.progress_iframe, "undisplayed" );
|
||||||
|
|
||||||
appendChildNodes( this.div, this.progress_iframe );
|
appendChildNodes( this.div, this.progress_iframe );
|
||||||
|
Pulldown.prototype.finish_init.call( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
Upload_pulldown.prototype = new function () { this.prototype = Pulldown.prototype; };
|
Upload_pulldown.prototype = new function () { this.prototype = Pulldown.prototype; };
|
||||||
|
@ -3086,6 +3113,7 @@ function File_link_pulldown( wiki, notebook_id, invoker, editor, link, ephemeral
|
||||||
|
|
||||||
// FIXME: when this is called, the text cursor moves to an unexpected location
|
// FIXME: when this is called, the text cursor moves to an unexpected location
|
||||||
editor.focus();
|
editor.focus();
|
||||||
|
Pulldown.prototype.finish_init.call( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
File_link_pulldown.prototype = new function () { this.prototype = Pulldown.prototype; };
|
File_link_pulldown.prototype = new function () { this.prototype = Pulldown.prototype; };
|
||||||
|
|
|
@ -5,13 +5,16 @@ from Tags import Html, Head, Title, Style, Meta, Body, H1, Div, Span, Hr, A
|
||||||
|
|
||||||
class Html_file( Html ):
|
class Html_file( Html ):
|
||||||
NOTE_LINK_PATTERN = re.compile( u'<a\s+href="\/notebooks\/[^>]+[?&]note_id=([a-z0-9]*)"[^>]*>', re.IGNORECASE )
|
NOTE_LINK_PATTERN = re.compile( u'<a\s+href="\/notebooks\/[^>]+[?&]note_id=([a-z0-9]*)"[^>]*>', re.IGNORECASE )
|
||||||
|
IMAGE_PATTERN = re.compile( u'<img [^>]* ?/?>', re.IGNORECASE )
|
||||||
|
|
||||||
def __init__( self, notebook_name, notes ):
|
def __init__( self, notebook_name, notes ):
|
||||||
relinked_notes = {} # map from note id to relinked note contents
|
relinked_notes = {} # map from note id to relinked note contents
|
||||||
|
|
||||||
# relink all note links so they point to named anchors within the page
|
# relink all note links so they point to named anchors within the page. also, for now, remove all
|
||||||
|
# images since they're not presently included with the download
|
||||||
for note in notes:
|
for note in notes:
|
||||||
contents = self.NOTE_LINK_PATTERN.sub( r'<a href="#note_\1">', note.contents )
|
contents = self.NOTE_LINK_PATTERN.sub( r'<a href="#note_\1">', note.contents )
|
||||||
|
contents = self.IMAGE_PATTERN.sub( '', contents )
|
||||||
relinked_notes[ note.object_id ] = contents
|
relinked_notes[ note.object_id ] = contents
|
||||||
|
|
||||||
cherrypy.response.headerMap[ u"Content-Disposition" ] = u"attachment; filename=wiki.html"
|
cherrypy.response.headerMap[ u"Content-Disposition" ] = u"attachment; filename=wiki.html"
|
||||||
|
|
Reference in New Issue