K-Meleon

KMeleonWiki > Resources > MacroLibrary > KmmPrivateTitle

Submitted by: JamesD and desga2



Notes:

PrivateTitle.kmm will change the title in the titlebar, the taskbar, the tab, and the information in the URLbar once the page has loaded. The user may configure to accept the title "Private" or another title of their choice. The menu for PrivateTitle appears in the TOOLS menu, and there is an accelerator keyset, CTRL SHIFT p, to toggle on and off.




Open your User Macro Folder (Edit > Configuration > User-Defined Macros) or your Macro Folder (Edit > Configuration > Macros) and create the following text file:

PrivateTitle.kmm

#  K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage)
#
# ---------- PrivateTitle.kmm
# ---------- K-Meleon Macro Language to halt display of page titles -------------------------------
# ----------  also halts display of info in the URLBAR.
#
# Dependencies        : main.kmm
# Resources            : -
# Preferences           : k-meleon_PrivateTitle_use
#                             : k-meleon_PrivateTitle_Loading
#                             : kmeleon.tabs.useLoadingTitle
#                             : k-meleon_PrivateTitle_custom
# Version                : 0.6   2008-12-03
# Authors                : JamesD and desga2
# -------------------------------------------------------------------------------------------------

PrivateTitle_ToggleUse{
getpref(BOOL, "k-meleon_PrivateTitle_use")==true?&_PrivateTitle_Set_Off:&_PrivateTitle_Set_On;
rebuildmenu($_PrivateTitle_Popm);
}

# - - - - PRIVATE - - - -

_PrivateTitle_Set_On{
# checkmark value for the on menu:
menuchecked=getpref(BOOL, "k-meleon_PrivateTitle_use")==true;
# set the userpref k-meleon_PrivateTitle_use to true:
setpref(BOOL, "k-meleon_PrivateTitle_use", true);
# check on tabs loading title:
getpref(BOOL, "kmeleon.tabs.useLoadingTitle")==true?&_PrivateTitle_Loading_Yes:0;
}

_PrivateTitle_Set_Off{
# checkmark value for the off menu:
menuchecked=getpref(BOOL, "k-meleon_PrivateTitle_use")==false;
# set the userpref k-meleon PrivateTitle_use to false:
setpref(BOOL, "k-meleon_PrivateTitle_use", false);
getpref(BOOL, "k-meleon_PrivateTitle_Loading")==true?&_PrivateTitle_Loading_ReDo:0;
}

_PrivateTitle_Loading_Yes{
setpref(BOOL, "kmeleon.tabs.useLoadingTitle", false);
setpref( BOOL , "k-meleon_PrivateTitle_Loading", true );
}

_PrivateTitle_Loading_ReDo{
setpref(BOOL, "kmeleon.tabs.useLoadingTitle", true);
delpref( "k-meleon_PrivateTitle_Loading" );
}

_PrivateTitle_TitleBlank{
$_PrivateTitle_Use=getpref(BOOL, "k-meleon_PrivateTitle_use");
$_PrivateTitle_Use==true?&_PrivateTitle_TitleWrite:0;
}

_PrivateTitle_TitleWrite{
$_PrivateCustomT=getpref(STRING, "k-meleon_PrivateTitle_custom");
$_PrivateCustomT==""?$_PrivateCustomT="Private":0;
$TITLE=$_PrivateCustomT;
$URLBAR=$_PrivateCustomT;
$_JS_private="document.title='".$_PrivateCustomT."';";
injectJS($_JS_private);
}

_PrivateTitle_CustomT{
$_PrivateCustomT=getpref(STRING, "k-meleon_PrivateTitle_custom");
$_PrivateCustomT==""?$_PrivateCustomT="Private":0;
$_PrivTcustom=prompt("Enter the title to use for title replacements. Type a space for no title.", "Custom Private Title", $_PrivateCustomT);
$_PrivTcustom==""?0 : setpref(STRING, "k-meleon_PrivateTitle_custom", $_PrivTcustom);
}

_PrivateTitle_SetAccels{
setaccel("CTRL SHIFT p", "macros(PrivateTitle_ToggleUse)");
}

_PrivateTitle_ModMenu{
$_PrivateTitle_Popm="Private Title";
setmenu("&Tools", popup, $_PrivateTitle_Popm, Misc);
&_PrivateTitle_ModMenuP;
}

_PrivateTitle_ModMenuP{
setmenu($_PrivateTitle_Popm, macro, "ON", _PrivateTitle_Set_On, 0);
setmenu($_PrivateTitle_Popm, macro, "OFF", _PrivateTitle_Set_Off, 1);
setmenu($_PrivateTitle_Popm, separator, 2);
setmenu($_PrivateTitle_Popm, macro, "Custom title ...", _PrivateTitle_CustomT, 3);
rebuildmenu($_PrivateTitle_Popm);
}

$OnLoad=$OnLoad."_PrivateTitle_TitleBlank;";
$OnInit=$OnInit."_PrivateTitle_ModMenu;";
$OnInit=$OnInit."_PrivateTitle_SetAccels;";
$macroModules=$macroModules."PrivateTitle;";


Comments & Questions

K-Meleon

(c) 2000-2010 kmeleonbrowser.org. All rights reserved.
design by splif.