home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2011 February / maximum-cd-2011-02.iso / DiscContents / digsby_setup85.exe / lib / plugins / myspace / res / infobox.js < prev    next >
Encoding:
JavaScript  |  2010-07-29  |  21.1 KB  |  640 lines

  1. var transitionDefault = 200;
  2.  
  3. var fxAttrs = [
  4.     // height animations
  5.     [ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ],
  6.     // width animations
  7.     [ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ],
  8.     // opacity animations
  9.     [ "opacity" ]
  10. ];
  11.  
  12. function ms_clear_error(callback){
  13.     error = $(".activity-data").find('.error_section');
  14.     var do_clear = function (){
  15.         error.html('');
  16.         if (callback){ callback(); };
  17.     }
  18.     do_clear();
  19.     if (error.css('display') === 'block'){
  20.         error.slideUp(transitionDefault / 2);
  21.     } else if (!error.css('display')) {
  22.         error.css('display', 'none');
  23.         //do_clear();
  24.     } else {
  25.         //do_clear();
  26.     }
  27. }
  28.  
  29. function genFx( type, num ){
  30.     var obj = {};
  31.     jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function(){
  32.         obj[ this ] = type;
  33.     });
  34.     return obj;
  35. }
  36.  
  37. var MS_SLIDE_UP = genFx('hide', 1);
  38.  
  39. var ms_commentFieldPadding;
  40.  
  41. $(function(){
  42.     var t = $("<textarea/>").css({'position':'fixed', 'right':'-500px', 'bottom':'-500px'}).appendTo(document.body);
  43.     ms_commentFieldPadding =  t.outerWidth() - t.width();
  44.     t.remove();
  45. })
  46.  
  47. function ms_hide_this_comment_box(self, animate) {
  48.     if (animate === undefined)
  49.         animate = true;
  50.  
  51.     if (self === undefined){
  52.         alert('need self')
  53.     } else {
  54.         var me2 = $(self);
  55.     }
  56.     var comment_box_disabled = $(me2.parents(".activity-data")[0]).find('[name="comment_input"]')[0].disabled;
  57.     if (!comment_box_disabled){
  58.         me2.parents(".activity-data").find('.likes_comments_section').css('-webkit-user-select','none');
  59.         var end2 = $(me2.parents(".activity-data")[0]).find(".comments_end");
  60.         var comment_button_section = me2.parents(".activity-data").find(".comment_button_section");
  61.         var likes_comment_section = me2.parents('.activity-data').find('.comments_section');
  62.         var time = animate ? transitionDefault : 0;
  63.         if (time) {
  64.             end2.animate(MS_SLIDE_UP, {queue:false, duration:time});
  65.             offset_top = me2.parents(".activity-data").offset().top;
  66.             var pageYOffset = window.pageYOffset;
  67.             var offsetHeight = document.body.offsetHeight;
  68.             if (offset_top < pageYOffset){
  69.                 $('html, body').animate({
  70.                     scrollTop: offset_top
  71.                 }, {queue:false, duration:time});
  72.             }
  73.             likes_comment_section.slideUp(time, function(){
  74.                 likes_comment_section.css('-webkit-user-select','text');
  75.             });
  76.             comment_button_section.show();
  77.         } else {
  78.             end2.hide();
  79.             comment_button_section.show();
  80.             likes_comment_section.hide();
  81.             likes_comment_section.css('-webkit-user-select','text');
  82.         }
  83.     }
  84.     return false;
  85. };
  86.  
  87. function ms_error_text(self, text, error_obj, callback){
  88.     error = $(self).parents(".activity-data").find('.error_section');
  89.     if (error_obj !== undefined && error_obj !== null) {
  90.         if (error_obj.error_msg) {
  91.             text += " "  + error_obj.error_msg;
  92.         }
  93.         if (error_obj.permissions) {
  94.             text += ' - <a href="javascript:null;" title="Opens a login window at myspace.com" class="do_permissions">Grant Permission</a>'
  95.         };
  96.  
  97.     }
  98.     console.log("text =  " + text);
  99.     error.html(text);
  100.     if (error.css('display') === 'none'){
  101.         error.slideDown(transitionDefault, callback);
  102.         return; // don't call callback, slideDown will do it.
  103.     } else if (!error.css('display')) {
  104.         error.css('display', 'block');
  105.     }
  106.  
  107.     if (callback){
  108.         callback();
  109.     };
  110. }
  111.  
  112. function comments_updater(self, slide, clear_error) {
  113.     return function(args) {
  114.         var comments_html = $($(args.comments_html)[0]);
  115.         var bottom_row_html = $($(args.bottom_row_html)[0]);
  116.         comments = $(comments_html[0]).find(".comment");
  117.  
  118.         if ((comments.length) && (slide == "new")) {
  119.             new_comment = $(comments[comments.length-1]);
  120.             new_comment.hide();
  121.         } else {
  122.             new_comment = null;
  123.         }
  124.         bottom_row_html.find(".comment_button_section").hide();
  125.         var old_comments_section = $(self).parents('.activity-data').find('.comments_section');
  126.         old_comments_section.find(".likes")   .replaceWith(comments_html.find(".likes"));
  127.         old_comments_section.find(".dislikes").replaceWith(comments_html.find(".dislikes"));
  128.         old_comments_section.find(".comments").replaceWith(comments_html.find(".comments"));
  129.         //only want the "Comment ()" chunk, not the "()" after likes -----v
  130.         var old_bottom_row = $(self).parents(".activity-data").find('.bottom_row');
  131.         $(old_bottom_row.find(".comment_button_section")[0]).replaceWith($(bottom_row_html.find(".comment_button_section")[0]));
  132.         old_bottom_row.find(".like_link_block").replaceWith(bottom_row_html.find(".like_link_block"));
  133.         old_bottom_row.find(".dislike_link_block").replaceWith(bottom_row_html.find(".dislike_link_block"));
  134.         ms_init($($(self).parents(".activityItem")[0]).find(".comment_block"));
  135.         comment_box = $($(self).parents(".form_wrapper")[0]).find("textarea[name='comment_input']");
  136.  
  137.         if (slide == "new") {
  138.             slide_element = new_comment;
  139.         } else if (slide == "all") {
  140.             slide_element = comments;
  141.         }
  142.  
  143.         if (clear_error) {
  144.             ms_clear_error(function(){
  145.                 slide_element.slideDown(transitionDefault, function(){
  146.                     $($(self).parents(".form_wrapper")[0]).find('.loader_img').remove();
  147.                     comment_box[0].value = '';
  148.                     comment_box[0].disabled = false;
  149.                     comment_box.jGrow();
  150.                 });
  151.             });
  152.         }
  153.         comment_box.focus();
  154.     };
  155. }
  156.  
  157. var ms_post_comment = function (self){
  158.     self.disabled = true;
  159.     var comment_box = $(self);
  160.     var comment = $(self).attr('value');
  161.     var post_id = $($(self).parents(".activityItem")[0]).attr('id');
  162.     $($(self).parents(".form_wrapper")[0]).append(loader_img);
  163.     D.rpc('post_comment', {'comment':comment, 'post_id':post_id},
  164.             comments_updater(self, "new", true),
  165.             function(error_obj){
  166.                 ms_error_text(comment_box, 'Error posting comment.', error_obj, function(){
  167.                     $($(self).parents(".form_wrapper")[0]).find('.loader_img').remove();
  168.                     comment_box[0].disabled = false;
  169.                     comment_box.focus();
  170.                 });
  171.             }
  172.         );
  173.     return false;
  174. }
  175. var ms_show_comment_box = function(self){
  176.     var me = $(self);
  177.     ms_clear_error();
  178.     me.parents(".activity-data").find('.comment_button_section').hide(); // placeholder
  179.     me.parents(".activity-data").find('.comments_section').css('-webkit-user-select','none');
  180.  
  181.     var end = me.parents(".activity-data").find(".comments_end");
  182.     var txt;
  183.  
  184.     if (end.find(".form_wrapper").length == 0){
  185.         end.html('<div class="form_wrapper"><textarea name="comment_input" rows="1" class="input_area expanding minor_border"/></div>');
  186.         txt = end.find('textarea');
  187.  
  188.         var haveFocus = false;
  189.         var blurFunc = function(animate) {
  190.             if (!haveFocus) {
  191.                 return true;
  192.             }
  193.             haveFocus = false;
  194.  
  195. //            if ($(txt).parents(".post_row").hasClass('mouseover')){
  196. //                return true;
  197. //            }
  198.             $(txt).unbind('keydown', 'esc');
  199.             $(txt).unbind('keydown', 'shift+return');
  200.             $(txt).unbind('keydown', 'return');
  201.             
  202.             ms_hide_this_comment_box(txt, animate);
  203.             ms_clear_error();
  204.  
  205.             return true; //blur should continue, so that we don't keep focus and possibly trigger another blur event.
  206.         }
  207.  
  208.         $(txt.parents('.form_wrapper')[0]).css('padding-right', ms_commentFieldPadding);
  209.  
  210.         txt.focus( function() {
  211.             if (haveFocus) {
  212.                 return true;
  213.             }
  214.             haveFocus = true;
  215.             $(this).bind('keydown', 'esc', function(){ txt.blur(); });
  216.             $(this).bind('keydown', 'shift+return', function(){
  217.                 var start = this.selectionStart;
  218.                 var end   = this.selectionEnd;
  219.                 this.value = this.value.substr(0, start)
  220.                     + '\n'
  221.                     + this.value.substr(end, this.value.length);
  222.                 this.selectionStart = start + 1;
  223.                 this.selectionEnd = start + 1;
  224.                 return false;
  225.             });
  226.             $(this).bind('keydown', 'return', function(){
  227.                 if (this.value && !this.disabled) {
  228.                     ms_post_comment(this);
  229.                 } else {
  230.                     //ms_hide_this_comment_box();
  231.                 }
  232.                 return false;
  233.             });
  234.             // When hiding the infobox, blur any active textboxes.
  235.             //TODO: fix/create the necessary functions so that things that don't need to happen don't
  236.             swapOut(function() { blurFunc(false); });
  237.             onHide(function() { blurFunc(false); });
  238.         });
  239.  
  240.         txt.blur(blurFunc);
  241.     }
  242.     txt = end.find('textarea');
  243. //    txt.parents('.activity-data').find('.comment_block, .likes').show();
  244.     txt.parents('.activity-data').find('.comments_section').slideDown(transitionDefault/2, function(){
  245.         end.slideDown(transitionDefault/2, function(){
  246.             txt.jGrow();
  247.             txt.focus();
  248.             //me.parents('.activity-data').find('.comments_section').show();
  249.             me.parents(".activity-data").find('.comments_section').css('-webkit-user-select','text');
  250.         });
  251.     });
  252.     txt.focus();
  253.  
  254.     comment_textfield = txt[0];
  255.     comment_textfield.disabled = true;
  256.  
  257.     post_id = $(self).parents(".activityItem[id]").attr("id");
  258.     D.rpc("load_comments",
  259.           {'post_id':post_id},
  260.           function (args) {
  261.             comments_updater(self, "all")(args);
  262.             comment_textfield.disabled = false;
  263.             txt.focus();
  264.           },
  265.           function(error_obj){
  266.                 if (error_obj.error_msg == "no_change") {
  267.                   comment_textfield.disabled = false;
  268.                   txt.focus();
  269.                   return;
  270.                 }
  271.                 ms_error_text(comment_textfield, 'Error retrieving comments.', error_obj,
  272.                   function(){
  273.                     $($(self).parents(".form_wrapper")[0]).find('.loader_img').remove();
  274.                     comment_textfield.disabled = true;
  275.                     me.parents(".activity-data").find('.comment_button_section').show();
  276.                     txt.slideUp();
  277.                 });
  278.             }
  279.         );
  280.     return false;
  281. }
  282.  
  283. function ms_liked(like, args) {
  284.     var me = args.me;
  285.     var item_html = $(args['item_html']);
  286.     ms_clear_error(function(){
  287.         ms_init(item_html);
  288.         me.parents('.activityItem').replaceWith(item_html);
  289.     });
  290. }
  291.  
  292. function ms_like_button_mousedown(e) {
  293.     var like = null;
  294.     if ($(e.target).hasClass("like_button")) {
  295.         like = "like";
  296.     } else if ($(e.target).hasClass("dislike_button")) {
  297.         like = "dislike";
  298.     }
  299.  
  300.     if (like == null) {
  301.         return false;
  302.     }
  303.  
  304.     me = $(this);
  305.     me.parents('.activityItem').find('.' + like + '_link_block').hide();
  306.     var post_id = $(me.parents(".activityItem")[0]).attr('id');
  307.     console.log("post id = " + post_id);
  308.     D.rpc('do_' + like, {"post_id":post_id},
  309.         function(args) {
  310.             args.me = me;
  311.             return ms_liked(like, args);
  312.         },
  313.         function(error_obj){
  314.             var msg = 'Error adding ' + like + '.';
  315.             ms_error_text(me, msg, error_obj, function(){
  316.                 me.parents('.activityItem').find('.' + like + '_link_block').show();
  317.             });
  318.         }
  319.     );
  320.     return false;
  321. }
  322.  
  323. var ms_comment_button_mousedown = function(){ ms_show_comment_box(this); return true;}
  324.  
  325. function change_photo_hrefs(tree) {
  326.  tree.find("a.Photo").each(function() {
  327.   if ($(this).attr("context")) {
  328.    // already been here!
  329.    return;
  330.   }
  331.   var img_child = $($(this).find("img")[0])
  332.   var img_src_small = img_child.attr("src");
  333.   var url_parts = img_src_small.split("/");
  334.  
  335.   var filename = url_parts.pop();
  336.   var new_filename = "l_" + filename.substr(2);
  337.   url_parts.push(new_filename);
  338.  
  339.   var img_src_large = url_parts.join("/");
  340.  
  341.   img_child.attr("longdesc", img_src_large);
  342.   var old_link = $(this).attr("href");
  343.   $(this).attr("context", old_link);
  344.   $(this).attr("href", img_src_large);
  345.  
  346.  })
  347. }
  348.  
  349. var LIGHTBOX_OPTIONS = {
  350.     changeCounterAfterSlide: false,
  351.     wrapNav: true,
  352.     imageDir: LIGHTBOX_IMAGE_DIR,
  353.     dataBoxFirst: true,
  354.     containerBorderSize: 0,
  355.     fixedDataBox: true,
  356.     clickLoadingClose: false,
  357.     clickBoxClose: false,
  358.     txtImage: "",
  359.     txtOf: "/",
  360.     //imageContext: 'popout.gif',
  361.     showContext: true,
  362.     forceTitleBar: true,
  363.     parentSelector: "#myspace-activities",
  364.     onShowFunction: function(){ D.notify('hook', 'digsby.myspace.photo_seen') },
  365. }
  366.  
  367. function lightbox_galleries(tree) {
  368.  tree.find(".ActivityTemplateMediaGallery").each(function () {
  369.      $(this).find("a.Photo").lightBox(LIGHTBOX_OPTIONS);
  370.   });
  371. }
  372.  
  373. /*
  374. function lightbox_galleries(tree) {
  375.  tree.find(".ActivityTemplateMediaGallery").each(function () {
  376.      $(this).find("a.Photo > img").fullsize({forceTitleBar: true});
  377.   });
  378. }
  379. */
  380.  
  381. // image sizing
  382. function setup_dynamic_sized_images(tree) {
  383.         var suggested_max = 64;
  384.         tree.find(".thumbnailImage").bind("load", function(){
  385.  
  386.             var imgs = $($(this).parents(".activityMedia")[0]).find(".thumbnailImage[complete=true]")
  387.             var max = suggested_max;
  388.             var extra_height = 0;
  389.             if (imgs.length > 0){
  390.              for (var i = 0; i < imgs.length; i++){
  391.               img = imgs[i];
  392.               extra_height = Math.max(img.offsetHeight - img.naturalHeight, 0);
  393.               if (img.width > img.height) {
  394.                max = Math.min(img.naturalHeight, Math.min(max, suggested_max));
  395.               } else {
  396.                max = Math.min(max,
  397.                       Math.min(img.naturalHeight,
  398.                        Math.max(max,
  399.                         Math.max(Math.round(img.naturalHeight/(img.naturalWidth/suggested_max)), suggested_max))));
  400.               }
  401.              };
  402.              if (max > 0) {
  403.               imgs.css({"max-height": max + "px", "visibility":"visible"});
  404.               $(this).parents(".activityMedia").css({"height" : (max+extra_height)+"px"});
  405.               //$(this).parents(".activityPreviews").hide();
  406.              }
  407.             };
  408.             $(this).show();
  409.         })
  410. };
  411.  
  412. function hide_images(tree) {
  413.         if (!tree) tree = $();
  414.         var pix = tree.find(".thumbnailImage");
  415.         pix.hide();
  416.         pix.css({'max-width':'100%'});
  417. };
  418.  
  419. _LOCAL_TIMEZONE = (new Date()).getTimezoneOffset() * 60 * 1000; // TimezoneOffset is returned in minutes
  420.  
  421.  
  422. var TODAY_TEXT = "";
  423.  
  424. function add_major_to_appActivity(tree) {
  425.     tree.find(".activityHeader").each(function() {
  426.        $(this).addClass("major");
  427.     });
  428. };
  429.  
  430. function on_click_activity_preview_toggle(e) {
  431.  previews = $(document.getElementById(e.attributes["for"].value));
  432.  
  433.  if (previews.is(":hidden")) {
  434.   $(e).text("-");
  435.  } else {
  436.   $(e).text("+");
  437.  }
  438.  
  439.  previews.toggle();
  440. }
  441.  
  442. function add_border_to_tables(tree){
  443.  if (!tree) tree = $();
  444.  tree.find("table").attr("border", 1);
  445. }
  446.  
  447. var DIGSBY_UTM = "utm_source=Digsby&utm_medium=MID&utm_campaign=Digsby_v1";
  448.  
  449. function add_digsby_utm_to_links(tree) {
  450.  tree.find("a").each(function() {
  451.  var href = $(this).attr("href");
  452.   if (href.match("^http")) {
  453.    var newval = href;
  454.    if (newval.indexOf("?") > -1) {
  455.     newval += "&";
  456.    } else {
  457.     newval += "?";
  458.    }
  459.    newval += DIGSBY_UTM;
  460.    $(this).attr("href", newval);
  461.   }
  462.  });
  463. }
  464.  
  465. function near_bottom() {
  466.     return ( window.pageYOffset >= ( document.body.offsetHeight - ( window.innerHeight * 2.0 ) ) );
  467. }
  468.  
  469. var inited = false;
  470. var active = false;
  471. var scrollRequestOutstanding = false;
  472.  
  473. var myName = currentContentName;
  474.  
  475. D.notify('initialize_feed');
  476.  
  477. function ms_on_scroll() {
  478.     if (!inited || myName !== currentContentName){
  479.         console.log('ms_on_scroll ' + myName + ' shortcircut1: ' + currentContentName);
  480.         return;
  481.     }
  482.     if (scrollRequestOutstanding){
  483.         return;
  484.     }
  485.     scrollRequestOutstanding = true;
  486.     if (!(active && near_bottom())) {
  487.         scrollRequestOutstanding = false;
  488.         return;
  489.     }
  490.     rows = $(".activityItem");
  491.     var parent = $($(".activitiesContainer")[0]);
  492.     var rows = parent.find(".activityItem");
  493.     last_item_id = $(rows[rows.length-1]).attr('id');
  494.  
  495.     D.rpc('next_item',
  496.         {},
  497.         function (args) {
  498.             if (!scrollRequestOutstanding)
  499.                 return;
  500.             if (!inited || myName !== currentContentName){
  501.                 console.log('ms_on_scroll ' + myName + ' shortcircut2: ' + currentContentName);
  502.                 scrollRequestOutstanding = false;
  503.                 return;
  504.             }
  505.             var dateparent = $('<div></div>');
  506.             dateparent.append(args.html);
  507.             var rows2 = dateparent.find('.activityItem');
  508.  
  509.             ms_maybe_add_date_separators(rows, rows2);
  510.             html = dateparent.contents().remove();
  511.             html.remove();
  512.             dateparent.remove();
  513.             ms_init(html);
  514.             html.appendTo(parent);
  515.             scrollRequestOutstanding = false;
  516.             on_scroll();
  517.         },
  518.         function (args) {
  519.             console.log("error with rpc thing:" + args);
  520.         }
  521.     );
  522. }
  523.  
  524. var on_scroll = ms_on_scroll;
  525.  
  526. _myspace_positioned_no_news = false;
  527.  
  528. swapIn(function () {
  529. //    if (!_myspace_positioned_no_news) {
  530. //        _myspace_positioned_no_news = true;
  531. //        $(".no-news-today").insertBefore($(".date-separator:not(.static,.today)")[0]);
  532. //    }
  533. });
  534.  
  535. function destroy_lightbox() {
  536.     var lb = window._activeLightBox;
  537.     if (lb != null) {
  538.         console.log('LB.DESTROY');
  539.         lb.destroy();
  540.     }
  541. }
  542.  
  543.  
  544. swapOut(destroy_lightbox);
  545. onHide(destroy_lightbox);
  546. //onHide(function() { console.log("*** myspace onHide"); });
  547.  
  548.  
  549. /*
  550.  
  551. D.rpc("something", {arg1:something, arg2:something}, function (args){ success;}, function (args){error;});
  552.  
  553. */
  554.  
  555. function do_permissions(){
  556.     D.notify('do_permissions');
  557. }
  558.  
  559. function ms_false() {
  560.     return false;
  561. }
  562. swapIn(function(){
  563.     active = true;
  564.     $(".do_permissions").live("click", do_permissions);
  565.     $(".do_permissions").live("mousedown", ms_false);
  566.     $(".like_button").live("mousedown", ms_false);
  567.     $(".like_button").live("click", ms_like_button_mousedown);
  568.     $(".dislike_button").live("mousedown", ms_false);
  569.     $(".dislike_button").live("click", ms_like_button_mousedown);
  570.  
  571. });
  572.  
  573. swapOut(function(){
  574.     active = false;
  575.     $(".do_permissions").die("click", do_permissions);
  576.     $(".do_permissions").die("mousedown", ms_false);
  577.     $(".like_button").die("mousedown", ms_false);
  578.     $(".like_button").die("click", ms_like_button_mousedown);
  579.     $(".dislike_button").die("mousedown", ms_false);
  580.     $(".dislike_button").die("click", ms_like_button_mousedown);
  581.  
  582. });
  583.  
  584. //$(add_border_to_tables);
  585. //swapOut(clear_previous_time_containers);
  586. //swapIn(function () {add_time_containers(".activityHeader");});
  587.  
  588. function ms_maybe_add_date_separators(rows1, rows2, today) {
  589.     if (today === null || today === undefined) {
  590.         today = get_today();
  591.     }
  592.     var current_time_period = null;
  593.  
  594.     if (rows1.length > 0) {
  595.         current_time_period = relevant_time_diff(_get_timestamp(rows1[rows1.length-1]), today);
  596.     }
  597.  
  598.     for (var i = 0; i < rows2.length; i++) {
  599.         var time_period = relevant_time_diff(_get_timestamp(rows2[i]), today);
  600.         if ((!current_time_period) ||
  601.             (time_period.valueOf() != current_time_period.valueOf())) {
  602.              first_event_of_time_period = rows2[i];
  603.              _insert_separator(rows2[i], time_period, TODAY_TEXT, today, false, (!current_time_period));
  604.              current_time_period = time_period;
  605.         }
  606.     }
  607. }
  608.  
  609. swapOut(function() {console.log('*** myspace SWAP OUT'); });
  610. swapIn(function() {console.log('*** myspace SWAP IN'); });
  611.  
  612. function ms_init(tree){
  613.     if (!tree) {
  614.         if (inited) {
  615.             return;
  616.         }
  617.         inited = true;
  618.         tree = $();
  619.     }
  620.     clip_imgs(tree);
  621.     add_major_to_appActivity(tree);
  622.     add_digsby_utm_to_links(tree);
  623.     change_photo_hrefs(tree);
  624.     setup_dynamic_sized_images(tree);
  625.     add_link_class_to_a_tags(tree);
  626.     lightbox_galleries(tree);
  627.     convert_timestamps_to_text(tree);
  628. }
  629.  
  630. swapIn(ms_init)
  631.  
  632. swapIn(on_scroll);
  633. swapIn(function() { $(window).bind('scroll', on_scroll); } );
  634. swapIn(function() {$(".comment_button").live("mousedown", ms_comment_button_mousedown);});
  635. swapOut(function() { $(window).unbind('scroll'); } );
  636. swapOut(function() { $(".comment_button").die("mousedown", ms_comment_button_mousedown);} );
  637.  
  638. swapOut(ms_clear_error);
  639. onHide(ms_clear_error);
  640.