<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: window code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Thu, 24 Jul 2008 04:54:45 GMT</pubDate>
    <description>DZone Snippets: window code</description>
    <item>
      <title>instapaper bookmarklet</title>
      <link>http://snippets.dzone.com/posts/show/5063</link>
      <description>Assuming you are registered with the new bookmarking service '&lt;a href="http://www.instapaper.com/"&gt;instapaper&lt;/a&gt;', then you would use the following code which would normally be placed as a link within your web browser's toolbar.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;javascript:var d=document,w=window,e=w.getSelection,k=d.getSelection,x=d.selection,&lt;br /&gt;s=(e?e():(k)?k():(x?x.createRange().text:0)),f='http://www.instapaper.com/b',&lt;br /&gt;l=d.location,e=encodeURIComponent,p='?v=3&amp;u='+e(l.href) +'&amp;t='+e(d.title) +'&amp;s='+e(s),&lt;br /&gt;u=f+p;try{if(!/^(.*\.)?instapaper([^.]*)?$/.test(l.host))throw(0);&lt;br /&gt;iptstbt();}catch(z){a =function(){if(!w.open(u,'t','toolbar=0,resizable=0,status=1,&lt;br /&gt;width=250,height=150'))l.href=u;};if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);&lt;br /&gt;else a();}void(0)&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;I'm interested in using similar JavaScript if I ever write my own personal bookmarking service.</description>
      <pubDate>Thu, 31 Jan 2008 15:23:12 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5063</guid>
      <author>jrobertson (James Robertson)</author>
    </item>
    <item>
      <title>Open a popup window with specified parameters / arguments</title>
      <link>http://snippets.dzone.com/posts/show/4441</link>
      <description>opens a popup a window with the specified width and height. can be centered in the screen&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;function openAWindow( pageToLoad, winName, width, height, center)&lt;br /&gt;{&lt;br /&gt;    xposition=0; yposition=0;&lt;br /&gt;    if ((parseInt(navigator.appVersion) &gt;= 4 ) &amp;&amp; (center)){&lt;br /&gt;        xposition = (screen.width - width) / 2;&lt;br /&gt;        yposition = (screen.height - height) / 2;&lt;br /&gt;    }&lt;br /&gt;	&lt;br /&gt;	//0 =&gt; no&lt;br /&gt;	//1 =&gt; yes&lt;br /&gt;    var args = "";&lt;br /&gt;    	args += "width=" + width + "," + "height=" + height + ","&lt;br /&gt;		+ "location=0,"&lt;br /&gt;		+ "menubar=0,"&lt;br /&gt;		+ "resizable=0,"&lt;br /&gt;		+ "scrollbars=0,"&lt;br /&gt;		+ "statusbar=false,dependent,alwaysraised,"&lt;br /&gt;		+ "status=false,"&lt;br /&gt;		+ "titlebar=no,"&lt;br /&gt;		+ "toolbar=0,"&lt;br /&gt;		+ "hotkeys=0,"&lt;br /&gt;		+ "screenx=" + xposition + ","  //NN Only&lt;br /&gt;		+ "screeny=" + yposition + ","  //NN Only&lt;br /&gt;		+ "left=" + xposition + ","     //IE Only&lt;br /&gt;		+ "top=" + yposition;           //IE Only&lt;br /&gt;		//fullscreen=yes, add for full screen&lt;br /&gt;    	var dmcaWin = window.open(pageToLoad,winName,args );&lt;br /&gt;    	dmcaWin.focus();&lt;br /&gt;    //window.showModalDialog(pageToLoad,"","dialogWidth:650px;dialogHeight:500px");&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;call the function as openAWindow("yourfilenamehere","windownamehere",500,600,true);&lt;br /&gt;500 =&gt; width&lt;br /&gt;600 =&gt; height&lt;br /&gt;true =&gt; if you want to place the popup window in the center of the screen</description>
      <pubDate>Wed, 22 Aug 2007 10:36:54 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4441</guid>
      <author>sundaramkumar (Kumar S)</author>
    </item>
    <item>
      <title>Customize JavaScript Popup Window  Code in sigle one line</title>
      <link>http://snippets.dzone.com/posts/show/4437</link>
      <description>Oneline JavaScript Popup Window Code&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"&lt;br /&gt;    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;&lt;br /&gt;&lt;br /&gt;&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;&lt;br /&gt;&lt;br /&gt;&lt;head&gt;&lt;br /&gt;  &lt;title&gt;&lt;/title&gt;&lt;br /&gt;&lt;/head&gt;&lt;br /&gt;&lt;br /&gt;&lt;body&gt;&lt;br /&gt;        &lt;a href="#"&lt;br /&gt;        onClick="MyWindow=window.open('http://www.yahoo.com','MyWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=600,height=300,left=0,top=0'); return false;"&gt;&lt;br /&gt;        Popup Window Code in single one line without any function&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/body&gt;&lt;br /&gt;&lt;br /&gt;&lt;/html&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Mon, 20 Aug 2007 10:30:04 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4437</guid>
      <author>dkedar (kedar)</author>
    </item>
    <item>
      <title>C - Simple Example GTK</title>
      <link>http://snippets.dzone.com/posts/show/3085</link>
      <description>// gcc file.c -o file.o `pkg-config --libs --cflags gtk+-2.0`&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#include &lt;gtk/gtk.h&gt;&lt;br /&gt;#include &lt;stdlib.h&gt;&lt;br /&gt;&lt;br /&gt;void displayUI()&lt;br /&gt;{&lt;br /&gt;	GtkWidget* mainWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);&lt;br /&gt;&lt;br /&gt;	gtk_window_set_default_size(GTK_WINDOW(mainWindow), 400, 300);&lt;br /&gt;	gtk_window_set_title(GTK_WINDOW(mainWindow), "GTK Simple Example");&lt;br /&gt;	gtk_window_set_position(GTK_WINDOW(mainWindow), GTK_WIN_POS_CENTER_ALWAYS);&lt;br /&gt;&lt;br /&gt;	gtk_signal_connect(GTK_OBJECT(mainWindow), "destroy", G_CALLBACK(gtk_main_quit), NULL);&lt;br /&gt;&lt;br /&gt;	gtk_widget_show_all(mainWindow);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;int main(int argc, char *argv[])&lt;br /&gt;{&lt;br /&gt;	gtk_init(&amp;argc, &amp;argv);&lt;br /&gt;&lt;br /&gt;	displayUI();&lt;br /&gt;&lt;br /&gt;	gtk_main();&lt;br /&gt;&lt;br /&gt;	return EXIT_SUCCESS;&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Tue, 05 Dec 2006 16:50:54 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3085</guid>
      <author>whitetiger ()</author>
    </item>
    <item>
      <title>how to open links in current window, new window, background.</title>
      <link>http://snippets.dzone.com/posts/show/2915</link>
      <description>&lt;code&gt;&lt;br /&gt;function open2(url, opt){&lt;br /&gt;  if (opt == 0) // current window&lt;br /&gt;    window.location = url;&lt;br /&gt;  else if (opt == 1) // new window&lt;br /&gt;    window.open(url);&lt;br /&gt;  else if (opt == 2) // background window&lt;br /&gt;    {window.open(url); self.focus();}&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Fri, 27 Oct 2006 21:23:40 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/2915</guid>
      <author>em3zh3 (Doc Aha)</author>
    </item>
    <item>
      <title>Xlib - mouseClick</title>
      <link>http://snippets.dzone.com/posts/show/2750</link>
      <description>// Simula il click del mouse&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#include &lt;stdio.h&gt;&lt;br /&gt;#include &lt;stdlib.h&gt;&lt;br /&gt;#include &lt;string.h&gt;&lt;br /&gt;&lt;br /&gt;#include &lt;unistd.h&gt;&lt;br /&gt;&lt;br /&gt;#include &lt;X11/Xlib.h&gt;&lt;br /&gt;#include &lt;X11/Xutil.h&gt;&lt;br /&gt;&lt;br /&gt;void mouseClick(int button)&lt;br /&gt;{&lt;br /&gt;	Display *display = XOpenDisplay(NULL);&lt;br /&gt;&lt;br /&gt;	XEvent event;&lt;br /&gt;	&lt;br /&gt;	if(display == NULL)&lt;br /&gt;	{&lt;br /&gt;		fprintf(stderr, "Errore nell'apertura del Display !!!\n");&lt;br /&gt;		exit(EXIT_FAILURE);&lt;br /&gt;	}&lt;br /&gt;	&lt;br /&gt;	memset(&amp;event, 0x00, sizeof(event));&lt;br /&gt;	&lt;br /&gt;	event.type = ButtonPress;&lt;br /&gt;	event.xbutton.button = button;&lt;br /&gt;	event.xbutton.same_screen = True;&lt;br /&gt;	&lt;br /&gt;	XQueryPointer(display, RootWindow(display, DefaultScreen(display)), &amp;event.xbutton.root, &amp;event.xbutton.window, &amp;event.xbutton.x_root, &amp;event.xbutton.y_root, &amp;event.xbutton.x, &amp;event.xbutton.y, &amp;event.xbutton.state);&lt;br /&gt;	&lt;br /&gt;	event.xbutton.subwindow = event.xbutton.window;&lt;br /&gt;	&lt;br /&gt;	while(event.xbutton.subwindow)&lt;br /&gt;	{&lt;br /&gt;		event.xbutton.window = event.xbutton.subwindow;&lt;br /&gt;		&lt;br /&gt;		XQueryPointer(display, event.xbutton.window, &amp;event.xbutton.root, &amp;event.xbutton.subwindow, &amp;event.xbutton.x_root, &amp;event.xbutton.y_root, &amp;event.xbutton.x, &amp;event.xbutton.y, &amp;event.xbutton.state);&lt;br /&gt;	}&lt;br /&gt;	&lt;br /&gt;	if(XSendEvent(display, PointerWindow, True, 0xfff, &amp;event) == 0) fprintf(stderr, "Errore nell'invio dell'evento !!!\n");&lt;br /&gt;	&lt;br /&gt;	XFlush(display);&lt;br /&gt;	&lt;br /&gt;	usleep(100000);&lt;br /&gt;	&lt;br /&gt;	event.type = ButtonRelease;&lt;br /&gt;	event.xbutton.state = 0x100;&lt;br /&gt;	&lt;br /&gt;	if(XSendEvent(display, PointerWindow, True, 0xfff, &amp;event) == 0) fprintf(stderr, "Errore nell'invio dell'evento !!!\n");&lt;br /&gt;	&lt;br /&gt;	XFlush(display);&lt;br /&gt;	&lt;br /&gt;	XCloseDisplay(display);&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;// gcc source.c -L /usr/X11R6/lib -lX11</description>
      <pubDate>Sun, 01 Oct 2006 21:54:28 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/2750</guid>
      <author>whitetiger ()</author>
    </item>
    <item>
      <title>Java - UIManager all-windows</title>
      <link>http://snippets.dzone.com/posts/show/2017</link>
      <description>// Imposto il tema Metal non solo all'interno delle finestre di Java, ma anche al suo esterno...&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;    // Con queste definizioni dico che tutti i frame e i dialog prendono il tema Metal&lt;br /&gt;    JFrame.setDefaultLookAndFeelDecorated(true);&lt;br /&gt;    JDialog.setDefaultLookAndFeelDecorated(true);&lt;br /&gt;    //&lt;br /&gt;&lt;br /&gt;    try&lt;br /&gt;    {&lt;br /&gt;        // Con questa imposto il tema&lt;br /&gt;	UIManager.setLookAndFeel(new MetalLookAndFeel());&lt;br /&gt;    }&lt;br /&gt;    catch(UnsupportedLookAndFeelException e)&lt;br /&gt;    {&lt;br /&gt;	e.printStackTrace();&lt;br /&gt;    }&lt;br /&gt;    // In questo modo tutte le finestre avranno il tema Metal&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Mon, 15 May 2006 01:41:13 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/2017</guid>
      <author>whitetiger ()</author>
    </item>
    <item>
      <title>dojo/window/slidshow</title>
      <link>http://snippets.dzone.com/posts/show/1863</link>
      <description>// description of your code here&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;?php&lt;br /&gt;/*&lt;br /&gt; * Created on 2006-4-7&lt;br /&gt; *&lt;br /&gt; * To change the template for this generated file go to&lt;br /&gt; * Window - Preferences - PHPeclipse - PHP - Code Templates&lt;br /&gt; */&lt;br /&gt;?&gt;&lt;br /&gt;&lt;br /&gt;&lt;html&gt;&lt;br /&gt;&lt;head&gt;&lt;br /&gt;&lt;meta http-equiv="Content-Language" content="en" /&gt;&lt;br /&gt;&lt;meta name="GENERATOR" content="PHPEclipse 1.0" /&gt;&lt;br /&gt;&lt;meta http-equiv="Content-Type" content="text/html; charset=gb2312" /&gt;&lt;br /&gt;&lt;/head&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;link href="dojo/src/widget/templates/HtmlSlideShow.css" rel="stylesheet" type="text/css" /&gt;&lt;br /&gt;&lt;script type="text/javascript" src="dojo/dojo.js"&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;	&lt;script type="text/javascript" src="windows/javascripts/prototype.js"&gt; &lt;/script&gt; &lt;br /&gt;	&lt;script type="text/javascript" src="windows/javascripts/effects.js"&gt; &lt;/script&gt;&lt;br /&gt;	&lt;script type="text/javascript" src="windows/javascripts/window.js"&gt; &lt;/script&gt;&lt;br /&gt;	&lt;script type="text/javascript" src="windows/javascripts/debug.js"&gt; &lt;/script&gt;&lt;br /&gt;	&lt;link href="windows/themes/default.css" rel="stylesheet" type="text/css" &gt;	 &lt;/link&gt;&lt;br /&gt;	&lt;link href="windows/themes/theme1.css" rel="stylesheet" type="text/css" &gt;	 &lt;/link&gt;&lt;br /&gt;	&lt;link href="winodws/themes/alert.css" rel="stylesheet" type="text/css" &gt;	 &lt;/link&gt;&lt;br /&gt;	&lt;title&gt;Sample Windows&lt;/title&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;&lt;br /&gt;   //dojo.require("dojo.widget.Editor");&lt;br /&gt;    //dojo.require("dojo.widget.SlideShow");&lt;br /&gt;	//doji.require("dojo.event.*");&lt;br /&gt;     &lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;body bgcolor="#FFFFFF" text="#000000" link="#FF9966" vlink="#FF9966" alink="#FFCC99"&gt;&lt;br /&gt;&lt;br /&gt;	&lt;a href="javascript:openModalDialog()"&gt;Click here to open a modal window&lt;/a&gt;&lt;br /&gt;	&lt;br/&gt;&lt;br /&gt;	&lt;script&gt;&lt;br /&gt;	var index= 0;&lt;br /&gt;    var contentWin = null;&lt;br /&gt;		function openContentWindow() {&lt;br /&gt;		if (contentWin != null) {&lt;br /&gt;			Dialog.alert("Close the window 'Test' before opening it again!"); &lt;br /&gt;		}&lt;br /&gt;		else {&lt;br /&gt;			contentWin = new Window('content_win', {title: "Test ",top:100, left:100, resizable: false})&lt;br /&gt;			contentWin.setContent('test_content', true)&lt;br /&gt;			contentWin.toFront();&lt;br /&gt;			contentWin.setDestroyOnClose();&lt;br /&gt;			contentWin.show();	&lt;br /&gt;		}		&lt;br /&gt;	}&lt;br /&gt;&lt;br /&gt;		function openModalDialog() {&lt;br /&gt;		var win = new Window('modal' + index, {title: "&#230;&#732;&#8220;&#231;&#8482;&#187;&#231;&#189;&#8216;",top:100, left:100,  width:300, height:200, zIndex:150, opacity:50, resizable: true,hideEffect: Effect.Grow})&lt;br /&gt;		win.getContent().innerHTML = "&amp;nbsp;&amp;nbsp;&lt;a href='http://www.edeng.cn'&gt;edeng&lt;/a&gt;&lt;br /&gt;&lt;input type='submit' value='&#230;??&#228;&#186;&#164;'&gt;"&lt;br /&gt;		win.show(true);	&lt;br /&gt;		index++;&lt;br /&gt;	}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;	win = new Window('dialog1', {className: "dialog",  width:300, height:400, zIndex: 100, resizable: true, title: "Title", hideEffect: Effect.SwitchOff})&lt;br /&gt;	win.getContent().innerHTML= "&lt;div style='padding:10px'&gt; Lorem ipsum dolor sit amet, consectetur adipiscing elit, set eiusmod tempor incidunt et labore et dolore magna aliquam. Ut enim ad minim veniam, quis nostrud exerc. Irure dolor in reprehend incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse molestaie cillum. Tia non ob ea soluad incom dereud facilis est er expedit distinct. Nam liber te conscient to factor tum poen legum odioque civiuda et tam. \&lt;br /&gt;	At vver eos et accusam dignissum qui blandit est praesent. Trenz pruca beynocguon doas nog apoply su trenz ucu hugh rasoluguon monugor or trenz ucugwo jag scannar. Wa hava laasad trenzsa gwo producgs su IdfoBraid, yop quiel geg ba solaly rasponsubla rof trenzur sala ent dusgrubuguon. Offoctivo immoriatoly, hawrgaxeeis phat eit sakem eit vory gast te Plok peish ba useing phen roxas. Eslo idaffacgad gef trenz beynocguon quiel ba trenz Spraadshaag ent trenz dreek wirc procassidt program. Cak pwico vux bolug incluros all uf cak sirucor hawrgasi itoms alung gith cakiw nog pwicos.\&lt;br /&gt;	Lor sum amet, commy nulputat. Duipit lum ipisl eros dolortionsed tin hent aliquis illam volor in ea feum in ut adipsustrud elent ulluptat. Duisl ullan ex et am vulputem augiam doloreet amet enibh eui te dipit acillutat acilis amet, suscil er iuscilla con utat, quisis eu feugait ad dolore commy nullam iuscilisl iureril ilisl del ut pratuer iliquis acipissit accum quis nulluptat. Dui bla faccumsan velis auguero con henis duismolor sumsandrem quat vulluptat alit er iniamcore exeriure vero core te dit ut nulla feummolore commod dipis augiamcommod tem ese dolestrud do odo odiamco eetummy nis aliquamcommy nonse eu feugue del eugiamconsed ming estrud magnis exero eumsandio enisim del dio od tat.sumsan et pratum velit ing etue te consequis alis nullan et, quis am iusci bla feummy.&lt;/div&gt;"&lt;br /&gt;	win.showCenter();&lt;br /&gt;	&lt;/script&gt;&lt;br /&gt;&lt;div dojoType="Editor" items="textGroup;|;listGroup;|;colorGroup;|;blockGroup;|;commandGroup;"&gt;&lt;br /&gt;    some contentfsdfsdfsdfsdfsdfsdfsd  dddd&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;img dojoType="SlideShow" &lt;br /&gt;    imgUrlBase="dojo/src/pic/"&lt;br /&gt;    imgUrls="2.jpg;3.jpg" &lt;br /&gt;    transitionInterval="700"&lt;br /&gt;    delay="1000"&lt;br /&gt;    imgWidth="400"&lt;br /&gt;    imgHeight="300"&lt;br /&gt;    width="400"&lt;br /&gt;    height="300"&lt;br /&gt;    src="http://dojotoolkit.org/path/to/dojo/tests/widget/images/1.jpg" /&gt;&lt;p&gt;&lt;br /&gt;    &lt;?php echo "ddd" ?&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/body&gt;&lt;br /&gt;&lt;/html&gt;&lt;br /&gt;  &lt;br /&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sat, 08 Apr 2006 10:04:44 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1863</guid>
      <author>vista8 (joe)</author>
    </item>
  </channel>
</rss>
