Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
pm-tools
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Yaroslav Lushnikov
pm-tools
Commits
d22eed97
Commit
d22eed97
authored
Feb 08, 2020
by
Yaroslav Lushnikov
🦆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fast search 1 step
parent
c6c68c88
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
174 additions
and
47 deletions
+174
-47
settings.html
extension/html/settings.html
+14
-0
settings.js
extension/html/settings.js
+25
-0
manifest.json
extension/manifest.json
+7
-14
adyax_issue.js
extension/scripts/pm/adyax_issue.js
+0
-14
search.js
extension/scripts/pm/search.js
+92
-0
commit_message.js
extension/scripts/prj.adyax/commit_message.js
+0
-19
search.css
extension/styles/i20/search.css
+36
-0
No files found.
extension/html/settings.html
0 → 100644
View file @
d22eed97
<!DOCTYPE html>
<html>
<head><title>
PM Tools settings
</title></head>
<body>
API key:
<input
id=
"api_key"
type=
"text"
placeholder=
"Enter your api key"
/>
<div
id=
"status"
></div>
<button
id=
"save"
>
Save
</button>
<script
src=
"settings.js"
>
</script>
</body>
</html>
\ No newline at end of file
extension/html/settings.js
0 → 100644
View file @
d22eed97
function
save_options
()
{
var
apiKey
=
document
.
getElementById
(
'api_key'
).
value
;
chrome
.
storage
.
sync
.
set
({
apiKey
:
apiKey
,
},
function
()
{
// Update status to let user know options were saved.
var
status
=
document
.
getElementById
(
'status'
);
status
.
textContent
=
'Options saved.'
;
setTimeout
(
function
()
{
status
.
textContent
=
''
;
},
750
);
});
}
function
restore_options
()
{
// Use default value color = 'red' and likesColor = true.
chrome
.
storage
.
sync
.
get
({
apiKey
:
''
,
},
function
(
items
)
{
document
.
getElementById
(
'api_key'
).
value
=
items
.
apiKey
;
});
}
document
.
addEventListener
(
'DOMContentLoaded'
,
restore_options
);
document
.
getElementById
(
'save'
).
addEventListener
(
'click'
,
save_options
);
extension/manifest.json
View file @
d22eed97
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
"64"
:
"images/logo_square.png"
,
"64"
:
"images/logo_square.png"
,
"128"
:
"images/logo_square.png"
"128"
:
"images/logo_square.png"
},
},
"options_page"
:
"html/settings.html"
,
"content_scripts"
:
[
"content_scripts"
:
[
{
{
"matches"
:
[
"matches"
:
[
...
@@ -20,22 +21,13 @@
...
@@ -20,22 +21,13 @@
"scripts/pm/branch.js"
,
"scripts/pm/branch.js"
,
"scripts/pm/commit_message.js"
,
"scripts/pm/commit_message.js"
,
"scripts/pm/prepare_assigment.js"
,
"scripts/pm/prepare_assigment.js"
,
"scripts/pm/adyax_issue.js"
,
"scripts/pm/workflow.js"
,
"scripts/pm/workflow.js"
,
"scripts/pm/select2.js"
"scripts/pm/select2.js"
,
"scripts/pm/search.js"
],
],
"css"
:
[
"css"
:
[
"libraries/select2/select2.css"
"libraries/select2/select2.css"
,
]
"styles/i20/search.css"
},
{
"matches"
:
[
"https://*.adyax.com/*"
],
"js"
:
[
"libraries/jQuery/jQuery.js"
,
"libraries/jScroll/jscroll.js"
,
"scripts/prj.adyax/commit_message.js"
]
]
},
},
{
{
...
@@ -49,7 +41,8 @@
...
@@ -49,7 +41,8 @@
}
}
],
],
"permissions"
:
[
"permissions"
:
[
"clipboardWrite"
"clipboardWrite"
,
"storage"
],
],
"browser_action"
:
{
"browser_action"
:
{
"default_icon"
:
"images/logo_square.png"
,
"default_icon"
:
"images/logo_square.png"
,
...
...
extension/scripts/pm/adyax_issue.js
deleted
100644 → 0
View file @
c6c68c88
(
function
(
$
)
{
var
issueTitle
=
$
(
'body.controller-issues.action-show'
).
find
(
'.subject h3'
);
if
(
issueTitle
.
length
)
{
var
regex
=
new
RegExp
(
'^#[0-9]{1,7}'
);
var
searchResult
=
issueTitle
.
html
().
match
(
regex
);
if
(
searchResult
)
{
var
issueNum
=
searchResult
[
0
].
replace
(
'#'
,
''
);
var
link
=
"<a href='https://prj.adyax.com/issues/"
+
issueNum
+
"' target='_blank'>#"
+
issueNum
+
'</a>'
;
var
newIssueTitle
=
issueTitle
.
html
().
replace
(
searchResult
[
0
],
link
);
issueTitle
.
html
(
newIssueTitle
);
}
}
})(
jQuery
);
extension/scripts/pm/search.js
0 → 100644
View file @
d22eed97
(
function
(
$
)
{
window
.
pmSearch
=
window
.
pmSearch
||
{};
let
search
=
window
.
pmSearch
;
search
.
init
=
function
()
{
// init key
search
.
getApiKey
();
search
.
timers
=
{};
search
.
selected
=
{};
search
.
wrapper
=
$
(
'<div class="pm-tools-search-wrapper hide-form"><div class="search-form"><input type="text" /><ul class="found"></ul></div></div>'
);
search
.
input
=
search
.
wrapper
.
find
(
'input'
);
search
.
found
=
search
.
wrapper
.
find
(
'.found'
);
$
(
'#wrapper'
).
append
(
search
.
wrapper
);
$
(
'body'
).
bind
(
'keydown'
,
function
(
event
)
{
if
(
search
.
wrapper
.
hasClass
(
'hide-form'
)
&&
(
event
.
altKey
===
true
&&
(
event
.
keyCode
===
68
||
event
.
keyCode
===
206
)))
{
search
.
showForm
();
event
.
preventDefault
();
}
else
if
(
!
search
.
wrapper
.
hasClass
(
'hide-form'
))
{
if
(
event
.
keyCode
===
27
||
(
event
.
altKey
===
true
&&
(
event
.
keyCode
===
68
||
event
.
keyCode
===
206
)))
{
search
.
closeForm
();
event
.
preventDefault
();
}
}
});
search
.
input
.
on
(
'keyup'
,
function
()
{
let
$this
=
$
(
this
);
if
(
search
.
timers
.
change
)
{
clearTimeout
(
search
.
timers
.
change
);
}
search
.
timers
.
change
=
setTimeout
(
function
()
{
search
.
searchValue
(
$this
.
val
());
},
100
);
});
};
search
.
showForm
=
function
()
{
search
.
input
.
val
(
''
);
search
.
found
.
html
(
''
);
search
.
wrapper
.
removeClass
(
'hide-form'
);
search
.
input
.
focus
();
};
search
.
closeForm
=
function
()
{
search
.
wrapper
.
addClass
(
'hide-form'
);
};
search
.
searchValue
=
function
(
searchText
)
{
if
(
searchText
!==
''
)
{
searchText
=
searchText
.
replace
(
' '
,
'+'
);
let
key
=
search
.
getApiKey
();
if
(
key
)
{
$
.
ajax
({
url
:
"https://pm.i20.biz/issues.json?limit=10&subject=~"
+
searchText
,
data
:
{
""
:
key
},
dataType
:
'json'
,
beforeSend
:
function
(
xhr
){
xhr
.
setRequestHeader
(
'X-Redmine-API-Key'
,
key
);},
success
:
function
(
data
)
{
if
(
data
&&
data
.
total_count
)
{
search
.
found
.
html
(
''
);
data
.
issues
.
forEach
(
function
(
element
)
{
let
issue
=
$
(
'<li><a href="https://pm.i20.biz/issues/'
+
element
.
id
+
'">'
+
'<div class="found-issue">'
+
element
.
subject
+
'</div>'
+
'</a></li>'
)
search
.
found
.
append
(
issue
);
});
}
},
async
:
true
})
}
}
}
search
.
getApiKey
=
function
()
{
if
(
typeof
search
.
apiKey
==
'undefined'
)
{
chrome
.
storage
.
sync
.
get
(
'apiKey'
,
function
(
value
)
{
search
.
apiKey
=
value
.
apiKey
});
}
return
search
.
apiKey
;
}
search
.
init
();
})(
jQuery
);
extension/scripts/prj.adyax/commit_message.js
deleted
100644 → 0
View file @
c6c68c88
(
function
(
$
)
{
var
subject
=
$
(
'.subject h3'
);
var
button
=
$
(
"<button>Commit message</button>"
);
$
(
'#sidebar'
).
append
(
button
);
button
.
on
(
'click'
,
function
(
e
)
{
var
issueId
=
window
.
location
.
pathname
.
split
(
'/'
)[
2
];
var
commitMessage
=
'refs #'
+
issueId
+
' '
+
subject
.
html
();
var
textfield
=
$
(
'<input type="text" style="display: block;" value="'
+
commitMessage
.
replace
(
/"/g
,
'"'
)
+
'">'
);
subject
.
after
(
textfield
);
textfield
.
select
();
document
.
execCommand
(
'copy'
);
textfield
.
remove
();
});
button
.
jScroll
({
top
:
50
});
$
(
document
).
trigger
(
'scroll'
);
})(
jQuery
);
extension/styles/i20/search.css
0 → 100644
View file @
d22eed97
.pm-tools-search-wrapper
{
width
:
100%
;
position
:
absolute
;
top
:
20%
;
z-index
:
500
;
display
:
flex
;
justify-content
:
center
;
}
.pm-tools-search-wrapper
.search-form
{
background-color
:
#cccccc
;
padding-bottom
:
15px
;
border-radius
:
7px
;
pointer-events
:
auto
;
}
.pm-tools-search-wrapper.hide-form
{
display
:
none
;
}
.pm-tools-search-wrapper
ul
{
list-style
:
none
;
width
:
400px
;
padding
:
5px
;
overflow
:
hidden
;
}
.pm-tools-search-wrapper
div
.found-issue
:hover
{
background-color
:
rgb
(
142
,
142
,
142
);
}
.pm-tools-search-wrapper
input
{
width
:
400px
;
height
:
30px
;
font-size
:
x-large
;
}
\ No newline at end of file
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