Ero sivun ”Widget:JwObsCharts” versioiden välillä
Järvi-meriwikistä
Rivi 67: | Rivi 67: | ||
memo.loaderEl.fadeIn( "slow" ); | memo.loaderEl.fadeIn( "slow" ); | ||
− | + | if ( memo.graphType != 'current' ) { | |
− | |||
− | |||
− | |||
− | |||
− | + | // add chart container | |
− | + | memo.widgetEl.append( '<div class="card JwCard mb-2" style="position: relative; width: 100%; height: 100%;"><div class="card-header" style="min-height: 49px;"></div><div class="card-body p-2" style="position: relative; width: 100%; height: 100%;"><div class="chart-container" style="position: relative; z-index: 110; width: 100%; height: 100%;"></div></div></div>' ); | |
− | + | memo.chartEl = jQuery( this ).find( '.chart-container' ); | |
+ | memo.chartEl.css( 'height', memo.height + 'px' ); | ||
+ | memo.headerEl = jQuery( this ).find( '.card-header' ); | ||
− | + | // add title | |
− | + | memo.headerEl.append( '<div class="obscharttitle" style="float: left;"></div>' ); | |
− | + | memo.titleEl = jQuery( this ).find( '.obscharttitle' ); | |
− | + | // add fullscreen button | |
− | + | memo.headerEl.append( '<div class="obschartbutton fullscreen-button" style="display: none; margin-left: 10px; float: right; Xbackground-color: rgba( 255, 255, 255, 1 ); border-radius: 50%; Xborder: 1px solid rgba( 0, 0, 0, 0.5 ); Xpadding: 1px;"><button title="' + i18n['fullscreen'][memo.lang] + '" style="width: 24px; height: 24px; padding: 0; margin: 0; color: #1B599B; background: none; border: none; "><i class="fas fa-expand"></i></button></div>' ); | |
− | + | memo.fullscreenEl = jQuery( this ).find( '.fullscreen-button' ); | |
− | + | ||
− | + | // add edit button | |
+ | if ( memo.editUrl != '-' ) { | ||
+ | memo.headerEl.append( '<div class="obschartbutton edit-button" style="Xdisplay: none; margin-left: 10px; float: right; Xbackground-color: rgba( 255, 255, 255, 1 ); border-radius: 50%; Xborder: 1px solid rgba( 0, 0, 0, 0.5 ); Xpadding: 1px;"><button title="' + i18n['edit'][memo.lang] + '" style="width: 24px; height: 24px; padding: 0; margin: 0; color: #1B599B; background: none; border: none;"><i class="fas fa-edit"></i></button></div>' ); | ||
+ | memo.editEl = jQuery( this ).find( '.edit-button' ); | ||
+ | memo.editEl.on( 'click', function() { window.location.href = memo.editUrl; }); | ||
+ | } | ||
+ | |||
+ | // add download data button | ||
+ | memo.headerEl.append( '<div class="obschartbutton download-button" style="display: none; margin-left: 10px; float: right; Xbackground-color: rgba( 255, 255, 255, 1 ); border-radius: 50%; Xborder: 1px solid rgba( 0, 0, 0, 0.5 ); Xpadding: 1px;"><button title="' + i18n['download'][memo.lang] + '" style="width: 24px; height: 24px; padding: 0; margin: 0; color: #1B599B; background: none; border: none;"><i class="fas fa-download"></i></button></div>' ); | ||
+ | memo.downloadEl = jQuery( this ).find( '.download-button' ); | ||
} | } | ||
− | |||
− | |||
− | |||
− | |||
memo.loadStarts = 0; | memo.loadStarts = 0; |