-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update all the source code to have a working web extension, compatible with Firefox 48+? (tested on version 57). Background script has been completely rewritten, even though much of the logics remain the same. Content script remains closer to its previous version. Option handling must now be done by the extension (no more by the SDK): add an option page. The popup for language selection did not change much. Since we changed a lot of things, this commit (or rather, the previous one) also makes some cleanup in the files tracked by Git. Furthermore, README.md and icons have been updated. Of course, this new version of the add-on is no more compatible with the jpm tool, or with the add-on SDK APIs. Change version number to 2+. Since the new reference for version numbers allows for more dot-separated values, the add-on will follow the following scheme: A.B.X.Y, where - A is the major version, bumped to 2, - B is the minor version, incremented for each modification to the add-on internal code, - X is the major version of embedded highlight.js, - Y is the minor version of embedded highlight.js. highlight.js also has a third (build) number, that will not appear in the add-on version number. Differences in behavior: - The icon of the button no longer changes aspect when the button is clicked. - Some options disappeared, as I suspect nobody used them: namely, the option for preventing background coloring, as well as the option for using alternate icon set (now handled directly in the manifest) have both been removed. Known issue: the add-on keeps one global state to remember if the tab has already been colored or not. Of course, in the case when several tabs are to be highlighted, this is a problem. This is not so big an issue, since in this case: - If the tab should be colored but the state is not correct, the first click to the add-on button is without effect. Second click works as expected and opens the language selection popup. - If the tab should be reset (to no-color) but the state is not correct, the language selection pops up (instead of not showing), and a click will un-highlight tab contents, whatever language was selected. Next click will have status in order, and will act as expected. As a workaround, maybe the background script could probe the tab to see if content script has been injected already. But I haven't been successful with this so far, background script seems to hang if it fails to connect to a content script. The issue will probably stay there for a while, until I find something better.
- Loading branch information
Showing
16 changed files
with
725 additions
and
762 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,6 @@ | ||
# Vim: set spelllang=en: | ||
|
||
# Metadata | ||
# Currently in master branch of add-on SDK, but not in current stable v1.17 | ||
addon_description = Syntax highlight for raw source code. | ||
|
||
# Preferences | ||
style_title = Color theme | ||
style_description = Select the color theme you want to use for syntax highlighting. | ||
autohl_title = Auto-highlight source code files | ||
autohl_description = Automatically apply highlighting to pages detected as source code (technically, detection occurs when HTML body contains a single child of name <pre></pre>). | ||
invert_title = Alternate icon set | ||
invert_description = Use white (instead of dark gray) icons for the button, for a better contrast on dark themes. | ||
bgColor_title = Adapt body background color | ||
bgColor_description = Make HTML body background color the same as background color for the code block. Should remove white border around highlighted code. Disable if you use the add-on on web pages other than plain text source code files. | ||
lineNumbers_title = Add line numbering | ||
lineNumbers_description = Display line numbers on the left of highlighted content. When this option is enabled, one can also scroll to e.g. line 27 and select it if a suffix such as “#Line27” or “#line27” or “#L27” or “#l27” is appended to the URL BEFORE the script loads (this does not relies on HTML anchors and cannot be triggered by simple URL modification; reload the script for current page if you added the suffix afterward). | ||
|
||
# Button | ||
button_label = Highlight raw source code | ||
|
||
# Language selection panel | ||
autodetect = Auto-detect | ||
no_language = None | ||
|
||
# Logs | ||
log_highlight = Let's (try to) highlight code for language “%s” with style “%s”. | ||
log_undo = Oh, well, let's get back to initial content. | ||
log_toggleoff = Received toggle off request from content script for reason “%s”. | ||
log_toff_r1 = nothing to work on in this document | ||
log_toff_r2 = document is unloaded | ||
{ | ||
"description": { | ||
"message": "Syntax highlighting for raw source code files.", | ||
"description": "Description of the extension." | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,6 @@ | ||
# Vim: set spelllang=fr: | ||
|
||
# Métadata | ||
# Currently in master branch of add-on SDK, but not in current stable v1.17 | ||
addon_description = Coloration syntaxique sur code source brut. | ||
|
||
# Préférences | ||
style_title = Thème | ||
style_description = Sélectionnez le jeu de couleurs à utiliser pour la coloration syntaxique. | ||
autohl_title = Coloration automatique du code source | ||
autohl_description = Lance automatiquement la coloration syntaxique à l'ouverture des pages détectées comme étant des fichiers sources (du point de vue technique, cette détection survient lorsque l'élément HTML body contient un unique nœud, de type <pre></pre>). | ||
invert_title = Icônes alternatives | ||
invert_description = Utiliser des icônes blanches (plutôt que gris foncé) pour le bouton, pour un meilleur contraste sur un thème foncé. | ||
bgColor_title = Adapter la couleur d'arrière-plan de l'élément body | ||
bgColor_description = Étend la couleur d'arrière plan du bloc de code coloré à l'élément body du document HTML. Cela permet en principe de retirer la bordure blanche qui apparaît autour du bloc coloré. Désactivez cette option si vous utilisez cette extension pour des pages web autres que contenant seulement du code source au format texte. | ||
lineNumbers_title = Numéroter les lignes | ||
lineNumbers_description = Affiche le numéro de chaque ligne à gauche du contenu coloré. Lorsque cette option est activée, il est possible de sauter à la ligne fournie, par exemple 27, et de la mettre en surbrillance si l'URL comporte un suffixe de la forme « #Line27 » ou « #line27 » ou « #L27 » ou « #l27 ». Ce suffixe doit être ajouté AVANT le chargement du script (la fonctionnalité ne repose pas sur les ancres HTML et ne peut pas détecter une simple modification de l'URL. Si le suffixe est ajouté après le chargement du script pour la page en cours, il suffit de recharger ce dernier). | ||
|
||
# Bouton | ||
button_label = Coloration syntaxique de code | ||
|
||
# Panneau de sélection du langage | ||
autodetect = Détection auto | ||
no_language = Aucun | ||
|
||
# Logs | ||
log_highlight = Essayons la coloration syntaxique pour le langage « %s » avec le thème « %s ». | ||
log_undo = Retour au contenu initial du document. | ||
log_toggleoff = Le script de contenu signale l'absence de coloration pour la raison « %s ». | ||
log_toff_r1 = aucun bloc sur lequel travailler dans ce document | ||
log_toff_r2 = le document est déchargé du navigateur | ||
{ | ||
"description": { | ||
"message": "Coloration syntaxique pour code source brut.", | ||
"description": "Description of the extension." | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.