Sha256: 23e956536cf670d50a867fb8911e26cea4e210485a79c154b452a03a2280f4cc
Contents?: true
Size: 1.36 KB
Versions: 5
Compression:
Stored size: 1.36 KB
Contents
# * George Moschovitis <gm@navel.gr> # (c) 2004-2005 Navel, all rights reserved. # $Id: popup.rb 1 2005-04-11 11:04:30Z gmosx $ module Nitro # 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
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
nitro-0.16.0 | lib/nitro/ui/popup.rb |
nitro-0.17.0 | lib/nitro/ui/popup.rb |
nitro-0.18.0 | lib/nitro/ui/popup.rb |
nitro-0.18.1 | lib/nitro/ui/popup.rb |
nitro-0.19.0 | lib/nitro/ui/popup.rb |