NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name Ingame Wiki
// @namespace IW
// @version 0.1
// @author ViralityEverden aka Bluebaby
// @updateURL https://openuserjs.org/meta/ViralityEverden/Ingame_Wiki.meta.js
// @downloadURL https://openuserjs.org/install/ViralityEverden/Ingame_Wiki.user.js
// @description Bored of having to go on an other page for the wiki?
// @include http://*.grepolis.com/game/*
// @include https://*.grepolis.com/game/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js
// @icon http://tgpa.esy.es/icowiki.png
// @iconURL http://tgpa.esy.es/icowiki.png
// @copyright 2017, Bluebaby
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js
// @grant GM_info
// @grant GM_setValue
// @grant GM_getValue
// @grant GM_deleteValue
// @grant GM_xmlhttpRequest
// @grant GM_getResourceURL
// ==/UserScript==
var version = '0.1';
/**********************************************************************************************
* CHANGES :
*
* 0.1 :
* Script created.
* Display the wiki
* Wiki's window is draggable
* Added a "close" button
*
*
*
* NOTE : Chrome users might need to disable the chrome protection due to iframe elements considered as "insecure".
* How to : Just click the shield icon in the adress bar and enable insecure content. USE AT YOUR OWN RISK.
*
**********************************************************************************************/
var uw = unsafeWindow || window, $ = uw.jQuery || jQuery, DATA, GM;
// GM-API?
GM = (typeof GM_info === 'object');
//
console.log('%c-InGame Wiki- Ready', 'color: blue; font-size: 1em; font-weight: bolder; ');
// Create the wiki button :
var dbf_tooltip = "Ingame Wiki";
$('.gods_area').append('<div class="btn_settings circle_button dbf_btn" style="top:95px;right:0px;z-index:10;"><div class="dbf_icon js-caption" style="margin:7px 0px 0px 6px;width:20px;height:20px;background:url(http://tgpa.esy.es/icowiki.png) no-repeat 0px 0px;background-size:100%"></div></div>');
$('.dbf_btn').tooltip(dbf_tooltip);
// Wiki Button click :
$('.dbf_btn').on('mousedown', function () {
$('.dbf_icon').addClass('click');
});
$('.dbf_btn').on('mouseup', function () {
$('.dbf_icon').removeClass('click');
});
$('.dbf_btn').click(editDBF);
//Create the html window :
$('body').append('<div id="dbfwndw" class="ui-dialog ui-widget ui-widget-content ui-corner-all ui-draggable js-window-main-container dbfwndw" tabindex="-1" style="position:relative;outline: 0px; z-index: 1031; height: auto; width: 800px; top: 96.5px; left: 124px; display: none;" role="dialog" aria-labelledby="ui-id-6"><div id="drag" class="ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix"><span id="ui-id-6" class="ui-dialog-title">Wiki Grepolis :</span><a href="#" class="ui-dialog-titlebar-close ui-corner-all" role="button"><span class="ui-icon ui-icon-closethick">close</span></a></div><div class="gpwindow_frame ui-dialog-content ui-widget-content" style="display: block; width: auto; min-height: 0px; height: 600px;" scrolltop="0" scrollleft="0"><div class="gpwindow_left"></div><div class="gpwindow_right"></div><div class="gpwindow_bottom"><div class="gpwindow_left corner"></div><div class="gpwindow_right corner"></div></div><div class="gpwindow_top"><div class="gpwindow_left corner"></div><div class="gpwindow_right corner"></div></div><div id="gpwnd_1005" class="gpwindow_content"><div class="game_border"><div class="game_border_top"></div><div class="game_border_bottom"></div><div class="game_border_left"></div><div class="game_border_right"></div><div class="game_border_corner corner1"></div><div class="game_border_corner corner2"></div><div class="game_border_corner corner3"></div><div class="game_border_corner corner4"></div><div class="game_header bold" style="height:18px;"><div style="float:left; padding-right:10px;">Wiki</div></div><p style="height:501;width:792;z-index=2000;min-height:501px;min-width:792;height:100%;width:100%;"><iframe src="https://wiki.fr.grepolis.com/" name="dbfiframe" allowTransparency="true" frameborder="0" style="height:501;width:792;z-index=2000;min-height:501px;min-width:792;height:100%;width:100%;";></iframe></p></div></div>');
// function "open/close" (more like stop displaying/ strat displaying)
function editDBF() {
var x = document.getElementById('dbfwndw');
if (x.style.display === 'none') {
x.style.display = 'block';
} else {
x.style.display = 'none';
}
}
// Close button click :
$('.ui-dialog-titlebar-close').on('mousedown', function () {
$('.dbf_icon').addClass('click');
});
$('.ui-dialog-titlebar-close').on('mouseup', function () {
$('.dbf_icon').removeClass('click');
});
$('.ui-dialog-titlebar-close').click(editDBF);
// Make the window draggable :
$( "#dbfwndw" ).draggable();
//