Permalink
Browse files

Exclude preferences are now an array. You can clean old thevirtualeuo…

…ccur.preferences.exclude_* from your brackers.json (Marco105)

Background color setting can contain CSS styles (treeno and atishay811)
Initial background setting is: background-color: #555; opacity: 0.7; border-radius: 6px;
  • Loading branch information...
yaddran committed Jul 5, 2016
1 parent e2b3688 commit 1bf9386a3013652b6276c1e98fd0e467db848c6f
Showing with 55 additions and 17 deletions.
  1. +18 −0 README.md
  2. +1 −1 htmlContent/preferences.html
  3. +26 −10 main.js
  4. +1 −1 nls/nl/strings.js
  5. +1 −1 nls/root/strings.js
  6. +1 −1 nls/sr/strings.js
  7. +1 −1 package.json
  8. +6 −2 styles/styles.css
View
@@ -22,3 +22,21 @@ Usage
The extension has its own preferences dialog. Go to (Edit -> Occurrences Marker Preferences). You can enable/disable the extension, exclude certain file types, choose marking mode and setup how to mark the occurrences.
Selected text is marked at once. Marking the word under cursor can be delayed to allow normal editing.
Change Log
----------
2016-07-05
- Exclude preferences are now an array. You can clean old thevirtualeuoccur.preferences.exclude_* from your brackers.json
- Background color setting can contain CSS styles
- Initial background setting is: background-color: #555; opacity: 0.7; border-radius: 6px;
2016-01-11
- Allow time interval to be set from 0sec to 10sec.
- 0sec interval wil cause instant marking.
- Default value is set to 0.2sec.
2016-01-07
- Added configurable time interval.
- Fixed unmarking.
@@ -27,7 +27,7 @@
<div class="field-container">
<label>
{{Strings.BACKGROUND_COLOR}}:<br/>
<input type="text" id="thevirtualeuoccurBackgroundColor" value="{{background_color}}"/>
<input type="text" id="thevirtualeuoccurBackgroundColor" value="{{background_color}}" class="more-text"/>
</label>
</div>
<div class="field-container">
View
36 main.js
@@ -156,7 +156,8 @@ define(function (require, exports, module) {
clearInterval(ticker_interval);
var editor = EditorManager.getCurrentFullEditor(),
language = editor.document.getLanguage();
language = editor.document.getLanguage(),
prfs;
clearOccurrences(editor);
@@ -173,9 +174,16 @@ define(function (require, exports, module) {
});
if (prefs.get('background_color') !== prefsBackgroundColor) {
ExtensionUtils.addEmbeddedStyleSheet(
'.thevirtualeuoccur-prefapply, .thevirtualeuoccur-highlighting .marking {background-color: ' + prefs.get('background_color') + ';}'
);
prfs = prefs.get('background_color');
if (prfs.charAt(0) === '#') {
ExtensionUtils.addEmbeddedStyleSheet(
'.thevirtualeuoccur-prefapply, .thevirtualeuoccur-highlighting .marking {background-color: ' + prfs + ';}'
);
} else {
ExtensionUtils.addEmbeddedStyleSheet(
'.thevirtualeuoccur-prefapply, .thevirtualeuoccur-highlighting .marking {' + prfs + '}'
);
}
}
if (!prefsEnabled) { return; }
@@ -232,17 +240,22 @@ define(function (require, exports, module) {
},
dialog = Dialogs.showModalDialogUsingTemplate(Mustache.render(PREFERENCES_TEMPLATE, context)),
$dlg = dialog.getElement(),
ex,
langs,
lang;
lang,
langex;
langs = LanguageManager.getLanguages();
ex = prefs.get('exclude');
if (!ex) { ex = {}; }
for (lang in langs) {
if (langs.hasOwnProperty(lang)) {
langex = ex.hasOwnProperty(lang) ? ex[lang] : false;
$dlg.find('#thevirtualeuoccurExcludeChecklist')
.append('<input id="thevirtualeuoccurExclude_' +
lang +
'" type="checkbox"' +
(prefs.get('exclude_' + lang) ? 'checked="checked"' : ' ') +
(langex ? 'checked="checked"' : ' ') +
'/> ' +
langs[lang]._name +
'<br/>');
@@ -252,7 +265,8 @@ define(function (require, exports, module) {
dialog.done(function (buttonId) {
if (buttonId === Dialogs.DIALOG_BTN_OK) {
var lan,
bgc = $.trim($dlg.find('#thevirtualeuoccurBackgroundColor').val()).toLocaleLowerCase();
bgc = $.trim($dlg.find('#thevirtualeuoccurBackgroundColor').val()).toLocaleLowerCase(),
exc = {};
if (bgc.length === 0) { bgc = 'transparent'; }
prefs.set('enabled', $dlg.find('#thevirtualeuoccurEnabled').prop('checked'));
prefs.set('selected_only', $dlg.find('#thevirtualeuoccurSelectedOnly').prop('checked'));
@@ -265,22 +279,24 @@ define(function (require, exports, module) {
prefs.set('time_interval', lan);
for (lan in langs) {
if (langs.hasOwnProperty(lan)) {
prefs.set('exclude_' + lan, $dlg.find('#thevirtualeuoccurExclude_' + lan).prop('checked'));
exc[lan] = $dlg.find('#thevirtualeuoccurExclude_' + lan).prop('checked');
}
}
prefs.set('exclude', exc);
applyNewSettings();
}
});
}
AppInit.appReady(function () {
prefsBackgroundColor = STYLES.split('marking_back_color')[1];
prefsBackgroundColor = STYLES.split(' marking_back_color ')[1];
prefs.definePreference('enabled', 'boolean', true);
prefs.definePreference('selected_only', 'boolean', false);
prefs.definePreference('background_color', 'string', prefsBackgroundColor);
prefs.definePreference('anim', 'boolean', false);
prefs.definePreference('time_interval', 'number', 1);
prefs.definePreference('time_interval', 'number', 0.2);
prefs.definePreference('exclude', 'object', {});
var langs = LanguageManager.getLanguages(), lang;
for (lang in langs) {
if (langs.hasOwnProperty(lang)) {
View
@@ -32,7 +32,7 @@ define({
'TIME_INTERVAL': 'sec wachten voor markering (0sec - 10sec)',
'EXCLUDE': 'Sluit de volgende bestandstypen van markering uit',
'SELECTED_ONLY': 'Mark alleen geselecteerde tekst en niet het woord onder de cursor',
'BACKGROUND_COLOR': 'Markering achtergrondkleur',
'BACKGROUND_COLOR': 'Markering achtergrondkleur of CSS stijl',
'ANIM': 'Markering animeren',
'CANCEL': 'annuleren',
'DONE': 'klaar'
View
@@ -32,7 +32,7 @@ define({
'TIME_INTERVAL': 'sec to wait before marking (0sec - 10sec)',
'EXCLUDE': 'Exclude the following file types from marking',
'SELECTED_ONLY': 'Mark only selected text and not the word under cursor',
'BACKGROUND_COLOR': 'Markings background color',
'BACKGROUND_COLOR': 'Markings background color or CSS style',
'ANIM': 'Animate markings',
'CANCEL': 'cancel',
'DONE': 'done'
View
@@ -32,7 +32,7 @@ define({
'TIME_INTERVAL': 'sec sacekti pre oznacavanja (0sec - 10sec)',
'EXCLUDE': 'Izuzmi sledece tipove datoteka od oznacavanja',
'SELECTED_ONLY': 'Oznaci samo selektovani tekst, a ne i rec pod kursorom',
'BACKGROUND_COLOR': 'Boja pozadine oznaka',
'BACKGROUND_COLOR': 'Boja pozadine ili CSS stil oznaka',
'ANIM': 'Animiraj oznake',
'CANCEL': 'odustani',
'DONE': 'gotovo'
View
@@ -4,7 +4,7 @@
"description": "Marks all occurrences of a selected text or the word under the cursor with a configurable delay so that it does not interfere with edit. Configurable through the Edit menu.",
"keywords": ["occurrences", "mark"],
"homepage": "https://github.com/yaddran/brackets-occurrences-marker",
"version": "1.0.3",
"version": "1.0.4",
"author": "Jadran Josimovic <yaddran@gmail.com> (https://github.com/yaddran)",
"license": "MIT",
"engines": {
View
@@ -3,9 +3,9 @@
}
.thevirtualeuoccur-highlighting .marking {
background-color: #f5ee92;
background-color: #555; opacity: 0.7; border-radius: 6px;
}
/*marking_back_color#f5ee92marking_back_color*/
/* marking_back_color background-color: #555; opacity: 0.7; border-radius: 6px; marking_back_color */
.thevirtualeuoccur-preferences label {
line-height: 20px;
@@ -18,4 +18,8 @@
.thevirtualeuoccur-preferences input[type="text"] {
width: 50px;
}
.thevirtualeuoccur-preferences input.more-text {
width: 99%;
}

0 comments on commit 1bf9386

Please sign in to comment.