0
var HomeMarksUtilities = {
0
- actionBar: function(request) { return $('action_bar'); },
0
getRequestMood: function(request) {
0
return (request.status >= 200 && request.status < 300) ? 'good' : 'bad';
0
var options = Object.extend({loadId:'form_loading',mood:'good'}, arguments[1] || {});
0
var completeId = 'complete_ajax_form_' + options.loadId;
0
var imgSrc = '/images/'+options.mood+'.png';
0
- var moodHtml = SPAN({id:completeId,class
:'m0 p0'}, [IMG({src:imgSrc})]);
0
+ var moodHtml = SPAN({id:completeId,class
Name:'m0 p0'}, [IMG({src:imgSrc})]);
0
$(options.loadId).update(moodHtml);
0
- setTimeout(function() { $(completeId).
visualEffect('fade') },3000);
0
+ setTimeout(function() { $(completeId).
fade(); },3000);
0
submitSupportForm: function(event) {
0
// WindowUtilities.getPageSize() // => [987,3129]
0
-var
Modal = Class.create(HomeMarksUtilities,{
0
+var
HomeMarksModal = Class.create(HomeMarksUtilities,{
0
- initialize: function(modalFor) {
0
- this.mask = $('modalmask');
0
+ initialize: function(contents) {
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.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
+ this.toggleMask('on');
0
+ this.toggleProgress('on');
0
+ this.toggleObservers('on');
0
+ // document.stopObserving('keypress', actionAreaHelper);
0
+ // if (this.action_bar().hasClassName('barout')) { toggleActionArea('inbox'); }
0
- showProgress: function() {
0
+ destroy: function(boxid) {
0
+ this.toggleObservers('off');
0
+ this.toggleProgress('off');
0
+ this.toggleMask('off');
0
+ // document.observe('keypress', actionAreaHelper);
0
- var maskHTML = DIV({id:'modalmask',style:'display:none;'},[DIV({id:'modal_progress',style:'display:none;'})]);
0
- var modalHTML = DIV({id:'modal_html_ap-wrapper',className:'inhomemarks_site'},[DIV({id:'modal_html_rel-wrapper',style:'display:none;'})]);
0
- // :before => "this.blur(); setupModal(#{box.id})",
0
- // :loading => "Element.show('modal_progress')" )
0
- setupModal: function(boxid) {
0
- boxid = (boxid == null) ? 'bookmarklet' : boxid;
0
- Effect.Appear(modalMask, {duration:0.4, from:0.0, to:0.9, queue:{position:'end', scope:'boxid_' + boxid}});
0
- Event.observe(window, 'resize', centerStuff);
0
- Event.observe(window, 'scroll', centerStuff);
0
- Event.observe(document, 'keypress', respondtoKeypress);
0
- if (typeof($('action_area_shim'))!='undefined') {
0
- Event.stopObserving(document, 'keypress', actionAreaHelper);
0
- if (this.action_bar().hasClassName('barout')) { toggleActionArea('inbox'); }
0
- centerStuff: function() {
0
-
if (this.wrapper.hasClassName('inhomemarks_site')) {this.centerBoxEdit();} else {this.centerBookmarklet();};
0
centerMask: function() {
0
this.progress.setStyle({top: (this.scroll().top + 60) + 'px'});
0
- centerBoxEdit: function() {
0
- modalWrapperLeft = (this.pageSize().width - 652)/2;
0
- if (modalWrapperLeft < 0) modalWrapperLeft = 0;
0
- modalWrapper.setStyle({left: modalWrapperLeft+'px'}) ;
0
+ centerModal: function() {
0
+ left = (( this.pageSize().width - this.width() ) / 2).ceil();
0
+ if (left < 0) left = 0;
0
+ this.wrapper.setStyle({left: left+'px'});
0
- centerBookmarklet: function() {
0
- modalWrapperLeft = (this.pageSize().width - 352)/2;
0
- if (modalWrapperLeft < 0) modalWrapperLeft = 0;
0
- modalWrapper.setStyle({left: modalWrapperLeft+'px'}) ;
0
+ switch (this.contents) {
0
+ case 'misc' : return 450;
0
+ case 'box' : return 652;
0
+ case 'bookmark' : return 352;
0
- destroyModal: function(boxid) {
0
- boxid = (boxid == null) ? 'bookmarklet' : boxid;
0
- Event.stopObserving(window, 'resize', centerStuff);
0
- Event.stopObserving(window, 'scroll', centerStuff);
0
- Event.stopObserving(document, 'keypress', respondtoKeypress);
0
- Effect.SlideUp(modalContent, {duration:0.4, queue:{position:'end', scope:'boxid_' + boxid}});
0
- Effect.Fade(modalMask, {duration:0.2, queue:{position:'end', scope:'boxid_' + boxid}});
0
- Event.observe(document, 'keypress', actionAreaHelper);
0
- respondtoKeypress: function(event) {
0
- if ($('modal_html_ap-wrapper').hasClassName('inhomemarks_site')) {
0
- boxidstring = $('modal_button_cancel').classNames().toString();
0
- boxid = boxidstring.gsub('cancel_modalbox_','');
0
- if (event.keyCode == Event.KEY_ESC) destroyModal(boxid);
0
+ toggleMask: function(toggle) {
0
+ this.mask.appear({duration:0.4, from:0.0, to:0.9, queue:this.queue});
0
- if (event.keyCode == Event.KEY_ESC) destroyModal();
0
+ // May not need visible check.
0
+ if (this.content.visible()) { this.content.slideUp({duration:0.4, queue:this.queue}); };
0
+ this.mask.fade({duration:0.2, queue:this.queue});
0
+ toggleObservers: function(toggle) {
0
+ Event.observe(window, 'resize', this.center.bindAsEventListener(this));
0
+ Event.observe(window, 'scroll', this.center.bind(this));
0
+ document.observe('keypress', this.keypress.bind(this));
0
+ Event.stopObserving(window, 'resize', this.center);
0
+ Event.stopObserving(window, 'scroll', this.center);
0
+ document.stopObserving('keypress', this.keypress);
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
+ toggleProgress: function(toggle) {
0
+ var options = {duration:0.2, queue:this.queue}
0
+ if (toggle == 'on') { this.progress.appear(options); } else { this.progress.fade(options); };
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
+ keypress: function(event) {
0
+ if (event.keyCode == Event.KEY_ESC) { this.destroy(); };
0
- window.location.reload();
0
+ var maskHTML = DIV({id:'modalmask',style:'display:none;'},[DIV({id:'modal_progress',style:'display:none;'})]);
0
+ var modalHTML = DIV({id:'modal_html_ap-wrapper'},[DIV({id:'modal_html_rel-wrapper',style:'display:none;'})]);
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();
0
document.observe('dom:loaded', function(){
0
HmSite = new HomeMarksSite();
0
+ // HmModal = new HomeMarksModal();
0
-/* General Application Wide Functions
0
- * ----------------------------------------------------------------------------------------------------------------- */
0
+// /* General Application Wide Functions
0
+// * ----------------------------------------------------------------------------------------------------------------- */
0
+// Event.observe(document, 'keypress', actionAreaHelper);
0
+// function actionAreaHelper(event) { if (event.charCode == 96) {toggleActionArea('inbox')}; };
0
+// function globalLoadingBehavior() {
0
+// $('hud').classNames().set('');
0
+// Element.show('loading');
0
+// Element.update('message_wrapper', '<span id="message"> </span>');
0
+// function loadLameActionSpan(boxid,direction) {
0
+// if (direction == 'down') { spanclass = 'box_action box_action_down' }
0
+// if (direction == 'up') { spanclass = 'box_action' }
0
+// Element.replace('boxid_'+boxid+'_action_alink', '<span class="'+spanclass+'" id="boxid_'+boxid+'_action_lame"></span>')
0
+// function remoteFormLoading(formobj,loadid) {
0
+// loadid = (loadid == null) ? 'form_loading' : loadid;
0
+// if (formobj.id == 'request_support_form') {loadimg=''} else {loadimg='_invert'};
0
+// Element.update($(loadid),'<img src="/images/loading'+loadimg+'.gif" />');
0
+// Form.disable(formobj);
0
-Event.observe(document, 'keypress', actionAreaHelper);
0
-function actionAreaHelper(event) { if (event.charCode == 96) {toggleActionArea('inbox')}; };
0
-function globalLoadingBehavior() {
0
- $('hud').classNames().set('');
0
- Element.show('loading');
0
- Element.update('message_wrapper', '<span id="message"> </span>');
0
+// /* Custom sortable serialize params Column#sort
0
+// * ----------------------------------------------------------------------------------------------------------------- */
0
+// function findSortedInfo(obj) {
0
+// pg_sortable_id = obj.element.id;
0
+// pg_lastvalues = $A(obj.lastValue.gsub(/col_wrapper\[\]=/i,'').split('&'));
0
+// pg_sortable_seq = $A(Sortable.sequence(pg_sortable_id));
0
+// if (pg_lastvalues.length == pg_sortable_seq.length) { // Find the column info within the sortable.
0
+// pg_lastvalues.each(function(v,i) {
0
+// if (v != pg_sortable_seq[i]) {
0
+// /* Check to see if the bookmark was moved down */
0
+// if (pg_lastvalues[i+1] == pg_sortable_seq[i]) { col_id=v; col_position=pg_sortable_seq.indexOf(v)+1; };
0
+// /* Check to see if the bookmark was moved up */
0
+// if (pg_lastvalues[i] == pg_sortable_seq[i+1]) { col_id=pg_sortable_seq[i]; col_position=i+1; };
0
+// return 'col_id='+col_id+'&col_position='+col_position;
0
+// else { return false; }
0
-function loadLameActionSpan(boxid,direction) {
0
- if (direction == 'down') { spanclass = 'box_action box_action_down' }
0
- if (direction == 'up') { spanclass = 'box_action' }
0
- Element.replace('boxid_'+boxid+'_action_alink', '<span class="'+spanclass+'" id="boxid_'+boxid+'_action_lame"></span>')
0
-function remoteFormLoading(formobj,loadid) {
0
- loadid = (loadid == null) ? 'form_loading' : loadid;
0
- if (formobj.id == 'request_support_form') {loadimg=''} else {loadimg='_invert'};
0
- Element.update($(loadid),'<img src="/images/loading'+loadimg+'.gif" />');
0
- Form.disable(formobj);
0
+// /* Custom sortable serialize params Box#sort
0
+// * ----------------------------------------------------------------------------------------------------------------- */
0
+// function findDroppedBoxInfo(obj) {
0
+// col_sortable_id = obj.element.id;
0
+// col_sortable_id_num = col_sortable_id.gsub(/col_/i,'');
0
+// col_empty = obj.lastValue.length == 0 ? true : false ;
0
+// col_lastvalues = $A(obj.lastValue.gsub(/(col_\d+)\[\]=/i,'').split('&'));
0
+// col_sortable_seq = $A(Sortable.sequence(col_sortable_id));
0
+// if ((col_lastvalues.length == col_sortable_seq.length) && !col_empty) { // Find the box info within the sortable.
0
+// col_internal_sort = true; col_lost_box = false;
0
+// col_lastvalues.each(function(v,i) {
0
+// if (v != col_sortable_seq[i]) {
0
+// /* Check to see if the box was moved down */
0
+// if (col_lastvalues[i+1] == col_sortable_seq[i]) { box_id=v; box_position=col_sortable_seq.indexOf(v)+1; };
0
+// /* Check to see if the box was moved up */
0
+// if (col_lastvalues[i] == col_sortable_seq[i+1]) { box_id=col_sortable_seq[i]; box_position=i+1; };
0
+// else { // Find the new or lost box info.
0
+// col_internal_sort = false;
0
+// col_lost_box = col_lastvalues.length > col_sortable_seq.length ? true : false ;
0
+// /* Column's with a lost box is ignored by the server. */
0
+// if (col_lost_box == true) { box_id = 'na' ; box_position = 'na' ; }
0
+// /* Column with no boxes now gaining one. */
0
+// else if (col_empty) { box_id = col_sortable_seq[0] ; box_position = 1 ; }
0
+// col_long_array = col_lastvalues.length > col_sortable_seq.length ? col_lastvalues : col_sortable_seq ;
0
+// col_short_array = col_lastvalues.length < col_sortable_seq.length ? col_lastvalues : col_sortable_seq ;
0
+// col_long_array.each(function(v,i) {
0
+// if (v != col_short_array[i]) { box_id=v; box_position=i+1; throw $break; };
0
+// return 'internal_sort='+col_internal_sort+'&lost_box='+col_lost_box+'&col_id='+col_sortable_id_num+'&box_id='+box_id+'&box_position='+box_position
0
-/* Custom sortable serialize params Column#sort
0
- * ----------------------------------------------------------------------------------------------------------------- */
0
-function findSortedInfo(obj) {
0
- pg_sortable_id = obj.element.id;
0
- pg_lastvalues = $A(obj.lastValue.gsub(/col_wrapper\[\]=/i,'').split('&'));
0
- pg_sortable_seq = $A(Sortable.sequence(pg_sortable_id));
0
- if (pg_lastvalues.length == pg_sortable_seq.length) { // Find the column info within the sortable.
0
- pg_lastvalues.each(function(v,i) {
0
- if (v != pg_sortable_seq[i]) {
0
- /* Check to see if the bookmark was moved down */
0
- if (pg_lastvalues[i+1] == pg_sortable_seq[i]) { col_id=v; col_position=pg_sortable_seq.indexOf(v)+1; };
0
- /* Check to see if the bookmark was moved up */
0
- if (pg_lastvalues[i] == pg_sortable_seq[i+1]) { col_id=pg_sortable_seq[i]; col_position=i+1; };
0
- return 'col_id='+col_id+'&col_position='+col_position;
0
- else { return false; }
0
+// /* Custom sortable serialize params Bookmark#sort
0
+// * ----------------------------------------------------------------------------------------------------------------- */
0
+// function findDroppedBookmarkInfo(obj) {
0
+// sortable_id = obj.element.id;
0
+// sortable_id_num = sortable_id.gsub(/boxid_list_/i,'');
0
+// box_type = findSortableBoxType(sortable_id_num);
0
+// box_empty = obj.lastValue.length == 0 ? true : false ;
0
+// lastvalues = $A(obj.lastValue.gsub(/(boxid_list_\d+|inbox_list|trashbox_list)\[\]=/i,'').split('&'));
0
+// sortable_seq = $A(Sortable.sequence(sortable_id));
0
+// if ((lastvalues.length == sortable_seq.length) && !box_empty) { // Find the bookmark info within the sortable.
0
+// internal_sort = true; lost_bmark = false; bmark_scope = box_type;
0
+// lastvalues.each(function(v,i) {
0
+// if (v != sortable_seq[i]) {
0
+// /* Check to see if the bookmark was moved down */
0
+// if (lastvalues[i+1] == sortable_seq[i]) { bmark_id=v; bmark_position=sortable_seq.indexOf(v)+1; };
0
+// /* Check to see if the bookmark was moved up */
0
+// if (lastvalues[i] == sortable_seq[i+1]) { bmark_id=sortable_seq[i]; bmark_position=i+1; };
0
+// else { // Find the new or lost bookmark info.
0
+// internal_sort = false;
0
+// lost_bmark = lastvalues.length > sortable_seq.length ? true : false ;
0
+// /* Box's with a lost bookmark are ignored by the server. */
0
+// if (lost_bmark == true) { bmark_id = 'na' ; bmark_position = 'na' ; bmark_scope = 'na'; }
0
+// /* Box with no bookmarks now gaining one. */
0
+// else if (box_empty) { bmark_id = sortable_seq[0] ; bmark_position = 1 ; bmark_scope = findBmarkScope(box_type,sortable_id); }
0
+// long_array = lastvalues.length > sortable_seq.length ? lastvalues : sortable_seq ;
0
+// short_array = lastvalues.length < sortable_seq.length ? lastvalues : sortable_seq ;
0
+// long_array.each(function(v,i) {
0
+// if (v != short_array[i]) { bmark_id=v; bmark_position=i+1; throw $break; };
0
+// bmark_scope = findBmarkScope(box_type,sortable_id);
0
+// return 'internal_sort='+internal_sort+'&lost_bmark='+lost_bmark+'&box_type='+box_type+'&sortable_id='+sortable_id_num+'&bmark_id='+bmark_id+'&bmark_position='+bmark_position+'&bmark_scope='+bmark_scope
0
+// function findSortableBoxType(sortable_id_num) {
0
+// if (sortable_id_num == 'inbox_list') { return 'inbox'; }
0
+// else if (sortable_id_num == 'trashbox_list') { return 'trashbox'; }
0
+// else { return 'box'; }
0
+// function findBmarkScope(box_type, sortable_id) {
0
+// if (box_type == 'box') {
0
+// if ($('inbox_list').visible() && sortableHasClass(sortable_id,'inbox')) {return 'inbox'}
0
+// else if ($('trashbox_list').visible() && sortableHasClass(sortable_id,'trashbox')) {return 'trashbox'}
0
+// function sortableHasClass(sortable_id, css_class) {
0
+// $A($(sortable_id).childNodes).each(function(li) {
0
+// if (li.hasClassName(css_class)) {css_check=true; throw $break;}
0
-/* Custom sortable serialize params Box#sort
0
- * ----------------------------------------------------------------------------------------------------------------- */
0
-function findDroppedBoxInfo(obj) {
0
- col_sortable_id = obj.element.id;
0
- col_sortable_id_num = col_sortable_id.gsub(/col_/i,'');
0
- col_empty = obj.lastValue.length == 0 ? true : false ;
0
- col_lastvalues = $A(obj.lastValue.gsub(/(col_\d+)\[\]=/i,'').split('&'));
0
- col_sortable_seq = $A(Sortable.sequence(col_sortable_id));
0
- if ((col_lastvalues.length == col_sortable_seq.length) && !col_empty) { // Find the box info within the sortable.
0
- col_internal_sort = true; col_lost_box = false;
0
- col_lastvalues.each(function(v,i) {
0
- if (v != col_sortable_seq[i]) {
0
- /* Check to see if the box was moved down */
0
- if (col_lastvalues[i+1] == col_sortable_seq[i]) { box_id=v; box_position=col_sortable_seq.indexOf(v)+1; };
0
- /* Check to see if the box was moved up */
0
- if (col_lastvalues[i] == col_sortable_seq[i+1]) { box_id=col_sortable_seq[i]; box_position=i+1; };
0
- else { // Find the new or lost box info.
0
- col_internal_sort = false;
0
- col_lost_box = col_lastvalues.length > col_sortable_seq.length ? true : false ;
0
- /* Column's with a lost box is ignored by the server. */
0
- if (col_lost_box == true) { box_id = 'na' ; box_position = 'na' ; }
0
- /* Column with no boxes now gaining one. */
0
- else if (col_empty) { box_id = col_sortable_seq[0] ; box_position = 1 ; }
0
- col_long_array = col_lastvalues.length > col_sortable_seq.length ? col_lastvalues : col_sortable_seq ;
0
- col_short_array = col_lastvalues.length < col_sortable_seq.length ? col_lastvalues : col_sortable_seq ;
0
- col_long_array.each(function(v,i) {
0
- if (v != col_short_array[i]) { box_id=v; box_position=i+1; throw $break; };