mirror of
https://bitbucket.org/skobkin/chrome_point_plus.git
synced 2024-11-23 18:56:04 +00:00
- @ before username
- Background message listener rewrited: 'injectCSSFile' and 'injectCSSCode' implemented - Removed sourceMappingURL from jQuery
This commit is contained in:
parent
27bca63a00
commit
fa68e41e04
8
chrome_point_plus/css/modules/at_before_username.css
Normal file
8
chrome_point_plus/css/modules/at_before_username.css
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
/* @ before username */
|
||||||
|
#main #content a.user:before {
|
||||||
|
content: "@";
|
||||||
|
}
|
||||||
|
/* Fix for recommendations in the feed */
|
||||||
|
#main #content .rec .user:before {
|
||||||
|
margin-right: -4px;
|
||||||
|
}
|
|
@ -1,10 +1,15 @@
|
||||||
|
// Message listener
|
||||||
chrome.extension.onMessage.addListener(function(message, sender) {
|
chrome.extension.onMessage.addListener(function(message, sender) {
|
||||||
if (message && message.type === 'showPageAction') {
|
console.log('Received message: %O', message);
|
||||||
|
|
||||||
|
if (message) {
|
||||||
|
switch (message.type) {
|
||||||
|
case 'showPageAction':
|
||||||
var tab = sender.tab;
|
var tab = sender.tab;
|
||||||
chrome.pageAction.show(tab.id);
|
chrome.pageAction.show(tab.id);
|
||||||
}
|
break;
|
||||||
|
|
||||||
if (message && message.type === 'showNotification') {
|
case 'showNotification':
|
||||||
console.log(chrome.notifications.create(
|
console.log(chrome.notifications.create(
|
||||||
message.notificationId, {
|
message.notificationId, {
|
||||||
type: 'basic',
|
type: 'basic',
|
||||||
|
@ -15,5 +20,27 @@ chrome.extension.onMessage.addListener(function(message, sender) {
|
||||||
},
|
},
|
||||||
function() { /* Error checking goes here */}
|
function() { /* Error checking goes here */}
|
||||||
));
|
));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'injectJS':
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'injectCSSFile':
|
||||||
|
console.log('Injecting CSS: %s', message.file);
|
||||||
|
chrome.tabs.insertCSS(null, {
|
||||||
|
file: message.file
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'injectCSSCode':
|
||||||
|
if (message.code !== undefined) {
|
||||||
|
chrome.tabs.insertCSS(null, {
|
||||||
|
code: message.code
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
4
chrome_point_plus/js/jquery-1.10.1.min.js
vendored
4
chrome_point_plus/js/jquery-1.10.1.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -18,7 +18,9 @@ var ppOptions = [
|
||||||
// Feeds
|
// Feeds
|
||||||
'option_ws_feeds', 'option_ws_feeds_subscriptions', 'option_ws_feeds_blogs',
|
'option_ws_feeds', 'option_ws_feeds_subscriptions', 'option_ws_feeds_blogs',
|
||||||
// Font size
|
// Font size
|
||||||
'option_enlarge_font', 'option_enlarge_font_size'
|
'option_enlarge_font', 'option_enlarge_font_size',
|
||||||
|
// @ before username
|
||||||
|
'option_at_before_username'
|
||||||
];
|
];
|
||||||
|
|
||||||
// Saves options to localStorage.
|
// Saves options to localStorage.
|
||||||
|
@ -61,6 +63,8 @@ function pp_save_options() {
|
||||||
var option_enlarge_font = document.getElementById('option-enlarge-font');
|
var option_enlarge_font = document.getElementById('option-enlarge-font');
|
||||||
// Size ratio
|
// Size ratio
|
||||||
var option_enlarge_font_size = document.querySelector('input[name="pp-font-size"]:checked');
|
var option_enlarge_font_size = document.querySelector('input[name="pp-font-size"]:checked');
|
||||||
|
// @ before username
|
||||||
|
var option_at_before_username = document.getElementById('option-at-before-username');
|
||||||
|
|
||||||
// Saving parameters
|
// Saving parameters
|
||||||
chrome.storage.sync.set({
|
chrome.storage.sync.set({
|
||||||
|
@ -81,7 +85,8 @@ function pp_save_options() {
|
||||||
'option_ws_feeds_subscriptions': option_ws_feeds_subscriptions.checked,
|
'option_ws_feeds_subscriptions': option_ws_feeds_subscriptions.checked,
|
||||||
'option_ws_feeds_blogs': option_ws_feeds_blogs.checked,
|
'option_ws_feeds_blogs': option_ws_feeds_blogs.checked,
|
||||||
'option_enlarge_font': option_enlarge_font.checked,
|
'option_enlarge_font': option_enlarge_font.checked,
|
||||||
'option_enlarge_font_size': option_enlarge_font_size.value
|
'option_enlarge_font_size': option_enlarge_font_size.value,
|
||||||
|
'option_at_before_username': option_at_before_username.checked
|
||||||
}, function() {
|
}, function() {
|
||||||
// Update status to let user know options were saved.
|
// Update status to let user know options were saved.
|
||||||
var status = document.getElementById('status');
|
var status = document.getElementById('status');
|
||||||
|
@ -174,6 +179,10 @@ function pp_restore_options() {
|
||||||
if (options.option_enlarge_font_size !== undefined) {
|
if (options.option_enlarge_font_size !== undefined) {
|
||||||
document.getElementById('option-enlarge-font-' + options.option_enlarge_font_size).checked = true;
|
document.getElementById('option-enlarge-font-' + options.option_enlarge_font_size).checked = true;
|
||||||
}
|
}
|
||||||
|
// @ before username
|
||||||
|
if (options.option_at_before_username == true) {
|
||||||
|
document.getElementById('option-at-before-username').checked = true;
|
||||||
|
}
|
||||||
|
|
||||||
// Showing version
|
// Showing version
|
||||||
document.getElementById('pp-version').innerHTML = 'Point+ ' + getVersion() + ' by <a href="http://skobkin-ru.point.im/" target="_blank">@skobkin-ru</a>';
|
document.getElementById('pp-version').innerHTML = 'Point+ ' + getVersion() + ' by <a href="http://skobkin-ru.point.im/" target="_blank">@skobkin-ru</a>';
|
||||||
|
|
|
@ -324,6 +324,14 @@ $(document).ready(function() {
|
||||||
if ((options.option_enlarge_font == true) && (options.option_enlarge_font_size !== undefined)) {
|
if ((options.option_enlarge_font == true) && (options.option_enlarge_font_size !== undefined)) {
|
||||||
$('body').css('font-size', (options.option_enlarge_font_size / 100) + 'em');
|
$('body').css('font-size', (options.option_enlarge_font_size / 100) + 'em');
|
||||||
}
|
}
|
||||||
|
// @ before username
|
||||||
|
if (options.option_at_before_username == true) {
|
||||||
|
chrome.extension.sendMessage({
|
||||||
|
type: 'injectCSSFile',
|
||||||
|
file: 'css/modules/at_before_username.css'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Showing page action
|
// Showing page action
|
||||||
|
|
|
@ -77,6 +77,10 @@
|
||||||
<input name="pp-font-size" id="option-enlarge-font-110" type="radio" value="110"><label for="option-enlarge-font-110">1.1em</label>
|
<input name="pp-font-size" id="option-enlarge-font-110" type="radio" value="110"><label for="option-enlarge-font-110">1.1em</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="option">
|
||||||
|
<input type="checkbox" id="option-at-before-username"><label for="option-at-before-username">@ before username</label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="tab-content" id="websocket">
|
<div class="tab-content" id="websocket">
|
||||||
|
|
Loading…
Reference in a new issue