Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save benoitjadinon/1b3e05333aa3699330337548a22de310 to your computer and use it in GitHub Desktop.
Save benoitjadinon/1b3e05333aa3699330337548a22de310 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Coinigy with TradingView
// @namespace http://tampermonkey.net/
// @version 0.1
// @description adds a TradingView tab
// @author BenJad
// @match https://www.coinigy.com/*
// @grant none
// ==/UserScript==
(function(){
'use strict';
$(document).ready(function () {
var tabsContents = $('#Ul1').next(".tab-content");
var tvtab = $('<div/>').attr('id','tv_tab').addClass("tab-pane");
tvtab.append('<object id="tradingViewObject" class="content" style="min-height:675px"></object>');
tabsContents.append(tvtab);
$('#Ul1').append('<li id="tv_li"><a id="tv_li_a" href="#tv_tab" data-toggle="tab">TradingView</a></li>');
tvtab.hide();
var tabs = [$("#data_tab"), $("#orders_tab"), $("#alerts_tab"), $("#economy_tab"), $("#notes_tab")];
var tabsButts = [$("#data_li_a"), $("#orders_li_a"), $("#alerts_li_a"), $("#economy_li_a"), $("#notes_li_a")];
for(var t in tabsButts)
tabsButts[t].click(function(){ tvtab.hide(); });
// not needed atm because switching coin is changing tabs
//$(window).on('hashchange', function(e){
// refreshTrading();
//});
$('#tv_li_a').click(function() {
//region coinigy craptastic
//activeTab = "TradingView";
//setCookie("active_tab", activeTab, 30);
$("#history_container").hide();
$("#bids_container").hide();
$("#asks_container").hide();
$("#actions_container").addClass("col-md-12");
$("#actions_container").removeClass("col-md-6");
$("#actions_content").css({
height: (init_height - 150 + "px")
});
$("#breakout_link").show();
$("#breakout_link").attr("href", base_url + "main/alerts");
$("#trade_account_select").hide();
// $("#bid").show();
$("#data_options").hide();
for(var t in tabs)
tabs[t].hide();
tvtab.show();
refreshTables(false);
//endregion coinigy craptastic
refreshTrading();
});
function refreshTrading(){
var code = (window.location+"").split('/');
code = code[code.length-2]+code[code.length-1];
var tvurl = "https://www.tradingview.com/ideas/"+code+"/?sort=recent";
tradingViewObject.data = tvurl;
}
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment