├── README.md ├── _config.yml ├── _devel └── hc-devel-notes.txt ├── _layouts └── default.html ├── chrome.manifest ├── chrome ├── content │ ├── HideCaption.css │ ├── HideCaption.js │ ├── options.xul │ ├── overlay.xul │ └── windows.xml ├── locale │ ├── en-US │ │ └── option.dtd │ ├── zh-CN │ │ └── option.dtd │ └── zh-TW │ │ └── option.dtd └── skin │ ├── Close.gif │ ├── Drag.gif │ ├── Maximize.gif │ ├── Minimize.gif │ ├── Restore.gif │ └── style.css ├── index.md ├── install.rdf └── web_public └── content ├── help └── dynbars_en.html └── skin └── hcp_icon.png /README.md: -------------------------------------------------------------------------------- 1 | # Readme: 2 | 3 | 4 | Test ... [Dynamic Bars help (BETA!): ](web_public/content/help/dynbars_en.html) 5 | 6 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-slate 2 | 3 | title: Hide Caption Titlebar Plus 4 | -------------------------------------------------------------------------------- /_devel/hc-devel-notes.txt: -------------------------------------------------------------------------------- 1 | 2 | - Guardar mouse-move dsd el caption y los resize tb!! 3 | - Arranca maximizado pero movido! 4 | - Falla fullscreen sin menu-bar! 5 | check inFull en REstoreWin o algo asi vd?? 6 | 7 | - Falla restore en LINUX (es el maximize extra?) 8 | - Resizing var - falta this. !!! 9 | 10 | 11 | --------------------- /\/\/\/\ TODO /\/\/\/\ ------------------------- 12 | --------------------- \/\/\/\/ DONE \/\/\/\/ ------------------------- 13 | 14 | bye haveCaption_OnlyForRestore var. 15 | Some Fulllscreen problem (bad one when there ISNT MENU-BAR). New preference config: "use_caption", "smart" & others 16 | (hc-devel-notes.txt) 17 | -------------------------------------------------------------------------------- /_layouts/default.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | {{ site.title | default: site.github.repository_name }} 13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 | View on GitHub 21 | 22 |

{{ site.title | default: site.github.repository_name }}

23 |

