Rescaling of images on Image planete

New resizing
height 180 to 150
Remove forced width in js (index.html)
Add ImgContainer img {max-width:150px; max-height:150px} in css
preferencesAboutTextFull
bmagnin 12 years ago
parent 41d8e4e459
commit 07397aba55
  1. 624
      resources/library/search/Image Planete.wgs/css/basic.css
  2. 0
      resources/library/search/Image Planete.wgs/images/down.png
  3. 0
      resources/library/search/Image Planete.wgs/images/greySquare.png
  4. 0
      resources/library/search/Image Planete.wgs/images/icon-close.png
  5. 0
      resources/library/search/Image Planete.wgs/images/popupBack.png
  6. 0
      resources/library/search/Image Planete.wgs/images/search.png
  7. 0
      resources/library/search/Image Planete.wgs/images/search_app.png
  8. 0
      resources/library/search/Image Planete.wgs/images/trgDown.png
  9. 0
      resources/library/search/Image Planete.wgs/images/trgUp.png
  10. 0
      resources/library/search/Image Planete.wgs/images/up.png
  11. 528
      resources/library/search/Image Planete.wgs/index.html
  12. 34
      resources/library/search/Image Planete.wgs/scripts/jquery-1.6.2.min.js

@ -1,310 +1,314 @@
html, body{ html, body{
width: 100%; width: 100%;
padding: 0; padding: 0;
height: auto; height: auto;
background-color: white; background-color: white;
margin: 0; margin: 0;
} }
::-webkit-scrollbar { ::-webkit-scrollbar {
width: 14px; width: 14px;
background-color:white; background-color:white;
} }
::-webkit-scrollbar-thumb { ::-webkit-scrollbar-thumb {
border-radius: 10px; border-radius: 10px;
background-color:lightgray; background-color:lightgray;
border: 2px solid gray; border: 2px solid gray;
} }
::-webkit-scrollbar-button:vertical:start{ ::-webkit-scrollbar-button:vertical:start{
border-radius: 10px; border-radius: 10px;
background-color:lightgray; background-color:lightgray;
background-image: url(../images/trgUp.png); background-image: url(../images/trgUp.png);
background-size: 8px auto; background-size: 8px auto;
background-position: center; background-position: center;
background-repeat: no-repeat; background-repeat: no-repeat;
border: 2px solid gray; border: 2px solid gray;
} }
::-webkit-scrollbar-button:vertical:end{ ::-webkit-scrollbar-button:vertical:end{
border-radius: 10px; border-radius: 10px;
background-color:lightgray; background-color:lightgray;
background-image: url(../images/trgDown.png); background-image: url(../images/trgDown.png);
background-size: 8px auto; background-size: 8px auto;
background-position: center; background-position: center;
background-repeat: no-repeat; background-repeat: no-repeat;
border: 2px solid gray; border: 2px solid gray;
} }
a { a {
text-decoration: underline; text-decoration: underline;
} }
#disc_nav_cont{ #disc_nav_cont{
height: auto; height: auto;
position: fixed; position: fixed;
left: 0; left: 0;
bottom: 0; bottom: 0;
width: 100%; width: 100%;
} }
.disclaimer{ .disclaimer{
padding: 5px; padding: 5px;
text-align: center; text-align: center;
background-color: #BBBBBB; background-color: #BBBBBB;
border-top: solid 4px #EEEEEE; border-top: solid 4px #EEEEEE;
border-bottom: none; border-bottom: none;
font-size: 12px; font-size: 12px;
} }
.resultFooter{ .resultFooter{
width: 100%; width: 100%;
padding: 3px; padding: 3px;
font-family: Verdana,Arial,Helvetica,sans-serif; font-family: Verdana,Arial,Helvetica,sans-serif;
font-weight: bold; font-weight: bold;
font-size: x-large; font-size: x-large;
text-align: center; text-align: center;
background-color: white; background-color: white;
} }
#searchResult { #searchResult {
overflow: hidden; overflow: hidden;
text-align: center; text-align: center;
margin-top: 50px; margin-top: 50px;
margin-bottom: 50px; margin-bottom: 50px;
} }
.search{ .search{
position: fixed; position: fixed;
top: 0; top: 0;
left: 0; left: 0;
padding: 5px; padding: 5px;
background-color: #BBBBBB; background-color: #BBBBBB;
border-bottom: solid 4px #EEEEEE; border-bottom: solid 4px #EEEEEE;
} }
.search, .search,
.disclaimer { .disclaimer {
width: 100%; width: 100%;
box-sizing: border-box; box-sizing: border-box;
-webkit-box-sizing: border-box; -webkit-box-sizing: border-box;
} }
.searchInput{ .searchInput{
padding: 3px; padding: 3px;
float: left; float: left;
width: 100%; width: 100%;
border-radius: 3px; border-radius: 3px;
border-style: none; border-style: none;
height: 22px; height: 22px;
line-height: 18px; line-height: 18px;
vertical-align: middle; vertical-align: middle;
box-sizing: border-box; box-sizing: border-box;
-webkit-box-sizing: border-box; -webkit-box-sizing: border-box;
} }
.searchButton{ .searchButton{
background: url("../images/search_app.png") -38px -38px no-repeat; background: url("../images/search_app.png") -38px -38px no-repeat;
width: 24px; width: 24px;
height: 24px; height: 24px;
overflow: hidden; overflow: hidden;
position: absolute; position: absolute;
right: 30px; right: 30px;
top: 9px; top: 9px;
margin-left: -2px; margin-left: -2px;
cursor: pointer; cursor: pointer;
} }
.subSearch{ .subSearch{
margin: 0; margin: 0;
float: left; float: left;
} }
#subSearchInput{ #subSearchInput{
width: 100%; width: 100%;
float: left; float: left;
box-sizing: border-box; box-sizing: border-box;
-webkit-box-sizing: border-box; -webkit-box-sizing: border-box;
padding: 5px; padding: 5px;
padding-right: 26px; padding-right: 26px;
} }
#subSearchFilter{ #subSearchFilter{
width: 100%; width: 100%;
float: left; float: left;
display: none; display: none;
} }
.searchResult{ .searchResult{
width: 98%; width: 98%;
padding: 3px; padding: 3px;
background-color:#123456; background-color:#123456;
} }
.imgContainer{ .imgContainer{
display: inline-block; display: inline-block;
padding: 3px; padding: 3px;
margin: 3px; margin: 3px;
text-align: center; text-align: center;
overflow: hidden; overflow: hidden;
font-size: small; font-size: small;
font-family: Verdana,Arial,Helvetica,sans-serif; font-family: Verdana,Arial,Helvetica,sans-serif;
vertical-align: top; vertical-align: top;
} }
.imgContainer img{
.filterContainer{ max-width: 150px;
float: left; max-height:150px;
margin: 2px; }
padding: 2px;
font-size: 14px; .filterContainer{
float: left;
} margin: 2px;
padding: 2px;
.filterSelect{ font-size: 14px;
border-style:none;
-webkit-border-top-right-radius: 15px; }
-webkit-border-bottom-right-radius: 15px;
-moz-border-radius-topright: 15px; .filterSelect{
-moz-border-radius-bottomright: 15px; border-style:none;
border-top-right-radius: 15px; -webkit-border-top-right-radius: 15px;
margin-top: 2px; -webkit-border-bottom-right-radius: 15px;
width: 100%; -moz-border-radius-topright: 15px;
} -moz-border-radius-bottomright: 15px;
border-top-right-radius: 15px;
span{ margin-top: 2px;
font-family: Verdana,Arial,Helvetica,sans-serif; width: 100%;
color: #666; }
}
span{
[draggable] { font-family: Verdana,Arial,Helvetica,sans-serif;
-webkit-user-select: none; color: #666;
user-select: none; }
}
[draggable] {
.toggleFilters{ -webkit-user-select: none;
margin: 0; user-select: none;
padding: 0; }
background-position: center;
background-image: url(../images/down.png); .toggleFilters{
position: absolute; margin: 0;
top: 11px; padding: 0;
right: 6px; background-position: center;
width: 20px; background-image: url(../images/down.png);
height: 20px; position: absolute;
cursor: pointer; top: 11px;
} right: 6px;
width: 20px;
.colors_line { height: 20px;
float: left; cursor: pointer;
margin: 4px; }
margin-right: 0;
clear: left; .colors_line {
} float: left;
margin: 4px;
.custom { margin-right: 0;
opacity: 0; clear: left;
position: absolute; }
left: -10000px;
} .custom {
opacity: 0;
.filter_button.button.color { position: absolute;
display: inline-block; left: -10000px;
width: 15px; }
height: 15px;
border: 1px solid #EBEBEB; .filter_button.button.color {
padding: 0; display: inline-block;
margin: 0; width: 15px;
box-sizing: border-box; height: 15px;
-webkit-box-sizing: border-box; border: 1px solid #EBEBEB;
} padding: 0;
margin: 0;
.filter_button.button.color:hover { box-sizing: border-box;
border: 1px solid rgb(128,128,128); -webkit-box-sizing: border-box;
cursor: pointer; }
}
.filter_button.button.color:hover {
input[type="radio"]:checked + .filter_button.button.color { border: 1px solid rgb(128,128,128);
border: 1px solid rgb(255,255,255); cursor: pointer;
box-shadow: 0 0 0px 1px #000; }
-webkit-box-shadow: 0 0 0px 1px #000;
} input[type="radio"]:checked + .filter_button.button.color {
border: 1px solid rgb(255,255,255);
#allcolor { box-shadow: 0 0 0px 1px #000;
background: white url('../images/search_app.png') -43px -144px no-repeat; -webkit-box-shadow: 0 0 0px 1px #000;
} }
#colored { #allcolor {
background: white url('../images/search_app.png') -43px -244px no-repeat; background: white url('../images/search_app.png') -43px -144px no-repeat;
} }
#grayed { #colored {
background: white url('../images/search_app.png') -45px -343px no-repeat; background: white url('../images/search_app.png') -43px -244px no-repeat;
} }
#black{ #grayed {
background-color:#ffffff; background: white url('../images/search_app.png') -45px -343px no-repeat;
} }
#blue{
background-color:#0000FF; #black{
} background-color:#ffffff;
#brown{ }
background-color:rgba(139, 82, 16, 1); #blue{
} background-color:#0000FF;
}
#gray{ #brown{
background-color:#999999; background-color:rgba(139, 82, 16, 1);
} }
#green{ #gray{
background-color:#00CC00; background-color:#999999;
} }
#orange{ #green{
background-color:#FB940B; background-color:#00CC00;
} }
#pink{ #orange{
background-color:#FF98BF; background-color:#FB940B;
} }
#purple{ #pink{
background-color:#762CA7; background-color:#FF98BF;
} }
#red{ #purple{
background-color:#CC0000; background-color:#762CA7;
} }
#teal{ #red{
background-color:#03C0C6; background-color:#CC0000;
} }
#white{ #teal{
background-color:#000000; background-color:#03C0C6;
} }
#yellow{ #white{
background-color:#FFFF00; background-color:#000000;
} }
.selectBox-dropdown, .selectBox-options li a { #yellow{
line-height: 1.3 !important; background-color:#FFFF00;
font-size: 13px; }
}
.selectBox-dropdown, .selectBox-options li a {
.pager_button { line-height: 1.3 !important;
padding: 3px 5px; font-size: 13px;
font-size: 16px; }
color: black;
display: inline-block; .pager_button {
} padding: 3px 5px;
font-size: 16px;
.pager_button.active { color: black;
border-radius: 3px; display: inline-block;
-webkit-border-radius: 3px; }
background-color: gray;
color: white; .pager_button.active {
} border-radius: 3px;
-webkit-border-radius: 3px;
background-color: gray;
color: white;
}

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Before

