/* Function initialize html5 charts using global data (GC.chart) */ function chart() { var type = (GC.chart.period == 'intra' || GC.chart.period == 'week')? GC.chart.intra_path : GC.chart.histo_path; var $src = type; $src += '?ticker=' + GC.chart['ticker']; $src += '&period=' + GC.chart['period']; $src += '&qty=' + GC.chart['qty']; $src += '&width=' + GC.chart['w']; $src += '&height=' + GC.chart['h']; $src += '&c1=' + GC.chart['c1']; // Only for chart on news_view.php page! if (GC.chart['id'] == "nvchart") { $src += '&news=' + GC.chart['news']; $src += '&news_type='+ GC.chart['news_type']; $src += '&sdate=' + GC.chart['sdate']; } // CSS $('#' + GC.chart.id).css({ width: GC.chart['w'] + 'px', height: GC.chart['h'] + 'px' }); // Set (or change) iframe src without affect browser history !!! var x = document.getElementById( GC.chart.id ); var y = (x.contentWindow || x.contentDocument); if (y.document) y = y.document; y.location.replace($src); } function set_chart_ticker(url) { var ticker = /ticker=([^&]+)/i.exec( url ); var pays = /pays=([^&]+)/i.exec( url ); if (ticker == null || pays == null) { return; } GC.chart['ticker'] = ticker[1] + ',' + pays[1]; } function winners_url_parameters() { return "winners.php?tick=" + GC.winners['tick'] + "&type=" + GC.winners['type'] + "&ord=" + GC.winners['ord']; } function winners_set_selects() { var tick = /tick=([^&]+)/i.exec( $.mobile.activePage[0].baseURI ); var type = /type=([^&]+)/i.exec( $.mobile.activePage[0].baseURI ); var ord = /ord=([^&]+)/i.exec( $.mobile.activePage[0].baseURI ); if (tick == null) tick = "PX1,FR"; // CAC 40 (France) if (type == null) type = 1; // Winners companies if (ord == null) ord = 1; // Sort by variation % DESC // Set select elements $('select.winners-market').val(tick).selectmenu('refresh'); $('select.winners-type').val(type).selectmenu('refresh'); $('select.winners-ord').val(ord).selectmenu('refresh'); // Free memory! tick = null; type = null; ord = null; } /* Idea: http://scottwb.com/blog/2012/06/29/reload-the-same-page-without-blinking-on-jquery-mobile/ */ function refreshPage() { $.mobile.changePage( window.location.href, { allowSamePageTransition : true, transition : 'fade', showLoadMsg : true, reloadPage : true }); } function goPage(page, effect) { var eff = (GC.is_android)? "none" : effect; $.mobile.changePage( page, { allowSamePageTransition : true, transition : eff, showLoadMsg : true, reloadPage : true }); }