imak1to / Gmail attachment on top

// ==UserScript==
// @name       			Gmail attachment on top
// @version    			1.0b
// @description			Move Gmail attachments to the top of your mail.
// @match      https://mail.google.com/mail/*
// @require http://code.jquery.com/jquery-latest.js
// @grant    GM_addStyle
// ==/UserScript==

if (window.top != window.self)  //don't run on frames or iframes
    return;

  var observer = new MutationObserver(function() {
    if (document.getElementsByClassName('Bu')) {
      console.log('table has appeared.');
      $(".hq").contents().appendTo(".aHl");
    }
  });
  observer.observe(document, {
    childList: true,
    subtree: true,
    attributes: false,
    characterData: false,
  });

// Visual upgrades
GM_addStyle(".gH { padding-right:16px;}");
GM_addStyle(".aHl { margin-left: -2px !important; background: rgb(245, 245, 245); padding-left:16px; -webkit-border-radius:5px; -moz-border-radius:5px; border-radius:5px; padding-right:16px;padding-top:10px; border-bottom: 1px dashed #ccc;margin-bottom: 10px;}");
GM_addStyle(".aVW { color: rgb(251, 76, 47);font-size: 12px;}");
GM_addStyle(".aYp { font-size:8px!important;display:run-in!important;");
GM_addStyle(".aQH { margin-bottom:0!important;");