Browse Source

added popups on hover for solr targets

2.x-ebsco
Paul Pound 11 years ago
parent
commit
06ef5e807f
  1. 2
      css/jquery.qtip.min.css
  2. 19
      js/imagesloaded.pkg.min.js
  3. 5
      js/jquery.qtip.min.js
  4. 21
      js/roblib_search.js
  5. 8
      roblib_search.module
  6. 10
      targets/solr_site/js/solr_site_bestbet.js
  7. 10
      targets/solr_site/js/solr_site_databases.js
  8. 10
      targets/solr_site/js/solr_site_guides.js
  9. 13
      targets/solr_site/js/solr_site_results.js
  10. 11
      targets/solr_site/theme/roblib-search-solr-site-results.tpl.php

2
css/jquery.qtip.min.css vendored

@ -0,0 +1,2 @@
/* qTip2 v2.2.0 basic | qtip2.com | Licensed MIT, GPL | Mon Mar 17 2014 09:58:32 */
.qtip{position:absolute;left:-28000px;top:-28000px;display:none;max-width:280px;min-width:50px;font-size:10.5px;line-height:12px;direction:ltr;box-shadow:none;padding:0}.qtip-content{position:relative;padding:5px 9px;overflow:hidden;text-align:left;word-wrap:break-word}.qtip-titlebar{position:relative;padding:5px 35px 5px 10px;overflow:hidden;border-width:0 0 1px;font-weight:700}.qtip-titlebar+.qtip-content{border-top-width:0!important}.qtip-close{position:absolute;right:-9px;top:-9px;cursor:pointer;outline:medium none;border-width:1px;border-style:solid;border-color:transparent}.qtip-titlebar .qtip-close{right:4px;top:50%;margin-top:-9px}* html .qtip-titlebar .qtip-close{top:16px}.qtip-titlebar .ui-icon,.qtip-icon .ui-icon{display:block;text-indent:-1000em;direction:ltr}.qtip-icon,.qtip-icon .ui-icon{-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;text-decoration:none}.qtip-icon .ui-icon{width:18px;height:14px;line-height:14px;text-align:center;text-indent:0;font:400 bold 10px/13px Tahoma,sans-serif;color:inherit;background:transparent none no-repeat -100em -100em}.qtip-focus{}.qtip-hover{}.qtip-default{border-width:1px;border-style:solid;border-color:#F1D031;background-color:#FFFFA3;color:#555}.qtip-default .qtip-titlebar{background-color:#FFEF93}.qtip-default .qtip-icon{border-color:#CCC;background:#F1F1F1;color:#777}.qtip-default .qtip-titlebar .qtip-close{border-color:#AAA;color:#111} .qtip-light{background-color:#fff;border-color:#E2E2E2;color:#454545}.qtip-light .qtip-titlebar{background-color:#f1f1f1} .qtip-dark{background-color:#505050;border-color:#303030;color:#f3f3f3}.qtip-dark .qtip-titlebar{background-color:#404040}.qtip-dark .qtip-icon{border-color:#444}.qtip-dark .qtip-titlebar .ui-state-hover{border-color:#303030} .qtip-cream{background-color:#FBF7AA;border-color:#F9E98E;color:#A27D35}.qtip-cream .qtip-titlebar{background-color:#F0DE7D}.qtip-cream .qtip-close .qtip-icon{background-position:-82px 0} .qtip-red{background-color:#F78B83;border-color:#D95252;color:#912323}.qtip-red .qtip-titlebar{background-color:#F06D65}.qtip-red .qtip-close .qtip-icon{background-position:-102px 0}.qtip-red .qtip-icon{border-color:#D95252}.qtip-red .qtip-titlebar .ui-state-hover{border-color:#D95252} .qtip-green{background-color:#CAED9E;border-color:#90D93F;color:#3F6219}.qtip-green .qtip-titlebar{background-color:#B0DE78}.qtip-green .qtip-close .qtip-icon{background-position:-42px 0} .qtip-blue{background-color:#E5F6FE;border-color:#ADD9ED;color:#5E99BD}.qtip-blue .qtip-titlebar{background-color:#D0E9F5}.qtip-blue .qtip-close .qtip-icon{background-position:-2px 0}.qtip .qtip-tip{margin:0 auto;overflow:hidden;z-index:10}x:-o-prefocus,.qtip .qtip-tip{visibility:hidden}.qtip .qtip-tip,.qtip .qtip-tip .qtip-vml,.qtip .qtip-tip canvas{position:absolute;color:#123456;background:transparent;border:0 dashed transparent}.qtip .qtip-tip canvas{top:0;left:0}.qtip .qtip-tip .qtip-vml{behavior:url(#default#VML);display:inline-block;visibility:visible}

19
js/imagesloaded.pkg.min.js vendored

@ -0,0 +1,19 @@
/* qTip2 v2.2.0 tips viewport | qtip2.com | Licensed MIT, GPL | Mon Mar 17 2014 09:58:31 */
/*!
* EventEmitter v4.2.6 - git.io/ee
* Oliver Caldwell
* MIT license
* @preserve
*/
(function(){"use strict";function a(){}function b(a,b){for(var c=a.length;c--;)if(a[c].listener===b)return c;return-1}function c(a){return function(){return this[a].apply(this,arguments)}}var d=a.prototype,e=this,f=e.EventEmitter;d.getListeners=function(a){var b,c,d=this._getEvents();if("object"==typeof a){b={};for(c in d)d.hasOwnProperty(c)&&a.test(c)&&(b[c]=d[c])}else b=d[a]||(d[a]=[]);return b},d.flattenListeners=function(a){var b,c=[];for(b=0;b<a.length;b+=1)c.push(a[b].listener);return c},d.getListenersAsObject=function(a){var b,c=this.getListeners(a);return c instanceof Array&&(b={},b[a]=c),b||c},d.addListener=function(a,c){var d,e=this.getListenersAsObject(a),f="object"==typeof c;for(d in e)e.hasOwnProperty(d)&&-1===b(e[d],c)&&e[d].push(f?c:{listener:c,once:!1});return this},d.on=c("addListener"),d.addOnceListener=function(a,b){return this.addListener(a,{listener:b,once:!0})},d.once=c("addOnceListener"),d.defineEvent=function(a){return this.getListeners(a),this},d.defineEvents=function(a){for(var b=0;b<a.length;b+=1)this.defineEvent(a[b]);return this},d.removeListener=function(a,c){var d,e,f=this.getListenersAsObject(a);for(e in f)f.hasOwnProperty(e)&&(d=b(f[e],c),-1!==d&&f[e].splice(d,1));return this},d.off=c("removeListener"),d.addListeners=function(a,b){return this.manipulateListeners(!1,a,b)},d.removeListeners=function(a,b){return this.manipulateListeners(!0,a,b)},d.manipulateListeners=function(a,b,c){var d,e,f=a?this.removeListener:this.addListener,g=a?this.removeListeners:this.addListeners;if("object"!=typeof b||b instanceof RegExp)for(d=c.length;d--;)f.call(this,b,c[d]);else for(d in b)b.hasOwnProperty(d)&&(e=b[d])&&("function"==typeof e?f.call(this,d,e):g.call(this,d,e));return this},d.removeEvent=function(a){var b,c=typeof a,d=this._getEvents();if("string"===c)delete d[a];else if("object"===c)for(b in d)d.hasOwnProperty(b)&&a.test(b)&&delete d[b];else delete this._events;return this},d.removeAllListeners=c("removeEvent"),d.emitEvent=function(a,b){var c,d,e,f,g=this.getListenersAsObject(a);for(e in g)if(g.hasOwnProperty(e))for(d=g[e].length;d--;)c=g[e][d],c.once===!0&&this.removeListener(a,c.listener),f=c.listener.apply(this,b||[]),f===this._getOnceReturnValue()&&this.removeListener(a,c.listener);return this},d.trigger=c("emitEvent"),d.emit=function(a){var b=Array.prototype.slice.call(arguments,1);return this.emitEvent(a,b)},d.setOnceReturnValue=function(a){return this._onceReturnValue=a,this},d._getOnceReturnValue=function(){return this.hasOwnProperty("_onceReturnValue")?this._onceReturnValue:!0},d._getEvents=function(){return this._events||(this._events={})},a.noConflict=function(){return e.EventEmitter=f,a},"function"==typeof define&&define.amd?define(function(){return a}):"object"==typeof module&&module.exports?module.exports=a:this.EventEmitter=a}).call(this),/*!
* eventie v1.0.3
* event binding helper
* eventie.bind( elem, 'click', myFn )
* eventie.unbind( elem, 'click', myFn )
*/
function(a){"use strict";var b=document.documentElement,c=function(){};b.addEventListener?c=function(a,b,c){a.addEventListener(b,c,!1)}:b.attachEvent&&(c=function(b,c,d){b[c+d]=d.handleEvent?function(){var b=a.event;b.target=b.target||b.srcElement,d.handleEvent.call(d,b)}:function(){var c=a.event;c.target=c.target||c.srcElement,d.call(b,c)},b.attachEvent("on"+c,b[c+d])});var d=function(){};b.removeEventListener?d=function(a,b,c){a.removeEventListener(b,c,!1)}:b.detachEvent&&(d=function(a,b,c){a.detachEvent("on"+b,a[b+c]);try{delete a[b+c]}catch(d){a[b+c]=void 0}});var e={bind:c,unbind:d};"function"==typeof define&&define.amd?define(e):a.eventie=e}(this),/*!
* imagesLoaded v3.0.2
* JavaScript is all like "You images are done yet or what?"
*/
function(a){"use strict";function b(a,b){for(var c in b)a[c]=b[c];return a}function c(a){return"[object Array]"===i.call(a)}function d(a){var b=[];if(c(a))b=a;else if("number"==typeof a.length)for(var d=0,e=a.length;e>d;d++)b.push(a[d]);else b.push(a);return b}function e(a,c){function e(a,c,g){if(!(this instanceof e))return new e(a,c);"string"==typeof a&&(a=document.querySelectorAll(a)),this.elements=d(a),this.options=b({},this.options),"function"==typeof c?g=c:b(this.options,c),g&&this.on("always",g),this.getImages(),f&&(this.jqDeferred=new f.Deferred);var h=this;setTimeout(function(){h.check()})}function i(a){this.img=a}e.prototype=new a,e.prototype.options={},e.prototype.getImages=function(){this.images=[];for(var a=0,b=this.elements.length;b>a;a++){var c=this.elements[a];"IMG"===c.nodeName&&this.addImage(c);for(var d=c.querySelectorAll("img"),e=0,f=d.length;f>e;e++){var g=d[e];this.addImage(g)}}},e.prototype.addImage=function(a){var b=new i(a);this.images.push(b)},e.prototype.check=function(){function a(a,e){return b.options.debug&&h&&g.log("confirm",a,e),b.progress(a),c++,c===d&&b.complete(),!0}var b=this,c=0,d=this.images.length;if(this.hasAnyBroken=!1,!d)return this.complete(),void 0;for(var e=0;d>e;e++){var f=this.images[e];f.on("confirm",a),f.check()}},e.prototype.progress=function(a){this.hasAnyBroken=this.hasAnyBroken||!a.isLoaded,this.emit("progress",this,a),this.jqDeferred&&this.jqDeferred.notify(this,a)},e.prototype.complete=function(){var a=this.hasAnyBroken?"fail":"done";if(this.isComplete=!0,this.emit(a,this),this.emit("always",this),this.jqDeferred){var b=this.hasAnyBroken?"reject":"resolve";this.jqDeferred[b](this)}},f&&(f.fn.imagesLoaded=function(a,b){var c=new e(this,a,b);return c.jqDeferred.promise(f(this))});var j={};return i.prototype=new a,i.prototype.check=function(){var a=j[this.img.src];if(a)return this.useCached(a),void 0;if(j[this.img.src]=this,this.img.complete&&void 0!==this.img.naturalWidth)return this.confirm(0!==this.img.naturalWidth,"naturalWidth"),void 0;var b=this.proxyImage=new Image;c.bind(b,"load",this),c.bind(b,"error",this),b.src=this.img.src},i.prototype.useCached=function(a){if(a.isConfirmed)this.confirm(a.isLoaded,"cached was confirmed");else{var b=this;a.on("confirm",function(a){return b.confirm(a.isLoaded,"cache emitted confirmed"),!0})}},i.prototype.confirm=function(a,b){this.isConfirmed=!0,this.isLoaded=a,this.emit("confirm",this,b)},i.prototype.handleEvent=function(a){var b="on"+a.type;this[b]&&this[b](a)},i.prototype.onload=function(){this.confirm(!0,"onload"),this.unbindProxyEvents()},i.prototype.onerror=function(){this.confirm(!1,"onerror"),this.unbindProxyEvents()},i.prototype.unbindProxyEvents=function(){c.unbind(this.proxyImage,"load",this),c.unbind(this.proxyImage,"error",this)},e}var f=a.jQuery,g=a.console,h="undefined"!=typeof g,i=Object.prototype.toString;"function"==typeof define&&define.amd?define(["eventEmitter","eventie"],e):a.imagesLoaded=e(a.EventEmitter,a.eventie)}(window);
//# sourceMappingURL=http://cdnjs.cloudflare.com/ajax/libs/qtip2/2.2.0//var/www/qtip2/build/tmp/tmp-11954j3xqb1s/imagesloaded.pkg.min.map

5
js/jquery.qtip.min.js vendored

File diff suppressed because one or more lines are too long

21
js/roblib_search.js

@ -0,0 +1,21 @@
/**
* Created by ppound on 2014-06-19.
*/
function qtipify(divs, content, title){
for (index = 0; index < divs.length; index++) {
jQuery('#' + divs[index]).qtip({
content: {
text: content[index],
title: title,
},
style: "qtip-light",
position: {
my: 'left center',
at: 'right center',
},
show: 'mouseover',
hide: 'mouseout'
});
}
}

8
roblib_search.module

@ -82,6 +82,14 @@ function roblib_search_block_info() {
return $blocks;
}
function roblib_search_init(){
// Make qtip available for all targets js.
drupal_add_js(drupal_get_path('module', 'roblib_search') . '/js/jquery.qtip.min.js');
drupal_add_js(drupal_get_path('module', 'roblib_search') . '/js/imagesloaded.pkg.min.js');
drupal_add_js(drupal_get_path('module', 'roblib_search') . '/js/roblib_search.js');
drupal_add_css(drupal_get_path('module', 'roblib_search') . '/css/jquery.qtip.min.css');
}
function roblib_search_block_view($delta = '') {
switch ($delta) {
case 'roblib_search_form':

10
targets/solr_site/js/solr_site_bestbet.js

@ -15,14 +15,20 @@ Drupal.behaviors.roblib_search_solr_site_bestbet = {
} else {
jQuery('#' + 'roblib-search-content-solr-site-bestbet').empty();
var counter = 0;
var divs = new Array();
var content = new Array();
jQuery.each(data.response.docs, function(key, val) {
items.push('<div class ="roblib-search-row">\n\
id = 'roblib_search_solr_bestbets_' + counter;
content[counter] = val.teaser;
divs[counter++] = id;
items.push('<div class ="roblib-search-row" id="' + id + '">\n\
<div class="roblib-title solr_site">\n\
<a href="' + val.url + '">' + val.label + '</a></div></div>');
});
jQuery('#' + 'roblib-search-content-solr-site-bestbet').empty().append(items.join(''));
qtipify(divs, content, 'Best Bet');
}
});
}

10
targets/solr_site/js/solr_site_databases.js

@ -15,14 +15,20 @@ Drupal.behaviors.roblib_search_solr_site_databases = {
} else {
jQuery('#' + 'roblib-search-content-solr-site-databases').empty();
var counter = 0;
var divs = new Array();
var content = new Array();
jQuery.each(data.response.docs, function(key, val) {
items.push('<div class="roblib-search-row">\n\
id = 'roblib_search_solr_databases_' + counter;
content[counter] = val.teaser;
divs[counter++] = id;
items.push('<div class="roblib-search-row" id="'+id+'">\n\
<div class="roblib-title databases">\n\
<a href="' + val.url + '">' + val.label + '</a></div></div>');
});
jQuery('#' + 'roblib-search-content-solr-site-databases').empty().append(items.join(''));
qtipify(divs, content, 'Description');
}
});

