Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Seniors
craig1617
Commits
a8da1f14
Commit
a8da1f14
authored
Nov 29, 2016
by
Craig Earley
Browse files
displays alert on any new page load
parent
b1f97a46
Changes
3
Hide whitespace changes
Inline
Side-by-side
extension/js/background.js
0 → 100644
View file @
a8da1f14
chrome
.
tabs
.
onUpdated
.
addListener
(
function
(
tabID
,
changeInfo
,
tab
)
{
if
(
changeInfo
.
status
==
'
complete
'
){
chrome
.
tabs
.
sendMessage
(
tab
.
id
,
{
action
:
'
saySomething
'
});
}
});
extension/js/check.js
View file @
a8da1f14
var
stop_url
=
"
https://www.google.com/
"
;
chrome
.
tabs
.
query
({
'
active
'
:
true
,
'
lastFocusedWindow
'
:
true
},
function
(
tabs
)
{
var
url
=
tabs
[
0
].
url
;
if
(
url
==
stop_url
){
document
.
writeln
(
"
welcome to the stop url!
"
);
}
else
{
document
.
writeln
(
"
not there yet, keep going
"
);}
/*
chrome.tabs.query({'active': true, 'lastFocusedWindow': true}, function (tabs) {
var url = tabs[0].url;
if (url == stop_url){
document.writeln("welcome to the stop url!");
}
else {document.writeln("not there yet, keep going");}
});
*/
extension/js/content.js
0 → 100644
View file @
a8da1f14
chrome
.
runtime
.
onMessage
.
addListener
(
function
(
msg
)
{
/* We received a message, let's do as instructed */
if
(
msg
.
action
==
'
saySomething
'
)
{
window
.
alert
(
'
something
'
);
}
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment