Skip to content

Instantly share code, notes, and snippets.

@seveniu
Last active December 22, 2015 08:48
Show Gist options
  • Save seveniu/6446991 to your computer and use it in GitHub Desktop.
Save seveniu/6446991 to your computer and use it in GitHub Desktop.
// ==Tempermonkey Script==
// ==UserScript==
// @name My Fancy New Userscript
// @namespace http://use.i.E.your.homepage/
// @version 0.1
// @description enter something useful
// @match http://search.maven.org/*
// @require http://code.jquery.com/jquery-1.8.2.js
// @copyright 2012+, You
// ==/UserScript==
var flag = false;
$(document).on("click",".tooltip",function(){
var groupId = $(this).find("#groupId").text();
var artifactId = $(this).find("#artifactId").text();
var version = $($(this).find("a").get("2")).text();
var result = "<textarea rows='5' style='white-space:nowrap;overflow:scroll;width:300px'><dependency>\n&nbsp;&nbsp;&nbsp;&nbsp;<groupId>"+groupId+"</groupId>\n&nbsp;&nbsp;&nbsp;&nbsp;<artifactId>"+artifactId+"</artifactId>\n&nbsp;&nbsp;&nbsp;&nbsp;<version>"+version+"</version>\n</dependency></textarea><br/><button id='close_result'>关闭</button>";
if(!flag) {
$("body").append("<div id='result_div' style='position:fixed;top:10%;left:30px;'></div>");
flag=true;
}
$(this).css("font-weight","bold");
$("#result_div").html(result);
$("#result_div").css("display","block");
});
$(document).on("click","#close_result",function(){
$(".tooltip").css("font-weight","normal");
$("#result_div").css("display","none");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment