Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CssLsd
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Florent Berthaut
CssLsd
Commits
53dd96c6
Commit
53dd96c6
authored
3 years ago
by
RANWEZ Pierre
Browse files
Options
Downloads
Patches
Plain Diff
feat: midi learn on focused, cleaning useless code
parent
69206c50
No related branches found
No related tags found
1 merge request
!1
✨ feat: CSSLSD V2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
main.js
+100
-145
100 additions, 145 deletions
main.js
with
100 additions
and
145 deletions
main.js
+
100
−
145
View file @
53dd96c6
...
...
@@ -137,7 +137,9 @@ function analyseAll() {
var
all
=
[];
var
parser
=
new
CSSParser
();
var
sheet
=
parser
.
parse
(
result
.
css
,
false
,
false
);
if
(
sheet
.
cssRules
.
length
>
0
)
{
sheet
.
cssRules
.
forEach
(
element
=>
{
if
(
element
.
declarations
.
length
>
0
)
{
element
.
declarations
.
forEach
(
css
=>
{
var
templates
=
[];
cssValue
=
css
.
valueText
;
...
...
@@ -235,7 +237,9 @@ function analyseAll() {
templates
:
templates
});
});
}
});
}
chrome
.
storage
.
sync
.
set
({
all
:
all
});
});
}
...
...
@@ -305,8 +309,10 @@ function onMessage({ type, data }) {
case
'
midiEvent
'
:
{
if
(
dataMidi
!=
data
)
{
$
(
'
#midiEvent
'
).
text
(
data
);
if
(
editor
.
isFocused
())
{
editor
.
session
.
insert
(
editor
.
getCursorPosition
(),
data
)
var
focusedTd
=
$
(
'
[contenteditable]:focus
'
);
var
focusedCol
=
$
(
focusedTd
).
index
(
'
#parameters tr:eq(
'
+
$
(
focusedTd
).
parent
().
index
(
'
#parameters tr
'
)
+
'
) td
'
);
if
(
focusedTd
.
length
>
0
&&
focusedCol
==
4
)
{
focused
.
text
(
focused
.
text
()
+
'
'
+
data
);
}
dataMidi
=
data
;
}
...
...
@@ -326,61 +332,11 @@ function onMessage({ type, data }) {
}
}
$
(
document
).
keydown
(
function
(
event
)
{
// If Control or Command key is pressed and the S key is pressed
// run save function. 83 is the key code for S.
if
((
event
.
ctrlKey
||
event
.
metaKey
)
&&
event
.
which
==
83
)
{
// Save Function
event
.
preventDefault
();
updateCss
();
return
false
;
}
}
);
$
(
document
).
keydown
(
function
(
event
)
{
// If Control or Command key is pressed and the S key is pressed
// run save function. 83 is the key code for S.
if
((
event
.
ctrlKey
||
event
.
metaKey
)
&&
event
.
which
==
79
)
{
// Save Function
event
.
preventDefault
();
activateButton
=
!
activateButton
;
chrome
.
storage
.
sync
.
set
({
activate
:
activateButton
},
function
()
{
if
(
activateButton
)
{
$
(
'
#onOff
'
).
text
(
'
Désactiver
'
);
var
API
=
chrome
||
browser
;
API
.
tabs
.
query
({
active
:
true
,
currentWindow
:
true
},
function
(
tabs
)
{
if
(
tabs
[
0
]
&&
tabs
[
0
].
favIconUrl
)
{
chrome
.
storage
.
sync
.
set
({
activateFav
:
tabs
[
0
].
favIconUrl
});
}
});
}
else
{
$
(
'
#onOff
'
).
text
(
'
Activer
'
);
}
chrome
.
tabs
.
query
({
active
:
true
,
currentWindow
:
true
},
function
(
tabs
)
{
chrome
.
tabs
.
sendMessage
(
tabs
[
0
].
id
,
{
type
:
'
start
'
,
data
:
activateButton
});
}
);
});
return
false
;
}
}
);
$
(
'
#onOff
'
).
on
(
'
click
'
,
function
()
{
activateButton
=
!
activateButton
;
chrome
.
storage
.
sync
.
set
({
activate
:
activateButton
},
function
()
{
if
(
activateButton
)
{
$
(
'
#onOff
'
).
addClass
(
'
active
'
);
var
API
=
chrome
||
browser
;
API
.
tabs
.
query
({
active
:
true
,
currentWindow
:
true
},
function
(
tabs
)
{
if
(
tabs
[
0
]
&&
tabs
[
0
].
favIconUrl
)
{
chrome
.
storage
.
sync
.
set
({
activateFav
:
tabs
[
0
].
favIconUrl
});
}
});
}
else
{
$
(
'
#onOff
'
).
removeClass
(
'
active
'
);
}
...
...
@@ -479,7 +435,6 @@ $(document).on('click', '.icon-tabler-minus', function () {
// Wait messages from content script
chrome
.
runtime
.
onMessage
.
addListener
(
onMessage
);
// Indicate to Background that the popup is ready
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment