diff options
Diffstat (limited to '')
-rw-r--r-- | admin/themes/default/js/jquery.geoip.js | 42 | ||||
-rw-r--r-- | admin/themes/default/template/history.tpl | 25 | ||||
-rw-r--r-- | admin/themes/default/theme.css | 9 |
3 files changed, 71 insertions, 5 deletions
diff --git a/admin/themes/default/js/jquery.geoip.js b/admin/themes/default/js/jquery.geoip.js new file mode 100644 index 000000000..fae389190 --- /dev/null +++ b/admin/themes/default/js/jquery.geoip.js @@ -0,0 +1,42 @@ + +GeoIp = { + cache: {}, + pending: {}, + + get: function(ip, callback){ + if (GeoIp.cache.hasOwnProperty(ip)) + callback(GeoIp.cache[ip]); + else if (GeoIp.pending[ip]) + GeoIp.pending[ip].push(callback); + else { + GeoIp.pending[ip] = [callback]; + jQuery.ajax( { + url: "http://freegeoip.net/json/" + ip, + dataType: "json", + success: function(data) { + var res=[]; + if (data.city) res.push(data.city); + if (data.region_name) res.push(data.region_name); + if (data.country_name) res.push(data.country_name); + data.fullName = res.join(", "); + + GeoIp.cache[ip] = data; + var callbacks = GeoIp.pending[ip]; + delete GeoIp.pending[ip]; + for (var i=0; i<callbacks.length; i++) + callbacks[i].call(null, data); + }, + + error: function() { + var data = {ip:ip, fullName:""}; + + GeoIp.cache[ip] = data; + var callbacks = GeoIp.pending[ip]; + delete GeoIp.pending[ip]; + for (var i=0; i<callbacks.length; i++) + callbacks[i].call(null, data); + } + }); + } + } +}
\ No newline at end of file diff --git a/admin/themes/default/template/history.tpl b/admin/themes/default/template/history.tpl index 4cc5e93c6..fa0f49e1d 100644 --- a/admin/themes/default/template/history.tpl +++ b/admin/themes/default/template/history.tpl @@ -6,9 +6,7 @@ pwg_initialization_datepicker("#end_day", "#end_month", "#end_year", "#end_linked_date", null, "#start_linked_date", null); {/literal}{/footer_script} -<div class="titrePage"> - <h2>{'History'|@translate} {$TABSHEET_TITLE}</h2> -</div> +<h2>{'History'|@translate} {$TABSHEET_TITLE}</h2> <form class="filter" method="post" name="filter" action="{$F_ACTION}"> <fieldset> @@ -83,7 +81,7 @@ </select> </label> - <input class="submit" type="submit" name="submit" value="{'Submit'|@translate}"> + <input type="submit" name="submit" value="{'Submit'|@translate}"> </fieldset> </form> @@ -124,7 +122,7 @@ <td class="hour">{$detail.DATE}</td> <td class="hour">{$detail.TIME}</td> <td>{$detail.USER}</td> - <td>{$detail.IP}</td> + <td class="IP">{$detail.IP}</td> <td>{$detail.IMAGE}</td> <td>{$detail.TYPE}</td> <td>{$detail.SECTION}</td> @@ -136,3 +134,20 @@ </table> {if !empty($navbar) }{include file='navigation_bar.tpl'|@get_extent:'navbar'}{/if} + +{combine_script id='jquery.geoip' load='async' path='admin/themes/default/js/jquery.geoip.js'} +{combine_script id='jquery.ui.tooltip' load='footer'} + +{footer_script}{literal} +jQuery(".IP").tooltip( { + items: "*", + /*show: {delay:0, effect:"show"}, + hide: {delay:50, effect:"hide"},*/ + content: function(response) { + var that = $(this); + GeoIp.get( that.text(), function(data) { + response( data.fullName ); + }); + } +}); +{/literal}{/footer_script}
\ No newline at end of file diff --git a/admin/themes/default/theme.css b/admin/themes/default/theme.css index 046d56be6..3357638b5 100644 --- a/admin/themes/default/theme.css +++ b/admin/themes/default/theme.css @@ -504,6 +504,15 @@ UL.tagSelection LI { } /* jQuery tooltips */ +.ui-tooltip { + padding: 8px; + position: absolute; + z-index: 9999; + max-width: 300px; + -webkit-box-shadow: 0 0 5px #aaa; + box-shadow: 0 0 5px #aaa; +} + .cluetip-outer { position: relative; border: 1px solid #111111; |