LockD&DMail

Bloque le drag and drop sur la messagerie

当前为 2014-09-03 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name LockD&DMail
  3. // @namespace InGame
  4. // @description Bloque le drag and drop sur la messagerie
  5. // @include http://www.dreadcast.net/Main
  6. // @version 1
  7. // @grant none
  8. // ==/UserScript==
  9.  
  10. MenuMessagerie.prototype.handleDrag = function () {
  11. $("#liste_messages .message:not(.ui-draggable)").draggable({
  12. cursorAt: {
  13. top: 0,
  14. left: -20
  15. },
  16. helper: function () {
  17. var a = $("#liste_messages .content input:checked").length;
  18. return $('<div id="dragged_msg"><span>' + (a ? a : "") + "</span></div>")
  19. },
  20. start: function () {
  21. if( document.getElementById('lock').style.backgroundImage == 'url("https://cdn1.iconfinder.com/data/icons/win8-and-ios-tab-bar-icons/30/Unlock.png")')
  22. return "-1" == $("#current_folder").attr("data-id") ? !1 : (!$(this).hasClass("selected") && $("#liste_messages").length && nav.getMessagerie().messageUnselectAll(), void($("#folder_list:hidden").length && $("#liste_messages .folder_list").trigger("click")))
  23. },
  24. stop: function () {
  25. if( document.getElementById('lock').style.backgroundImage == 'url("https://cdn1.iconfinder.com/data/icons/win8-and-ios-tab-bar-icons/30/Unlock.png")')
  26. $("#liste_messages .folder_list").trigger("click")
  27. }
  28. })
  29. }
  30.  
  31. var lock = document.createElement('div');
  32. lock.id='lock';
  33. lock.setAttribute("style", "width:32px;height:30px;background-image:url('https://cdn1.iconfinder.com/data/icons/win8-and-ios-tab-bar-icons/30/Unlock.png');background-repeat: no-repeat;background-position: 33px 0;position: absolute; right: 0px;z-index: 999999;");
  34.  
  35. var mess = document.getElementById('zone_messagerie');
  36. mess.appendChild(lock);
  37. $('#lock').css('background-position','0px 0px').css('left','123px').css('top','12px').css('background-size','15px 15px').addClass('link');
  38.  
  39. lock.onclick = function(){
  40. if( document.getElementById('lock').style.backgroundImage == 'url("https://cdn1.iconfinder.com/data/icons/win8-and-ios-tab-bar-icons/30/Unlock.png")')
  41. document.getElementById('lock').style.backgroundImage = 'url("http://www.geodesheep.com/skin-01/images/icone_cadenas.png")';
  42. else
  43. document.getElementById('lock').style.backgroundImage = 'url("https://cdn1.iconfinder.com/data/icons/win8-and-ios-tab-bar-icons/30/Unlock.png")';
  44. };