24 | 25 | {% if site.show_downloads %} 26 |
27 | Download this project as a .zip file 28 | Download this project as a tar.gz file 29 |
30 | {% endif %} 31 |
32 |
33 | 34 | 35 |
36 |
37 | {{ content }} 38 |
39 |
40 | 41 | 42 | 50 | 51 | {% if site.google_analytics %} 52 | 60 | {% endif %} 61 | 62 | 63 | -------------------------------------------------------------------------------- /chrome.manifest: -------------------------------------------------------------------------------- 1 | content HideCaption chrome/content/ 2 | skin HideCaption classic/1.0 chrome/skin/ 3 | locale HideCaption en-US chrome/locale/en-US/ 4 | locale HideCaption zh-CN chrome/locale/zh-CN/ 5 | locale HideCaption zh-TW chrome/locale/zh-TW/ 6 | overlay chrome://browser/content/browser.xul chrome://HideCaption/content/overlay.xul 7 | -------------------------------------------------------------------------------- /chrome/content/HideCaption.css: -------------------------------------------------------------------------------- 1 | #main-window { -moz-binding: url("chrome://HideCaption/content/windows.xml#newWindow"); } 2 | #toolbar-menubar { -moz-binding: url("chrome://HideCaption/content/windows.xml#toolbar-menubar"); } 3 | 4 | -------------------------------------------------------------------------------- /chrome/content/HideCaption.js: -------------------------------------------------------------------------------- 1 | 2 | window.addEventListener('load', function() { HideCaption.OnLoad() }, false); 3 | window.addEventListener('resize', function(e) { HideCaption.OnResize(e) }, false); 4 | window.addEventListener('beforeunload', function(e) { HideCaption.OnClose() }, false); 5 | window.addEventListener('unload', function(e) { HideCaption.OnClose() }, false); 6 | window.onbeforeunload = function() { HideCaption.OnClose(); } 7 | 8 | var DownX, DownY, DownT, DblClk; 9 | var FormX, FormY, FormW, FormH; 10 | var WinState, Resizing, InitPos, gPref; 11 | 12 | var DragCtrlsTagName = ["toolbarspring", "toolbarspacer"]; 13 | var DragCtrls = [ 14 | "navigator-throbber", //dp: this doesnt work , don't know why 15 | "window-controls", "statusbar-display", "hc-drag-space", "tabsontop-place-bar", "stop-button"]; 16 | 17 | var HideCaption = { 18 | 19 | //new behavior (will be configurable) 20 | setCaptionOnRestore_option: true, 21 | //haveCaption_OnlyForRestore: false, // this caption was set only due to the corresponding xxx_option ! (isn't a popup that should have caption_permanent and such) 22 | 23 | haveCaption_Permanent : false, 24 | haveCaption : false, 25 | 26 | mainW : null, 27 | processOnResize: true, 28 | 29 | settedMaxSize : false, 30 | 31 | Close : function() { 32 | if (this.GetBoolPref("min-on-close",null)) 33 | window.minimize(); 34 | else 35 | BrowserTryToCloseWindow(); 36 | }, 37 | 38 | SetMaxSize : function() { 39 | 40 | this.myDumpToConsole("SetMaxSize: settedMaxSize= "+this.settedMaxSize+" , WinState= "+WinState ); //this.haveCaptionOnlyForRestore 41 | 42 | if( this.settedMaxSize && WinState > 0 ){ // win32 is generating a 2nd resize-maximize() event (perhaps when hidechrome is set to true.) 43 | this.myDumpToConsole("SetMaxSize: SKIPPING !!!!!!!!!! ---------------------------------------------------------------- "); 44 | return; 45 | } 46 | 47 | WinState |= 1; 48 | 49 | HideCaption.processOnResize= false; 50 | this.doSetMaxSize(); 51 | HideCaption.processOnResize= true; 52 | 53 | this.SaveInDB_Pos_Size(); // save this for "Open New Window" CTRL+N command (new windows will be the same as 1st) 54 | }, 55 | doSetMaxSize: function(){ 56 | 57 | var x = 0; var w = screen.availWidth; 58 | var y = 0; var h = screen.availHeight; 59 | 60 | if (h==screen.height && w==screen.width) { 61 | var tb=this.GetCharPref("taskbar_pos", 62 | "").toLowerCase(); 63 | if (tb=="left" || tb=="right") { 64 | w -= 1; x = tb=="left" ? 1 : 0; 65 | } 66 | else { 67 | h -= 1; y = tb=="top" ? 1 : 0; 68 | } 69 | } 70 | else { 71 | x=screen.availLeft; y=screen.availTop; 72 | } 73 | 74 | var isMaximizedWin= window.windowState==window.STATE_MAXIMIZED; 75 | 76 | if( ! this.haveCaption_Permanent ){ // this.haveCaptionOnlyForRestore -- only it it ISNT a permanent caption 77 | 78 | this.mainW.setAttribute("hidechrome", "true"); 79 | this.haveCaption= this.mainW.getAttribute("hidechrome") != "true"; 80 | //this.haveCaptionOnlyForRestore= false; 81 | 82 | this.myDumpToConsole("SetMaxSize: (with timeout) "); 83 | 84 | HideCaption.my_moveTo(x,y); 85 | if( !isMaximizedWin ){ 86 | HideCaption.my_maximize(); 87 | } 88 | 89 | setTimeout( function() 90 | { 91 | HideCaption.processOnResize= false; 92 | Resizing += 1; 93 | 94 | HideCaption.my_resizeTo(w,h); 95 | 96 | Resizing -= 1; 97 | HideCaption.processOnResize= true; 98 | }, 20); // setTimeout() 99 | 100 | }else{ 101 | this.myDumpToConsole("SetMaxSize: "); 102 | this.my_moveTo(x,y); 103 | this.my_resizeTo(w,h); 104 | } 105 | 106 | this.settedMaxSize= true; 107 | }, 108 | 109 | Maximize : function() { 110 | if( this.haveCaption_Permanent ){ 111 | if( window.windowState != window.STATE_MAXIMIZED ){ 112 | WinState |= 1; 113 | window.maximize(); 114 | }else{ 115 | WinState = 0; 116 | window.restore(); 117 | } 118 | //return; // !! 119 | 120 | }else{ // ! this.haveCaption_Permanent 121 | 122 | Resizing += 1; 123 | if (WinState == 0) { 124 | this.SavePosSize(); this.SetMaxSize(); 125 | } 126 | else if(WinState >= 2){ 127 | BrowserFullScreen(); 128 | this.myDumpToConsole(" called BrowserFullScreen() !"); 129 | }else { 130 | this.RestoreWin(); 131 | WinState = 0; 132 | 133 | } 134 | Resizing -= 1; 135 | this.ResetBorder(); 136 | } 137 | this.SaveInDB_Pos_Size(); // save this for "Open New Window" CTRL+N command (new windows will be the same as 1st) 138 | }, 139 | 140 | RestoreWin : function() { 141 | HideCaption.processOnResize= false; 142 | this.doRestoreWin(); 143 | HideCaption.processOnResize= true; 144 | }, 145 | doRestoreWin : function() { 146 | 147 | this.haveCaption= this.mainW.getAttribute("hidechrome") != "true"; 148 | if( this.setCaptionOnRestore_option ){ 149 | if( !this.haveCaption ){ 150 | //this.haveCaptionOnlyForRestore= true; 151 | this.mainW.setAttribute("hidechrome", "false"); 152 | this.haveCaption= this.mainW.getAttribute("hidechrome") != "true"; 153 | } 154 | 155 | this.myDumpToConsole("RestoreWin: (with timeout) "); 156 | 157 | HideCaption.my_maximize(); // only WIn32?? 158 | HideCaption.my_moveTo(FormX, FormY); 159 | HideCaption.my_restore(); 160 | HideCaption.my_resizeTo(FormW-1, FormH); 161 | 162 | setTimeout( function(){ 163 | HideCaption.processOnResize= false; 164 | Resizing += 1; 165 | 166 | HideCaption.my_resizeTo(FormW, FormH); 167 | 168 | Resizing -= 1; 169 | HideCaption.processOnResize= true; 170 | }, 20); 171 | }else{ 172 | this.myDumpToConsole("RestoreWin: "); 173 | this.my_moveTo(FormX, FormY); 174 | this.my_resizeTo(FormW, FormH); 175 | } 176 | 177 | this.settedMaxSize= false; 178 | }, 179 | 180 | my_moveTo: function(_x, _y){ 181 | this.debug_move("moveTo("+_x+","+_y+")"); 182 | window.moveTo (_x, _y); 183 | }, 184 | my_resizeTo: function(_x, _y){ 185 | this.debug_move("resizeTo("+_x+","+_y+")"); 186 | window.resizeTo(_x, _y); 187 | }, 188 | my_maximize: function(){ 189 | this.debug_move("maximize()"); 190 | window.maximize(); 191 | }, 192 | my_restore: function(){ 193 | this.debug_move("restore()"); 194 | window.restore(); 195 | }, 196 | 197 | debug_move: function(_sMsg){ 198 | this.myDumpToConsole(" >> about to: "+_sMsg); 199 | }, 200 | 201 | OnLoad : function() { 202 | var ctrlW, Class; 203 | 204 | this.mainW = document.getElementById("main-window"); 205 | 206 | Class = "@mozilla.org/preferences-service;1"; 207 | gPref = Components.classes[Class].getService( 208 | Components.interfaces.nsIPrefService). 209 | getBranch("extensions."); 210 | 211 | InitPos = 1; Resizing = 0; WinState = 0; 212 | DownT = 0; DblClk = 0; this.SavePosSize(); 213 | 214 | this.LoadFromDB_Pos_Size(); //read WinState !!! 215 | 216 | var use_caption_option= this.GetCharPref("use_caption", "smart").toLowerCase(); // never, smart, always 217 | // check in LINUX!!! 218 | this.myDumpToConsole(" final use_caption: "+use_caption_option); 219 | if( use_caption_option == "never"){ 220 | this.setCaptionOnRestore_option= false; 221 | }else if( use_caption_option == "always"){ 222 | // NOT implemented yet! 223 | }else{ // default: smart !!! 224 | this.setCaptionOnRestore_option= true; 225 | } 226 | this.myDumpToConsole(" setted setCaptionOnRestore_option: "+this.setCaptionOnRestore_option); 227 | 228 | var hidechrome= false; 229 | if (this.mainW) { 230 | 231 | var menubar = document.getElementById("toolbar-menubar"); 232 | if( getComputedStyle(menubar,"").display != "-moz-box" ){ //leave POPUPS with Caption, close box, etc 233 | //hidechrome= false; 234 | this.haveCaption_Permanent = true; //?? have popup have captionOnRestore also? 235 | }else{ 236 | if( this.setCaptionOnRestore_option && WinState == 0 ){ 237 | //leave restored win 238 | }else{ 239 | hidechrome= true; 240 | } 241 | } 242 | this.mainW.setAttribute("hidechrome", hidechrome?"true":"false"); // ALWAYS set this attribute for css to work well! 243 | this.haveCaption= this.mainW.getAttribute("hidechrome") != "true"; 244 | 245 | FormX = this.mainW.getAttribute("screenX"); 246 | FormY = this.mainW.getAttribute("screenY"); 247 | } 248 | 249 | const _XULNS= "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; 250 | for(var i=0; i> OnResize: hidec="+this.mainW.getAttribute("hidechrome")+ 351 | " process:"+HideCaption.processOnResize+(HideCaption.processOnResize?"":" || ")+ 352 | " WinState:"+WinState+ 353 | " STATE_MAXIMIZED:"+(window.windowState==window.STATE_MAXIMIZED)+ 354 | " - e: "+ 355 | e.target.screenX+" "+e.target.screenY+" "+ 356 | " - mainW: "+ 357 | this.mainW.width+" "+this.mainW.height+" "+ 358 | ""); 359 | 360 | //DarthPalpatine@dummy.addons.mozilla.org: don't maximize popup/captioned windows ! (the most frequent ones, without menubar) 361 | if( getComputedStyle(menubar,"").display != "-moz-box" || 362 | this.haveCaption_Permanent ){ 363 | 364 | //winctrls.setAttribute("hidden", "true"); 365 | inFull=="true" ? WinState |= 2 : (window.windowState==window.STATE_MAXIMIZED? WinState |= 1 : WinState = 0); // for mousemove in status bar 366 | this.ResetBorder(); // after setting WinState 367 | return; // RETURN here!!!! 368 | } 369 | 370 | if( ! HideCaption.processOnResize ){ //SKIPPING !!! - don't mess anything more! 371 | return; 372 | } 373 | 374 | if (window.windowState==window.STATE_MAXIMIZED) { 375 | this.SetMaxSize(); this.ResetBorder(); 376 | } 377 | else{ 378 | this.ResetBorder(); 379 | } 380 | 381 | if (InitPos == 1) { 382 | InitPos = 0; 383 | 384 | if( this.LoadFromDB_Pos_Size() ){ 385 | var WinState_bak= WinState; 386 | Resizing += 1; 387 | if (WinState & 3){ 388 | (WinState&2) ? BrowserFullScreen() 389 | : window.maximize(); 390 | }else { 391 | if( ! this.haveCaption ){ 392 | this.RestoreWin(); 393 | } 394 | } 395 | Resizing -= 1; 396 | WinState = WinState_bak; 397 | } 398 | } 399 | else if(State0==2 && Resizing==0 && WinState== 400 | 0) { 401 | Resizing += 1; 402 | this.RestoreWin(); 403 | Resizing -= 1; 404 | } 405 | }, 406 | 407 | MouseDown : function(e) { 408 | if (e.button==0) { 409 | if (DownT!=0 && DblClk!=1 && e.timeStamp-DownT<= 410 | 400 && DownX==e.screenX && DownY==e.screenY) 411 | DblClk = 1; 412 | else { 413 | DownT = e.timeStamp; DblClk = 0; 414 | } 415 | } 416 | if (e.button==0 && document.getElementById(e.target.id 417 | ).parentNode.id!="window-controls") { 418 | if (WinState == 0) { 419 | FormX = screenX; FormY = screenY; 420 | } 421 | DownX = e.screenX; DownY = e.screenY; 422 | document.addEventListener("mouseup", HideCaption 423 | .MouseUp, true); 424 | document.addEventListener("mousemove", HideCaption 425 | .MouseMove, true); 426 | } 427 | }, 428 | 429 | MouseUp : function(e) { 430 | document.removeEventListener("mouseup", HideCaption. 431 | MouseUp, true); 432 | document.removeEventListener("mousemove", HideCaption. 433 | MouseMove, true); 434 | if (WinState==0) HideCaption.SavePosSize(); 435 | 436 | if (e.button==0 && DblClk==1 && e.timeStamp-DownT<=800 437 | ) { 438 | DownT = 0; DblClk = 0; HideCaption.Maximize(); 439 | } 440 | }, 441 | 442 | MouseMove : function(e) { 443 | if (e.screenX!=DownX || e.screenY!=DownY) { 444 | DownT = 0; DblClk = 0; 445 | } 446 | if (WinState == 0) 447 | window.moveTo(FormX+e.screenX-DownX, FormY+e. 448 | screenY-DownY); 449 | }, 450 | 451 | SavePosSize : function() { 452 | var width, height; 453 | 454 | width = this.mainW.getAttribute("width"); 455 | height= this.mainW.getAttribute("height"); 456 | 457 | if( width <320 ) width= 320; 458 | if( height<240 ) height=240; 459 | if( width >screen.width ) width = screen.width; 460 | if( height>screen.height) height= screen.height; 461 | 462 | FormX = screenX; FormW = width; 463 | FormY = screenY; FormH = height; 464 | 465 | this.myDumpToConsole(" SavePosSize: saved coords!!: "+FormX+","+FormY+","+FormW+","+FormH); 466 | }, 467 | 468 | ResetBorder : function() { 469 | var MaxFull = WinState!=0 ? true : false; 470 | if (MaxFull != this.mainW.getAttribute("hc-MaxFull")) { 471 | if (MaxFull) 472 | this.mainW.setAttribute( "hc-MaxFull", MaxFull); 473 | else 474 | this.mainW.removeAttribute( "hc-MaxFull"); 475 | } 476 | //this.haveCaption= this.mainW.getAttribute("hidechrome") != "true"; 477 | // check new haveCaption var also. 478 | //var n=0; 479 | //for(var n=1; n<=8; n++) { 480 | // document.getElementById("hc-resizer"+n).style 481 | // .display = MaxFull || this.haveCaption ? "none" : "-moz-box"; // setted in CSS 482 | //} 483 | }, 484 | 485 | GetBoolPref : function(Name, DefVal) { 486 | var hcName = "hide_caption." + Name; 487 | try { 488 | return gPref.getBoolPref(hcName); 489 | } 490 | catch(e) { 491 | if (DefVal) 492 | gPref.setBoolPref(hcName, DefVal); 493 | return DefVal; 494 | } 495 | }, 496 | 497 | GetCharPref : function(Name, DefVal) { 498 | var hcName = "hide_caption." + Name; 499 | try { 500 | return gPref.getCharPref(hcName); 501 | } 502 | catch(e) { 503 | if (DefVal) 504 | gPref.setCharPref(hcName, DefVal); 505 | return DefVal; 506 | } 507 | }, 508 | 509 | }; 510 | -------------------------------------------------------------------------------- /chrome/content/options.xul: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /chrome/content/overlay.xul: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | %browserDTD; 8 | 9 | %baseMenuOverlayDTD; 10 | 11 | %brandDTD; 12 | ]> 13 | 14 | 15 | 16 | 17 | 18 | 19 | 21 |