0
var HomeMarksModal = Class.create(HomeMarksUtilities,{
0
- initialize: function(
contents) {
0
+ initialize: function(
) {
0
- this.contents = contents || 'misc' // ['box','bookmark']
0
this.mask = $('modalmask');
0
this.progress = $('modal_progress');
0
- this.wrapper = $('modal_html_ap-wrapper');
0
- this.content = $('modal_html_rel-wrapper');
0
+ this.apWrapper = $('modal_html_ap-wrapper');
0
+ this.relWrapper = $('modal_html_rel-wrapper');
0
+ this.topShadow = $('modal_html_top');
0
+ this.content = $('modal_html');
0
+ this.contentFor = 'misc'; // ['box','bookmark']
0
this.queue = {position:'end', scope:'modalscope'};
0
- miscContents: function() { return this.contents == 'misc'; },
0
- boxContents: function() { return this.contents == 'box'; },
0
- bookmarkContents: function() { return this.contents == 'bookmark'; },
0
+ var body = $
$('body').first();
0
var maskHTML = DIV({id:'modalmask',style:'display:none;'},[DIV({id:'modal_progress',style:'display:none;',onclick:'location.reload();'})]);
0
- var modalHTML = DIV({id:'modal_html_ap-wrapper'},[DIV({id:'modal_html_rel-wrapper',style:'display:none;'})]);
0
+ var modalHTML = DIV({id:'modal_html_ap-wrapper'},[
0
+ DIV({id:'modal_html_rel-wrapper',style:'display:none;'},[
0
+ DIV({id:'modal_html_border'},[
0
+ DIV({id:'modal_html'})
0
+ DIV({id:'modal_html_top'})
0
body.insert({top:modalHTML});
0
body.insert({top:maskHTML});
0
+ show: function(contentFor) {
0
+ this.contentFor = contentFor;
0
this.toggleProgress('on');
0
this.toggleObservers('on');
0
+ this.toggleProgress('off');
0
+ this.relWrapper.slideDown({duration:0.4, queue:this.queue});
0
// document.stopObserving('keypress', actionAreaHelper);
0
// if (this.action_bar().hasClassName('barout')) { toggleActionArea('inbox'); }
0
- destroy: function(boxid) {
0
+ updateContent: function() {
0
+ this.topShadow.setStyle({width:this.dimensions().topWidth+'px'});
0
+ this.content.setStyle({width:this.dimensions().contentWidth, height:this.dimensions().contentHeight});
0
+ this.content.update('<div>Hello Modal</div>');
0
+ hide: function(boxid) {
0
this.toggleObservers('off');
0
this.toggleProgress('off');
0
this.toggleMask('off');
0
- centerMask: function() {
0
this.mask.setStyle({height: this.pageSize().height + 'px'});
0
this.progress.setStyle({top: (this.scroll().top + 60) + 'px'});
0
- centerModal: function() {
0
- left = (( this.pageSize().width - this.width() ) / 2).ceil();
0
+ var total = this.pageSize().width - this.dimensions().topWidth;
0
+ var left = (total/2).ceil();
0
if (left < 0) left = 0;
0
- this.
wrapper.setStyle({left: left+'px'});
0
+ this.
apWrapper.setStyle({left:left+'px'});
0
- switch (this.contents) {
0
- case 'misc' : return 450;
0
- case 'box' : return 652;
0
- case 'bookmark' : return 352;
0
+ dimensions: function() {
0
+ switch (this.contentFor) {
0
+ case 'misc' : return { topWidth:452, contentWidth:'400px', contentHeight:'auto' };
0
+ case 'box' : return { topWidth:652, contentWidth:'600px', contentHeight:'300px' };
0
+ case 'bookmark' : return { topWidth:352, contentWidth:'300px', contentHeight:'145px' };
0
// May not need visible check.
0
- if (this.
content.visible()) { this.content.slideUp({duration:0.4, queue:this.queue}); };
0
+ if (this.
relWrapper.visible()) { this.relWrapper.slideUp({duration:0.4, queue:this.queue}); };
0
this.mask.fade({duration:0.2, queue:this.queue});
0
if (event.keyCode == Event.KEY_ESC) { this.destroy(); };
0
- // hideModal: function(boxid) {
0
- // boxid = (boxid == null) ? 'bookmarklet' : boxid;
0
- // Event.stopObserving(document, 'keypress', respondtoKeypress);
0
- // Effect.SlideUp(modalContent, {duration:0.4, queue:{position:'end', scope:'boxid_' + boxid}});
0
- // Effect.Appear(modalProgress, {duration:0.2, from:0.0, to:0.9, queue:{position:'end', scope:'boxid_' + boxid}});
0
- // destroyModalMask: function(boxid) {
0
- // boxid = (boxid == null) ? 'bookmarklet' : boxid;
0
- // Event.stopObserving(window, 'resize', centerStuff);
0
- // Event.stopObserving(window, 'scroll', centerStuff);
0
- // Effect.Fade(modalMask, {duration:0.2, queue:{position:'end', scope:'boxid_' + boxid}});
0
// goHere: function() {
0
// window.location.reload();
Comments
No one has commented yet.