// ==UserScript== // @name gitlab-ci-batch // @namespace undefined // @version 0.1 // @description 批量上线samza任务脚本 // @author songyang // @require http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js // @match https://git.yidian-inc.com:8021/cpp-streaming/cpp-samza-task-ci/pipelines/* // @match https://git.yidian-inc.com:8021/crawler/gitlab-ci-test/pipelines/* // @grant none // @downloadURL none // ==/UserScript== (function() { 'use strict'; $(document).ready(function(){ var selects = [] $("a[data-original-title*='manual']").click(function() { var link = this.href + "/play"; console.log("you found one " + link); var index = $.inArray(link, selects); if (index == -1) { selects.push(link); $(this).css("background-color", "yellow"); } else { selects.splice(index, 1); $(this).css("background-color", "white"); } return false; }); $("div.content-wrapper").append('
'); $("#submit-batch").click(function() { $.each(selects, function(index, val){ console.log("index is " + index + ", val is " + val); var csrf_token = $('meta[name="csrf-token"]').attr('content'); $.ajax({ url: val, type: "post", headers: { 'x-csrf-token': csrf_token } }); }); }) }); })();