Width:  |  Height:  |  Size: 214 B

After

Width:  |  Height:  |  Size: 214 B

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Before

Width:  |  Height:  |  Size: 931 B

After

Width:  |  Height:  |  Size: 931 B

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Before

Width:  |  Height:  |  Size: 475 B

After

Width:  |  Height:  |  Size: 475 B

Before

Width:  |  Height:  |  Size: 448 B

After

Width:  |  Height:  |  Size: 448 B

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

@ -1,264 +1,264 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
<title>Planete Sankore Image Search</title> <title>Planete Sankore Image Search</title>
<link rel="stylesheet" type="text/css" href="css/basic.css"/> <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="scripts/jquery-1.6.2.min.js"></script>
<script type="text/javascript"> <script type="text/javascript">
var category = "image"; var category = "image";
var thumbnails = true; var thumbnails = true;
var minHeight = 180; var minHeight = 150;
var minWidth = 150; var minWidth = 150;
var currentIndex = 0; var currentIndex = 0;
var currentTerm = ""; var currentTerm = "";
var limit = 10; var limit = 10;
var filtersDisplayed = false; //display or hide filters var filtersDisplayed = false; //display or hide filters
function addPaginationLinks(totalResults) { function addPaginationLinks(totalResults) {
var curPage = currentIndex; // check what page the app is on var curPage = currentIndex; // check what page the app is on
var pagesDiv = $("<div id='resultFooter' class='resultFooter'>"); var pagesDiv = $("<div id='resultFooter' class='resultFooter'>");
for (var i = 0; i < 8; i++) { for (var i = 0; i < 8; i++) {
if (i * limit < totalResults) { if (i * limit < totalResults) {
var link = $("<a class='pager_button'></a>").attr('href', 'javascript:gotoPage('+i+');').html(i+1).appendTo(pagesDiv); var link = $("<a class='pager_button'></a>").attr('href', 'javascript:gotoPage('+i+');').html(i+1).appendTo(pagesDiv);
if (curPage == i) { if (curPage == i) {
link.addClass('active'); link.addClass('active');
} }
} }
} }
$("#disc_nav_cont #resultFooter").remove(); $("#disc_nav_cont #resultFooter").remove();
pagesDiv.insertBefore($('#disclaimer')); pagesDiv.insertBefore($('#disclaimer'));
$(".imgContainer").each(function(){ $(".imgContainer").each(function(){
this.addEventListener("dragstart", imageDragging, false); this.addEventListener("dragstart", imageDragging, false);
}) })
$(".imgContainer").each(function(){ $(".imgContainer").each(function(){
this.addEventListener("dragenter", imageDragenter, false); this.addEventListener("dragenter", imageDragenter, false);
}) })
$(".imgContainer").each(function(){ $(".imgContainer").each(function(){
this.addEventListener("dragleave", imageDragleave, false); this.addEventListener("dragleave", imageDragleave, false);
}) })
$(".imgContainer").each(function(){ $(".imgContainer").each(function(){
this.addEventListener("dragover", imageDragover, false); this.addEventListener("dragover", imageDragover, false);
}) })
} }
function searchFail(jqXHR, textStatus, errorThrown) { function searchFail(jqXHR, textStatus, errorThrown) {
alert('Impossible to connect to Planete Sankore: ' + textStatus + ' ' + errorThrown); alert('Impossible to connect to Planete Sankore: ' + textStatus + ' ' + errorThrown);
} }
function searchComplete(json) { function searchComplete(json) {
// Grab our content div, clear it. // Grab our content div, clear it.
var totalResults = json.totalResults; var totalResults = json.totalResults;
var contentDiv = $('#searchResult').empty(); var contentDiv = $('#searchResult').empty();
// Loop through our results, printing them to the page. // Loop through our results, printing them to the page.
var results = json.rows; var results = json.rows;
for (var i = 0; i < results.length; i++) { for (var i = 0; i < results.length; i++) {
// For each result write it's title and image to the screen // For each result write it's title and image to the screen
var result = results[i]; var result = results[i];
var imgContainer = $("<div class='imgContainer' draggable='true'>"); var imgContainer = $("<div class='imgContainer' draggable='true'>");
//var title = document.createElement('div'); //var title = document.createElement('div');
var iUrl = $("<input type='hidden'/>"); var iUrl = $("<input type='hidden'/>");
var iContent = $("<input type='hidden'/>"); var iContent = $("<input type='hidden'/>");
var iHeight = $("<input type='hidden'/>"); var iHeight = $("<input type='hidden'/>");
var iWidth = $("<input type='hidden'/>"); var iWidth = $("<input type='hidden'/>");
var iTitle = $("<input type='hidden'/>"); var iTitle = $("<input type='hidden'/>");
// We use titleNoFormatting so that no HTML tags are left in the // We use titleNoFormatting so that no HTML tags are left in the
// title // title
//title.innerHTML = result.title; //title.innerHTML = result.title;
var newImg = document.createElement('img'); var newImg = document.createElement('img');
// There is also a result.file property which has the escaped version // There is also a result.file property which has the escaped version
if (thumbnails) { if (thumbnails) {
newImg.src = result.file; newImg.src = result.file;
if(result.height >= result.width) /*if(result.height >= result.width)
newImg.height = minHeight; newImg.height = minHeight;
else{ else{
newImg.width = minWidth; newImg.width = minWidth;
//newImg.style.margin = (120 - result.height)/2 + "px 0"; //newImg.style.margin = (120 - result.height)/2 + "px 0";
} }*/
} else { } else {
newImg.src = "./images/thumbnail_icon.png"; newImg.src = "./images/thumbnail_icon.png";
} }
var imgWidth = (result.tbWidth > minWidth)?result.tbWidth:minWidth; var imgWidth = (result.tbWidth > minWidth)?result.tbWidth:minWidth;
var imgHeight = (result.tbHeight > minHeight)?result.tbHeight:minHeight; var imgHeight = (result.tbHeight > minHeight)?result.tbHeight:minHeight;
imgContainer.width(imgWidth).height(imgHeight); imgContainer.width(imgWidth).height(imgHeight);
imgContainer.append($(newImg)); imgContainer.append($(newImg));
iUrl.attr("value", result.file); iUrl.attr("value", result.file);
iContent.attr("value", result.title); iContent.attr("value", result.title);
iHeight.attr("value", result.height); iHeight.attr("value", result.height);
iWidth.attr("value", result.width); iWidth.attr("value", result.width);
iTitle.attr("value",result.title); iTitle.attr("value",result.title);
//imgContainer.append($(title)); //imgContainer.append($(title));
imgContainer.append(iUrl); imgContainer.append(iUrl);
imgContainer.append(iContent); imgContainer.append(iContent);
imgContainer.append(iHeight); imgContainer.append(iHeight);
imgContainer.append(iWidth); imgContainer.append(iWidth);
imgContainer.append(iTitle); imgContainer.append(iTitle);
// Put our title + image in the content // Put our title + image in the content
imgContainer.appendTo(contentDiv); imgContainer.appendTo(contentDiv);
} }
// Now add links to additional pages of search results. // Now add links to additional pages of search results.
addPaginationLinks(totalResults); addPaginationLinks(totalResults);
} }
function imageDragging(e){ function imageDragging(e){
e.dataTransfer.setData("text/plain",$(this).find("input:hidden").eq(0).val()); e.dataTransfer.setData("text/plain",$(this).find("input:hidden").eq(0).val());
// alert($(this).find("input:hidden").eq(0).val()); // alert($(this).find("input:hidden").eq(0).val());
} }
function imageDragleave(e){ function imageDragleave(e){
return false; return false;
} }
function imageDragover(e){ function imageDragover(e){
return false; return false;
} }
function imageDragenter(e){ function imageDragenter(e){
return false; return false;
} }
$(document).ready(function(){ $(document).ready(function(){
//variables //variables
var mode = false; //search or view mode var mode = false; //search or view mode
var hide = false; //hide or no main panel var hide = false; //hide or no main panel
//basic containers and elements //basic containers and elements
var disc_nav_cont = $("<div id='disc_nav_cont' class='disc_nav_cont'>").appendTo("body"); var disc_nav_cont = $("<div id='disc_nav_cont' class='disc_nav_cont'>").appendTo("body");
var disclaimer = $("<div id='disclaimer' class='disclaimer'>Recherche d'images sur Planète Sankoré<div>").appendTo(disc_nav_cont); var disclaimer = $("<div id='disclaimer' class='disclaimer'>Recherche d'images sur Planète Sankoré<div>").appendTo(disc_nav_cont);
var search = $("<div id='search' class='search'>").appendTo("body"); var search = $("<div id='search' class='search'>").appendTo("body");
var togglePages = $("<div id='togglePages' class='togglePages'>").appendTo(search); var togglePages = $("<div id='togglePages' class='togglePages'>").appendTo(search);
var toggleIcon = $("<div id='toggleIcon' class='toggleIcon'>").appendTo(togglePages); var toggleIcon = $("<div id='toggleIcon' class='toggleIcon'>").appendTo(togglePages);
var subSearchInput = $("<div id='subSearchInput' class='subSearch'>").appendTo(search); var subSearchInput = $("<div id='subSearchInput' class='subSearch'>").appendTo(search);
var subSearchFilter = $("<div id='subSearchFilter' class='subSearch'>").appendTo(search); var subSearchFilter = $("<div id='subSearchFilter' class='subSearch'>").appendTo(search);
var searchInput = $("<input id='searchInput' class='searchInput' type='text'/>").appendTo(subSearchInput); var searchInput = $("<input id='searchInput' class='searchInput' type='text'/>").appendTo(subSearchInput);
var searchButton = $("<div id='searchButton' class='searchButton'>").appendTo(subSearchInput); var searchButton = $("<div id='searchButton' class='searchButton'>").appendTo(subSearchInput);
// var toggleFilters = $("<div id='toggleFilters' class='toggleFilters'>").appendTo(subSearchInput); // var toggleFilters = $("<div id='toggleFilters' class='toggleFilters'>").appendTo(subSearchInput);
//adding filters to the wgt //adding filters to the wgt
var selectFilter = $("<select id='sizeFilter' class='filterSelect'>") var selectFilter = $("<select id='sizeFilter' class='filterSelect'>")
.append($("<option value='0'>Any</option>")) .append($("<option value='0'>Any</option>"))
.append($("<option value='1'>Small</option>")) .append($("<option value='1'>Small</option>"))
.append($("<option value='2'>Medium</option>")) .append($("<option value='2'>Medium</option>"))
.append($("<option value='3'>Large</option>")) .append($("<option value='3'>Large</option>"))
.append($("<option value='4'>Extra large</option>")); .append($("<option value='4'>Extra large</option>"));
$("<div class='filterContainer'>").append("<span>Size:</span>").append(selectFilter).appendTo(subSearchFilter); $("<div class='filterContainer'>").append("<span>Size:</span>").append(selectFilter).appendTo(subSearchFilter);
//mouse click actions //mouse click actions
/* /*
toggleFilters.click(function(){ toggleFilters.click(function(){
if(filtersDisplayed){ if(filtersDisplayed){
subSearchFilter.hide(); subSearchFilter.hide();
toggleFilters.css("background-image","url(images/down.png)"); toggleFilters.css("background-image","url(images/down.png)");
filtersDisplayed = false; filtersDisplayed = false;
} else { } else {
subSearchFilter.show(); subSearchFilter.show();
toggleFilters.css("background-image","url(images/up.png)"); toggleFilters.css("background-image","url(images/up.png)");
filtersDisplayed = true; filtersDisplayed = true;
} }
}); });
*/ */
/*togglePages.click(function(event){ /*togglePages.click(function(event){
if(mode){ if(mode){
hide = false; hide = false;
$("#search, #disclaimer").slideDown('slow', function(){ $("#search, #disclaimer").slideDown('slow', function(){
toggleIcon.css("background-image","url(images/trgUp.png)"); toggleIcon.css("background-image","url(images/trgUp.png)");
togglePages.appendTo("#search").css("top","").css("bottom","-14px"); togglePages.appendTo("#search").css("top","").css("bottom","-14px");
}); });
mode = false; mode = false;
} else { } else {
hide = true; hide = true;
$("#search, #disclaimer").slideUp('slow', function(){ $("#search, #disclaimer").slideUp('slow', function(){
toggleIcon.css("background-image","url(images/trgDown.png)"); toggleIcon.css("background-image","url(images/trgDown.png)");
togglePages.appendTo("body").css("top","0"); togglePages.appendTo("body").css("top","0");
}); });
mode = true; mode = true;
} }
});*/ });*/
searchButton.click(function(){ searchButton.click(function(){
if(!hide){ if(!hide){
runSearch(searchInput.val(), 0); runSearch(searchInput.val(), 0);
//togglePages.trigger("click"); //togglePages.trigger("click");
} }
}); });
searchInput.keydown(function(event){ searchInput.keydown(function(event){
if(!hide){ if(!hide){
if((event.keyCode == 0xA)||(event.keyCode == 0xD)){ if((event.keyCode == 0xA)||(event.keyCode == 0xD)){
runSearch(searchInput.val(), 0); runSearch(searchInput.val(), 0);
//togglePages.trigger("click"); //togglePages.trigger("click");
} }
} }
}); });
( (
$(".imgContainer").live("click",function(){ $(".imgContainer").live("click",function(){
sankore.sendFileMetadata(createMetaData($(this))); sankore.sendFileMetadata(createMetaData($(this)));
})); }));
/*$(window).resize(function(){ /*$(window).resize(function(){
disclaimer.width($("body").width()-20); disclaimer.width($("body").width()-20);
search.width($("body").width()-20); search.width($("body").width()-20);
toggleIcon.css("margin-left",(togglePages.width()/2 - 7)); toggleIcon.css("margin-left",(togglePages.width()/2 - 7));
})*/ })*/
}); });
function gotoPage(i) { function gotoPage(i) {
runSearch(currentTerm, i); runSearch(currentTerm, i);
} }
// launching the search on planete sankore // launching the search on planete sankore
function runSearch(term, index) { function runSearch(term, index) {
currentTerm = term; currentTerm = term;
currentIndex = index; currentIndex = index;
var start = index * limit; var start = index * limit;
var url = "http://planete.sankore.org/xwiki/bin/view/Search/Resources?xpage=plain&category=" + category + "&level=&sort=title&dir=ASC&terms=" + escape(term) + "&start=" + start + "&limit=" + limit; var url = "http://planete.sankore.org/xwiki/bin/view/Search/Resources?xpage=plain&category=" + category + "&level=&sort=title&dir=ASC&terms=" + escape(term) + "&start=" + start + "&limit=" + limit;
$.ajax({ $.ajax({
url: url, url: url,
success: searchComplete, success: searchComplete,
error: searchFail, error: searchFail,
dataType: "json" dataType: "json"
}); });
} }
function createMetaData(parent){ function createMetaData(parent){
var meta = ""; var meta = "";
//alert($(this).find("input:hidden").eq(0).val()); //alert($(this).find("input:hidden").eq(0).val());
meta = "<metadata><data><key>Type</key><value>Image</value></data><data><key>Url</key><value>" + meta = "<metadata><data><key>Type</key><value>Image</value></data><data><key>Url</key><value>" +
parent.find("input:hidden").eq(0).val() + parent.find("input:hidden").eq(0).val() +
"</value></data><data><key>Content</key><value>" + "</value></data><data><key>Content</key><value>" +
parent.find("input:hidden").eq(1).val() + parent.find("input:hidden").eq(1).val() +
"</value></data><data><key>Height</key><value>" + "</value></data><data><key>Height</key><value>" +
parent.find("input:hidden").eq(2).val() + parent.find("input:hidden").eq(2).val() +
"</value></data><data><key>Width</key><value>" + "</value></data><data><key>Width</key><value>" +
parent.find("input:hidden").eq(3).val() + parent.find("input:hidden").eq(3).val() +
"</value></data><data><key>Title</key><value>" + "</value></data><data><key>Title</key><value>" +
parent.find("input:hidden").eq(4).val() + parent.find("input:hidden").eq(4).val() +
"</value></data></metadata>"; "</value></data></metadata>";
return meta; return meta;
} }
</script> </script>
</head> </head>
<body style="font-family: Arial;border: 0 none;"> <body style="font-family: Arial;border: 0 none;">
<div id="searchResult"></div> <div id="searchResult"></div>
</body> </body>
</html> </html>

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save