Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Star Federation
- // @namespace starfederationuimod
- // @include http://www.star-kings.ru/*
- // @include http://star-kings.ru/*
- // @include http://starfederation.ru/*
- // @include http://www.starfederation.ru/*
- // @version 1
- // @grant none
- // ==/UserScript==
- var run = function() {
- $("body").append ( ' \
- <div id="gmRightSideBar" style="position:fixed; top:40; right: 0;background:#000000;z-index:99999999; "> \
- <p>Панель расширенных команд:</p> \
- <ul> \
- <!-- <li><a onClick="$(`#gmRightSideBar`).trigger(`RefreshWnd`);">Refresh</a></li> \
- <li><a onClick="$(`#gmRightSideBar`).trigger(`grabPlanetsData`);">Grab planets data</a></li> --> \
- <li><a onClick="$(`#gmRightSideBar`).trigger(`grabFlightPlan`);">Сохранить полетник</a></li> \
- <li><a onClick="$(`#gmRightSideBar`).trigger(`loadFlightPlan`);">Добавить команды к полетнику</a></li> \
- <!-- <li><a onClick="$(`#gmRightSideBar`).trigger(`empireViewUpdate`);">Empire view check</a></li> --> \
- </ul> \
- </div> \
- ' );
- function addnextcmd(forms_html,id){
- if (id == forms_html.length)
- return;
- var new_form = $("#WndFleet_comand_form_new");
- new_form[0].outerHTML = forms_html[id];
- var forms = $("form[id^='WndFleet_comand_form_']:last");
- forms.attr('id','WndFleet_comand_form_new');
- $("> input[name='icmd']",forms).attr('value','new');
- getWindow('WndFleet').add_comand('new');
- setTimeout(function(){addnextcmd(forms_html,id+1)}, 5000);
- }
- $("#gmRightSideBar").bind('loadFlightPlan',function() {
- var text = window.prompt("Вставьте сохраненные команды: Ctrl+V, Enter", '');
- var forms_html = text.split("<;>");
- addnextcmd(forms_html,0);
- });
- $("#gmRightSideBar").bind('grabFlightPlan',function() {
- var forms = $("form[id^='WndFleet_comand_form_']");
- var text = "";
- forms.each(function(index){
- if (index < forms.length-1)
- {
- if (index > 0)
- text = text + "<;>";
- var tmp = forms[index].outerHTML;
- text = text + tmp.replace(/<[^\/if][^>]*>/g,"").replace(/<\/[^f][^>]*>/g,"").replace(/title="[^"]*"/g,"").replace(/style="[^"]*"/g,"").replace(/onclick="[^"]*"/g,"").replace(/src="[^"]*"/g,"").replace(/class="[^"]*"/g,"").replace(/>[^<]*</g,"><").replace(/<img[^>]*>/g,"");
- }
- });
- showMessageS("Сохраните эти данные в буффер обмена: ",text.replace(/&/g, '&').replace(/"/g, '"').replace(/'/g, ''').replace(/</g, '<').replace(/>/g, '>'));
- //window.prompt("Сохранить в буффер обмена: Ctrl+C, Enter", text);
- });
- GM_addStyle ( " \
- #gmRightSideBar { \
- position: fixed; \
- top: 100; \
- right: 900; \
- margin: 1ex; \
- padding: 1em; \
- background: orange; \
- width: 100px; \
- z-index: 9999; \
- opacity: 0.9; \
- } \
- #gmRightSideBar p { \
- font-size: 80%; \
- } \
- #gmRightSideBar ul { \
- margin: 0ex; \
- } \
- #gmRightSideBar a { \
- color: blue; \
- } \
- " );
- }
- var script = document.createElement("script");
- script.textContent = '(' + run.toString() + ')();';
- document.documentElement.appendChild(script);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement