Sha256: 88644edd8f76517043a27441a9a6edce094723f7d0fdd68f255207730f1e06b9
Contents?: true
Size: 1.41 KB
Versions: 3
Compression:
Stored size: 1.41 KB
Contents
# code: # * George Moschovitis <gm@navel.gr> # # (c) 2004 Navel, all rights reserved. # $Id: popup.rb 152 2004-11-13 20:02:35Z gmosx $ module N; module UI # = Popup # # Display a popup window. # class Popup # Emit the needed javascript. # Alternatively use this code: <script src="/r/js/std.js">#{}</script> # def self.script %[ function newWin(url, name, w, h, scroll) { var pleft = (screen.width - w) / 2; var ptop = (screen.height - h) / 2; var settings = 'height=' + h + ',width=' + w + ',top=' + ptop + ',left=' + pleft + ',scrollbars=' + scroll + ',resizable'; win = window.open(url, name, settings); return false; } ] end # gmosx: keep the leading / to be IE friendly. # def self.onclick(uri, width, height, title = "Popup", type="PAGE", options = "scrollbars=yes,resizable", container = "/p/glue/popup.sx") %[javascript: var pwl = (screen.width - #{width}) / 2; var pwt = (screen.height - #{height}) / 2; window.open('#{container}?uri=#{uri};type=#{type}', '#{title}', 'width=#{width},height=#{height},top='+pwt+',left='+pwl+', #{options}'); return false"] end # gmosx: keep the leading / to be IE friendly. # def self.link(uri, width, height, link = "link", title = "Popup", type="PAGE", options = "scrollbars=yes,resizable", container = "/p/glue/popup.sx") %[<a href="#" onclick="#{self.onclick(uri, width, height, title, type, options, container)}">#{link}</a>] end end end; end # module
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
nitro-0.4.1 | lib/nitro/ui/popup.rb |
nitro-0.5.0 | lib/nitro/ui/popup.rb |
nitro-0.6.0 | lib/nitro/ui/popup.rb |