Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Colorschemepicker
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Stud.IP
Plugins
Colorschemepicker
Commits
1ce856b5
Commit
1ce856b5
authored
6 months ago
by
Jan-Hendrik Willms
Browse files
Options
Downloads
Patches
Plain Diff
fixes
#4
parent
6f951545
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
Colorschemepicker.class.php
+1
-1
1 addition, 1 deletion
Colorschemepicker.class.php
assets/script.js
+55
-16
55 additions, 16 deletions
assets/script.js
plugin.manifest
+2
-2
2 additions, 2 deletions
plugin.manifest
with
58 additions
and
19 deletions
Colorschemepicker.class.php
+
1
−
1
View file @
1ce856b5
...
@@ -57,7 +57,7 @@ class Colorschemepicker extends StudIPPlugin implements SystemPlugin
...
@@ -57,7 +57,7 @@ class Colorschemepicker extends StudIPPlugin implements SystemPlugin
$widget
=
Sidebar
::
get
()
->
addWidget
(
new
SearchWidget
());
$widget
=
Sidebar
::
get
()
->
addWidget
(
new
SearchWidget
());
$widget
->
setTitle
(
_
(
'Farbwert suchen'
));
$widget
->
setTitle
(
_
(
'Farbwert suchen'
));
$widget
->
addNeedle
(
'#abcdef'
,
'search-color'
,
true
,
null
,
null
,
null
,
[
$widget
->
addNeedle
(
'#abcdef'
,
'search-color'
,
true
,
null
,
null
,
null
,
[
'pattern'
=>
'#?[a-fA-F0-9]{
6
}'
'pattern'
=>
'#?
(?:
[a-fA-F0-9]{
3}){1,2
}'
]);
]);
$factory
=
new
Flexi_TemplateFactory
(
$this
->
getPluginPath
()
.
'/templates'
);
$factory
=
new
Flexi_TemplateFactory
(
$this
->
getPluginPath
()
.
'/templates'
);
...
...
This diff is collapsed.
Click to expand it.
assets/script.js
+
55
−
16
View file @
1ce856b5
...
@@ -5,6 +5,10 @@
...
@@ -5,6 +5,10 @@
hex
=
hex
.
slice
(
1
);
hex
=
hex
.
slice
(
1
);
}
}
if
(
hex
.
length
===
3
)
{
hex
=
hex
[
0
]
+
hex
[
0
]
+
hex
[
1
]
+
hex
[
1
]
+
hex
[
2
]
+
hex
[
2
];
}
const
rgb
=
{
const
rgb
=
{
r
:
parseInt
(
hex
.
slice
(
0
,
2
),
16
),
r
:
parseInt
(
hex
.
slice
(
0
,
2
),
16
),
g
:
parseInt
(
hex
.
slice
(
2
,
4
),
16
),
g
:
parseInt
(
hex
.
slice
(
2
,
4
),
16
),
...
@@ -125,27 +129,58 @@
...
@@ -125,27 +129,58 @@
return
allVars
.
concat
(...
colors
);
return
allVars
.
concat
(...
colors
);
},
[]);
},
[]);
const
minibus
=
{
handlers
:
{},
trigger
(
event
,
...
args
)
{
if
(
this
.
handlers
[
event
]
===
undefined
)
{
return
;
}
this
.
handlers
[
event
].
forEach
(
handler
=>
handler
(...
args
));
},
on
(
event
,
handler
)
{
if
(
this
.
handlers
[
event
]
===
undefined
)
{
this
.
handlers
[
event
]
=
[];
}
this
.
handlers
[
event
].
push
(
handler
);
}
}
// Create vue app
// Create vue app
const
appConfig
=
{
const
appConfig
=
{
el
:
document
.
getElementById
(
'
color-list
'
),
el
:
document
.
getElementById
(
'
color-list
'
),
data
:
{
data
()
{
return
{
colors
:
colors
,
colors
:
colors
,
searchColor
:
false
,
searchColor
:
false
,
sortByColor
:
false
,
sortByColor
:
false
,
};
},
},
methods
:
{
methods
:
{
copy
(
event
)
{
copy
(
event
)
{
(
new
Promise
((
resolve
,
reject
)
=>
{
if
(
navigator
.
clipboard
)
{
navigator
.
clipboard
.
writeText
(
event
.
target
.
value
).
then
(
resolve
,
reject
);
}
const
dummy
=
document
.
createElement
(
'
textarea
'
);
const
dummy
=
document
.
createElement
(
'
textarea
'
);
dummy
.
value
=
event
.
target
.
value
;
dummy
.
value
=
event
.
target
.
value
;
document
.
body
.
appendChild
(
dummy
);
document
.
body
.
appendChild
(
dummy
);
dummy
.
select
();
dummy
.
select
();
if
(
document
.
execCommand
(
'
copy
'
))
{
if
(
document
.
execCommand
(
'
copy
'
))
{
resolve
();
}
else
{
reject
();
}
document
.
body
.
removeChild
(
dummy
);
})).
then
(()
=>
{
console
.
log
(
'
fooooo
'
);
event
.
target
.
classList
.
add
(
'
copied-value
'
);
event
.
target
.
classList
.
add
(
'
copied-value
'
);
event
.
target
.
addEventListener
(
'
animationend
'
,
()
=>
{
event
.
target
.
addEventListener
(
'
animationend
'
,
()
=>
{
event
.
target
.
classList
.
remove
(
'
copied-value
'
);
event
.
target
.
classList
.
remove
(
'
copied-value
'
);
});
});
}
});
document
.
body
.
removeChild
(
dummy
);
},
},
toggleSortByColor
()
{
toggleSortByColor
()
{
if
(
!
this
.
sortByColor
)
{
if
(
!
this
.
sortByColor
)
{
...
@@ -196,13 +231,16 @@
...
@@ -196,13 +231,16 @@
}
}
return
colors
;
return
colors
;
}
}
},
created
()
{
minibus
.
on
(
'
search-color
'
,
color
=>
this
.
searchColor
=
color
);
}
}
};
};
let
promise
;
let
promise
;
if
(
window
.
Vue
)
{
if
(
window
.
Vue
!==
undefined
)
{
promise
=
Promise
.
resolve
(
new
Vue
(
appConfig
));
promise
=
Promise
.
resolve
(
new
Vue
(
appConfig
));
}
else
if
(
window
.
STUDIP
.
Vue
)
{
}
else
if
(
window
.
STUDIP
.
Vue
!==
undefined
)
{
promise
=
STUDIP
.
Vue
.
load
().
then
(({
createApp
})
=>
{
promise
=
STUDIP
.
Vue
.
load
().
then
(({
createApp
})
=>
{
return
createApp
(
appConfig
);
return
createApp
(
appConfig
);
})
})
...
@@ -210,14 +248,15 @@
...
@@ -210,14 +248,15 @@
promise
=
Promise
.
reject
(
'
No search possible due to missing vue
'
);
promise
=
Promise
.
reject
(
'
No search possible due to missing vue
'
);
}
}
promise
.
then
(
app
=>
{
promise
.
then
(
()
=>
{
// Attach search input from sidebar
// Attach search input from sidebar
const
search
=
document
.
querySelector
(
'
.sidebar,#sidebar
'
).
querySelector
(
'
input[name="search-color"]
'
);
const
search
=
document
.
querySelector
(
'
.sidebar,#sidebar
'
).
querySelector
(
'
input[name="search-color"]
'
);
console
.
log
(
'
search
'
,
search
);
search
.
addEventListener
(
'
keyup
'
,
event
=>
{
search
.
addEventListener
(
'
keyup
'
,
event
=>
{
if
(
search
.
checkValidity
())
{
if
(
search
.
checkValidity
())
{
app
.
search
C
olor
=
Color
.
fromHexValue
(
search
.
value
);
minibus
.
trigger
(
'
search
-c
olor
'
,
Color
.
fromHexValue
(
search
.
value
)
)
;
}
else
{
}
else
{
app
.
search
C
olor
=
false
;
minibus
.
trigger
(
'
search
-c
olor
'
,
false
)
;
}
}
});
});
search
.
closest
(
'
form
'
).
addEventListener
(
search
.
closest
(
'
form
'
).
addEventListener
(
...
...
This diff is collapsed.
Click to expand it.
plugin.manifest
+
2
−
2
View file @
1ce856b5
pluginname=Colorscheme Picker
pluginname=Colorscheme Picker
pluginclassname=Colorschemepicker
pluginclassname=Colorschemepicker
origin=UOL
origin=UOL
version=2.3.
1
version=2.3.
2
studipMinVersion=
4.5
studipMinVersion=
5.0
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