10
targets/solr_site/js/solr_site_guides.js

@ -15,13 +15,19 @@ Drupal.behaviors.roblib_search_solr_site_guides = {
} else {
jQuery('#' + 'roblib-search-content-solr-site-guides').empty();
var counter = 0;
var divs = new Array();
var content = new Array();
jQuery.each(data.response.docs, function(key, val) {
items.push('<div class ="roblib-search-row">\n\
id = 'roblib_search_solr_guides_' + counter;
content[counter] = val.teaser;
divs[counter++] = id;
items.push('<div class ="roblib-search-row" id="' + id + '">\n\
<div class="roblib-title guides">\n\
<a href="' + val.url + '">' + val.label + '</a></div></div>');
});
jQuery('#' + 'roblib-search-content-solr-site-guides').empty().append(items.join(''));
qtipify(divs, content, 'Description');
}
});
}

13
targets/solr_site/js/solr_site_results.js

@ -15,14 +15,21 @@ Drupal.behaviors.roblib_search_solr_site_results = {
} else {
jQuery('#' + 'roblib-search-content-solr-site-results').empty();
var counter = 0;
var divs = new Array();
var content = new Array();
jQuery.each(data.response.docs, function(key, val) {
items.push('<div class ="roblib-search-row">\n\
id = 'roblib_search_solr_results_' + counter;
content[counter] = val.teaser;
divs[counter++] = id;
items.push('<div class ="roblib-search-row" id="'+ id +'">\n\
<div class="roblib-title results">\n\
<a href="' + val.url + '">' + val.label + '</a></div></div>');
});
jQuery('#' + 'roblib-search-content-solr-site-results').empty().append(items.join(''));
qtipify(divs, content, 'Teaser');
}
});
}

11
targets/solr_site/theme/roblib-search-solr-site-results.tpl.php

@ -1,19 +1,12 @@
<?php
/**
* @file islandora-solr-wrapper.tpl.php
* Islandora solr search results wrapper template
* @file roblib-search-solr-site-results.tpl.php
*
*
* Variables available:
* - $variables: all array elements of $variables can be used as a variable. e.g. $base_url equals $variables['base_url']
* - $base_url: The base url of the current website. eg: http://example.com .
* - $user: The user object.
*
*
* - $results: Rendered search results (primary profile)
*
*
* @see template_preprocess_roblib_search_wrapper()
*/
?>
<div class ="roblib-search-more" id="roblib-search-solr-site-<?php echo $type;?>-more"></div>

Loading…
Cancel
Save