diff options
-rw-r--r-- | agent-stylesheet.css | 8 | ||||
-rw-r--r-- | clickToView.xml | 239 | ||||
-rw-r--r-- | progresslistener.py | 103 | ||||
-rw-r--r-- | promptservice.py | 67 | ||||
-rw-r--r-- | securitydialogs.py | 51 | ||||
-rw-r--r-- | sessionhistory.py | 77 |
6 files changed, 0 insertions, 545 deletions
diff --git a/agent-stylesheet.css b/agent-stylesheet.css deleted file mode 100644 index 6c94d0e..0000000 --- a/agent-stylesheet.css +++ /dev/null @@ -1,8 +0,0 @@ -/* Prevent flash animations from playing until you click on them. */ -object[classid$=":D27CDB6E-AE6D-11cf-96B8-444553540000"], -object[codebase*="swflash.cab"], -object[type="application/x-shockwave-flash"], -embed[type="application/x-shockwave-flash"], -embed[src$=".swf"] -{ -moz-binding: url("clickToView.xml#flash"); } - diff --git a/clickToView.xml b/clickToView.xml deleted file mode 100644 index 6164c73..0000000 --- a/clickToView.xml +++ /dev/null @@ -1,239 +0,0 @@ -<?xml version="1.0"?> -<!-- This provides a click-to-view capability to block flash - and java content in Firefox. Derived from: - http://www.squarefree.com/userstyles/xbl.html - and modified to allow different messages for flash and java - by Steve Zobell. This can be placed in the rez directory in - the Firefox install (e.g. C:\Program Files\Mozilla Firefox\res). - - The blocking capabilities are derived from this description: - http://www.wlug.org.nz/MozillaNotes - - Add the following to userContent.css (in the chrome directory - in the user profile): - -/* Prevent flash animations from playing until you click on them. */ -object[classid$=":D27CDB6E-AE6D-11cf-96B8-444553540000"], -object[codebase*="swflash.cab"], -object[type="application/x-shockwave-flash"], -embed[type="application/x-shockwave-flash"], -embed[src$=".swf"] -{ -moz-binding: url("resource:///res/clickToView.xml#flash"); } - -/* Block java, with a click to load feature. */ -object[codebase*="java"], -object[type="application/java"], -embed[type="application/java"], -applet[code$=".class"] -{ -moz-binding: url("resource:///res/clickToView.xml#java"); } - ---> -<bindings xmlns="http://www.mozilla.org/xbl" xmlns:html="http://www.w3.org/1999/xhtml"> - -<binding id="flash"> - <implementation> - <constructor> - <![CDATA[ - - -var doomed = this; - -// Check parent too (case of working EMBED inside broken OBJECT) -if (doomed.overrideCTV || doomed.parentNode.overrideCTV) - return; -doomed.overrideCTV = true; - -var placeholder = document.createElement("div"); - - -// === Styling === - -var w = parseInt(doomed.width || doomed.style.width); -var h = parseInt(doomed.height || doomed.style.height); - -if (!w || w < 32) w = 32; // !w catches e.g. NaN -if (!h || h < 32) h = 32; - -placeholder.style.width = w + "px"; -placeholder.style.height = h + "px"; -placeholder.style.backgroundColor = "yellow"; -placeholder.style.MozOutline = "1px solid red"; -placeholder.style.textAlign = "center"; -placeholder.style.color = "black"; -placeholder.style.background = "white"; -placeholder.style.opacity = 0.4; -placeholder.style.cursor = "pointer"; -placeholder.style.overflow = "hidden"; - -var red = document.createElement("span"); -red.style.fontWeight = "bold"; -red.style.fontStyle = "italic"; -red.style.color = "red"; -red.appendChild(document.createTextNode("Flash")); - -var text = document.createTextNode(" [[Click to play]] "); - - -// A button to dismiss the placeholder (instead of playing) -// Useful for those wonderful flash animations that cover -// the text on the page at the start. -var bye = document.createElement("bye"); -bye.style.backgroundColor = "white"; -bye.style.MozOutline = "2px solid red"; -bye.style.textAlign = "center"; -bye.style.color = "red"; -bye.style.background = "white"; -bye.style.cursor = "pointer"; -bye.style.overflow = "hidden"; -bye.appendChild(document.createTextNode("X")); - -placeholder.appendChild(red); -placeholder.appendChild(text); -placeholder.appendChild(bye); - -placeholder.onmouseover = function() -{ - this.style.MozOutline='3px outset white'; - this.style.opacity = 1.0; - this.style.background='lightgrey' -} -placeholder.onmouseout = function() -{ - this.style.background='white'; - this.style.opacity = 0.4; - this.style.MozOutline='1px solid red'; -} - - -// === Replacement === - -var p = doomed.parentNode; - -// Do in a timeout to avoid bugginess -setTimeout ( function () -{ - p.insertBefore(placeholder, doomed); - p.removeChild(doomed); -}, 0); - -// I love closures -placeholder.onclick = function() -{ - p.insertBefore(doomed, placeholder); - p.removeChild(placeholder); -} - - -bye.onclick = function() -{ - p.removeChild(placeholder); -} - - ]]> - </constructor> - </implementation> -</binding> - - -<binding id="java"> - <implementation> - <constructor> - <![CDATA[ - - -var doomed = this; - -// Check parent too (case of working EMBED inside broken OBJECT) -if (doomed.overrideCTV || doomed.parentNode.overrideCTV) - return; -doomed.overrideCTV = true; - -var placeholder = document.createElement("div"); - - -// === Styling === - -var w = parseInt(doomed.width || doomed.style.width); -var h = parseInt(doomed.height || doomed.style.height); - -if (!w || w < 32) w = 32; // !w catches e.g. NaN -if (!h || h < 32) h = 32; - -placeholder.style.width = w + "px"; -placeholder.style.height = h + "px"; -placeholder.style.backgroundColor = "yellow"; -placeholder.style.MozOutline = "1px solid red"; -placeholder.style.textAlign = "center"; -placeholder.style.color = "black"; -placeholder.style.background = "white"; -placeholder.style.opacity = 0.4; -placeholder.style.cursor = "pointer"; -placeholder.style.overflow = "hidden"; - -var red = document.createElement("span"); -red.style.fontWeight = "bold"; -red.style.fontStyle = "italic"; -red.style.color = "red"; -red.appendChild(document.createTextNode("Java")) - -var text = document.createTextNode(" [[Click to play]] "); - -placeholder.appendChild(red); -placeholder.appendChild(text); - -// A button to dismiss the placeholder (instead of playing) -var bye = document.createElement("span"); -bye.style.backgroundColor = "white"; -bye.style.MozOutline = "2px solid red"; -bye.style.textAlign = "center"; -bye.style.color = "red"; -bye.style.background = "white"; -bye.style.cursor = "pointer"; -bye.style.overflow = "hidden"; -bye.appendChild(document.createTextNode("X")) -placeholder.appendChild(bye); - -placeholder.onmouseover = function() -{ - this.style.MozOutline='3px outset white'; - this.style.opacity = 1.0; - this.style.background='lightgrey' -} -placeholder.onmouseout = function() -{ - this.style.background='white'; - this.style.opacity = 0.4; - this.style.MozOutline='1px solid red'; -} - - -// === Replacement === - -var p = doomed.parentNode; - -// Do in a timeout to avoid bugginess -setTimeout ( function () -{ - p.insertBefore(placeholder, doomed); - p.removeChild(doomed); -}, 0); - -// I love closures -placeholder.onclick = function() -{ - p.insertBefore(doomed, placeholder); - p.removeChild(placeholder); -} - - -bye.onclick = function() -{ - p.removeChild(placeholder); -} - - ]]> - </constructor> - </implementation> -</binding> - -</bindings> diff --git a/progresslistener.py b/progresslistener.py deleted file mode 100644 index 2a78c42..0000000 --- a/progresslistener.py +++ /dev/null @@ -1,103 +0,0 @@ -# Copyright (C) 2006, Red Hat, Inc. -# Copyright (C) 2007, One Laptop Per Child -# Copyright (C) 2009, Tomeu Vizoso -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -from gi.repository import GObject -import xpcom -from xpcom.components import interfaces - - -class ProgressListener(GObject.GObject): - _com_interfaces_ = interfaces.nsIWebProgressListener - - def __init__(self): - GObject.GObject.__init__(self) - - self._location = None - self._loading = False - self._progress = 0.0 - self._total_requests = 0 - self._completed_requests = 0 - - self._wrapped_self = xpcom.server.WrapObject( \ - self, interfaces.nsIWebProgressListener) - weak_ref = xpcom.client.WeakReference(self._wrapped_self) - - def setup(self, browser): - mask = interfaces.nsIWebProgress.NOTIFY_STATE_NETWORK | \ - interfaces.nsIWebProgress.NOTIFY_STATE_REQUEST | \ - interfaces.nsIWebProgress.NOTIFY_LOCATION - - browser.web_progress.addProgressListener(self._wrapped_self, mask) - - def _reset_requests_count(self): - self._total_requests = 0 - self._completed_requests = 0 - - def onLocationChange(self, webProgress, request, location): - self._location = location - self.notify('location') - - def onProgressChange(self, webProgress, request, curSelfProgress, - maxSelfProgress, curTotalProgress, maxTotalProgress): - pass - - def onSecurityChange(self, webProgress, request, state): - pass - - def onStateChange(self, webProgress, request, stateFlags, status): - if stateFlags & interfaces.nsIWebProgressListener.STATE_IS_REQUEST: - if stateFlags & interfaces.nsIWebProgressListener.STATE_START: - self._total_requests += 1 - elif stateFlags & interfaces.nsIWebProgressListener.STATE_STOP: - self._completed_requests += 1 - - if stateFlags & interfaces.nsIWebProgressListener.STATE_IS_NETWORK: - if stateFlags & interfaces.nsIWebProgressListener.STATE_START: - self._loading = True - self._reset_requests_count() - self.notify('loading') - elif stateFlags & interfaces.nsIWebProgressListener.STATE_STOP: - self._loading = False - self.notify('loading') - - if self._total_requests < self._completed_requests: - self._progress = 1.0 - elif self._total_requests > 0: - self._progress = \ - self._completed_requests / float(self._total_requests) - else: - self._progress = 0.0 - self.notify('progress') - - def onStatusChange(self, webProgress, request, status, message): - pass - - def _get_location(self): - return self._location - - location = GObject.property(type=object, getter=_get_location) - - def _get_loading(self): - return self._loading - - loading = GObject.property(type=bool, default=False, getter=_get_loading) - - def _get_progress(self): - return self._progress - - progress = GObject.property(type=float, getter=_get_progress) diff --git a/promptservice.py b/promptservice.py deleted file mode 100644 index 31ba0da..0000000 --- a/promptservice.py +++ /dev/null @@ -1,67 +0,0 @@ -# Copyright (C) 2007, One Laptop Per Child -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -import logging - -from xpcom.components import interfaces - - -class PromptService: - _com_interfaces_ = interfaces.nsIPromptService - - cid = '{836a90cb-6304-44f0-97df-c29913b908b7}' - description = 'Sugar Prompt Service' - - def __init__(self): - pass - - def alert(self, parent, dialogTitle, text): - logging.debug('nsIPromptService.alert()') - - def alertCheck(self, parent, dialogTitle, text, checkMsg, checkState): - logging.debug('nsIPromptService.alertCheck()') - - def confirm(self, parent, dialogTitle, text): - logging.debug('nsIPromptService.confirm()') - - def confirmCheck(self, parent, dialogTitle, text, checkMsg, checkState): - logging.debug('nsIPromptService.confirmCheck()') - - def confirmEx(self, parent, dialogTitle, text, buttonFlags, button0Title, - button1Title, button2Title, checkMsg, checkState): - logging.debug('nsIPromptService.confirmEx()') - - def prompt(self, parent, dialogTitle, text, value, checkMsg, checkState): - logging.debug('nsIPromptService.prompt()') - - def promptPassword(self, parent, dialogTitle, text, password, checkMsg, - checkState): - logging.debug('nsIPromptService.promptPassword()') - - def promptUsernameAndPassword(self, parent, dialogTitle, text, username, - password, checkMsg, checkState): - logging.debug('nsIPromptService.promptUsernameAndPassword()') - - def select(self, parent, dialogTitle, text, count, selectList, - outSelection): - logging.debug('nsIPromptService.select()') - - -#components.registrar.registerFactory( -# PromptService.cid, -# PromptService.description, -# '@mozilla.org/embedcomp/prompt-service;1', -# Factory(PromptService)) diff --git a/securitydialogs.py b/securitydialogs.py deleted file mode 100644 index f3d20fb..0000000 --- a/securitydialogs.py +++ /dev/null @@ -1,51 +0,0 @@ -# Copyright (C) 2007, One Laptop Per Child -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -import logging - -from xpcom.components import interfaces - - -class SecurityDialogs: - _com_interfaces_ = interfaces.nsIBadCertListener - - cid = '{267d2fc2-1810-11dc-8314-0800200c9a66}' - description = 'Sugar Security Dialogs' - - def __init__(self): - pass - - def confirmCertExpired(socketInfo, cert): - logging.debug('UNIMPLEMENTED: SecurityDialogs.confirmCertExpired()') - return interfaces.nsIBadCertListener.ADD_TRUSTED_FOR_SESSION, True - - def confirmMismatchDomain(socketInfo, targetURL, cert): - logging.debug('UNIMPLEMENTED: SecurityDialogs.confirmMismatchDomain()') - return interfaces.nsIBadCertListener.ADD_TRUSTED_FOR_SESSION, True - - def confirmUnknownIssuer(socketInfo, cert, certAddType): - logging.debug('UNIMPLEMENTED: SecurityDialogs.confirmUnknownIssuer()') - return interfaces.nsIBadCertListener.ADD_TRUSTED_FOR_SESSION, True - - def notifyCrlNextupdate(socketInfo, targetURL, cert): - logging.debug('UNIMPLEMENTED: SecurityDialogs.notifyCrlNextupdate()') - -""" -components.registrar.registerFactory(SecurityDialogs.cid, - SecurityDialogs.description, - '@mozilla.org/nsBadCertListener;1', - Factory(SecurityDialogs)) -""" diff --git a/sessionhistory.py b/sessionhistory.py deleted file mode 100644 index 615a98d..0000000 --- a/sessionhistory.py +++ /dev/null @@ -1,77 +0,0 @@ -# Copyright (C) 2007, One Laptop Per Child -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -import logging - -from gi.repository import GObject -import xpcom -from xpcom.components import interfaces - - -class HistoryListener(GObject.GObject): - _com_interfaces_ = interfaces.nsISHistoryListener - - __gsignals__ = { - 'session-history-changed': (GObject.SignalFlags.RUN_FIRST, - None, - ([int])), - 'session-link-changed': (GObject.SignalFlags.RUN_FIRST, None, - ([str])), - } - - def __init__(self): - GObject.GObject.__init__(self) - - self._wrapped_self = xpcom.server.WrapObject( \ - self, interfaces.nsISHistoryListener) - weak_ref = xpcom.client.WeakReference(self._wrapped_self) - - def setup(self, web_navigation): - self._session_history = web_navigation.sessionHistory - self._session_history.addSHistoryListener(self._wrapped_self) - - def OnHistoryGoBack(self, back_uri): - logging.debug('OnHistoryGoBack: %s', back_uri.spec) - self.emit('session-link-changed', back_uri.spec) - self.emit('session-history-changed', self._session_history.index - 1) - return True - - def OnHistoryGoForward(self, forward_uri): - logging.debug('OnHistoryGoForward: %s', forward_uri.spec) - self.emit('session-link-changed', forward_uri.spec) - self.emit('session-history-changed', self._session_history.index + 1) - return True - - def OnHistoryGotoIndex(self, index, goto_uri): - logging.debug('OnHistoryGotoIndex: %i %s', index, goto_uri.spec) - self.emit('session-link-changed', goto_uri.spec) - self.emit('session-history-changed', index) - return True - - def OnHistoryNewEntry(self, new_uri): - logging.debug('OnHistoryNewEntry: %s', new_uri.spec) - self.emit('session-link-changed', new_uri.spec) - self.emit('session-history-changed', self._session_history.index + 1) - - def OnHistoryPurge(self, num_entries): - logging.debug('OnHistoryPurge: %i', num_entries) - #self.emit('session-history-changed') - return True - - def OnHistoryReload(self, reload_uri, reload_flags): - self.emit('session-link-changed', reload_uri.spec) - logging.debug('OnHistoryReload: %s', reload_uri.spec) - return True |