Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpenBoard
Project
Project
Details
Activity
Releases
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lifo
Nicolas Ollinger
OpenBoard
Commits
2c484ae4
Commit
2c484ae4
authored
8 years ago
by
Craig Watson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added filters for image type, and french/english locales
parent
6d5f44b3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
8 deletions
+53
-8
index.html
resources/library/search/Pixabay.wgs/index.html
+47
-6
locales.js
resources/library/search/Pixabay.wgs/locales/locales.js
+6
-2
No files found.
resources/library/search/Pixabay.wgs/index.html
View file @
2c484ae4
...
...
@@ -5,6 +5,7 @@
<title>
Pixabay Image Search
</title>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"css/basic.css"
/>
<script
type=
"text/javascript"
src=
"scripts/jquery-1.6.2.min.js"
></script>
<script
type=
"text/javascript"
src=
"locales/locales.js"
></script>
</head>
<body>
...
...
@@ -36,6 +37,9 @@
// Default language to search in, if the application can't return a suitable one
var
searchLanguage
=
"en"
;
// Language for the widget
var
locale
=
"en"
;
// Fetch 960px images instead of the default 640px. However the API doesn't
// provide size information in this case, so it is disabled by default.
var
fetchMediumResImages
=
false
;
...
...
@@ -45,6 +49,7 @@
// ---------------------
var
currentIndex
=
0
;
var
currentTerm
=
""
;
var
filtersDisplayed
=
false
;
// Pixabay's supported search languages
var
availableLanguages
=
[
'cs'
,
'da'
,
'de'
,
'en'
,
'es'
,
'fr'
,
'id'
,
'it'
,
'hu'
,
'nl'
,
'no'
,
...
...
@@ -60,13 +65,18 @@
// Get OpenBoard's current language
var
appLanguage
=
window
.
sankore
?
sankore
.
locale
().
substr
(
0
,
2
)
:
searchLanguage
;
// Set it as search language, if possible
if
(
availableLanguages
.
indexOf
(
appLanguage
)
>
-
1
)
searchLanguage
=
appLanguage
searchLanguage
=
appLanguage
;
// And as the widget's language
if
(
locales
[
searchLanguage
]
!=
undefined
)
locale
=
locales
[
searchLanguage
];
var
mode
=
false
;
//search or view mode
var
hide
=
false
;
//hide or no main panel
//basic containers and elements
//
basic containers and elements
var
search
=
$
(
"<div id='search' class='search'>"
).
appendTo
(
"body"
);
...
...
@@ -76,12 +86,24 @@
var
searchInput
=
$
(
"<input id='searchInput' class='searchInput' type='text'/>"
).
appendTo
(
subSearchInput
);
var
searchButton
=
$
(
"<div id='searchButton' class='searchButton'>"
).
appendTo
(
subSearchInput
);
var
toggleFilters
=
$
(
"<div id='toggleFilters' class='toggleFilters'>"
).
appendTo
(
subSearchInput
);
var
selectFilter
=
$
(
"<select id='typeFilter' class='filterSelect'>"
)
.
append
(
$
(
"<option value='all'>"
+
locale
.
def_opts_val_image
+
"</option>"
))
.
append
(
$
(
"<option value='photo'>"
+
locale
.
image_type_photo
+
"</option>"
))
.
append
(
$
(
"<option value='illustration'>"
+
locale
.
image_type_illustration
+
"</option>"
))
.
append
(
$
(
"<option value='vector'>"
+
locale
.
image_type_vector
+
"</option>"
))
$
(
"<div class='filterContainer'>"
).
append
(
"<span>"
+
locale
.
image_type_title
+
":</span><br/>"
).
append
(
selectFilter
).
appendTo
(
subSearchFilter
);
var
searchResult
=
$
(
"<div id='searchResult'>"
).
appendTo
(
"body"
);
var
disc_nav_cont
=
$
(
"<div id='disc_nav_cont' class='disc_nav_cont'>"
).
appendTo
(
"body"
);
var
disclaimer
=
$
(
"<div id='disclaimer' class='disclaimer'>
Pixabay.com image search
<div>"
).
appendTo
(
disc_nav_cont
);
var
disclaimer
=
$
(
"<div id='disclaimer' class='disclaimer'>
"
+
locale
.
disclaimer_title
+
"
<div>"
).
appendTo
(
disc_nav_cont
);
// Functions
searchButton
.
click
(
function
(){
if
(
!
hide
){
runSearch
(
searchInput
.
val
(),
0
);
...
...
@@ -93,17 +115,36 @@
if
((
event
.
keyCode
==
0xA
)
||
(
event
.
keyCode
==
0xD
)){
runSearch
(
searchInput
.
val
(),
0
);
}
}
});
(
$
(
".imgContainer"
).
live
(
"click"
,
function
(){
(
$
(
".imgContainer"
).
live
(
"click"
,
function
(){
sankore
.
sendFileMetadata
(
createMetaData
(
$
(
this
)));
}));
toggleFilters
.
click
(
function
(){
if
(
filtersDisplayed
){
subSearchFilter
.
hide
();
toggleFilters
.
css
(
"background-image"
,
"url(images/down.png)"
);
filtersDisplayed
=
false
;
}
else
{
subSearchFilter
.
css
(
"display"
,
"inline-block"
);
toggleFilters
.
css
(
"background-image"
,
"url(images/up.png)"
);
filtersDisplayed
=
true
;
}
});
}
function
updateFilters
()
{
var
value
=
$
(
"#typeFilter option:selected"
).
val
();
imageType
=
value
;
}
function
runSearch
(
term
,
index
)
{
updateFilters
();
currentTerm
=
term
;
currentIndex
=
index
;
var
page
=
index
+
1
;
// Page numbers start at 1 on Pixabay
...
...
This diff is collapsed.
Click to expand it.
resources/library/search/Pixabay.wgs/locales/locales.js
View file @
2c484ae4
...
...
@@ -29,6 +29,8 @@ var locales = {
'image_type_title'
:
'Image type'
,
'image_type_faces'
:
'Faces'
,
'image_type_photo'
:
'Photo'
,
'image_type_illustration'
:
'Illustration'
,
'image_type_vector'
:
'Vector'
,
'image_type_clipart'
:
'Clipart'
,
'image_type_lineart'
:
'Lineart'
,
'image_license_title'
:
'Licence'
,
...
...
@@ -36,7 +38,7 @@ var locales = {
'image_license_comm_reuse'
:
'Commercial reuse'
,
'image_license_modif'
:
'Modification'
,
'image_license_comm_modif'
:
'Commercial modification'
,
'disclaimer_title'
:
'
This API is based on Google Image. Please refer to terms of use of this service.
'
'disclaimer_title'
:
'
Pixabay image search
'
},
'fr'
:
{
'def_opts_val_size'
:
'Toutes'
,
...
...
@@ -68,6 +70,8 @@ var locales = {
'image_type_title'
:
'Types d
\'
image'
,
'image_type_faces'
:
'Visages'
,
'image_type_photo'
:
'Photo'
,
'image_type_illustration'
:
'Illustration'
,
'image_type_vector'
:
'Vectoriel'
,
'image_type_clipart'
:
'Images clipart'
,
'image_type_lineart'
:
'Dessins au trait'
,
'image_license_title'
:
'Droits d
\'
usage'
,
...
...
@@ -75,6 +79,6 @@ var locales = {
'image_license_comm_reuse'
:
'Usage, distribution, commercial'
,
'image_license_modif'
:
'Usage, distribution, modification'
,
'image_license_comm_modif'
:
'Usage, distribution, modification, commercial'
,
'disclaimer_title'
:
'
Cette recherche utilise les services de Google Images. Veuillez vous référer aux conditions d
\'
utilisation de ce service.
'
'disclaimer_title'
:
'
Recherche d
\'
images sur Pixabay
'
}
};
This diff is collapsed.
Click to expand it.
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