From ddcd7e6f3e6b326812421bb67e621c27be857202 Mon Sep 17 00:00:00 2001 From: Ram Date: Fri, 19 Sep 2014 07:47:19 -0700 Subject: [PATCH] =?utf8?q?Implemented=20the=20following=20functionality=20?= =?utf8?q?for=20MU2=20-=20=C2=A7170.314(a)(12)=20Image=20Results?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 1. Provision to tag the encounter to the uploaded document at patient/documents page. 2. Display the links to uploaded tagged documents in the encounter page. 3. Display the links to uploded tagged documents in the past encounter page. 4. New menu option "Documents" at Patient demographics left menu to view the documents uploded to the "Lab Report" category 5. Provision to preview the uploaded document as a tooltip at above Documents page. --- controllers/C_Document.class.php | 96 +- interface/main/display_documents.php | 251 +++ interface/main/left_nav.php | 4 +- interface/patient_file/encounter/forms.php | 41 +- interface/patient_file/history/encounters.php | 45 + library/classes/Document.class.php | 23 +- library/forms.inc | 17 + library/js/qtip/jquery.qtip.css | 589 ++++++ library/js/qtip/jquery.qtip.js | 2731 +++++++++++++++++++++++++ library/js/qtip/jquery.qtip.min.css | 3 + library/js/qtip/jquery.qtip.min.js | 5 + sql/4_1_2-to-4_1_3_upgrade.sql | 8 + sql/database.sql | 2 + templates/documents/general_view.html | 53 + 14 files changed, 3861 insertions(+), 7 deletions(-) create mode 100644 interface/main/display_documents.php create mode 100644 library/js/qtip/jquery.qtip.css create mode 100644 library/js/qtip/jquery.qtip.js create mode 100644 library/js/qtip/jquery.qtip.min.css create mode 100644 library/js/qtip/jquery.qtip.min.js diff --git a/controllers/C_Document.class.php b/controllers/C_Document.class.php index c0f29fc4c..7b7d0ca3c 100644 --- a/controllers/C_Document.class.php +++ b/controllers/C_Document.class.php @@ -10,6 +10,8 @@ require_once(dirname(__FILE__) . "/../library/classes/CategoryTree.class.php"); require_once(dirname(__FILE__) . "/../library/classes/TreeMenu.php"); require_once(dirname(__FILE__) . "/../library/classes/Note.class.php"); require_once(dirname(__FILE__) . "/../library/classes/CouchDB.class.php"); +require_once(dirname(__FILE__) . "/../library/forms.inc"); +require_once(dirname(__FILE__) . "/../library/formatting.inc.php"); class C_Document extends Controller { @@ -256,7 +258,30 @@ class C_Document extends Controller { $issues_options .= ""; } $this->assign("ISSUES_LIST", $issues_options); - + + // For tagging to encounter + // Populate the dropdown with patient's encounter list + $this->assign("TAG_ACTION",$this->_link("tag") . "document_id=" . $d->get_id() . "&process=true"); + $encOptions = ""; + $result_docs = sqlStatement("SELECT fe.encounter,fe.date,openemr_postcalendar_categories.pc_catname FROM form_encounter AS fe " . + "LEFT JOIN openemr_postcalendar_categories ON fe.pc_catid=openemr_postcalendar_categories.pc_catid WHERE fe.pid = ? ORDER BY fe.date desc",array($patient_id)); + if ( sqlNumRows($result_docs) > 0) + while($row_result_docs = sqlFetchArray($result_docs)) { + $sel_enc = ($row_result_docs['encounter'] == $d->get_encounter_id()) ? ' selected' : ''; + $encOptions .= ""; + } + $this->assign("ENC_LIST", $encOptions); + + //Populate the dropdown with category list + $visit_category_list = ""; + $cres = sqlStatement("SELECT pc_catid, pc_catname FROM openemr_postcalendar_categories ORDER BY pc_catname"); + while ($crow = sqlFetchArray($cres)) { + $catid = $crow['pc_catid']; + if ($catid < 9 && $catid != 5) continue; // Applying same logic as in new encounter page. + $visit_category_list .="\n"; + } + $this->assign("VISIT_CATEGORY_LIST", $visit_category_list); + $this->assign("notes",$notes); $this->_last_node = null; @@ -1001,12 +1026,79 @@ class C_Document extends Controller { fclose($LOG); } -} //place to hold optional code //$first_node = array_keys($t->tree); //$first_node = $first_node[0]; //$node1 = new HTML_TreeNode(array('text' => $t->get_node_name($first_node), 'link' => "test.php", 'icon' => $icon, 'expandedIcon' => $expandedIcon, 'expanded' => true), array('onclick' => "alert('foo'); return false", 'onexpand' => "alert('Expanded')")); //$this->_last_node = &$node1; + +// Function to tag a document to an encounter. +function tag_action_process($patient_id="", $document_id) { + if ($_POST['process'] != "true") { + die("process is '" . $_POST['process'] . "', expected 'true'"); + return; + } + + // Create Encounter and Tag it. + $event_date = date('Y-m-d H:i:s'); + $encounter_id = $_POST['encounter_id']; + $encounter_check = $_POST['encounter_check']; + $visit_category_id = $_POST['visit_category_id']; + if (is_numeric($document_id)) { + $messages = ''; + $d = new Document( $document_id ); + $file_name = $d->get_url_file(); + if (!is_numeric($encounter_id)) { + $encounter_id = 0; + } + + $encounter_check = ( $encounter_check == 'on') ? 1 : 0; + if ($encounter_check) { + $provider_id = $_SESSION['authUserID'] ; + + // Get the logged in user's facility + $facilityRow = sqlQuery("SELECT username, facility, facility_id FROM users WHERE id = '" . $provider_id . "'"); + $username = $facilityRow['username']; + $facility = $facilityRow['facility']; + $facility_id = $facilityRow['facility_id']; + // Get the primary Business Entity facility to set as billing facility, if null take user's facility as billing facility + $billingFacility = sqlQuery("SELECT id FROM facility WHERE primary_business_entity = 1"); + $billingFacilityID = ( $billingFacility['id'] ) ? $billingFacility['id'] : $facility_id; + + $conn = $GLOBALS['adodb']['db']; + $encounter = $conn->GenID("sequences"); + $query = "INSERT INTO form_encounter SET + date = ?, + reason = ?, + facility = ?, + sensitivity = 'normal', + pc_catid = ?, + facility_id = ?, + billing_facility = ?, + provider_id = ?, + pid = ?, + encounter = ?"; + $bindArray = array($event_date,$file_name,$facility,$_POST['visit_category_id'],(int)$facility_id,(int)$billingFacilityID,(int)$provider_id,$patient_id,$encounter); + $formID = sqlInsert($query,$bindArray); + addForm($encounter, "New Patient Encounter",$formID,"newpatient", $patient_id, "1", date("Y-m-d H:i:s"), $username ); + $d->set_encounter_id($encounter); + + } else { + $d->set_encounter_id($encounter_id); + } + $d->set_encounter_check($encounter_check); + $d->persist(); + + $messages .= xl('Document tagged to Encounter successfully') . "
"; + } + + $this->_state = false; + $this->assign("messages", $messages); + + return $this->view_action($patient_id, $document_id); +} + +} ?> diff --git a/interface/main/display_documents.php b/interface/main/display_documents.php new file mode 100644 index 000000000..f48d2fc30 --- /dev/null +++ b/interface/main/display_documents.php @@ -0,0 +1,251 @@ +;. + * + * @package OpenEMR + * @author Hema Bandaru + * @link http://www.open-emr.org + */ + +//SANITIZE ALL ESCAPES +$sanitize_all_escapes=true; +//STOP FAKE REGISTER GLOBALS +$fake_register_globals=false; + +require_once('../globals.php'); +require_once("$srcdir/formatting.inc.php"); +require_once("$srcdir/patient.inc"); +require_once("$srcdir/payment_jav.inc.php"); + +//ini_set("display_errors","on"); + +$DateFormat = DateFormatRead(); +$curdate = date_create(date("Y-m-d")); +date_sub($curdate, date_interval_create_from_date_string("7 days")); +$sub_date = date_format($curdate, 'Y-m-d'); + +// Set the default dates for Lab document search +$form_from_doc_date = ( $_GET['form_from_doc_date'] ) ? $_GET['form_from_doc_date'] : oeFormatShortDate(fixDate($_GET['form_from_doc_date'],$sub_date)); +$form_to_doc_date = ( $_GET['form_to_doc_date'] ) ? $_GET['form_to_doc_date'] : oeFormatShortDate(fixDate($_GET['form_to_doc_date'],date("Y-m-d"))); + +if($GLOBALS['date_display_format'] == 1) { + $title_tooltip = "MM/DD/YYYY"; +} elseif($GLOBALS['date_display_format'] == 2) { + $title_tooltip = "DD/MM/YYYY"; +} else { + $title_tooltip = "YYYY-MM-DD"; +} + +$display_div = "style='display:block;'"; +$display_expand_msg = "display:none;"; +$display_collapse_msg = "display:inline;"; + +?> + + + + + + +/library/js/qtip/jquery.qtip.min.css' type='text/css'> + + + + + + + + + + + + + + + + + + + +
+ + (expand) + (collapse) +

+
> + + + + + + + + + + +
: + Date Selector'>: + Date Selector'> + + + +
+
+
+ +
> + = '$form_from_doc_date' "; + } + if ($form_to_doc_date) { + $form_to_doc_date = DateToYYYYMMDD($form_to_doc_date); + $date_filter .= " AND DATE(d.date) <= '$form_to_doc_date'"; + } + // Get the category ID for lab reports. + $query = "SELECT rght FROM categories WHERE name = ?"; + $catIDRs = sqlQuery($query,array($GLOBALS['lab_results_category_name'])); + $catID = $catIDRs['rght']; + + $query = "SELECT d.*,CONCAT(pd.fname,' ',pd.lname) AS pname,GROUP_CONCAT(n.note ORDER BY n.date DESC SEPARATOR '|') AS docNotes, + GROUP_CONCAT(n.date ORDER BY n.date DESC SEPARATOR '|') AS docDates FROM documents d + INNER JOIN patient_data pd ON d.foreign_id = pd.pid + INNER JOIN categories_to_documents ctd ON d.id = ctd.document_id AND ctd.category_id = " . $catID . " + LEFT JOIN notes n ON d.id = n.foreign_id + WHERE " . $date_filter . " GROUP BY d.id ORDER BY date DESC"; + $resultSet = sqlStatement($query); + ?> + + + + + + + + + + "; + ?> + + + + + + + + + +
+ +  
+
+ + \ No newline at end of file diff --git a/interface/main/left_nav.php b/interface/main/left_nav.php index 8494e1aa1..945105620 100644 --- a/interface/main/left_nav.php +++ b/interface/main/left_nav.php @@ -147,7 +147,8 @@ use ESign\Api; 'erx' => array(xl('e-Rx') , 1, 'eRx.php'), 'err' => array(xl('e-Rx Renewal') , 1, 'eRx.php?page=status'), 'pay' => array(xl('Payment') , 1, '../patient_file/front_payment.php'), - 'edi' => array(xl('EDI History') , 0, 'billing/edih_view.php') + 'edi' => array(xl('EDI History') , 0, 'billing/edih_view.php'), + 'dld' => array(xl('Display Documents'), 0, 'main/display_documents.php') ); $primary_docs['npa']=array(xl('Batch Payments') , 0, 'billing/new_payment.php'); if ($GLOBALS['use_charges_panel'] || $GLOBALS['concurrent_layout'] == 2) { @@ -1258,6 +1259,7 @@ if ($GLOBALS['athletic_team']) { + @@ -119,14 +120,20 @@ function expandcollapse(atr){ for(i=1;i<15;i++){ var mydivid="divid_"+i;var myspanid="spanid_"+i; var ele = document.getElementById(mydivid); var text = document.getElementById(myspanid); - ele.style.display = "block";text.innerHTML = ""; + if (typeof(ele) != 'undefined' && ele != null) + ele.style.display = "block"; + if (typeof(text) != 'undefined' && text != null) + text.innerHTML = ""; } } else { for(i=1;i<15;i++){ var mydivid="divid_"+i;var myspanid="spanid_"+i; var ele = document.getElementById(mydivid); var text = document.getElementById(myspanid); - ele.style.display = "none"; text.innerHTML = ""; + if (typeof(ele) != 'undefined' && ele != null) + ele.style.display = "none"; + if (typeof(text) != 'undefined' && text != null) + text.innerHTML = ""; } } @@ -328,7 +335,35 @@ if ( $esign->isButtonViewable() ) { -
+ + 0 ) { +?> +
+: +_tpl_vars[CURRENT_ACTION]. "&view&patient_id=".$pid."&document_id=" . $doc_iter[id] . "&"; + // Get notes for this document. + $queryString = "SELECT GROUP_CONCAT(note ORDER BY date DESC SEPARATOR '|') AS docNotes, GROUP_CONCAT(date ORDER BY date DESC SEPARATOR '|') AS docDates + FROM notes WHERE foreign_id = ? GROUP BY foreign_id"; + $noteData = sqlQuery($queryString,array($doc_iter[id])); + $note = ''; + if ( $noteData ) { + $notes = array(); + $notes = explode("|",$noteData['docNotes']); + $dates = explode("|", $noteData['docDates']); + for ( $i = 0 ; $i < count($notes) ; $i++ ) + $note .= oeFormatShortDate(date('Y-m-d', strtotime($dates[$i]))) . " : " . $notes[$i] . "\n"; + } +?> +
+ + +
+
0 ) { + foreach ( $documents as $documentrow) { + if ($auth_med) { + $irow = sqlQuery("SELECT type, title, begdate FROM lists WHERE id = ? LIMIT 1", array($documentrow['list_id']) ); + if ($irow) { + $tcode = $irow['type']; + if ($ISSUE_TYPES[$tcode]) + $tcode = $ISSUE_TYPES[$tcode][2]; + echo text("$tcode: " . $irow['title']); + } + } + else { + echo "(" . text('No access') . ")"; + } + + // Get the notes for this document and display as title for the link. + $queryString = "SELECT date,note FROM notes WHERE foreign_id = ? ORDER BY date"; + $noteResultSet = sqlStatement($queryString,array($documentrow['id'])); + $note = ''; + while ( $row = sqlFetchArray($noteResultSet)) { + $note .= oeFormatShortDate(date('Y-m-d', strtotime($row['date']))) . " : " . attr($row['note']) . "\n"; + } + $docTitle = ( $note ) ? $note : attr("View document"); + + $docHref = $GLOBALS['webroot']."/controller.php?document&view&patient_id=".$pid."&doc_id=".$documentrow['id']; + echo ""; + } + } +} + // This is called to generate a line of output for a patient document. // function showDocument(&$drow) { @@ -463,6 +500,10 @@ while ($result4 = sqlFetchArray($res4)) { // Show billing note that you can click on to edit. $feid = $result4['id'] ? htmlspecialchars( $result4['id'], ENT_QUOTES) : 0; // form_encounter id echo ""; + + //Display the documents tagged to this encounter + getDocListByEncID($result4['encounter'],$raw_encounter_date,$pid); + echo "
"; //echo "
"; echo "
"; @@ -500,6 +541,10 @@ while ($result4 = sqlFetchArray($res4)) { // show encounter reason/title echo "".$reason_string; + + //Display the documents tagged to this encounter + getDocListByEncID($result4['encounter'],$raw_encounter_date,$pid); + echo "
"; // Now show a line for each encounter form, if the user is authorized to diff --git a/library/classes/Document.class.php b/library/classes/Document.class.php index e314202ba..4f22b4e36 100644 --- a/library/classes/Document.class.php +++ b/library/classes/Document.class.php @@ -98,6 +98,10 @@ class Document extends ORDataObject{ * @var int */ var $list_id; + + // For tagging with the encounter + var $encounter_id; + var $encounter_check; /* * Whether the file is already imported @@ -128,6 +132,8 @@ class Document extends ORDataObject{ $this->docdate = date("Y-m-d"); $this->hash = ""; $this->list_id = 0; + $this->encounter_id = 0; + $this->encounter_check = ""; if ($id != "") { $this->populate(); @@ -227,7 +233,9 @@ class Document extends ORDataObject{ . "revision: " . $this->revision . "\n" . "docdate: " . $this->docdate . "\n" . "hash: " . $this->hash . "\n" - . "list_id: " . $this->list_id . "\n"; + . "list_id: " . $this->list_id . "\n" + . "encounter_id: " . $this->encounter_id . "\n" + . "encounter_check: " . $this->encounter_check . "\n"; if ($html) { return nl2br($string); @@ -349,6 +357,19 @@ class Document extends ORDataObject{ function get_list_id() { return $this->list_id; } + function set_encounter_id($encounter_id) { + $this->encounter_id = $encounter_id; + } + function get_encounter_id() { + return $this->encounter_id; + } + function set_encounter_check($encounter_check) { + $this->encounter_check = $encounter_check; + } + function get_encounter_check() { + return $this->encounter_check; + } + function get_ccr_type($doc_id){ $type = sqlQuery("SELECT c.name FROM categories AS c LEFT JOIN categories_to_documents AS ctd ON c.id = ctd.category_id WHERE ctd.document_id = ?",array($doc_id)); return $type['name']; diff --git a/library/forms.inc b/library/forms.inc index f4e15026c..a3c2bac51 100644 --- a/library/forms.inc +++ b/library/forms.inc @@ -151,4 +151,21 @@ function getFormNameByFormdir ($formdir) { return sqlQuery("select form_name from forms where formdir='$formdir'"); } + +function getDocumentsByEncounter($patientID = null,$encounterID = null) { + $allDocuments = null; + $currentEncounter = ( $encounterID ) ? $encounterID : $_SESSION['encounter']; + $currentPatient = ( $patientID ) ? $patientID : $_SESSION['pid']; + + if($currentPatient != "" && $currentEncounter != "") { + $sql = "SELECT d.id, d.type, d.url, d.docdate, d.list_id, c.name,d.encounter_id FROM documents AS d, categories_to_documents AS cd, + categories AS c WHERE d.foreign_id = ? AND d.encounter_id=? AND cd.document_id = d.id AND c.id = cd.category_id ORDER BY d.docdate DESC, d.id DESC"; + $res = sqlStatement($sql,array($currentPatient,$currentEncounter)); + + while ( $row = sqlFetchArray($res) ) { + $allDocuments[] = $row; + } + } + return $allDocuments; +} ?> diff --git a/library/js/qtip/jquery.qtip.css b/library/js/qtip/jquery.qtip.css new file mode 100644 index 000000000..380378ca0 --- /dev/null +++ b/library/js/qtip/jquery.qtip.css @@ -0,0 +1,589 @@ +/* + * qTip2 - Pretty powerful tooltips - v2.2.1 + * http://qtip2.com + * + * Copyright (c) 2014 + * Released under the MIT licenses + * http://jquery.org/license + * + * Date: Sat Sep 6 2014 09:55 EDT-0400 + * Plugins: tips viewport + * Styles: core basic css3 + */ +.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: bold; + } + + .qtip-titlebar + .qtip-content{ border-top-width: 0 !important; } + + /* Default close button class */ + .qtip-close{ + position: absolute; + right: -9px; top: -9px; + z-index: 11; /* Overlap .qtip-tip */ + + cursor: pointer; + outline: medium none; + + border: 1px solid transparent; + } + + .qtip-titlebar .qtip-close{ + right: 4px; top: 50%; + margin-top: -9px; + } + + * html .qtip-titlebar .qtip-close{ top: 16px; } /* IE fix */ + + .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: normal bold 10px/13px Tahoma,sans-serif; + + color: inherit; + background: transparent none no-repeat -100em -100em; + } + +/* Applied to 'focused' tooltips e.g. most recently displayed/interacted with */ +.qtip-focus{} + +/* Applied on hover of tooltips i.e. added/removed on mouseenter/mouseleave respectively */ +.qtip-hover{} + +/* Default tooltip style */ +.qtip-default{ + border: 1px solid #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; + } + + +/*! Light tooltip style */ +.qtip-light{ + background-color: white; + border-color: #E2E2E2; + color: #454545; +} + + .qtip-light .qtip-titlebar{ + background-color: #f1f1f1; + } + + +/*! Dark tooltip style */ +.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; + } + + +/*! Cream tooltip style */ +.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; + } + + +/*! Red tooltip style */ +.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; + } + + +/*! Green tooltip style */ +.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; + } + + +/*! Blue tooltip style */ +.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-shadow{ + -webkit-box-shadow: 1px 1px 3px 1px rgba(0, 0, 0, 0.15); + -moz-box-shadow: 1px 1px 3px 1px rgba(0, 0, 0, 0.15); + box-shadow: 1px 1px 3px 1px rgba(0, 0, 0, 0.15); +} + +/* Add rounded corners to your tooltips in: FF3+, Chrome 2+, Opera 10.6+, IE9+, Safari 2+ */ +.qtip-rounded, +.qtip-tipsy, +.qtip-bootstrap{ + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + border-radius: 5px; +} + +.qtip-rounded .qtip-titlebar{ + -moz-border-radius: 4px 4px 0 0; + -webkit-border-radius: 4px 4px 0 0; + border-radius: 4px 4px 0 0; +} + +/* Youtube tooltip style */ +.qtip-youtube{ + -moz-border-radius: 2px; + -webkit-border-radius: 2px; + border-radius: 2px; + + -webkit-box-shadow: 0 0 3px #333; + -moz-box-shadow: 0 0 3px #333; + box-shadow: 0 0 3px #333; + + color: white; + border: 0 solid transparent; + + background: #4A4A4A; + background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0,#4A4A4A),color-stop(100%,black)); + background-image: -webkit-linear-gradient(top,#4A4A4A 0,black 100%); + background-image: -moz-linear-gradient(top,#4A4A4A 0,black 100%); + background-image: -ms-linear-gradient(top,#4A4A4A 0,black 100%); + background-image: -o-linear-gradient(top,#4A4A4A 0,black 100%); +} + + .qtip-youtube .qtip-titlebar{ + background-color: #4A4A4A; + background-color: rgba(0,0,0,0); + } + + .qtip-youtube .qtip-content{ + padding: .75em; + font: 12px arial,sans-serif; + + filter: progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#4a4a4a,EndColorStr=#000000); + -ms-filter: "progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#4a4a4a,EndColorStr=#000000);"; + } + + .qtip-youtube .qtip-icon{ + border-color: #222; + } + + .qtip-youtube .qtip-titlebar .ui-state-hover{ + border-color: #303030; + } + + +/* jQuery TOOLS Tooltip style */ +.qtip-jtools{ + background: #232323; + background: rgba(0, 0, 0, 0.7); + background-image: -webkit-gradient(linear, left top, left bottom, from(#717171), to(#232323)); + background-image: -moz-linear-gradient(top, #717171, #232323); + background-image: -webkit-linear-gradient(top, #717171, #232323); + background-image: -ms-linear-gradient(top, #717171, #232323); + background-image: -o-linear-gradient(top, #717171, #232323); + + border: 2px solid #ddd; + border: 2px solid rgba(241,241,241,1); + + -moz-border-radius: 2px; + -webkit-border-radius: 2px; + border-radius: 2px; + + -webkit-box-shadow: 0 0 12px #333; + -moz-box-shadow: 0 0 12px #333; + box-shadow: 0 0 12px #333; +} + + /* IE Specific */ + .qtip-jtools .qtip-titlebar{ + background-color: transparent; + filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#717171,endColorstr=#4A4A4A); + -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#717171,endColorstr=#4A4A4A)"; + } + .qtip-jtools .qtip-content{ + filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#4A4A4A,endColorstr=#232323); + -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#4A4A4A,endColorstr=#232323)"; + } + + .qtip-jtools .qtip-titlebar, + .qtip-jtools .qtip-content{ + background: transparent; + color: white; + border: 0 dashed transparent; + } + + .qtip-jtools .qtip-icon{ + border-color: #555; + } + + .qtip-jtools .qtip-titlebar .ui-state-hover{ + border-color: #333; + } + + +/* Cluetip style */ +.qtip-cluetip{ + -webkit-box-shadow: 4px 4px 5px rgba(0, 0, 0, 0.4); + -moz-box-shadow: 4px 4px 5px rgba(0, 0, 0, 0.4); + box-shadow: 4px 4px 5px rgba(0, 0, 0, 0.4); + + background-color: #D9D9C2; + color: #111; + border: 0 dashed transparent; +} + + .qtip-cluetip .qtip-titlebar{ + background-color: #87876A; + color: white; + border: 0 dashed transparent; + } + + .qtip-cluetip .qtip-icon{ + border-color: #808064; + } + + .qtip-cluetip .qtip-titlebar .ui-state-hover{ + border-color: #696952; + color: #696952; + } + + +/* Tipsy style */ +.qtip-tipsy{ + background: black; + background: rgba(0, 0, 0, .87); + + color: white; + border: 0 solid transparent; + + font-size: 11px; + font-family: 'Lucida Grande', sans-serif; + font-weight: bold; + line-height: 16px; + text-shadow: 0 1px black; +} + + .qtip-tipsy .qtip-titlebar{ + padding: 6px 35px 0 10px; + background-color: transparent; + } + + .qtip-tipsy .qtip-content{ + padding: 6px 10px; + } + + .qtip-tipsy .qtip-icon{ + border-color: #222; + text-shadow: none; + } + + .qtip-tipsy .qtip-titlebar .ui-state-hover{ + border-color: #303030; + } + + +/* Tipped style */ +.qtip-tipped{ + border: 3px solid #959FA9; + + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; + + background-color: #F9F9F9; + color: #454545; + + font-weight: normal; + font-family: serif; +} + + .qtip-tipped .qtip-titlebar{ + border-bottom-width: 0; + + color: white; + background: #3A79B8; + background-image: -webkit-gradient(linear, left top, left bottom, from(#3A79B8), to(#2E629D)); + background-image: -webkit-linear-gradient(top, #3A79B8, #2E629D); + background-image: -moz-linear-gradient(top, #3A79B8, #2E629D); + background-image: -ms-linear-gradient(top, #3A79B8, #2E629D); + background-image: -o-linear-gradient(top, #3A79B8, #2E629D); + filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#3A79B8,endColorstr=#2E629D); + -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#3A79B8,endColorstr=#2E629D)"; + } + + .qtip-tipped .qtip-icon{ + border: 2px solid #285589; + background: #285589; + } + + .qtip-tipped .qtip-icon .ui-icon{ + background-color: #FBFBFB; + color: #555; + } + + +/** + * Twitter Bootstrap style. + * + * Tested with IE 8, IE 9, Chrome 18, Firefox 9, Opera 11. + * Does not work with IE 7. + */ +.qtip-bootstrap{ + /** Taken from Bootstrap body */ + font-size: 14px; + line-height: 20px; + color: #333333; + + /** Taken from Bootstrap .popover */ + padding: 1px; + background-color: #ffffff; + border: 1px solid #ccc; + border: 1px solid rgba(0, 0, 0, 0.2); + -webkit-border-radius: 6px; + -moz-border-radius: 6px; + border-radius: 6px; + -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); + -moz-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); + box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); + -webkit-background-clip: padding-box; + -moz-background-clip: padding; + background-clip: padding-box; +} + + .qtip-bootstrap .qtip-titlebar{ + /** Taken from Bootstrap .popover-title */ + padding: 8px 14px; + margin: 0; + font-size: 14px; + font-weight: normal; + line-height: 18px; + background-color: #f7f7f7; + border-bottom: 1px solid #ebebeb; + -webkit-border-radius: 5px 5px 0 0; + -moz-border-radius: 5px 5px 0 0; + border-radius: 5px 5px 0 0; + } + + .qtip-bootstrap .qtip-titlebar .qtip-close{ + /** + * Overrides qTip2: + * .qtip-titlebar .qtip-close{ + * [...] + * right: 4px; + * top: 50%; + * [...] + * border-style: solid; + * } + */ + right: 11px; + top: 45%; + border-style: none; + } + + .qtip-bootstrap .qtip-content{ + /** Taken from Bootstrap .popover-content */ + padding: 9px 14px; + } + + .qtip-bootstrap .qtip-icon{ + /** + * Overrides qTip2: + * .qtip-default .qtip-icon { + * border-color: #CCC; + * background: #F1F1F1; + * color: #777; + * } + */ + background: transparent; + } + + .qtip-bootstrap .qtip-icon .ui-icon{ + /** + * Overrides qTip2: + * .qtip-icon .ui-icon{ + * width: 18px; + * height: 14px; + * } + */ + width: auto; + height: auto; + + /* Taken from Bootstrap .close */ + float: right; + font-size: 20px; + font-weight: bold; + line-height: 18px; + color: #000000; + text-shadow: 0 1px 0 #ffffff; + opacity: 0.2; + filter: alpha(opacity=20); + } + + .qtip-bootstrap .qtip-icon .ui-icon:hover{ + /* Taken from Bootstrap .close:hover */ + color: #000000; + text-decoration: none; + cursor: pointer; + opacity: 0.4; + filter: alpha(opacity=40); + } + + +/* IE9 fix - removes all filters */ +.qtip:not(.ie9haxors) div.qtip-content, +.qtip:not(.ie9haxors) div.qtip-titlebar{ + filter: none; + -ms-filter: none; +} + + +.qtip .qtip-tip{ + margin: 0 auto; + overflow: hidden; + z-index: 10; + +} + + /* Opera bug #357 - Incorrect tip position + https://github.com/Craga89/qTip2/issues/367 */ + 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; + } diff --git a/library/js/qtip/jquery.qtip.js b/library/js/qtip/jquery.qtip.js new file mode 100644 index 000000000..56a2630e4 --- /dev/null +++ b/library/js/qtip/jquery.qtip.js @@ -0,0 +1,2731 @@ +/* + * qTip2 - Pretty powerful tooltips - v2.2.1 + * http://qtip2.com + * + * Copyright (c) 2014 + * Released under the MIT licenses + * http://jquery.org/license + * + * Date: Sat Sep 6 2014 09:55 EDT-0400 + * Plugins: tips viewport + * Styles: core basic css3 + */ +/*global window: false, jQuery: false, console: false, define: false */ + +/* Cache window, document, undefined */ +(function( window, document, undefined ) { + +// Uses AMD or browser globals to create a jQuery plugin. +(function( factory ) { + "use strict"; + if(typeof define === 'function' && define.amd) { + define(['jquery'], factory); + } + else if(jQuery && !jQuery.fn.qtip) { + factory(jQuery); + } +} +(function($) { + "use strict"; // Enable ECMAScript "strict" operation for this function. See more: http://ejohn.org/blog/ecmascript-5-strict-mode-json-and-more/ +;// Munge the primitives - Paul Irish tip +var TRUE = true, +FALSE = false, +NULL = null, + +// Common variables +X = 'x', Y = 'y', +WIDTH = 'width', +HEIGHT = 'height', + +// Positioning sides +TOP = 'top', +LEFT = 'left', +BOTTOM = 'bottom', +RIGHT = 'right', +CENTER = 'center', + +// Position adjustment types +FLIP = 'flip', +FLIPINVERT = 'flipinvert', +SHIFT = 'shift', + +// Shortcut vars +QTIP, PROTOTYPE, CORNER, CHECKS, +PLUGINS = {}, +NAMESPACE = 'qtip', +ATTR_HAS = 'data-hasqtip', +ATTR_ID = 'data-qtip-id', +WIDGET = ['ui-widget', 'ui-tooltip'], +SELECTOR = '.'+NAMESPACE, +INACTIVE_EVENTS = 'click dblclick mousedown mouseup mousemove mouseleave mouseenter'.split(' '), + +CLASS_FIXED = NAMESPACE+'-fixed', +CLASS_DEFAULT = NAMESPACE + '-default', +CLASS_FOCUS = NAMESPACE + '-focus', +CLASS_HOVER = NAMESPACE + '-hover', +CLASS_DISABLED = NAMESPACE+'-disabled', + +replaceSuffix = '_replacedByqTip', +oldtitle = 'oldtitle', +trackingBound, + +// Browser detection +BROWSER = { + /* + * IE version detection + * + * Adapted from: http://ajaxian.com/archives/attack-of-the-ie-conditional-comment + * Credit to James Padolsey for the original implemntation! + */ + ie: (function(){ + for ( + var v = 4, i = document.createElement("div"); + (i.innerHTML = "") && i.getElementsByTagName("i")[0]; + v+=1 + ) {} + return v > 4 ? v : NaN; + }()), + + /* + * iOS version detection + */ + iOS: parseFloat( + ('' + (/CPU.*OS ([0-9_]{1,5})|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent) || [0,''])[1]) + .replace('undefined', '3_2').replace('_', '.').replace('_', '') + ) || FALSE +}; +;function QTip(target, options, id, attr) { + // Elements and ID + this.id = id; + this.target = target; + this.tooltip = NULL; + this.elements = { target: target }; + + // Internal constructs + this._id = NAMESPACE + '-' + id; + this.timers = { img: {} }; + this.options = options; + this.plugins = {}; + + // Cache object + this.cache = { + event: {}, + target: $(), + disabled: FALSE, + attr: attr, + onTooltip: FALSE, + lastClass: '' + }; + + // Set the initial flags + this.rendered = this.destroyed = this.disabled = this.waiting = + this.hiddenDuringWait = this.positioning = this.triggering = FALSE; +} +PROTOTYPE = QTip.prototype; + +PROTOTYPE._when = function(deferreds) { + return $.when.apply($, deferreds); +}; + +PROTOTYPE.render = function(show) { + if(this.rendered || this.destroyed) { return this; } // If tooltip has already been rendered, exit + + var self = this, + options = this.options, + cache = this.cache, + elements = this.elements, + text = options.content.text, + title = options.content.title, + button = options.content.button, + posOptions = options.position, + namespace = '.'+this._id+' ', + deferreds = [], + tooltip; + + // Add ARIA attributes to target + $.attr(this.target[0], 'aria-describedby', this._id); + + // Create public position object that tracks current position corners + cache.posClass = this._createPosClass( + (this.position = { my: posOptions.my, at: posOptions.at }).my + ); + + // Create tooltip element + this.tooltip = elements.tooltip = tooltip = $('
', { + 'id': this._id, + 'class': [ NAMESPACE, CLASS_DEFAULT, options.style.classes, cache.posClass ].join(' '), + 'width': options.style.width || '', + 'height': options.style.height || '', + 'tracking': posOptions.target === 'mouse' && posOptions.adjust.mouse, + + /* ARIA specific attributes */ + 'role': 'alert', + 'aria-live': 'polite', + 'aria-atomic': FALSE, + 'aria-describedby': this._id + '-content', + 'aria-hidden': TRUE + }) + .toggleClass(CLASS_DISABLED, this.disabled) + .attr(ATTR_ID, this.id) + .data(NAMESPACE, this) + .appendTo(posOptions.container) + .append( + // Create content element + elements.content = $('
', { + 'class': NAMESPACE + '-content', + 'id': this._id + '-content', + 'aria-atomic': TRUE + }) + ); + + // Set rendered flag and prevent redundant reposition calls for now + this.rendered = -1; + this.positioning = TRUE; + + // Create title... + if(title) { + this._createTitle(); + + // Update title only if its not a callback (called in toggle if so) + if(!$.isFunction(title)) { + deferreds.push( this._updateTitle(title, FALSE) ); + } + } + + // Create button + if(button) { this._createButton(); } + + // Set proper rendered flag and update content if not a callback function (called in toggle) + if(!$.isFunction(text)) { + deferreds.push( this._updateContent(text, FALSE) ); + } + this.rendered = TRUE; + + // Setup widget classes + this._setWidget(); + + // Initialize 'render' plugins + $.each(PLUGINS, function(name) { + var instance; + if(this.initialize === 'render' && (instance = this(self))) { + self.plugins[name] = instance; + } + }); + + // Unassign initial events and assign proper events + this._unassignEvents(); + this._assignEvents(); + + // When deferreds have completed + this._when(deferreds).then(function() { + // tooltiprender event + self._trigger('render'); + + // Reset flags + self.positioning = FALSE; + + // Show tooltip if not hidden during wait period + if(!self.hiddenDuringWait && (options.show.ready || show)) { + self.toggle(TRUE, cache.event, FALSE); + } + self.hiddenDuringWait = FALSE; + }); + + // Expose API + QTIP.api[this.id] = this; + + return this; +}; + +PROTOTYPE.destroy = function(immediate) { + // Set flag the signify destroy is taking place to plugins + // and ensure it only gets destroyed once! + if(this.destroyed) { return this.target; } + + function process() { + if(this.destroyed) { return; } + this.destroyed = TRUE; + + var target = this.target, + title = target.attr(oldtitle), + timer; + + // Destroy tooltip if rendered + if(this.rendered) { + this.tooltip.stop(1,0).find('*').remove().end().remove(); + } + + // Destroy all plugins + $.each(this.plugins, function(name) { + this.destroy && this.destroy(); + }); + + // Clear timers + for(timer in this.timers) { + clearTimeout(this.timers[timer]); + } + + // Remove api object and ARIA attributes + target.removeData(NAMESPACE) + .removeAttr(ATTR_ID) + .removeAttr(ATTR_HAS) + .removeAttr('aria-describedby'); + + // Reset old title attribute if removed + if(this.options.suppress && title) { + target.attr('title', title).removeAttr(oldtitle); + } + + // Remove qTip events associated with this API + this._unassignEvents(); + + // Remove ID from used id objects, and delete object references + // for better garbage collection and leak protection + this.options = this.elements = this.cache = this.timers = + this.plugins = this.mouse = NULL; + + // Delete epoxsed API object + delete QTIP.api[this.id]; + } + + // If an immediate destory is needed + if((immediate !== TRUE || this.triggering === 'hide') && this.rendered) { + this.tooltip.one('tooltiphidden', $.proxy(process, this)); + !this.triggering && this.hide(); + } + + // If we're not in the process of hiding... process + else { process.call(this); } + + return this.target; +}; +;function invalidOpt(a) { + return a === NULL || $.type(a) !== 'object'; +} + +function invalidContent(c) { + return !( $.isFunction(c) || (c && c.attr) || c.length || ($.type(c) === 'object' && (c.jquery || c.then) )); +} + +// Option object sanitizer +function sanitizeOptions(opts) { + var content, text, ajax, once; + + if(invalidOpt(opts)) { return FALSE; } + + if(invalidOpt(opts.metadata)) { + opts.metadata = { type: opts.metadata }; + } + + if('content' in opts) { + content = opts.content; + + if(invalidOpt(content) || content.jquery || content.done) { + content = opts.content = { + text: (text = invalidContent(content) ? FALSE : content) + }; + } + else { text = content.text; } + + // DEPRECATED - Old content.ajax plugin functionality + // Converts it into the proper Deferred syntax + if('ajax' in content) { + ajax = content.ajax; + once = ajax && ajax.once !== FALSE; + delete content.ajax; + + content.text = function(event, api) { + var loading = text || $(this).attr(api.options.content.attr) || 'Loading...', + + deferred = $.ajax( + $.extend({}, ajax, { context: api }) + ) + .then(ajax.success, NULL, ajax.error) + .then(function(content) { + if(content && once) { api.set('content.text', content); } + return content; + }, + function(xhr, status, error) { + if(api.destroyed || xhr.status === 0) { return; } + api.set('content.text', status + ': ' + error); + }); + + return !once ? (api.set('content.text', loading), deferred) : loading; + }; + } + + if('title' in content) { + if($.isPlainObject(content.title)) { + content.button = content.title.button; + content.title = content.title.text; + } + + if(invalidContent(content.title || FALSE)) { + content.title = FALSE; + } + } + } + + if('position' in opts && invalidOpt(opts.position)) { + opts.position = { my: opts.position, at: opts.position }; + } + + if('show' in opts && invalidOpt(opts.show)) { + opts.show = opts.show.jquery ? { target: opts.show } : + opts.show === TRUE ? { ready: TRUE } : { event: opts.show }; + } + + if('hide' in opts && invalidOpt(opts.hide)) { + opts.hide = opts.hide.jquery ? { target: opts.hide } : { event: opts.hide }; + } + + if('style' in opts && invalidOpt(opts.style)) { + opts.style = { classes: opts.style }; + } + + // Sanitize plugin options + $.each(PLUGINS, function() { + this.sanitize && this.sanitize(opts); + }); + + return opts; +} + +// Setup builtin .set() option checks +CHECKS = PROTOTYPE.checks = { + builtin: { + // Core checks + '^id$': function(obj, o, v, prev) { + var id = v === TRUE ? QTIP.nextid : v, + new_id = NAMESPACE + '-' + id; + + if(id !== FALSE && id.length > 0 && !$('#'+new_id).length) { + this._id = new_id; + + if(this.rendered) { + this.tooltip[0].id = this._id; + this.elements.content[0].id = this._id + '-content'; + this.elements.title[0].id = this._id + '-title'; + } + } + else { obj[o] = prev; } + }, + '^prerender': function(obj, o, v) { + v && !this.rendered && this.render(this.options.show.ready); + }, + + // Content checks + '^content.text$': function(obj, o, v) { + this._updateContent(v); + }, + '^content.attr$': function(obj, o, v, prev) { + if(this.options.content.text === this.target.attr(prev)) { + this._updateContent( this.target.attr(v) ); + } + }, + '^content.title$': function(obj, o, v) { + // Remove title if content is null + if(!v) { return this._removeTitle(); } + + // If title isn't already created, create it now and update + v && !this.elements.title && this._createTitle(); + this._updateTitle(v); + }, + '^content.button$': function(obj, o, v) { + this._updateButton(v); + }, + '^content.title.(text|button)$': function(obj, o, v) { + this.set('content.'+o, v); // Backwards title.text/button compat + }, + + // Position checks + '^position.(my|at)$': function(obj, o, v){ + 'string' === typeof v && (this.position[o] = obj[o] = new CORNER(v, o === 'at')); + }, + '^position.container$': function(obj, o, v){ + this.rendered && this.tooltip.appendTo(v); + }, + + // Show checks + '^show.ready$': function(obj, o, v) { + v && (!this.rendered && this.render(TRUE) || this.toggle(TRUE)); + }, + + // Style checks + '^style.classes$': function(obj, o, v, p) { + this.rendered && this.tooltip.removeClass(p).addClass(v); + }, + '^style.(width|height)': function(obj, o, v) { + this.rendered && this.tooltip.css(o, v); + }, + '^style.widget|content.title': function() { + this.rendered && this._setWidget(); + }, + '^style.def': function(obj, o, v) { + this.rendered && this.tooltip.toggleClass(CLASS_DEFAULT, !!v); + }, + + // Events check + '^events.(render|show|move|hide|focus|blur)$': function(obj, o, v) { + this.rendered && this.tooltip[($.isFunction(v) ? '' : 'un') + 'bind']('tooltip'+o, v); + }, + + // Properties which require event reassignment + '^(show|hide|position).(event|target|fixed|inactive|leave|distance|viewport|adjust)': function() { + if(!this.rendered) { return; } + + // Set tracking flag + var posOptions = this.options.position; + this.tooltip.attr('tracking', posOptions.target === 'mouse' && posOptions.adjust.mouse); + + // Reassign events + this._unassignEvents(); + this._assignEvents(); + } + } +}; + +// Dot notation converter +function convertNotation(options, notation) { + var i = 0, obj, option = options, + + // Split notation into array + levels = notation.split('.'); + + // Loop through + while( option = option[ levels[i++] ] ) { + if(i < levels.length) { obj = option; } + } + + return [obj || options, levels.pop()]; +} + +PROTOTYPE.get = function(notation) { + if(this.destroyed) { return this; } + + var o = convertNotation(this.options, notation.toLowerCase()), + result = o[0][ o[1] ]; + + return result.precedance ? result.string() : result; +}; + +function setCallback(notation, args) { + var category, rule, match; + + for(category in this.checks) { + for(rule in this.checks[category]) { + if(match = (new RegExp(rule, 'i')).exec(notation)) { + args.push(match); + + if(category === 'builtin' || this.plugins[category]) { + this.checks[category][rule].apply( + this.plugins[category] || this, args + ); + } + } + } + } +} + +var rmove = /^position\.(my|at|adjust|target|container|viewport)|style|content|show\.ready/i, + rrender = /^prerender|show\.ready/i; + +PROTOTYPE.set = function(option, value) { + if(this.destroyed) { return this; } + + var rendered = this.rendered, + reposition = FALSE, + options = this.options, + checks = this.checks, + name; + + // Convert singular option/value pair into object form + if('string' === typeof option) { + name = option; option = {}; option[name] = value; + } + else { option = $.extend({}, option); } + + // Set all of the defined options to their new values + $.each(option, function(notation, value) { + if(rendered && rrender.test(notation)) { + delete option[notation]; return; + } + + // Set new obj value + var obj = convertNotation(options, notation.toLowerCase()), previous; + previous = obj[0][ obj[1] ]; + obj[0][ obj[1] ] = value && value.nodeType ? $(value) : value; + + // Also check if we need to reposition + reposition = rmove.test(notation) || reposition; + + // Set the new params for the callback + option[notation] = [obj[0], obj[1], value, previous]; + }); + + // Re-sanitize options + sanitizeOptions(options); + + /* + * Execute any valid callbacks for the set options + * Also set positioning flag so we don't get loads of redundant repositioning calls. + */ + this.positioning = TRUE; + $.each(option, $.proxy(setCallback, this)); + this.positioning = FALSE; + + // Update position if needed + if(this.rendered && this.tooltip[0].offsetWidth > 0 && reposition) { + this.reposition( options.position.target === 'mouse' ? NULL : this.cache.event ); + } + + return this; +}; +;PROTOTYPE._update = function(content, element, reposition) { + var self = this, + cache = this.cache; + + // Make sure tooltip is rendered and content is defined. If not return + if(!this.rendered || !content) { return FALSE; } + + // Use function to parse content + if($.isFunction(content)) { + content = content.call(this.elements.target, cache.event, this) || ''; + } + + // Handle deferred content + if($.isFunction(content.then)) { + cache.waiting = TRUE; + return content.then(function(c) { + cache.waiting = FALSE; + return self._update(c, element); + }, NULL, function(e) { + return self._update(e, element); + }); + } + + // If content is null... return false + if(content === FALSE || (!content && content !== '')) { return FALSE; } + + // Append new content if its a DOM array and show it if hidden + if(content.jquery && content.length > 0) { + element.empty().append( + content.css({ display: 'block', visibility: 'visible' }) + ); + } + + // Content is a regular string, insert the new content + else { element.html(content); } + + // Wait for content to be loaded, and reposition + return this._waitForContent(element).then(function(images) { + if(self.rendered && self.tooltip[0].offsetWidth > 0) { + self.reposition(cache.event, !images.length); + } + }); +}; + +PROTOTYPE._waitForContent = function(element) { + var cache = this.cache; + + // Set flag + cache.waiting = TRUE; + + // If imagesLoaded is included, ensure images have loaded and return promise + return ( $.fn.imagesLoaded ? element.imagesLoaded() : $.Deferred().resolve([]) ) + .done(function() { cache.waiting = FALSE; }) + .promise(); +}; + +PROTOTYPE._updateContent = function(content, reposition) { + this._update(content, this.elements.content, reposition); +}; + +PROTOTYPE._updateTitle = function(content, reposition) { + if(this._update(content, this.elements.title, reposition) === FALSE) { + this._removeTitle(FALSE); + } +}; + +PROTOTYPE._createTitle = function() +{ + var elements = this.elements, + id = this._id+'-title'; + + // Destroy previous title element, if present + if(elements.titlebar) { this._removeTitle(); } + + // Create title bar and title elements + elements.titlebar = $('
', { + 'class': NAMESPACE + '-titlebar ' + (this.options.style.widget ? createWidgetClass('header') : '') + }) + .append( + elements.title = $('
', { + 'id': id, + 'class': NAMESPACE + '-title', + 'aria-atomic': TRUE + }) + ) + .insertBefore(elements.content) + + // Button-specific events + .delegate('.qtip-close', 'mousedown keydown mouseup keyup mouseout', function(event) { + $(this).toggleClass('ui-state-active ui-state-focus', event.type.substr(-4) === 'down'); + }) + .delegate('.qtip-close', 'mouseover mouseout', function(event){ + $(this).toggleClass('ui-state-hover', event.type === 'mouseover'); + }); + + // Create button if enabled + if(this.options.content.button) { this._createButton(); } +}; + +PROTOTYPE._removeTitle = function(reposition) +{ + var elements = this.elements; + + if(elements.title) { + elements.titlebar.remove(); + elements.titlebar = elements.title = elements.button = NULL; + + // Reposition if enabled + if(reposition !== FALSE) { this.reposition(); } + } +}; +;PROTOTYPE._createPosClass = function(my) { + return NAMESPACE + '-pos-' + (my || this.options.position.my).abbrev(); +}; + +PROTOTYPE.reposition = function(event, effect) { + if(!this.rendered || this.positioning || this.destroyed) { return this; } + + // Set positioning flag + this.positioning = TRUE; + + var cache = this.cache, + tooltip = this.tooltip, + posOptions = this.options.position, + target = posOptions.target, + my = posOptions.my, + at = posOptions.at, + viewport = posOptions.viewport, + container = posOptions.container, + adjust = posOptions.adjust, + method = adjust.method.split(' '), + tooltipWidth = tooltip.outerWidth(FALSE), + tooltipHeight = tooltip.outerHeight(FALSE), + targetWidth = 0, + targetHeight = 0, + type = tooltip.css('position'), + position = { left: 0, top: 0 }, + visible = tooltip[0].offsetWidth > 0, + isScroll = event && event.type === 'scroll', + win = $(window), + doc = container[0].ownerDocument, + mouse = this.mouse, + pluginCalculations, offset, adjusted, newClass; + + // Check if absolute position was passed + if($.isArray(target) && target.length === 2) { + // Force left top and set position + at = { x: LEFT, y: TOP }; + position = { left: target[0], top: target[1] }; + } + + // Check if mouse was the target + else if(target === 'mouse') { + // Force left top to allow flipping + at = { x: LEFT, y: TOP }; + + // Use the mouse origin that caused the show event, if distance hiding is enabled + if((!adjust.mouse || this.options.hide.distance) && cache.origin && cache.origin.pageX) { + event = cache.origin; + } + + // Use cached event for resize/scroll events + else if(!event || (event && (event.type === 'resize' || event.type === 'scroll'))) { + event = cache.event; + } + + // Otherwise, use the cached mouse coordinates if available + else if(mouse && mouse.pageX) { + event = mouse; + } + + // Calculate body and container offset and take them into account below + if(type !== 'static') { position = container.offset(); } + if(doc.body.offsetWidth !== (window.innerWidth || doc.documentElement.clientWidth)) { + offset = $(document.body).offset(); + } + + // Use event coordinates for position + position = { + left: event.pageX - position.left + (offset && offset.left || 0), + top: event.pageY - position.top + (offset && offset.top || 0) + }; + + // Scroll events are a pain, some browsers + if(adjust.mouse && isScroll && mouse) { + position.left -= (mouse.scrollX || 0) - win.scrollLeft(); + position.top -= (mouse.scrollY || 0) - win.scrollTop(); + } + } + + // Target wasn't mouse or absolute... + else { + // Check if event targetting is being used + if(target === 'event') { + if(event && event.target && event.type !== 'scroll' && event.type !== 'resize') { + cache.target = $(event.target); + } + else if(!event.target) { + cache.target = this.elements.target; + } + } + else if(target !== 'event'){ + cache.target = $(target.jquery ? target : this.elements.target); + } + target = cache.target; + + // Parse the target into a jQuery object and make sure there's an element present + target = $(target).eq(0); + if(target.length === 0) { return this; } + + // Check if window or document is the target + else if(target[0] === document || target[0] === window) { + targetWidth = BROWSER.iOS ? window.innerWidth : target.width(); + targetHeight = BROWSER.iOS ? window.innerHeight : target.height(); + + if(target[0] === window) { + position = { + top: (viewport || target).scrollTop(), + left: (viewport || target).scrollLeft() + }; + } + } + + // Check if the target is an element + else if(PLUGINS.imagemap && target.is('area')) { + pluginCalculations = PLUGINS.imagemap(this, target, at, PLUGINS.viewport ? method : FALSE); + } + + // Check if the target is an SVG element + else if(PLUGINS.svg && target && target[0].ownerSVGElement) { + pluginCalculations = PLUGINS.svg(this, target, at, PLUGINS.viewport ? method : FALSE); + } + + // Otherwise use regular jQuery methods + else { + targetWidth = target.outerWidth(FALSE); + targetHeight = target.outerHeight(FALSE); + position = target.offset(); + } + + // Parse returned plugin values into proper variables + if(pluginCalculations) { + targetWidth = pluginCalculations.width; + targetHeight = pluginCalculations.height; + offset = pluginCalculations.offset; + position = pluginCalculations.position; + } + + // Adjust position to take into account offset parents + position = this.reposition.offset(target, position, container); + + // Adjust for position.fixed tooltips (and also iOS scroll bug in v3.2-4.0 & v4.3-4.3.2) + if((BROWSER.iOS > 3.1 && BROWSER.iOS < 4.1) || + (BROWSER.iOS >= 4.3 && BROWSER.iOS < 4.33) || + (!BROWSER.iOS && type === 'fixed') + ){ + position.left -= win.scrollLeft(); + position.top -= win.scrollTop(); + } + + // Adjust position relative to target + if(!pluginCalculations || (pluginCalculations && pluginCalculations.adjustable !== FALSE)) { + position.left += at.x === RIGHT ? targetWidth : at.x === CENTER ? targetWidth / 2 : 0; + position.top += at.y === BOTTOM ? targetHeight : at.y === CENTER ? targetHeight / 2 : 0; + } + } + + // Adjust position relative to tooltip + position.left += adjust.x + (my.x === RIGHT ? -tooltipWidth : my.x === CENTER ? -tooltipWidth / 2 : 0); + position.top += adjust.y + (my.y === BOTTOM ? -tooltipHeight : my.y === CENTER ? -tooltipHeight / 2 : 0); + + // Use viewport adjustment plugin if enabled + if(PLUGINS.viewport) { + adjusted = position.adjusted = PLUGINS.viewport( + this, position, posOptions, targetWidth, targetHeight, tooltipWidth, tooltipHeight + ); + + // Apply offsets supplied by positioning plugin (if used) + if(offset && adjusted.left) { position.left += offset.left; } + if(offset && adjusted.top) { position.top += offset.top; } + + // Apply any new 'my' position + if(adjusted.my) { this.position.my = adjusted.my; } + } + + // Viewport adjustment is disabled, set values to zero + else { position.adjusted = { left: 0, top: 0 }; } + + // Set tooltip position class if it's changed + if(cache.posClass !== (newClass = this._createPosClass(this.position.my))) { + tooltip.removeClass(cache.posClass).addClass( (cache.posClass = newClass) ); + } + + // tooltipmove event + if(!this._trigger('move', [position, viewport.elem || viewport], event)) { return this; } + delete position.adjusted; + + // If effect is disabled, target it mouse, no animation is defined or positioning gives NaN out, set CSS directly + if(effect === FALSE || !visible || isNaN(position.left) || isNaN(position.top) || target === 'mouse' || !$.isFunction(posOptions.effect)) { + tooltip.css(position); + } + + // Use custom function if provided + else if($.isFunction(posOptions.effect)) { + posOptions.effect.call(tooltip, this, $.extend({}, position)); + tooltip.queue(function(next) { + // Reset attributes to avoid cross-browser rendering bugs + $(this).css({ opacity: '', height: '' }); + if(BROWSER.ie) { this.style.removeAttribute('filter'); } + + next(); + }); + } + + // Set positioning flag + this.positioning = FALSE; + + return this; +}; + +// Custom (more correct for qTip!) offset calculator +PROTOTYPE.reposition.offset = function(elem, pos, container) { + if(!container[0]) { return pos; } + + var ownerDocument = $(elem[0].ownerDocument), + quirks = !!BROWSER.ie && document.compatMode !== 'CSS1Compat', + parent = container[0], + scrolled, position, parentOffset, overflow; + + function scroll(e, i) { + pos.left += i * e.scrollLeft(); + pos.top += i * e.scrollTop(); + } + + // Compensate for non-static containers offset + do { + if((position = $.css(parent, 'position')) !== 'static') { + if(position === 'fixed') { + parentOffset = parent.getBoundingClientRect(); + scroll(ownerDocument, -1); + } + else { + parentOffset = $(parent).position(); + parentOffset.left += (parseFloat($.css(parent, 'borderLeftWidth')) || 0); + parentOffset.top += (parseFloat($.css(parent, 'borderTopWidth')) || 0); + } + + pos.left -= parentOffset.left + (parseFloat($.css(parent, 'marginLeft')) || 0); + pos.top -= parentOffset.top + (parseFloat($.css(parent, 'marginTop')) || 0); + + // If this is the first parent element with an overflow of "scroll" or "auto", store it + if(!scrolled && (overflow = $.css(parent, 'overflow')) !== 'hidden' && overflow !== 'visible') { scrolled = $(parent); } + } + } + while((parent = parent.offsetParent)); + + // Compensate for containers scroll if it also has an offsetParent (or in IE quirks mode) + if(scrolled && (scrolled[0] !== ownerDocument[0] || quirks)) { + scroll(scrolled, 1); + } + + return pos; +}; + +// Corner class +var C = (CORNER = PROTOTYPE.reposition.Corner = function(corner, forceY) { + corner = ('' + corner).replace(/([A-Z])/, ' $1').replace(/middle/gi, CENTER).toLowerCase(); + this.x = (corner.match(/left|right/i) || corner.match(/center/) || ['inherit'])[0].toLowerCase(); + this.y = (corner.match(/top|bottom|center/i) || ['inherit'])[0].toLowerCase(); + this.forceY = !!forceY; + + var f = corner.charAt(0); + this.precedance = (f === 't' || f === 'b' ? Y : X); +}).prototype; + +C.invert = function(z, center) { + this[z] = this[z] === LEFT ? RIGHT : this[z] === RIGHT ? LEFT : center || this[z]; +}; + +C.string = function(join) { + var x = this.x, y = this.y; + + var result = x !== y ? + (x === 'center' || y !== 'center' && (this.precedance === Y || this.forceY) ? + [y,x] : [x,y] + ) : + [x]; + + return join !== false ? result.join(' ') : result; +}; + +C.abbrev = function() { + var result = this.string(false); + return result[0].charAt(0) + (result[1] && result[1].charAt(0) || ''); +}; + +C.clone = function() { + return new CORNER( this.string(), this.forceY ); +}; + +; +PROTOTYPE.toggle = function(state, event) { + var cache = this.cache, + options = this.options, + tooltip = this.tooltip; + + // Try to prevent flickering when tooltip overlaps show element + if(event) { + if((/over|enter/).test(event.type) && cache.event && (/out|leave/).test(cache.event.type) && + options.show.target.add(event.target).length === options.show.target.length && + tooltip.has(event.relatedTarget).length) { + return this; + } + + // Cache event + cache.event = $.event.fix(event); + } + + // If we're currently waiting and we've just hidden... stop it + this.waiting && !state && (this.hiddenDuringWait = TRUE); + + // Render the tooltip if showing and it isn't already + if(!this.rendered) { return state ? this.render(1) : this; } + else if(this.destroyed || this.disabled) { return this; } + + var type = state ? 'show' : 'hide', + opts = this.options[type], + otherOpts = this.options[ !state ? 'show' : 'hide' ], + posOptions = this.options.position, + contentOptions = this.options.content, + width = this.tooltip.css('width'), + visible = this.tooltip.is(':visible'), + animate = state || opts.target.length === 1, + sameTarget = !event || opts.target.length < 2 || cache.target[0] === event.target, + identicalState, allow, showEvent, delay, after; + + // Detect state if valid one isn't provided + if((typeof state).search('boolean|number')) { state = !visible; } + + // Check if the tooltip is in an identical state to the new would-be state + identicalState = !tooltip.is(':animated') && visible === state && sameTarget; + + // Fire tooltip(show/hide) event and check if destroyed + allow = !identicalState ? !!this._trigger(type, [90]) : NULL; + + // Check to make sure the tooltip wasn't destroyed in the callback + if(this.destroyed) { return this; } + + // If the user didn't stop the method prematurely and we're showing the tooltip, focus it + if(allow !== FALSE && state) { this.focus(event); } + + // If the state hasn't changed or the user stopped it, return early + if(!allow || identicalState) { return this; } + + // Set ARIA hidden attribute + $.attr(tooltip[0], 'aria-hidden', !!!state); + + // Execute state specific properties + if(state) { + // Store show origin coordinates + this.mouse && (cache.origin = $.event.fix(this.mouse)); + + // Update tooltip content & title if it's a dynamic function + if($.isFunction(contentOptions.text)) { this._updateContent(contentOptions.text, FALSE); } + if($.isFunction(contentOptions.title)) { this._updateTitle(contentOptions.title, FALSE); } + + // Cache mousemove events for positioning purposes (if not already tracking) + if(!trackingBound && posOptions.target === 'mouse' && posOptions.adjust.mouse) { + $(document).bind('mousemove.'+NAMESPACE, this._storeMouse); + trackingBound = TRUE; + } + + // Update the tooltip position (set width first to prevent viewport/max-width issues) + if(!width) { tooltip.css('width', tooltip.outerWidth(FALSE)); } + this.reposition(event, arguments[2]); + if(!width) { tooltip.css('width', ''); } + + // Hide other tooltips if tooltip is solo + if(!!opts.solo) { + (typeof opts.solo === 'string' ? $(opts.solo) : $(SELECTOR, opts.solo)) + .not(tooltip).not(opts.target).qtip('hide', $.Event('tooltipsolo')); + } + } + else { + // Clear show timer if we're hiding + clearTimeout(this.timers.show); + + // Remove cached origin on hide + delete cache.origin; + + // Remove mouse tracking event if not needed (all tracking qTips are hidden) + if(trackingBound && !$(SELECTOR+'[tracking="true"]:visible', opts.solo).not(tooltip).length) { + $(document).unbind('mousemove.'+NAMESPACE); + trackingBound = FALSE; + } + + // Blur the tooltip + this.blur(event); + } + + // Define post-animation, state specific properties + after = $.proxy(function() { + if(state) { + // Prevent antialias from disappearing in IE by removing filter + if(BROWSER.ie) { tooltip[0].style.removeAttribute('filter'); } + + // Remove overflow setting to prevent tip bugs + tooltip.css('overflow', ''); + + // Autofocus elements if enabled + if('string' === typeof opts.autofocus) { + $(this.options.show.autofocus, tooltip).focus(); + } + + // If set, hide tooltip when inactive for delay period + this.options.show.target.trigger('qtip-'+this.id+'-inactive'); + } + else { + // Reset CSS states + tooltip.css({ + display: '', + visibility: '', + opacity: '', + left: '', + top: '' + }); + } + + // tooltipvisible/tooltiphidden events + this._trigger(state ? 'visible' : 'hidden'); + }, this); + + // If no effect type is supplied, use a simple toggle + if(opts.effect === FALSE || animate === FALSE) { + tooltip[ type ](); + after(); + } + + // Use custom function if provided + else if($.isFunction(opts.effect)) { + tooltip.stop(1, 1); + opts.effect.call(tooltip, this); + tooltip.queue('fx', function(n) { + after(); n(); + }); + } + + // Use basic fade function by default + else { tooltip.fadeTo(90, state ? 1 : 0, after); } + + // If inactive hide method is set, active it + if(state) { opts.target.trigger('qtip-'+this.id+'-inactive'); } + + return this; +}; + +PROTOTYPE.show = function(event) { return this.toggle(TRUE, event); }; + +PROTOTYPE.hide = function(event) { return this.toggle(FALSE, event); }; +;PROTOTYPE.focus = function(event) { + if(!this.rendered || this.destroyed) { return this; } + + var qtips = $(SELECTOR), + tooltip = this.tooltip, + curIndex = parseInt(tooltip[0].style.zIndex, 10), + newIndex = QTIP.zindex + qtips.length, + focusedElem; + + // Only update the z-index if it has changed and tooltip is not already focused + if(!tooltip.hasClass(CLASS_FOCUS)) { + // tooltipfocus event + if(this._trigger('focus', [newIndex], event)) { + // Only update z-index's if they've changed + if(curIndex !== newIndex) { + // Reduce our z-index's and keep them properly ordered + qtips.each(function() { + if(this.style.zIndex > curIndex) { + this.style.zIndex = this.style.zIndex - 1; + } + }); + + // Fire blur event for focused tooltip + qtips.filter('.' + CLASS_FOCUS).qtip('blur', event); + } + + // Set the new z-index + tooltip.addClass(CLASS_FOCUS)[0].style.zIndex = newIndex; + } + } + + return this; +}; + +PROTOTYPE.blur = function(event) { + if(!this.rendered || this.destroyed) { return this; } + + // Set focused status to FALSE + this.tooltip.removeClass(CLASS_FOCUS); + + // tooltipblur event + this._trigger('blur', [ this.tooltip.css('zIndex') ], event); + + return this; +}; +;PROTOTYPE.disable = function(state) { + if(this.destroyed) { return this; } + + // If 'toggle' is passed, toggle the current state + if(state === 'toggle') { + state = !(this.rendered ? this.tooltip.hasClass(CLASS_DISABLED) : this.disabled); + } + + // Disable if no state passed + else if('boolean' !== typeof state) { + state = TRUE; + } + + if(this.rendered) { + this.tooltip.toggleClass(CLASS_DISABLED, state) + .attr('aria-disabled', state); + } + + this.disabled = !!state; + + return this; +}; + +PROTOTYPE.enable = function() { return this.disable(FALSE); }; +;PROTOTYPE._createButton = function() +{ + var self = this, + elements = this.elements, + tooltip = elements.tooltip, + button = this.options.content.button, + isString = typeof button === 'string', + close = isString ? button : 'Close tooltip'; + + if(elements.button) { elements.button.remove(); } + + // Use custom button if one was supplied by user, else use default + if(button.jquery) { + elements.button = button; + } + else { + elements.button = $('', { + 'class': 'qtip-close ' + (this.options.style.widget ? '' : NAMESPACE+'-icon'), + 'title': close, + 'aria-label': close + }) + .prepend( + $('', { + 'class': 'ui-icon ui-icon-close', + 'html': '×' + }) + ); + } + + // Create button and setup attributes + elements.button.appendTo(elements.titlebar || tooltip) + .attr('role', 'button') + .click(function(event) { + if(!tooltip.hasClass(CLASS_DISABLED)) { self.hide(event); } + return FALSE; + }); +}; + +PROTOTYPE._updateButton = function(button) +{ + // Make sure tooltip is rendered and if not, return + if(!this.rendered) { return FALSE; } + + var elem = this.elements.button; + if(button) { this._createButton(); } + else { elem.remove(); } +}; +;// Widget class creator +function createWidgetClass(cls) { + return WIDGET.concat('').join(cls ? '-'+cls+' ' : ' '); +} + +// Widget class setter method +PROTOTYPE._setWidget = function() +{ + var on = this.options.style.widget, + elements = this.elements, + tooltip = elements.tooltip, + disabled = tooltip.hasClass(CLASS_DISABLED); + + tooltip.removeClass(CLASS_DISABLED); + CLASS_DISABLED = on ? 'ui-state-disabled' : 'qtip-disabled'; + tooltip.toggleClass(CLASS_DISABLED, disabled); + + tooltip.toggleClass('ui-helper-reset '+createWidgetClass(), on).toggleClass(CLASS_DEFAULT, this.options.style.def && !on); + + if(elements.content) { + elements.content.toggleClass( createWidgetClass('content'), on); + } + if(elements.titlebar) { + elements.titlebar.toggleClass( createWidgetClass('header'), on); + } + if(elements.button) { + elements.button.toggleClass(NAMESPACE+'-icon', !on); + } +}; +;function delay(callback, duration) { + // If tooltip has displayed, start hide timer + if(duration > 0) { + return setTimeout( + $.proxy(callback, this), duration + ); + } + else{ callback.call(this); } +} + +function showMethod(event) { + if(this.tooltip.hasClass(CLASS_DISABLED)) { return; } + + // Clear hide timers + clearTimeout(this.timers.show); + clearTimeout(this.timers.hide); + + // Start show timer + this.timers.show = delay.call(this, + function() { this.toggle(TRUE, event); }, + this.options.show.delay + ); +} + +function hideMethod(event) { + if(this.tooltip.hasClass(CLASS_DISABLED) || this.destroyed) { return; } + + // Check if new target was actually the tooltip element + var relatedTarget = $(event.relatedTarget), + ontoTooltip = relatedTarget.closest(SELECTOR)[0] === this.tooltip[0], + ontoTarget = relatedTarget[0] === this.options.show.target[0]; + + // Clear timers and stop animation queue + clearTimeout(this.timers.show); + clearTimeout(this.timers.hide); + + // Prevent hiding if tooltip is fixed and event target is the tooltip. + // Or if mouse positioning is enabled and cursor momentarily overlaps + if(this !== relatedTarget[0] && + (this.options.position.target === 'mouse' && ontoTooltip) || + (this.options.hide.fixed && ( + (/mouse(out|leave|move)/).test(event.type) && (ontoTooltip || ontoTarget)) + )) + { + try { + event.preventDefault(); + event.stopImmediatePropagation(); + } catch(e) {} + + return; + } + + // If tooltip has displayed, start hide timer + this.timers.hide = delay.call(this, + function() { this.toggle(FALSE, event); }, + this.options.hide.delay, + this + ); +} + +function inactiveMethod(event) { + if(this.tooltip.hasClass(CLASS_DISABLED) || !this.options.hide.inactive) { return; } + + // Clear timer + clearTimeout(this.timers.inactive); + + this.timers.inactive = delay.call(this, + function(){ this.hide(event); }, + this.options.hide.inactive + ); +} + +function repositionMethod(event) { + if(this.rendered && this.tooltip[0].offsetWidth > 0) { this.reposition(event); } +} + +// Store mouse coordinates +PROTOTYPE._storeMouse = function(event) { + (this.mouse = $.event.fix(event)).type = 'mousemove'; + return this; +}; + +// Bind events +PROTOTYPE._bind = function(targets, events, method, suffix, context) { + if(!targets || !method || !events.length) { return; } + var ns = '.' + this._id + (suffix ? '-'+suffix : ''); + $(targets).bind( + (events.split ? events : events.join(ns + ' ')) + ns, + $.proxy(method, context || this) + ); + return this; +}; +PROTOTYPE._unbind = function(targets, suffix) { + targets && $(targets).unbind('.' + this._id + (suffix ? '-'+suffix : '')); + return this; +}; + +// Global delegation helper +function delegate(selector, events, method) { + $(document.body).delegate(selector, + (events.split ? events : events.join('.'+NAMESPACE + ' ')) + '.'+NAMESPACE, + function() { + var api = QTIP.api[ $.attr(this, ATTR_ID) ]; + api && !api.disabled && method.apply(api, arguments); + } + ); +} +// Event trigger +PROTOTYPE._trigger = function(type, args, event) { + var callback = $.Event('tooltip'+type); + callback.originalEvent = (event && $.extend({}, event)) || this.cache.event || NULL; + + this.triggering = type; + this.tooltip.trigger(callback, [this].concat(args || [])); + this.triggering = FALSE; + + return !callback.isDefaultPrevented(); +}; + +PROTOTYPE._bindEvents = function(showEvents, hideEvents, showTargets, hideTargets, showMethod, hideMethod) { + // Get tasrgets that lye within both + var similarTargets = showTargets.filter( hideTargets ).add( hideTargets.filter(showTargets) ), + toggleEvents = []; + + // If hide and show targets are the same... + if(similarTargets.length) { + + // Filter identical show/hide events + $.each(hideEvents, function(i, type) { + var showIndex = $.inArray(type, showEvents); + + // Both events are identical, remove from both hide and show events + // and append to toggleEvents + showIndex > -1 && toggleEvents.push( showEvents.splice( showIndex, 1 )[0] ); + }); + + // Toggle events are special case of identical show/hide events, which happen in sequence + if(toggleEvents.length) { + // Bind toggle events to the similar targets + this._bind(similarTargets, toggleEvents, function(event) { + var state = this.rendered ? this.tooltip[0].offsetWidth > 0 : false; + (state ? hideMethod : showMethod).call(this, event); + }); + + // Remove the similar targets from the regular show/hide bindings + showTargets = showTargets.not(similarTargets); + hideTargets = hideTargets.not(similarTargets); + } + } + + // Apply show/hide/toggle events + this._bind(showTargets, showEvents, showMethod); + this._bind(hideTargets, hideEvents, hideMethod); +}; + +PROTOTYPE._assignInitialEvents = function(event) { + var options = this.options, + showTarget = options.show.target, + hideTarget = options.hide.target, + showEvents = options.show.event ? $.trim('' + options.show.event).split(' ') : [], + hideEvents = options.hide.event ? $.trim('' + options.hide.event).split(' ') : []; + + // Catch remove/removeqtip events on target element to destroy redundant tooltips + this._bind(this.elements.target, ['remove', 'removeqtip'], function(event) { + this.destroy(true); + }, 'destroy'); + + /* + * Make sure hoverIntent functions properly by using mouseleave as a hide event if + * mouseenter/mouseout is used for show.event, even if it isn't in the users options. + */ + if(/mouse(over|enter)/i.test(options.show.event) && !/mouse(out|leave)/i.test(options.hide.event)) { + hideEvents.push('mouseleave'); + } + + /* + * Also make sure initial mouse targetting works correctly by caching mousemove coords + * on show targets before the tooltip has rendered. Also set onTarget when triggered to + * keep mouse tracking working. + */ + this._bind(showTarget, 'mousemove', function(event) { + this._storeMouse(event); + this.cache.onTarget = TRUE; + }); + + // Define hoverIntent function + function hoverIntent(event) { + // Only continue if tooltip isn't disabled + if(this.disabled || this.destroyed) { return FALSE; } + + // Cache the event data + this.cache.event = event && $.event.fix(event); + this.cache.target = event && $(event.target); + + // Start the event sequence + clearTimeout(this.timers.show); + this.timers.show = delay.call(this, + function() { this.render(typeof event === 'object' || options.show.ready); }, + options.prerender ? 0 : options.show.delay + ); + } + + // Filter and bind events + this._bindEvents(showEvents, hideEvents, showTarget, hideTarget, hoverIntent, function() { + if(!this.timers) { return FALSE; } + clearTimeout(this.timers.show); + }); + + // Prerendering is enabled, create tooltip now + if(options.show.ready || options.prerender) { hoverIntent.call(this, event); } +}; + +// Event assignment method +PROTOTYPE._assignEvents = function() { + var self = this, + options = this.options, + posOptions = options.position, + + tooltip = this.tooltip, + showTarget = options.show.target, + hideTarget = options.hide.target, + containerTarget = posOptions.container, + viewportTarget = posOptions.viewport, + documentTarget = $(document), + bodyTarget = $(document.body), + windowTarget = $(window), + + showEvents = options.show.event ? $.trim('' + options.show.event).split(' ') : [], + hideEvents = options.hide.event ? $.trim('' + options.hide.event).split(' ') : []; + + + // Assign passed event callbacks + $.each(options.events, function(name, callback) { + self._bind(tooltip, name === 'toggle' ? ['tooltipshow','tooltiphide'] : ['tooltip'+name], callback, null, tooltip); + }); + + // Hide tooltips when leaving current window/frame (but not select/option elements) + if(/mouse(out|leave)/i.test(options.hide.event) && options.hide.leave === 'window') { + this._bind(documentTarget, ['mouseout', 'blur'], function(event) { + if(!/select|option/.test(event.target.nodeName) && !event.relatedTarget) { + this.hide(event); + } + }); + } + + // Enable hide.fixed by adding appropriate class + if(options.hide.fixed) { + hideTarget = hideTarget.add( tooltip.addClass(CLASS_FIXED) ); + } + + /* + * Make sure hoverIntent functions properly by using mouseleave to clear show timer if + * mouseenter/mouseout is used for show.event, even if it isn't in the users options. + */ + else if(/mouse(over|enter)/i.test(options.show.event)) { + this._bind(hideTarget, 'mouseleave', function() { + clearTimeout(this.timers.show); + }); + } + + // Hide tooltip on document mousedown if unfocus events are enabled + if(('' + options.hide.event).indexOf('unfocus') > -1) { + this._bind(containerTarget.closest('html'), ['mousedown', 'touchstart'], function(event) { + var elem = $(event.target), + enabled = this.rendered && !this.tooltip.hasClass(CLASS_DISABLED) && this.tooltip[0].offsetWidth > 0, + isAncestor = elem.parents(SELECTOR).filter(this.tooltip[0]).length > 0; + + if(elem[0] !== this.target[0] && elem[0] !== this.tooltip[0] && !isAncestor && + !this.target.has(elem[0]).length && enabled + ) { + this.hide(event); + } + }); + } + + // Check if the tooltip hides when inactive + if('number' === typeof options.hide.inactive) { + // Bind inactive method to show target(s) as a custom event + this._bind(showTarget, 'qtip-'+this.id+'-inactive', inactiveMethod, 'inactive'); + + // Define events which reset the 'inactive' event handler + this._bind(hideTarget.add(tooltip), QTIP.inactiveEvents, inactiveMethod); + } + + // Filter and bind events + this._bindEvents(showEvents, hideEvents, showTarget, hideTarget, showMethod, hideMethod); + + // Mouse movement bindings + this._bind(showTarget.add(tooltip), 'mousemove', function(event) { + // Check if the tooltip hides when mouse is moved a certain distance + if('number' === typeof options.hide.distance) { + var origin = this.cache.origin || {}, + limit = this.options.hide.distance, + abs = Math.abs; + + // Check if the movement has gone beyond the limit, and hide it if so + if(abs(event.pageX - origin.pageX) >= limit || abs(event.pageY - origin.pageY) >= limit) { + this.hide(event); + } + } + + // Cache mousemove coords on show targets + this._storeMouse(event); + }); + + // Mouse positioning events + if(posOptions.target === 'mouse') { + // If mouse adjustment is on... + if(posOptions.adjust.mouse) { + // Apply a mouseleave event so we don't get problems with overlapping + if(options.hide.event) { + // Track if we're on the target or not + this._bind(showTarget, ['mouseenter', 'mouseleave'], function(event) { + if(!this.cache) {return FALSE; } + this.cache.onTarget = event.type === 'mouseenter'; + }); + } + + // Update tooltip position on mousemove + this._bind(documentTarget, 'mousemove', function(event) { + // Update the tooltip position only if the tooltip is visible and adjustment is enabled + if(this.rendered && this.cache.onTarget && !this.tooltip.hasClass(CLASS_DISABLED) && this.tooltip[0].offsetWidth > 0) { + this.reposition(event); + } + }); + } + } + + // Adjust positions of the tooltip on window resize if enabled + if(posOptions.adjust.resize || viewportTarget.length) { + this._bind( $.event.special.resize ? viewportTarget : windowTarget, 'resize', repositionMethod ); + } + + // Adjust tooltip position on scroll of the window or viewport element if present + if(posOptions.adjust.scroll) { + this._bind( windowTarget.add(posOptions.container), 'scroll', repositionMethod ); + } +}; + +// Un-assignment method +PROTOTYPE._unassignEvents = function() { + var options = this.options, + showTargets = options.show.target, + hideTargets = options.hide.target, + targets = $.grep([ + this.elements.target[0], + this.rendered && this.tooltip[0], + options.position.container[0], + options.position.viewport[0], + options.position.container.closest('html')[0], // unfocus + window, + document + ], function(i) { + return typeof i === 'object'; + }); + + // Add show and hide targets if they're valid + if(showTargets && showTargets.toArray) { + targets = targets.concat(showTargets.toArray()); + } + if(hideTargets && hideTargets.toArray) { + targets = targets.concat(hideTargets.toArray()); + } + + // Unbind the events + this._unbind(targets) + ._unbind(targets, 'destroy') + ._unbind(targets, 'inactive'); +}; + +// Apply common event handlers using delegate (avoids excessive .bind calls!) +$(function() { + delegate(SELECTOR, ['mouseenter', 'mouseleave'], function(event) { + var state = event.type === 'mouseenter', + tooltip = $(event.currentTarget), + target = $(event.relatedTarget || event.target), + options = this.options; + + // On mouseenter... + if(state) { + // Focus the tooltip on mouseenter (z-index stacking) + this.focus(event); + + // Clear hide timer on tooltip hover to prevent it from closing + tooltip.hasClass(CLASS_FIXED) && !tooltip.hasClass(CLASS_DISABLED) && clearTimeout(this.timers.hide); + } + + // On mouseleave... + else { + // When mouse tracking is enabled, hide when we leave the tooltip and not onto the show target (if a hide event is set) + if(options.position.target === 'mouse' && options.position.adjust.mouse && + options.hide.event && options.show.target && !target.closest(options.show.target[0]).length) { + this.hide(event); + } + } + + // Add hover class + tooltip.toggleClass(CLASS_HOVER, state); + }); + + // Define events which reset the 'inactive' event handler + delegate('['+ATTR_ID+']', INACTIVE_EVENTS, inactiveMethod); +}); +;// Initialization method +function init(elem, id, opts) { + var obj, posOptions, attr, config, title, + + // Setup element references + docBody = $(document.body), + + // Use document body instead of document element if needed + newTarget = elem[0] === document ? docBody : elem, + + // Grab metadata from element if plugin is present + metadata = (elem.metadata) ? elem.metadata(opts.metadata) : NULL, + + // If metadata type if HTML5, grab 'name' from the object instead, or use the regular data object otherwise + metadata5 = opts.metadata.type === 'html5' && metadata ? metadata[opts.metadata.name] : NULL, + + // Grab data from metadata.name (or data-qtipopts as fallback) using .data() method, + html5 = elem.data(opts.metadata.name || 'qtipopts'); + + // If we don't get an object returned attempt to parse it manualyl without parseJSON + try { html5 = typeof html5 === 'string' ? $.parseJSON(html5) : html5; } catch(e) {} + + // Merge in and sanitize metadata + config = $.extend(TRUE, {}, QTIP.defaults, opts, + typeof html5 === 'object' ? sanitizeOptions(html5) : NULL, + sanitizeOptions(metadata5 || metadata)); + + // Re-grab our positioning options now we've merged our metadata and set id to passed value + posOptions = config.position; + config.id = id; + + // Setup missing content if none is detected + if('boolean' === typeof config.content.text) { + attr = elem.attr(config.content.attr); + + // Grab from supplied attribute if available + if(config.content.attr !== FALSE && attr) { config.content.text = attr; } + + // No valid content was found, abort render + else { return FALSE; } + } + + // Setup target options + if(!posOptions.container.length) { posOptions.container = docBody; } + if(posOptions.target === FALSE) { posOptions.target = newTarget; } + if(config.show.target === FALSE) { config.show.target = newTarget; } + if(config.show.solo === TRUE) { config.show.solo = posOptions.container.closest('body'); } + if(config.hide.target === FALSE) { config.hide.target = newTarget; } + if(config.position.viewport === TRUE) { config.position.viewport = posOptions.container; } + + // Ensure we only use a single container + posOptions.container = posOptions.container.eq(0); + + // Convert position corner values into x and y strings + posOptions.at = new CORNER(posOptions.at, TRUE); + posOptions.my = new CORNER(posOptions.my); + + // Destroy previous tooltip if overwrite is enabled, or skip element if not + if(elem.data(NAMESPACE)) { + if(config.overwrite) { + elem.qtip('destroy', true); + } + else if(config.overwrite === FALSE) { + return FALSE; + } + } + + // Add has-qtip attribute + elem.attr(ATTR_HAS, id); + + // Remove title attribute and store it if present + if(config.suppress && (title = elem.attr('title'))) { + // Final attr call fixes event delegatiom and IE default tooltip showing problem + elem.removeAttr('title').attr(oldtitle, title).attr('title', ''); + } + + // Initialize the tooltip and add API reference + obj = new QTip(elem, config, id, !!attr); + elem.data(NAMESPACE, obj); + + return obj; +} + +// jQuery $.fn extension method +QTIP = $.fn.qtip = function(options, notation, newValue) +{ + var command = ('' + options).toLowerCase(), // Parse command + returned = NULL, + args = $.makeArray(arguments).slice(1), + event = args[args.length - 1], + opts = this[0] ? $.data(this[0], NAMESPACE) : NULL; + + // Check for API request + if((!arguments.length && opts) || command === 'api') { + return opts; + } + + // Execute API command if present + else if('string' === typeof options) { + this.each(function() { + var api = $.data(this, NAMESPACE); + if(!api) { return TRUE; } + + // Cache the event if possible + if(event && event.timeStamp) { api.cache.event = event; } + + // Check for specific API commands + if(notation && (command === 'option' || command === 'options')) { + if(newValue !== undefined || $.isPlainObject(notation)) { + api.set(notation, newValue); + } + else { + returned = api.get(notation); + return FALSE; + } + } + + // Execute API command + else if(api[command]) { + api[command].apply(api, args); + } + }); + + return returned !== NULL ? returned : this; + } + + // No API commands. validate provided options and setup qTips + else if('object' === typeof options || !arguments.length) { + // Sanitize options first + opts = sanitizeOptions($.extend(TRUE, {}, options)); + + return this.each(function(i) { + var api, id; + + // Find next available ID, or use custom ID if provided + id = $.isArray(opts.id) ? opts.id[i] : opts.id; + id = !id || id === FALSE || id.length < 1 || QTIP.api[id] ? QTIP.nextid++ : id; + + // Initialize the qTip and re-grab newly sanitized options + api = init($(this), id, opts); + if(api === FALSE) { return TRUE; } + else { QTIP.api[id] = api; } + + // Initialize plugins + $.each(PLUGINS, function() { + if(this.initialize === 'initialize') { this(api); } + }); + + // Assign initial pre-render events + api._assignInitialEvents(event); + }); + } +}; + +// Expose class +$.qtip = QTip; + +// Populated in render method +QTIP.api = {}; +;$.each({ + /* Allow other plugins to successfully retrieve the title of an element with a qTip applied */ + attr: function(attr, val) { + if(this.length) { + var self = this[0], + title = 'title', + api = $.data(self, 'qtip'); + + if(attr === title && api && 'object' === typeof api && api.options.suppress) { + if(arguments.length < 2) { + return $.attr(self, oldtitle); + } + + // If qTip is rendered and title was originally used as content, update it + if(api && api.options.content.attr === title && api.cache.attr) { + api.set('content.text', val); + } + + // Use the regular attr method to set, then cache the result + return this.attr(oldtitle, val); + } + } + + return $.fn['attr'+replaceSuffix].apply(this, arguments); + }, + + /* Allow clone to correctly retrieve cached title attributes */ + clone: function(keepData) { + var titles = $([]), title = 'title', + + // Clone our element using the real clone method + elems = $.fn['clone'+replaceSuffix].apply(this, arguments); + + // Grab all elements with an oldtitle set, and change it to regular title attribute, if keepData is false + if(!keepData) { + elems.filter('['+oldtitle+']').attr('title', function() { + return $.attr(this, oldtitle); + }) + .removeAttr(oldtitle); + } + + return elems; + } +}, function(name, func) { + if(!func || $.fn[name+replaceSuffix]) { return TRUE; } + + var old = $.fn[name+replaceSuffix] = $.fn[name]; + $.fn[name] = function() { + return func.apply(this, arguments) || old.apply(this, arguments); + }; +}); + +/* Fire off 'removeqtip' handler in $.cleanData if jQuery UI not present (it already does similar). + * This snippet is taken directly from jQuery UI source code found here: + * http://code.jquery.com/ui/jquery-ui-git.js + */ +if(!$.ui) { + $['cleanData'+replaceSuffix] = $.cleanData; + $.cleanData = function( elems ) { + for(var i = 0, elem; (elem = $( elems[i] )).length; i++) { + if(elem.attr(ATTR_HAS)) { + try { elem.triggerHandler('removeqtip'); } + catch( e ) {} + } + } + $['cleanData'+replaceSuffix].apply(this, arguments); + }; +} +;// qTip version +QTIP.version = '2.2.1'; + +// Base ID for all qTips +QTIP.nextid = 0; + +// Inactive events array +QTIP.inactiveEvents = INACTIVE_EVENTS; + +// Base z-index for all qTips +QTIP.zindex = 15000; + +// Define configuration defaults +QTIP.defaults = { + prerender: FALSE, + id: FALSE, + overwrite: TRUE, + suppress: TRUE, + content: { + text: TRUE, + attr: 'title', + title: FALSE, + button: FALSE + }, + position: { + my: 'top left', + at: 'bottom right', + target: FALSE, + container: FALSE, + viewport: FALSE, + adjust: { + x: 0, y: 0, + mouse: TRUE, + scroll: TRUE, + resize: TRUE, + method: 'flipinvert flipinvert' + }, + effect: function(api, pos, viewport) { + $(this).animate(pos, { + duration: 200, + queue: FALSE + }); + } + }, + show: { + target: FALSE, + event: 'mouseenter', + effect: TRUE, + delay: 90, + solo: FALSE, + ready: FALSE, + autofocus: FALSE + }, + hide: { + target: FALSE, + event: 'mouseleave', + effect: TRUE, + delay: 0, + fixed: FALSE, + inactive: FALSE, + leave: 'window', + distance: FALSE + }, + style: { + classes: '', + widget: FALSE, + width: FALSE, + height: FALSE, + def: TRUE + }, + events: { + render: NULL, + move: NULL, + show: NULL, + hide: NULL, + toggle: NULL, + visible: NULL, + hidden: NULL, + focus: NULL, + blur: NULL + } +}; +;var TIP, + +// .bind()/.on() namespace +TIPNS = '.qtip-tip', + +// Common CSS strings +MARGIN = 'margin', +BORDER = 'border', +COLOR = 'color', +BG_COLOR = 'background-color', +TRANSPARENT = 'transparent', +IMPORTANT = ' !important', + +// Check if the browser supports elements +HASCANVAS = !!document.createElement('canvas').getContext, + +// Invalid colour values used in parseColours() +INVALID = /rgba?\(0, 0, 0(, 0)?\)|transparent|#123456/i; + +// Camel-case method, taken from jQuery source +// http://code.jquery.com/jquery-1.8.0.js +function camel(s) { return s.charAt(0).toUpperCase() + s.slice(1); } + +/* + * Modified from Modernizr's testPropsAll() + * http://modernizr.com/downloads/modernizr-latest.js + */ +var cssProps = {}, cssPrefixes = ["Webkit", "O", "Moz", "ms"]; +function vendorCss(elem, prop) { + var ucProp = prop.charAt(0).toUpperCase() + prop.slice(1), + props = (prop + ' ' + cssPrefixes.join(ucProp + ' ') + ucProp).split(' '), + cur, val, i = 0; + + // If the property has already been mapped... + if(cssProps[prop]) { return elem.css(cssProps[prop]); } + + while((cur = props[i++])) { + if((val = elem.css(cur)) !== undefined) { + return cssProps[prop] = cur, val; + } + } +} + +// Parse a given elements CSS property into an int +function intCss(elem, prop) { + return Math.ceil(parseFloat(vendorCss(elem, prop))); +} + + +// VML creation (for IE only) +if(!HASCANVAS) { + var createVML = function(tag, props, style) { + return ''; + }; +} + +// Canvas only definitions +else { + var PIXEL_RATIO = window.devicePixelRatio || 1, + BACKING_STORE_RATIO = (function() { + var context = document.createElement('canvas').getContext('2d'); + return context.backingStorePixelRatio || context.webkitBackingStorePixelRatio || context.mozBackingStorePixelRatio || + context.msBackingStorePixelRatio || context.oBackingStorePixelRatio || 1; + }()), + SCALE = PIXEL_RATIO / BACKING_STORE_RATIO; +} + + +function Tip(qtip, options) { + this._ns = 'tip'; + this.options = options; + this.offset = options.offset; + this.size = [ options.width, options.height ]; + + // Initialize + this.init( (this.qtip = qtip) ); +} + +$.extend(Tip.prototype, { + init: function(qtip) { + var context, tip; + + // Create tip element and prepend to the tooltip + tip = this.element = qtip.elements.tip = $('
', { 'class': NAMESPACE+'-tip' }).prependTo(qtip.tooltip); + + // Create tip drawing element(s) + if(HASCANVAS) { + // save() as soon as we create the canvas element so FF2 doesn't bork on our first restore()! + context = $('').appendTo(this.element)[0].getContext('2d'); + + // Setup constant parameters + context.lineJoin = 'miter'; + context.miterLimit = 100000; + context.save(); + } + else { + context = createVML('shape', 'coordorigin="0,0"', 'position:absolute;'); + this.element.html(context + context); + + // Prevent mousing down on the tip since it causes problems with .live() handling in IE due to VML + qtip._bind( $('*', tip).add(tip), ['click', 'mousedown'], function(event) { event.stopPropagation(); }, this._ns); + } + + // Bind update events + qtip._bind(qtip.tooltip, 'tooltipmove', this.reposition, this._ns, this); + + // Create it + this.create(); + }, + + _swapDimensions: function() { + this.size[0] = this.options.height; + this.size[1] = this.options.width; + }, + _resetDimensions: function() { + this.size[0] = this.options.width; + this.size[1] = this.options.height; + }, + + _useTitle: function(corner) { + var titlebar = this.qtip.elements.titlebar; + return titlebar && ( + corner.y === TOP || (corner.y === CENTER && this.element.position().top + (this.size[1] / 2) + this.options.offset < titlebar.outerHeight(TRUE)) + ); + }, + + _parseCorner: function(corner) { + var my = this.qtip.options.position.my; + + // Detect corner and mimic properties + if(corner === FALSE || my === FALSE) { + corner = FALSE; + } + else if(corner === TRUE) { + corner = new CORNER( my.string() ); + } + else if(!corner.string) { + corner = new CORNER(corner); + corner.fixed = TRUE; + } + + return corner; + }, + + _parseWidth: function(corner, side, use) { + var elements = this.qtip.elements, + prop = BORDER + camel(side) + 'Width'; + + return (use ? intCss(use, prop) : ( + intCss(elements.content, prop) || + intCss(this._useTitle(corner) && elements.titlebar || elements.content, prop) || + intCss(elements.tooltip, prop) + )) || 0; + }, + + _parseRadius: function(corner) { + var elements = this.qtip.elements, + prop = BORDER + camel(corner.y) + camel(corner.x) + 'Radius'; + + return BROWSER.ie < 9 ? 0 : + intCss(this._useTitle(corner) && elements.titlebar || elements.content, prop) || + intCss(elements.tooltip, prop) || 0; + }, + + _invalidColour: function(elem, prop, compare) { + var val = elem.css(prop); + return !val || (compare && val === elem.css(compare)) || INVALID.test(val) ? FALSE : val; + }, + + _parseColours: function(corner) { + var elements = this.qtip.elements, + tip = this.element.css('cssText', ''), + borderSide = BORDER + camel(corner[ corner.precedance ]) + camel(COLOR), + colorElem = this._useTitle(corner) && elements.titlebar || elements.content, + css = this._invalidColour, color = []; + + // Attempt to detect the background colour from various elements, left-to-right precedance + color[0] = css(tip, BG_COLOR) || css(colorElem, BG_COLOR) || css(elements.content, BG_COLOR) || + css(elements.tooltip, BG_COLOR) || tip.css(BG_COLOR); + + // Attempt to detect the correct border side colour from various elements, left-to-right precedance + color[1] = css(tip, borderSide, COLOR) || css(colorElem, borderSide, COLOR) || + css(elements.content, borderSide, COLOR) || css(elements.tooltip, borderSide, COLOR) || elements.tooltip.css(borderSide); + + // Reset background and border colours + $('*', tip).add(tip).css('cssText', BG_COLOR+':'+TRANSPARENT+IMPORTANT+';'+BORDER+':0'+IMPORTANT+';'); + + return color; + }, + + _calculateSize: function(corner) { + var y = corner.precedance === Y, + width = this.options['width'], + height = this.options['height'], + isCenter = corner.abbrev() === 'c', + base = (y ? width: height) * (isCenter ? 0.5 : 1), + pow = Math.pow, + round = Math.round, + bigHyp, ratio, result, + + smallHyp = Math.sqrt( pow(base, 2) + pow(height, 2) ), + hyp = [ (this.border / base) * smallHyp, (this.border / height) * smallHyp ]; + + hyp[2] = Math.sqrt( pow(hyp[0], 2) - pow(this.border, 2) ); + hyp[3] = Math.sqrt( pow(hyp[1], 2) - pow(this.border, 2) ); + + bigHyp = smallHyp + hyp[2] + hyp[3] + (isCenter ? 0 : hyp[0]); + ratio = bigHyp / smallHyp; + + result = [ round(ratio * width), round(ratio * height) ]; + return y ? result : result.reverse(); + }, + + // Tip coordinates calculator + _calculateTip: function(corner, size, scale) { + scale = scale || 1; + size = size || this.size; + + var width = size[0] * scale, + height = size[1] * scale, + width2 = Math.ceil(width / 2), height2 = Math.ceil(height / 2), + + // Define tip coordinates in terms of height and width values + tips = { + br: [0,0, width,height, width,0], + bl: [0,0, width,0, 0,height], + tr: [0,height, width,0, width,height], + tl: [0,0, 0,height, width,height], + tc: [0,height, width2,0, width,height], + bc: [0,0, width,0, width2,height], + rc: [0,0, width,height2, 0,height], + lc: [width,0, width,height, 0,height2] + }; + + // Set common side shapes + tips.lt = tips.br; tips.rt = tips.bl; + tips.lb = tips.tr; tips.rb = tips.tl; + + return tips[ corner.abbrev() ]; + }, + + // Tip coordinates drawer (canvas) + _drawCoords: function(context, coords) { + context.beginPath(); + context.moveTo(coords[0], coords[1]); + context.lineTo(coords[2], coords[3]); + context.lineTo(coords[4], coords[5]); + context.closePath(); + }, + + create: function() { + // Determine tip corner + var c = this.corner = (HASCANVAS || BROWSER.ie) && this._parseCorner(this.options.corner); + + // If we have a tip corner... + if( (this.enabled = !!this.corner && this.corner.abbrev() !== 'c') ) { + // Cache it + this.qtip.cache.corner = c.clone(); + + // Create it + this.update(); + } + + // Toggle tip element + this.element.toggle(this.enabled); + + return this.corner; + }, + + update: function(corner, position) { + if(!this.enabled) { return this; } + + var elements = this.qtip.elements, + tip = this.element, + inner = tip.children(), + options = this.options, + curSize = this.size, + mimic = options.mimic, + round = Math.round, + color, precedance, context, + coords, bigCoords, translate, newSize, border, BACKING_STORE_RATIO; + + // Re-determine tip if not already set + if(!corner) { corner = this.qtip.cache.corner || this.corner; } + + // Use corner property if we detect an invalid mimic value + if(mimic === FALSE) { mimic = corner; } + + // Otherwise inherit mimic properties from the corner object as necessary + else { + mimic = new CORNER(mimic); + mimic.precedance = corner.precedance; + + if(mimic.x === 'inherit') { mimic.x = corner.x; } + else if(mimic.y === 'inherit') { mimic.y = corner.y; } + else if(mimic.x === mimic.y) { + mimic[ corner.precedance ] = corner[ corner.precedance ]; + } + } + precedance = mimic.precedance; + + // Ensure the tip width.height are relative to the tip position + if(corner.precedance === X) { this._swapDimensions(); } + else { this._resetDimensions(); } + + // Update our colours + color = this.color = this._parseColours(corner); + + // Detect border width, taking into account colours + if(color[1] !== TRANSPARENT) { + // Grab border width + border = this.border = this._parseWidth(corner, corner[corner.precedance]); + + // If border width isn't zero, use border color as fill if it's not invalid (1.0 style tips) + if(options.border && border < 1 && !INVALID.test(color[1])) { color[0] = color[1]; } + + // Set border width (use detected border width if options.border is true) + this.border = border = options.border !== TRUE ? options.border : border; + } + + // Border colour was invalid, set border to zero + else { this.border = border = 0; } + + // Determine tip size + newSize = this.size = this._calculateSize(corner); + tip.css({ + width: newSize[0], + height: newSize[1], + lineHeight: newSize[1]+'px' + }); + + // Calculate tip translation + if(corner.precedance === Y) { + translate = [ + round(mimic.x === LEFT ? border : mimic.x === RIGHT ? newSize[0] - curSize[0] - border : (newSize[0] - curSize[0]) / 2), + round(mimic.y === TOP ? newSize[1] - curSize[1] : 0) + ]; + } + else { + translate = [ + round(mimic.x === LEFT ? newSize[0] - curSize[0] : 0), + round(mimic.y === TOP ? border : mimic.y === BOTTOM ? newSize[1] - curSize[1] - border : (newSize[1] - curSize[1]) / 2) + ]; + } + + // Canvas drawing implementation + if(HASCANVAS) { + // Grab canvas context and clear/save it + context = inner[0].getContext('2d'); + context.restore(); context.save(); + context.clearRect(0,0,6000,6000); + + // Calculate coordinates + coords = this._calculateTip(mimic, curSize, SCALE); + bigCoords = this._calculateTip(mimic, this.size, SCALE); + + // Set the canvas size using calculated size + inner.attr(WIDTH, newSize[0] * SCALE).attr(HEIGHT, newSize[1] * SCALE); + inner.css(WIDTH, newSize[0]).css(HEIGHT, newSize[1]); + + // Draw the outer-stroke tip + this._drawCoords(context, bigCoords); + context.fillStyle = color[1]; + context.fill(); + + // Draw the actual tip + context.translate(translate[0] * SCALE, translate[1] * SCALE); + this._drawCoords(context, coords); + context.fillStyle = color[0]; + context.fill(); + } + + // VML (IE Proprietary implementation) + else { + // Calculate coordinates + coords = this._calculateTip(mimic); + + // Setup coordinates string + coords = 'm' + coords[0] + ',' + coords[1] + ' l' + coords[2] + + ',' + coords[3] + ' ' + coords[4] + ',' + coords[5] + ' xe'; + + // Setup VML-specific offset for pixel-perfection + translate[2] = border && /^(r|b)/i.test(corner.string()) ? + BROWSER.ie === 8 ? 2 : 1 : 0; + + // Set initial CSS + inner.css({ + coordsize: (newSize[0]+border) + ' ' + (newSize[1]+border), + antialias: ''+(mimic.string().indexOf(CENTER) > -1), + left: translate[0] - (translate[2] * Number(precedance === X)), + top: translate[1] - (translate[2] * Number(precedance === Y)), + width: newSize[0] + border, + height: newSize[1] + border + }) + .each(function(i) { + var $this = $(this); + + // Set shape specific attributes + $this[ $this.prop ? 'prop' : 'attr' ]({ + coordsize: (newSize[0]+border) + ' ' + (newSize[1]+border), + path: coords, + fillcolor: color[0], + filled: !!i, + stroked: !i + }) + .toggle(!!(border || i)); + + // Check if border is enabled and add stroke element + !i && $this.html( createVML( + 'stroke', 'weight="'+(border*2)+'px" color="'+color[1]+'" miterlimit="1000" joinstyle="miter"' + ) ); + }); + } + + // Opera bug #357 - Incorrect tip position + // https://github.com/Craga89/qTip2/issues/367 + window.opera && setTimeout(function() { + elements.tip.css({ + display: 'inline-block', + visibility: 'visible' + }); + }, 1); + + // Position if needed + if(position !== FALSE) { this.calculate(corner, newSize); } + }, + + calculate: function(corner, size) { + if(!this.enabled) { return FALSE; } + + var self = this, + elements = this.qtip.elements, + tip = this.element, + userOffset = this.options.offset, + isWidget = elements.tooltip.hasClass('ui-widget'), + position = { }, + precedance, corners; + + // Inherit corner if not provided + corner = corner || this.corner; + precedance = corner.precedance; + + // Determine which tip dimension to use for adjustment + size = size || this._calculateSize(corner); + + // Setup corners and offset array + corners = [ corner.x, corner.y ]; + if(precedance === X) { corners.reverse(); } + + // Calculate tip position + $.each(corners, function(i, side) { + var b, bc, br; + + if(side === CENTER) { + b = precedance === Y ? LEFT : TOP; + position[ b ] = '50%'; + position[MARGIN+'-' + b] = -Math.round(size[ precedance === Y ? 0 : 1 ] / 2) + userOffset; + } + else { + b = self._parseWidth(corner, side, elements.tooltip); + bc = self._parseWidth(corner, side, elements.content); + br = self._parseRadius(corner); + + position[ side ] = Math.max(-self.border, i ? bc : (userOffset + (br > b ? br : -b))); + } + }); + + // Adjust for tip size + position[ corner[precedance] ] -= size[ precedance === X ? 0 : 1 ]; + + // Set and return new position + tip.css({ margin: '', top: '', bottom: '', left: '', right: '' }).css(position); + return position; + }, + + reposition: function(event, api, pos, viewport) { + if(!this.enabled) { return; } + + var cache = api.cache, + newCorner = this.corner.clone(), + adjust = pos.adjusted, + method = api.options.position.adjust.method.split(' '), + horizontal = method[0], + vertical = method[1] || method[0], + shift = { left: FALSE, top: FALSE, x: 0, y: 0 }, + offset, css = {}, props; + + function shiftflip(direction, precedance, popposite, side, opposite) { + // Horizontal - Shift or flip method + if(direction === SHIFT && newCorner.precedance === precedance && adjust[side] && newCorner[popposite] !== CENTER) { + newCorner.precedance = newCorner.precedance === X ? Y : X; + } + else if(direction !== SHIFT && adjust[side]){ + newCorner[precedance] = newCorner[precedance] === CENTER ? + (adjust[side] > 0 ? side : opposite) : (newCorner[precedance] === side ? opposite : side); + } + } + + function shiftonly(xy, side, opposite) { + if(newCorner[xy] === CENTER) { + css[MARGIN+'-'+side] = shift[xy] = offset[MARGIN+'-'+side] - adjust[side]; + } + else { + props = offset[opposite] !== undefined ? + [ adjust[side], -offset[side] ] : [ -adjust[side], offset[side] ]; + + if( (shift[xy] = Math.max(props[0], props[1])) > props[0] ) { + pos[side] -= adjust[side]; + shift[side] = FALSE; + } + + css[ offset[opposite] !== undefined ? opposite : side ] = shift[xy]; + } + } + + // If our tip position isn't fixed e.g. doesn't adjust with viewport... + if(this.corner.fixed !== TRUE) { + // Perform shift/flip adjustments + shiftflip(horizontal, X, Y, LEFT, RIGHT); + shiftflip(vertical, Y, X, TOP, BOTTOM); + + // Update and redraw the tip if needed (check cached details of last drawn tip) + if(newCorner.string() !== cache.corner.string() || cache.cornerTop !== adjust.top || cache.cornerLeft !== adjust.left) { + this.update(newCorner, FALSE); + } + } + + // Setup tip offset properties + offset = this.calculate(newCorner); + + // Readjust offset object to make it left/top + if(offset.right !== undefined) { offset.left = -offset.right; } + if(offset.bottom !== undefined) { offset.top = -offset.bottom; } + offset.user = this.offset; + + // Perform shift adjustments + if(shift.left = (horizontal === SHIFT && !!adjust.left)) { shiftonly(X, LEFT, RIGHT); } + if(shift.top = (vertical === SHIFT && !!adjust.top)) { shiftonly(Y, TOP, BOTTOM); } + + /* + * If the tip is adjusted in both dimensions, or in a + * direction that would cause it to be anywhere but the + * outer border, hide it! + */ + this.element.css(css).toggle( + !((shift.x && shift.y) || (newCorner.x === CENTER && shift.y) || (newCorner.y === CENTER && shift.x)) + ); + + // Adjust position to accomodate tip dimensions + pos.left -= offset.left.charAt ? offset.user : + horizontal !== SHIFT || shift.top || !shift.left && !shift.top ? offset.left + this.border : 0; + pos.top -= offset.top.charAt ? offset.user : + vertical !== SHIFT || shift.left || !shift.left && !shift.top ? offset.top + this.border : 0; + + // Cache details + cache.cornerLeft = adjust.left; cache.cornerTop = adjust.top; + cache.corner = newCorner.clone(); + }, + + destroy: function() { + // Unbind events + this.qtip._unbind(this.qtip.tooltip, this._ns); + + // Remove the tip element(s) + if(this.qtip.elements.tip) { + this.qtip.elements.tip.find('*') + .remove().end().remove(); + } + } +}); + +TIP = PLUGINS.tip = function(api) { + return new Tip(api, api.options.style.tip); +}; + +// Initialize tip on render +TIP.initialize = 'render'; + +// Setup plugin sanitization options +TIP.sanitize = function(options) { + if(options.style && 'tip' in options.style) { + var opts = options.style.tip; + if(typeof opts !== 'object') { opts = options.style.tip = { corner: opts }; } + if(!(/string|boolean/i).test(typeof opts.corner)) { opts.corner = TRUE; } + } +}; + +// Add new option checks for the plugin +CHECKS.tip = { + '^position.my|style.tip.(corner|mimic|border)$': function() { + // Make sure a tip can be drawn + this.create(); + + // Reposition the tooltip + this.qtip.reposition(); + }, + '^style.tip.(height|width)$': function(obj) { + // Re-set dimensions and redraw the tip + this.size = [ obj.width, obj.height ]; + this.update(); + + // Reposition the tooltip + this.qtip.reposition(); + }, + '^content.title|style.(classes|widget)$': function() { + this.update(); + } +}; + +// Extend original qTip defaults +$.extend(TRUE, QTIP.defaults, { + style: { + tip: { + corner: TRUE, + mimic: FALSE, + width: 6, + height: 6, + border: TRUE, + offset: 0 + } + } +}); +;PLUGINS.viewport = function(api, position, posOptions, targetWidth, targetHeight, elemWidth, elemHeight) +{ + var target = posOptions.target, + tooltip = api.elements.tooltip, + my = posOptions.my, + at = posOptions.at, + adjust = posOptions.adjust, + method = adjust.method.split(' '), + methodX = method[0], + methodY = method[1] || method[0], + viewport = posOptions.viewport, + container = posOptions.container, + cache = api.cache, + adjusted = { left: 0, top: 0 }, + fixed, newMy, containerOffset, containerStatic, + viewportWidth, viewportHeight, viewportScroll, viewportOffset; + + // If viewport is not a jQuery element, or it's the window/document, or no adjustment method is used... return + if(!viewport.jquery || target[0] === window || target[0] === document.body || adjust.method === 'none') { + return adjusted; + } + + // Cach container details + containerOffset = container.offset() || adjusted; + containerStatic = container.css('position') === 'static'; + + // Cache our viewport details + fixed = tooltip.css('position') === 'fixed'; + viewportWidth = viewport[0] === window ? viewport.width() : viewport.outerWidth(FALSE); + viewportHeight = viewport[0] === window ? viewport.height() : viewport.outerHeight(FALSE); + viewportScroll = { left: fixed ? 0 : viewport.scrollLeft(), top: fixed ? 0 : viewport.scrollTop() }; + viewportOffset = viewport.offset() || adjusted; + + // Generic calculation method + function calculate(side, otherSide, type, adjust, side1, side2, lengthName, targetLength, elemLength) { + var initialPos = position[side1], + mySide = my[side], + atSide = at[side], + isShift = type === SHIFT, + myLength = mySide === side1 ? elemLength : mySide === side2 ? -elemLength : -elemLength / 2, + atLength = atSide === side1 ? targetLength : atSide === side2 ? -targetLength : -targetLength / 2, + sideOffset = viewportScroll[side1] + viewportOffset[side1] - (containerStatic ? 0 : containerOffset[side1]), + overflow1 = sideOffset - initialPos, + overflow2 = initialPos + elemLength - (lengthName === WIDTH ? viewportWidth : viewportHeight) - sideOffset, + offset = myLength - (my.precedance === side || mySide === my[otherSide] ? atLength : 0) - (atSide === CENTER ? targetLength / 2 : 0); + + // shift + if(isShift) { + offset = (mySide === side1 ? 1 : -1) * myLength; + + // Adjust position but keep it within viewport dimensions + position[side1] += overflow1 > 0 ? overflow1 : overflow2 > 0 ? -overflow2 : 0; + position[side1] = Math.max( + -containerOffset[side1] + viewportOffset[side1], + initialPos - offset, + Math.min( + Math.max( + -containerOffset[side1] + viewportOffset[side1] + (lengthName === WIDTH ? viewportWidth : viewportHeight), + initialPos + offset + ), + position[side1], + + // Make sure we don't adjust complete off the element when using 'center' + mySide === 'center' ? initialPos - myLength : 1E9 + ) + ); + + } + + // flip/flipinvert + else { + // Update adjustment amount depending on if using flipinvert or flip + adjust *= (type === FLIPINVERT ? 2 : 0); + + // Check for overflow on the left/top + if(overflow1 > 0 && (mySide !== side1 || overflow2 > 0)) { + position[side1] -= offset + adjust; + newMy.invert(side, side1); + } + + // Check for overflow on the bottom/right + else if(overflow2 > 0 && (mySide !== side2 || overflow1 > 0) ) { + position[side1] -= (mySide === CENTER ? -offset : offset) + adjust; + newMy.invert(side, side2); + } + + // Make sure we haven't made things worse with the adjustment and reset if so + if(position[side1] < viewportScroll && -position[side1] > overflow2) { + position[side1] = initialPos; newMy = my.clone(); + } + } + + return position[side1] - initialPos; + } + + // Set newMy if using flip or flipinvert methods + if(methodX !== 'shift' || methodY !== 'shift') { newMy = my.clone(); } + + // Adjust position based onviewport and adjustment options + adjusted = { + left: methodX !== 'none' ? calculate( X, Y, methodX, adjust.x, LEFT, RIGHT, WIDTH, targetWidth, elemWidth ) : 0, + top: methodY !== 'none' ? calculate( Y, X, methodY, adjust.y, TOP, BOTTOM, HEIGHT, targetHeight, elemHeight ) : 0, + my: newMy + }; + + return adjusted; +}; +;})); +}( window, document )); diff --git a/library/js/qtip/jquery.qtip.min.css b/library/js/qtip/jquery.qtip.min.css new file mode 100644 index 000000000..06f7d0b04 --- /dev/null +++ b/library/js/qtip/jquery.qtip.min.css @@ -0,0 +1,3 @@ +/* qTip2 v2.2.1 | Plugins: tips viewport | Styles: core basic css3 | qtip2.com | Licensed MIT | Sat Sep 06 2014 21:55:19 */ + +.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;z-index:11;cursor:pointer;outline:0;border:1px solid transparent}.qtip-titlebar .qtip-close{right:4px;top:50%;margin-top:-9px}* html .qtip-titlebar .qtip-close{top:16px}.qtip-icon .ui-icon,.qtip-titlebar .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:-100em -100em no-repeat}.qtip-default{border:1px solid #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,.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-shadow{-webkit-box-shadow:1px 1px 3px 1px rgba(0,0,0,.15);-moz-box-shadow:1px 1px 3px 1px rgba(0,0,0,.15);box-shadow:1px 1px 3px 1px rgba(0,0,0,.15)}.qtip-bootstrap,.qtip-rounded,.qtip-tipsy{-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px}.qtip-rounded .qtip-titlebar{-moz-border-radius:4px 4px 0 0;-webkit-border-radius:4px 4px 0 0;border-radius:4px 4px 0 0}.qtip-youtube{-moz-border-radius:2px;-webkit-border-radius:2px;border-radius:2px;-webkit-box-shadow:0 0 3px #333;-moz-box-shadow:0 0 3px #333;box-shadow:0 0 3px #333;color:#fff;border:0 solid transparent;background:#4A4A4A;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#4A4A4A),color-stop(100%,#000));background-image:-webkit-linear-gradient(top,#4A4A4A 0,#000 100%);background-image:-moz-linear-gradient(top,#4A4A4A 0,#000 100%);background-image:-ms-linear-gradient(top,#4A4A4A 0,#000 100%);background-image:-o-linear-gradient(top,#4A4A4A 0,#000 100%)}.qtip-youtube .qtip-titlebar{background-color:transparent}.qtip-youtube .qtip-content{padding:.75em;font:12px arial,sans-serif;filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr=#4a4a4a, EndColorStr=#000000);-ms-filter:"progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#4a4a4a,EndColorStr=#000000);"}.qtip-youtube .qtip-icon{border-color:#222}.qtip-youtube .qtip-titlebar .ui-state-hover{border-color:#303030}.qtip-jtools{background:#232323;background:rgba(0,0,0,.7);background-image:-webkit-gradient(linear,left top,left bottom,from(#717171),to(#232323));background-image:-moz-linear-gradient(top,#717171,#232323);background-image:-webkit-linear-gradient(top,#717171,#232323);background-image:-ms-linear-gradient(top,#717171,#232323);background-image:-o-linear-gradient(top,#717171,#232323);border:2px solid #ddd;border:2px solid rgba(241,241,241,1);-moz-border-radius:2px;-webkit-border-radius:2px;border-radius:2px;-webkit-box-shadow:0 0 12px #333;-moz-box-shadow:0 0 12px #333;box-shadow:0 0 12px #333}.qtip-jtools .qtip-titlebar{filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#717171, endColorstr=#4A4A4A);-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorstr=#717171,endColorstr=#4A4A4A)"}.qtip-jtools .qtip-content{filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#4A4A4A, endColorstr=#232323);-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorstr=#4A4A4A,endColorstr=#232323)"}.qtip-jtools .qtip-content,.qtip-jtools .qtip-titlebar{background:0 0;color:#fff;border:0 dashed transparent}.qtip-jtools .qtip-icon{border-color:#555}.qtip-jtools .qtip-titlebar .ui-state-hover{border-color:#333}.qtip-cluetip{-webkit-box-shadow:4px 4px 5px rgba(0,0,0,.4);-moz-box-shadow:4px 4px 5px rgba(0,0,0,.4);box-shadow:4px 4px 5px rgba(0,0,0,.4);background-color:#D9D9C2;color:#111;border:0 dashed transparent}.qtip-cluetip .qtip-titlebar{background-color:#87876A;color:#fff;border:0 dashed transparent}.qtip-cluetip .qtip-icon{border-color:#808064}.qtip-cluetip .qtip-titlebar .ui-state-hover{border-color:#696952;color:#696952}.qtip-tipsy{background:#000;background:rgba(0,0,0,.87);color:#fff;border:0 solid transparent;font-size:11px;font-family:'Lucida Grande',sans-serif;font-weight:700;line-height:16px;text-shadow:0 1px #000}.qtip-tipsy .qtip-titlebar{padding:6px 35px 0 10px;background-color:transparent}.qtip-tipsy .qtip-content{padding:6px 10px}.qtip-tipsy .qtip-icon{border-color:#222;text-shadow:none}.qtip-tipsy .qtip-titlebar .ui-state-hover{border-color:#303030}.qtip-tipped{border:3px solid #959FA9;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;background-color:#F9F9F9;color:#454545;font-weight:400;font-family:serif}.qtip-tipped .qtip-titlebar{border-bottom-width:0;color:#fff;background:#3A79B8;background-image:-webkit-gradient(linear,left top,left bottom,from(#3A79B8),to(#2E629D));background-image:-webkit-linear-gradient(top,#3A79B8,#2E629D);background-image:-moz-linear-gradient(top,#3A79B8,#2E629D);background-image:-ms-linear-gradient(top,#3A79B8,#2E629D);background-image:-o-linear-gradient(top,#3A79B8,#2E629D);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#3A79B8, endColorstr=#2E629D);-ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorstr=#3A79B8,endColorstr=#2E629D)"}.qtip-tipped .qtip-icon{border:2px solid #285589;background:#285589}.qtip-tipped .qtip-icon .ui-icon{background-color:#FBFBFB;color:#555}.qtip-bootstrap{font-size:14px;line-height:20px;color:#333;padding:1px;background-color:#fff;border:1px solid #ccc;border:1px solid rgba(0,0,0,.2);-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);-moz-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2);-webkit-background-clip:padding-box;-moz-background-clip:padding;background-clip:padding-box}.qtip-bootstrap .qtip-titlebar{padding:8px 14px;margin:0;font-size:14px;font-weight:400;line-height:18px;background-color:#f7f7f7;border-bottom:1px solid #ebebeb;-webkit-border-radius:5px 5px 0 0;-moz-border-radius:5px 5px 0 0;border-radius:5px 5px 0 0}.qtip-bootstrap .qtip-titlebar .qtip-close{right:11px;top:45%;border-style:none}.qtip-bootstrap .qtip-content{padding:9px 14px}.qtip-bootstrap .qtip-icon{background:0 0}.qtip-bootstrap .qtip-icon .ui-icon{width:auto;height:auto;float:right;font-size:20px;font-weight:700;line-height:18px;color:#000;text-shadow:0 1px 0 #fff;opacity:.2;filter:alpha(opacity=20)}.qtip-bootstrap .qtip-icon .ui-icon:hover{color:#000;text-decoration:none;cursor:pointer;opacity:.4;filter:alpha(opacity=40)}.qtip:not(.ie9haxors) div.qtip-content,.qtip:not(.ie9haxors) div.qtip-titlebar{filter:none;-ms-filter:none}.qtip .qtip-tip{margin:0 auto;overflow:hidden;z-index:10}.qtip .qtip-tip,x:-o-prefocus{visibility:hidden}.qtip .qtip-tip,.qtip .qtip-tip .qtip-vml,.qtip .qtip-tip canvas{position:absolute;color:#123456;background:0 0;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} \ No newline at end of file diff --git a/library/js/qtip/jquery.qtip.min.js b/library/js/qtip/jquery.qtip.min.js new file mode 100644 index 000000000..2eec1f31a --- /dev/null +++ b/library/js/qtip/jquery.qtip.min.js @@ -0,0 +1,5 @@ +/* qTip2 v2.2.1 | Plugins: tips viewport | Styles: core basic css3 | qtip2.com | Licensed MIT | Sat Sep 06 2014 21:55:18 */ + +!function(a,b,c){!function(a){"use strict";"function"==typeof define&&define.amd?define(["jquery"],a):jQuery&&!jQuery.fn.qtip&&a(jQuery)}(function(d){"use strict";function e(a,b,c,e){this.id=c,this.target=a,this.tooltip=D,this.elements={target:a},this._id=Q+"-"+c,this.timers={img:{}},this.options=b,this.plugins={},this.cache={event:{},target:d(),disabled:C,attr:e,onTooltip:C,lastClass:""},this.rendered=this.destroyed=this.disabled=this.waiting=this.hiddenDuringWait=this.positioning=this.triggering=C}function f(a){return a===D||"object"!==d.type(a)}function g(a){return!(d.isFunction(a)||a&&a.attr||a.length||"object"===d.type(a)&&(a.jquery||a.then))}function h(a){var b,c,e,h;return f(a)?C:(f(a.metadata)&&(a.metadata={type:a.metadata}),"content"in a&&(b=a.content,f(b)||b.jquery||b.done?b=a.content={text:c=g(b)?C:b}:c=b.text,"ajax"in b&&(e=b.ajax,h=e&&e.once!==C,delete b.ajax,b.text=function(a,b){var f=c||d(this).attr(b.options.content.attr)||"Loading...",g=d.ajax(d.extend({},e,{context:b})).then(e.success,D,e.error).then(function(a){return a&&h&&b.set("content.text",a),a},function(a,c,d){b.destroyed||0===a.status||b.set("content.text",c+": "+d)});return h?f:(b.set("content.text",f),g)}),"title"in b&&(d.isPlainObject(b.title)&&(b.button=b.title.button,b.title=b.title.text),g(b.title||C)&&(b.title=C))),"position"in a&&f(a.position)&&(a.position={my:a.position,at:a.position}),"show"in a&&f(a.show)&&(a.show=a.show.jquery?{target:a.show}:a.show===B?{ready:B}:{event:a.show}),"hide"in a&&f(a.hide)&&(a.hide=a.hide.jquery?{target:a.hide}:{event:a.hide}),"style"in a&&f(a.style)&&(a.style={classes:a.style}),d.each(P,function(){this.sanitize&&this.sanitize(a)}),a)}function i(a,b){for(var c,d=0,e=a,f=b.split(".");e=e[f[d++]];)d0?setTimeout(d.proxy(a,this),b):void a.call(this)}function m(a){this.tooltip.hasClass($)||(clearTimeout(this.timers.show),clearTimeout(this.timers.hide),this.timers.show=l.call(this,function(){this.toggle(B,a)},this.options.show.delay))}function n(a){if(!this.tooltip.hasClass($)&&!this.destroyed){var b=d(a.relatedTarget),c=b.closest(U)[0]===this.tooltip[0],e=b[0]===this.options.show.target[0];if(clearTimeout(this.timers.show),clearTimeout(this.timers.hide),this!==b[0]&&"mouse"===this.options.position.target&&c||this.options.hide.fixed&&/mouse(out|leave|move)/.test(a.type)&&(c||e))try{a.preventDefault(),a.stopImmediatePropagation()}catch(f){}else this.timers.hide=l.call(this,function(){this.toggle(C,a)},this.options.hide.delay,this)}}function o(a){!this.tooltip.hasClass($)&&this.options.hide.inactive&&(clearTimeout(this.timers.inactive),this.timers.inactive=l.call(this,function(){this.hide(a)},this.options.hide.inactive))}function p(a){this.rendered&&this.tooltip[0].offsetWidth>0&&this.reposition(a)}function q(a,c,e){d(b.body).delegate(a,(c.split?c:c.join("."+Q+" "))+"."+Q,function(){var a=w.api[d.attr(this,S)];a&&!a.disabled&&e.apply(a,arguments)})}function r(a,c,f){var g,i,j,k,l,m=d(b.body),n=a[0]===b?m:a,o=a.metadata?a.metadata(f.metadata):D,p="html5"===f.metadata.type&&o?o[f.metadata.name]:D,q=a.data(f.metadata.name||"qtipopts");try{q="string"==typeof q?d.parseJSON(q):q}catch(r){}if(k=d.extend(B,{},w.defaults,f,"object"==typeof q?h(q):D,h(p||o)),i=k.position,k.id=c,"boolean"==typeof k.content.text){if(j=a.attr(k.content.attr),k.content.attr===C||!j)return C;k.content.text=j}if(i.container.length||(i.container=m),i.target===C&&(i.target=n),k.show.target===C&&(k.show.target=n),k.show.solo===B&&(k.show.solo=i.container.closest("body")),k.hide.target===C&&(k.hide.target=n),k.position.viewport===B&&(k.position.viewport=i.container),i.container=i.container.eq(0),i.at=new y(i.at,B),i.my=new y(i.my),a.data(Q))if(k.overwrite)a.qtip("destroy",!0);else if(k.overwrite===C)return C;return a.attr(R,c),k.suppress&&(l=a.attr("title"))&&a.removeAttr("title").attr(ab,l).attr("title",""),g=new e(a,k,c,!!j),a.data(Q,g),g}function s(a){return a.charAt(0).toUpperCase()+a.slice(1)}function t(a,b){var d,e,f=b.charAt(0).toUpperCase()+b.slice(1),g=(b+" "+pb.join(f+" ")+f).split(" "),h=0;if(ob[b])return a.css(ob[b]);for(;d=g[h++];)if((e=a.css(d))!==c)return ob[b]=d,e}function u(a,b){return Math.ceil(parseFloat(t(a,b)))}function v(a,b){this._ns="tip",this.options=b,this.offset=b.offset,this.size=[b.width,b.height],this.init(this.qtip=a)}var w,x,y,z,A,B=!0,C=!1,D=null,E="x",F="y",G="width",H="height",I="top",J="left",K="bottom",L="right",M="center",N="flipinvert",O="shift",P={},Q="qtip",R="data-hasqtip",S="data-qtip-id",T=["ui-widget","ui-tooltip"],U="."+Q,V="click dblclick mousedown mouseup mousemove mouseleave mouseenter".split(" "),W=Q+"-fixed",X=Q+"-default",Y=Q+"-focus",Z=Q+"-hover",$=Q+"-disabled",_="_replacedByqTip",ab="oldtitle",bb={ie:function(){for(var a=4,c=b.createElement("div");(c.innerHTML="")&&c.getElementsByTagName("i")[0];a+=1);return a>4?a:0/0}(),iOS:parseFloat((""+(/CPU.*OS ([0-9_]{1,5})|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent)||[0,""])[1]).replace("undefined","3_2").replace("_",".").replace("_",""))||C};x=e.prototype,x._when=function(a){return d.when.apply(d,a)},x.render=function(a){if(this.rendered||this.destroyed)return this;var b,c=this,e=this.options,f=this.cache,g=this.elements,h=e.content.text,i=e.content.title,j=e.content.button,k=e.position,l=("."+this._id+" ",[]);return d.attr(this.target[0],"aria-describedby",this._id),f.posClass=this._createPosClass((this.position={my:k.my,at:k.at}).my),this.tooltip=g.tooltip=b=d("
",{id:this._id,"class":[Q,X,e.style.classes,f.posClass].join(" "),width:e.style.width||"",height:e.style.height||"",tracking:"mouse"===k.target&&k.adjust.mouse,role:"alert","aria-live":"polite","aria-atomic":C,"aria-describedby":this._id+"-content","aria-hidden":B}).toggleClass($,this.disabled).attr(S,this.id).data(Q,this).appendTo(k.container).append(g.content=d("
",{"class":Q+"-content",id:this._id+"-content","aria-atomic":B})),this.rendered=-1,this.positioning=B,i&&(this._createTitle(),d.isFunction(i)||l.push(this._updateTitle(i,C))),j&&this._createButton(),d.isFunction(h)||l.push(this._updateContent(h,C)),this.rendered=B,this._setWidget(),d.each(P,function(a){var b;"render"===this.initialize&&(b=this(c))&&(c.plugins[a]=b)}),this._unassignEvents(),this._assignEvents(),this._when(l).then(function(){c._trigger("render"),c.positioning=C,c.hiddenDuringWait||!e.show.ready&&!a||c.toggle(B,f.event,C),c.hiddenDuringWait=C}),w.api[this.id]=this,this},x.destroy=function(a){function b(){if(!this.destroyed){this.destroyed=B;var a,b=this.target,c=b.attr(ab);this.rendered&&this.tooltip.stop(1,0).find("*").remove().end().remove(),d.each(this.plugins,function(){this.destroy&&this.destroy()});for(a in this.timers)clearTimeout(this.timers[a]);b.removeData(Q).removeAttr(S).removeAttr(R).removeAttr("aria-describedby"),this.options.suppress&&c&&b.attr("title",c).removeAttr(ab),this._unassignEvents(),this.options=this.elements=this.cache=this.timers=this.plugins=this.mouse=D,delete w.api[this.id]}}return this.destroyed?this.target:(a===B&&"hide"!==this.triggering||!this.rendered?b.call(this):(this.tooltip.one("tooltiphidden",d.proxy(b,this)),!this.triggering&&this.hide()),this.target)},z=x.checks={builtin:{"^id$":function(a,b,c,e){var f=c===B?w.nextid:c,g=Q+"-"+f;f!==C&&f.length>0&&!d("#"+g).length?(this._id=g,this.rendered&&(this.tooltip[0].id=this._id,this.elements.content[0].id=this._id+"-content",this.elements.title[0].id=this._id+"-title")):a[b]=e},"^prerender":function(a,b,c){c&&!this.rendered&&this.render(this.options.show.ready)},"^content.text$":function(a,b,c){this._updateContent(c)},"^content.attr$":function(a,b,c,d){this.options.content.text===this.target.attr(d)&&this._updateContent(this.target.attr(c))},"^content.title$":function(a,b,c){return c?(c&&!this.elements.title&&this._createTitle(),void this._updateTitle(c)):this._removeTitle()},"^content.button$":function(a,b,c){this._updateButton(c)},"^content.title.(text|button)$":function(a,b,c){this.set("content."+b,c)},"^position.(my|at)$":function(a,b,c){"string"==typeof c&&(this.position[b]=a[b]=new y(c,"at"===b))},"^position.container$":function(a,b,c){this.rendered&&this.tooltip.appendTo(c)},"^show.ready$":function(a,b,c){c&&(!this.rendered&&this.render(B)||this.toggle(B))},"^style.classes$":function(a,b,c,d){this.rendered&&this.tooltip.removeClass(d).addClass(c)},"^style.(width|height)":function(a,b,c){this.rendered&&this.tooltip.css(b,c)},"^style.widget|content.title":function(){this.rendered&&this._setWidget()},"^style.def":function(a,b,c){this.rendered&&this.tooltip.toggleClass(X,!!c)},"^events.(render|show|move|hide|focus|blur)$":function(a,b,c){this.rendered&&this.tooltip[(d.isFunction(c)?"":"un")+"bind"]("tooltip"+b,c)},"^(show|hide|position).(event|target|fixed|inactive|leave|distance|viewport|adjust)":function(){if(this.rendered){var a=this.options.position;this.tooltip.attr("tracking","mouse"===a.target&&a.adjust.mouse),this._unassignEvents(),this._assignEvents()}}}},x.get=function(a){if(this.destroyed)return this;var b=i(this.options,a.toLowerCase()),c=b[0][b[1]];return c.precedance?c.string():c};var cb=/^position\.(my|at|adjust|target|container|viewport)|style|content|show\.ready/i,db=/^prerender|show\.ready/i;x.set=function(a,b){if(this.destroyed)return this;{var c,e=this.rendered,f=C,g=this.options;this.checks}return"string"==typeof a?(c=a,a={},a[c]=b):a=d.extend({},a),d.each(a,function(b,c){if(e&&db.test(b))return void delete a[b];var h,j=i(g,b.toLowerCase());h=j[0][j[1]],j[0][j[1]]=c&&c.nodeType?d(c):c,f=cb.test(b)||f,a[b]=[j[0],j[1],c,h]}),h(g),this.positioning=B,d.each(a,d.proxy(j,this)),this.positioning=C,this.rendered&&this.tooltip[0].offsetWidth>0&&f&&this.reposition("mouse"===g.position.target?D:this.cache.event),this},x._update=function(a,b){var c=this,e=this.cache;return this.rendered&&a?(d.isFunction(a)&&(a=a.call(this.elements.target,e.event,this)||""),d.isFunction(a.then)?(e.waiting=B,a.then(function(a){return e.waiting=C,c._update(a,b)},D,function(a){return c._update(a,b)})):a===C||!a&&""!==a?C:(a.jquery&&a.length>0?b.empty().append(a.css({display:"block",visibility:"visible"})):b.html(a),this._waitForContent(b).then(function(a){c.rendered&&c.tooltip[0].offsetWidth>0&&c.reposition(e.event,!a.length)}))):C},x._waitForContent=function(a){var b=this.cache;return b.waiting=B,(d.fn.imagesLoaded?a.imagesLoaded():d.Deferred().resolve([])).done(function(){b.waiting=C}).promise()},x._updateContent=function(a,b){this._update(a,this.elements.content,b)},x._updateTitle=function(a,b){this._update(a,this.elements.title,b)===C&&this._removeTitle(C)},x._createTitle=function(){var a=this.elements,b=this._id+"-title";a.titlebar&&this._removeTitle(),a.titlebar=d("
",{"class":Q+"-titlebar "+(this.options.style.widget?k("header"):"")}).append(a.title=d("
",{id:b,"class":Q+"-title","aria-atomic":B})).insertBefore(a.content).delegate(".qtip-close","mousedown keydown mouseup keyup mouseout",function(a){d(this).toggleClass("ui-state-active ui-state-focus","down"===a.type.substr(-4))}).delegate(".qtip-close","mouseover mouseout",function(a){d(this).toggleClass("ui-state-hover","mouseover"===a.type)}),this.options.content.button&&this._createButton()},x._removeTitle=function(a){var b=this.elements;b.title&&(b.titlebar.remove(),b.titlebar=b.title=b.button=D,a!==C&&this.reposition())},x._createPosClass=function(a){return Q+"-pos-"+(a||this.options.position.my).abbrev()},x.reposition=function(c,e){if(!this.rendered||this.positioning||this.destroyed)return this;this.positioning=B;var f,g,h,i,j=this.cache,k=this.tooltip,l=this.options.position,m=l.target,n=l.my,o=l.at,p=l.viewport,q=l.container,r=l.adjust,s=r.method.split(" "),t=k.outerWidth(C),u=k.outerHeight(C),v=0,w=0,x=k.css("position"),y={left:0,top:0},z=k[0].offsetWidth>0,A=c&&"scroll"===c.type,D=d(a),E=q[0].ownerDocument,F=this.mouse;if(d.isArray(m)&&2===m.length)o={x:J,y:I},y={left:m[0],top:m[1]};else if("mouse"===m)o={x:J,y:I},(!r.mouse||this.options.hide.distance)&&j.origin&&j.origin.pageX?c=j.origin:!c||c&&("resize"===c.type||"scroll"===c.type)?c=j.event:F&&F.pageX&&(c=F),"static"!==x&&(y=q.offset()),E.body.offsetWidth!==(a.innerWidth||E.documentElement.clientWidth)&&(g=d(b.body).offset()),y={left:c.pageX-y.left+(g&&g.left||0),top:c.pageY-y.top+(g&&g.top||0)},r.mouse&&A&&F&&(y.left-=(F.scrollX||0)-D.scrollLeft(),y.top-=(F.scrollY||0)-D.scrollTop());else{if("event"===m?c&&c.target&&"scroll"!==c.type&&"resize"!==c.type?j.target=d(c.target):c.target||(j.target=this.elements.target):"event"!==m&&(j.target=d(m.jquery?m:this.elements.target)),m=j.target,m=d(m).eq(0),0===m.length)return this;m[0]===b||m[0]===a?(v=bb.iOS?a.innerWidth:m.width(),w=bb.iOS?a.innerHeight:m.height(),m[0]===a&&(y={top:(p||m).scrollTop(),left:(p||m).scrollLeft()})):P.imagemap&&m.is("area")?f=P.imagemap(this,m,o,P.viewport?s:C):P.svg&&m&&m[0].ownerSVGElement?f=P.svg(this,m,o,P.viewport?s:C):(v=m.outerWidth(C),w=m.outerHeight(C),y=m.offset()),f&&(v=f.width,w=f.height,g=f.offset,y=f.position),y=this.reposition.offset(m,y,q),(bb.iOS>3.1&&bb.iOS<4.1||bb.iOS>=4.3&&bb.iOS<4.33||!bb.iOS&&"fixed"===x)&&(y.left-=D.scrollLeft(),y.top-=D.scrollTop()),(!f||f&&f.adjustable!==C)&&(y.left+=o.x===L?v:o.x===M?v/2:0,y.top+=o.y===K?w:o.y===M?w/2:0)}return y.left+=r.x+(n.x===L?-t:n.x===M?-t/2:0),y.top+=r.y+(n.y===K?-u:n.y===M?-u/2:0),P.viewport?(h=y.adjusted=P.viewport(this,y,l,v,w,t,u),g&&h.left&&(y.left+=g.left),g&&h.top&&(y.top+=g.top),h.my&&(this.position.my=h.my)):y.adjusted={left:0,top:0},j.posClass!==(i=this._createPosClass(this.position.my))&&k.removeClass(j.posClass).addClass(j.posClass=i),this._trigger("move",[y,p.elem||p],c)?(delete y.adjusted,e===C||!z||isNaN(y.left)||isNaN(y.top)||"mouse"===m||!d.isFunction(l.effect)?k.css(y):d.isFunction(l.effect)&&(l.effect.call(k,this,d.extend({},y)),k.queue(function(a){d(this).css({opacity:"",height:""}),bb.ie&&this.style.removeAttribute("filter"),a()})),this.positioning=C,this):this},x.reposition.offset=function(a,c,e){function f(a,b){c.left+=b*a.scrollLeft(),c.top+=b*a.scrollTop()}if(!e[0])return c;var g,h,i,j,k=d(a[0].ownerDocument),l=!!bb.ie&&"CSS1Compat"!==b.compatMode,m=e[0];do"static"!==(h=d.css(m,"position"))&&("fixed"===h?(i=m.getBoundingClientRect(),f(k,-1)):(i=d(m).position(),i.left+=parseFloat(d.css(m,"borderLeftWidth"))||0,i.top+=parseFloat(d.css(m,"borderTopWidth"))||0),c.left-=i.left+(parseFloat(d.css(m,"marginLeft"))||0),c.top-=i.top+(parseFloat(d.css(m,"marginTop"))||0),g||"hidden"===(j=d.css(m,"overflow"))||"visible"===j||(g=d(m)));while(m=m.offsetParent);return g&&(g[0]!==k[0]||l)&&f(g,1),c};var eb=(y=x.reposition.Corner=function(a,b){a=(""+a).replace(/([A-Z])/," $1").replace(/middle/gi,M).toLowerCase(),this.x=(a.match(/left|right/i)||a.match(/center/)||["inherit"])[0].toLowerCase(),this.y=(a.match(/top|bottom|center/i)||["inherit"])[0].toLowerCase(),this.forceY=!!b;var c=a.charAt(0);this.precedance="t"===c||"b"===c?F:E}).prototype;eb.invert=function(a,b){this[a]=this[a]===J?L:this[a]===L?J:b||this[a]},eb.string=function(a){var b=this.x,c=this.y,d=b!==c?"center"===b||"center"!==c&&(this.precedance===F||this.forceY)?[c,b]:[b,c]:[b];return a!==!1?d.join(" "):d},eb.abbrev=function(){var a=this.string(!1);return a[0].charAt(0)+(a[1]&&a[1].charAt(0)||"")},eb.clone=function(){return new y(this.string(),this.forceY)},x.toggle=function(a,c){var e=this.cache,f=this.options,g=this.tooltip;if(c){if(/over|enter/.test(c.type)&&e.event&&/out|leave/.test(e.event.type)&&f.show.target.add(c.target).length===f.show.target.length&&g.has(c.relatedTarget).length)return this;e.event=d.event.fix(c)}if(this.waiting&&!a&&(this.hiddenDuringWait=B),!this.rendered)return a?this.render(1):this;if(this.destroyed||this.disabled)return this;var h,i,j,k=a?"show":"hide",l=this.options[k],m=(this.options[a?"hide":"show"],this.options.position),n=this.options.content,o=this.tooltip.css("width"),p=this.tooltip.is(":visible"),q=a||1===l.target.length,r=!c||l.target.length<2||e.target[0]===c.target;return(typeof a).search("boolean|number")&&(a=!p),h=!g.is(":animated")&&p===a&&r,i=h?D:!!this._trigger(k,[90]),this.destroyed?this:(i!==C&&a&&this.focus(c),!i||h?this:(d.attr(g[0],"aria-hidden",!a),a?(this.mouse&&(e.origin=d.event.fix(this.mouse)),d.isFunction(n.text)&&this._updateContent(n.text,C),d.isFunction(n.title)&&this._updateTitle(n.title,C),!A&&"mouse"===m.target&&m.adjust.mouse&&(d(b).bind("mousemove."+Q,this._storeMouse),A=B),o||g.css("width",g.outerWidth(C)),this.reposition(c,arguments[2]),o||g.css("width",""),l.solo&&("string"==typeof l.solo?d(l.solo):d(U,l.solo)).not(g).not(l.target).qtip("hide",d.Event("tooltipsolo"))):(clearTimeout(this.timers.show),delete e.origin,A&&!d(U+'[tracking="true"]:visible',l.solo).not(g).length&&(d(b).unbind("mousemove."+Q),A=C),this.blur(c)),j=d.proxy(function(){a?(bb.ie&&g[0].style.removeAttribute("filter"),g.css("overflow",""),"string"==typeof l.autofocus&&d(this.options.show.autofocus,g).focus(),this.options.show.target.trigger("qtip-"+this.id+"-inactive")):g.css({display:"",visibility:"",opacity:"",left:"",top:""}),this._trigger(a?"visible":"hidden")},this),l.effect===C||q===C?(g[k](),j()):d.isFunction(l.effect)?(g.stop(1,1),l.effect.call(g,this),g.queue("fx",function(a){j(),a()})):g.fadeTo(90,a?1:0,j),a&&l.target.trigger("qtip-"+this.id+"-inactive"),this))},x.show=function(a){return this.toggle(B,a)},x.hide=function(a){return this.toggle(C,a)},x.focus=function(a){if(!this.rendered||this.destroyed)return this;var b=d(U),c=this.tooltip,e=parseInt(c[0].style.zIndex,10),f=w.zindex+b.length;return c.hasClass(Y)||this._trigger("focus",[f],a)&&(e!==f&&(b.each(function(){this.style.zIndex>e&&(this.style.zIndex=this.style.zIndex-1)}),b.filter("."+Y).qtip("blur",a)),c.addClass(Y)[0].style.zIndex=f),this},x.blur=function(a){return!this.rendered||this.destroyed?this:(this.tooltip.removeClass(Y),this._trigger("blur",[this.tooltip.css("zIndex")],a),this)},x.disable=function(a){return this.destroyed?this:("toggle"===a?a=!(this.rendered?this.tooltip.hasClass($):this.disabled):"boolean"!=typeof a&&(a=B),this.rendered&&this.tooltip.toggleClass($,a).attr("aria-disabled",a),this.disabled=!!a,this)},x.enable=function(){return this.disable(C)},x._createButton=function(){var a=this,b=this.elements,c=b.tooltip,e=this.options.content.button,f="string"==typeof e,g=f?e:"Close tooltip";b.button&&b.button.remove(),b.button=e.jquery?e:d("",{"class":"qtip-close "+(this.options.style.widget?"":Q+"-icon"),title:g,"aria-label":g}).prepend(d("",{"class":"ui-icon ui-icon-close",html:"×"})),b.button.appendTo(b.titlebar||c).attr("role","button").click(function(b){return c.hasClass($)||a.hide(b),C})},x._updateButton=function(a){if(!this.rendered)return C;var b=this.elements.button;a?this._createButton():b.remove()},x._setWidget=function(){var a=this.options.style.widget,b=this.elements,c=b.tooltip,d=c.hasClass($);c.removeClass($),$=a?"ui-state-disabled":"qtip-disabled",c.toggleClass($,d),c.toggleClass("ui-helper-reset "+k(),a).toggleClass(X,this.options.style.def&&!a),b.content&&b.content.toggleClass(k("content"),a),b.titlebar&&b.titlebar.toggleClass(k("header"),a),b.button&&b.button.toggleClass(Q+"-icon",!a)},x._storeMouse=function(a){return(this.mouse=d.event.fix(a)).type="mousemove",this},x._bind=function(a,b,c,e,f){if(a&&c&&b.length){var g="."+this._id+(e?"-"+e:"");return d(a).bind((b.split?b:b.join(g+" "))+g,d.proxy(c,f||this)),this}},x._unbind=function(a,b){return a&&d(a).unbind("."+this._id+(b?"-"+b:"")),this},x._trigger=function(a,b,c){var e=d.Event("tooltip"+a);return e.originalEvent=c&&d.extend({},c)||this.cache.event||D,this.triggering=a,this.tooltip.trigger(e,[this].concat(b||[])),this.triggering=C,!e.isDefaultPrevented()},x._bindEvents=function(a,b,c,e,f,g){var h=c.filter(e).add(e.filter(c)),i=[];h.length&&(d.each(b,function(b,c){var e=d.inArray(c,a);e>-1&&i.push(a.splice(e,1)[0])}),i.length&&(this._bind(h,i,function(a){var b=this.rendered?this.tooltip[0].offsetWidth>0:!1;(b?g:f).call(this,a)}),c=c.not(h),e=e.not(h))),this._bind(c,a,f),this._bind(e,b,g)},x._assignInitialEvents=function(a){function b(a){return this.disabled||this.destroyed?C:(this.cache.event=a&&d.event.fix(a),this.cache.target=a&&d(a.target),clearTimeout(this.timers.show),void(this.timers.show=l.call(this,function(){this.render("object"==typeof a||c.show.ready)},c.prerender?0:c.show.delay)))}var c=this.options,e=c.show.target,f=c.hide.target,g=c.show.event?d.trim(""+c.show.event).split(" "):[],h=c.hide.event?d.trim(""+c.hide.event).split(" "):[];this._bind(this.elements.target,["remove","removeqtip"],function(){this.destroy(!0)},"destroy"),/mouse(over|enter)/i.test(c.show.event)&&!/mouse(out|leave)/i.test(c.hide.event)&&h.push("mouseleave"),this._bind(e,"mousemove",function(a){this._storeMouse(a),this.cache.onTarget=B}),this._bindEvents(g,h,e,f,b,function(){return this.timers?void clearTimeout(this.timers.show):C}),(c.show.ready||c.prerender)&&b.call(this,a)},x._assignEvents=function(){var c=this,e=this.options,f=e.position,g=this.tooltip,h=e.show.target,i=e.hide.target,j=f.container,k=f.viewport,l=d(b),q=(d(b.body),d(a)),r=e.show.event?d.trim(""+e.show.event).split(" "):[],s=e.hide.event?d.trim(""+e.hide.event).split(" "):[];d.each(e.events,function(a,b){c._bind(g,"toggle"===a?["tooltipshow","tooltiphide"]:["tooltip"+a],b,null,g)}),/mouse(out|leave)/i.test(e.hide.event)&&"window"===e.hide.leave&&this._bind(l,["mouseout","blur"],function(a){/select|option/.test(a.target.nodeName)||a.relatedTarget||this.hide(a)}),e.hide.fixed?i=i.add(g.addClass(W)):/mouse(over|enter)/i.test(e.show.event)&&this._bind(i,"mouseleave",function(){clearTimeout(this.timers.show)}),(""+e.hide.event).indexOf("unfocus")>-1&&this._bind(j.closest("html"),["mousedown","touchstart"],function(a){var b=d(a.target),c=this.rendered&&!this.tooltip.hasClass($)&&this.tooltip[0].offsetWidth>0,e=b.parents(U).filter(this.tooltip[0]).length>0;b[0]===this.target[0]||b[0]===this.tooltip[0]||e||this.target.has(b[0]).length||!c||this.hide(a)}),"number"==typeof e.hide.inactive&&(this._bind(h,"qtip-"+this.id+"-inactive",o,"inactive"),this._bind(i.add(g),w.inactiveEvents,o)),this._bindEvents(r,s,h,i,m,n),this._bind(h.add(g),"mousemove",function(a){if("number"==typeof e.hide.distance){var b=this.cache.origin||{},c=this.options.hide.distance,d=Math.abs;(d(a.pageX-b.pageX)>=c||d(a.pageY-b.pageY)>=c)&&this.hide(a)}this._storeMouse(a)}),"mouse"===f.target&&f.adjust.mouse&&(e.hide.event&&this._bind(h,["mouseenter","mouseleave"],function(a){return this.cache?void(this.cache.onTarget="mouseenter"===a.type):C}),this._bind(l,"mousemove",function(a){this.rendered&&this.cache.onTarget&&!this.tooltip.hasClass($)&&this.tooltip[0].offsetWidth>0&&this.reposition(a)})),(f.adjust.resize||k.length)&&this._bind(d.event.special.resize?k:q,"resize",p),f.adjust.scroll&&this._bind(q.add(f.container),"scroll",p)},x._unassignEvents=function(){var c=this.options,e=c.show.target,f=c.hide.target,g=d.grep([this.elements.target[0],this.rendered&&this.tooltip[0],c.position.container[0],c.position.viewport[0],c.position.container.closest("html")[0],a,b],function(a){return"object"==typeof a});e&&e.toArray&&(g=g.concat(e.toArray())),f&&f.toArray&&(g=g.concat(f.toArray())),this._unbind(g)._unbind(g,"destroy")._unbind(g,"inactive")},d(function(){q(U,["mouseenter","mouseleave"],function(a){var b="mouseenter"===a.type,c=d(a.currentTarget),e=d(a.relatedTarget||a.target),f=this.options;b?(this.focus(a),c.hasClass(W)&&!c.hasClass($)&&clearTimeout(this.timers.hide)):"mouse"===f.position.target&&f.position.adjust.mouse&&f.hide.event&&f.show.target&&!e.closest(f.show.target[0]).length&&this.hide(a),c.toggleClass(Z,b)}),q("["+S+"]",V,o)}),w=d.fn.qtip=function(a,b,e){var f=(""+a).toLowerCase(),g=D,i=d.makeArray(arguments).slice(1),j=i[i.length-1],k=this[0]?d.data(this[0],Q):D;return!arguments.length&&k||"api"===f?k:"string"==typeof a?(this.each(function(){var a=d.data(this,Q);if(!a)return B;if(j&&j.timeStamp&&(a.cache.event=j),!b||"option"!==f&&"options"!==f)a[f]&&a[f].apply(a,i);else{if(e===c&&!d.isPlainObject(b))return g=a.get(b),C;a.set(b,e)}}),g!==D?g:this):"object"!=typeof a&&arguments.length?void 0:(k=h(d.extend(B,{},a)),this.each(function(a){var b,c;return c=d.isArray(k.id)?k.id[a]:k.id,c=!c||c===C||c.length<1||w.api[c]?w.nextid++:c,b=r(d(this),c,k),b===C?B:(w.api[c]=b,d.each(P,function(){"initialize"===this.initialize&&this(b)}),void b._assignInitialEvents(j))}))},d.qtip=e,w.api={},d.each({attr:function(a,b){if(this.length){var c=this[0],e="title",f=d.data(c,"qtip");if(a===e&&f&&"object"==typeof f&&f.options.suppress)return arguments.length<2?d.attr(c,ab):(f&&f.options.content.attr===e&&f.cache.attr&&f.set("content.text",b),this.attr(ab,b))}return d.fn["attr"+_].apply(this,arguments)},clone:function(a){var b=(d([]),d.fn["clone"+_].apply(this,arguments));return a||b.filter("["+ab+"]").attr("title",function(){return d.attr(this,ab)}).removeAttr(ab),b}},function(a,b){if(!b||d.fn[a+_])return B;var c=d.fn[a+_]=d.fn[a];d.fn[a]=function(){return b.apply(this,arguments)||c.apply(this,arguments)}}),d.ui||(d["cleanData"+_]=d.cleanData,d.cleanData=function(a){for(var b,c=0;(b=d(a[c])).length;c++)if(b.attr(R))try{b.triggerHandler("removeqtip")}catch(e){}d["cleanData"+_].apply(this,arguments)}),w.version="2.2.1",w.nextid=0,w.inactiveEvents=V,w.zindex=15e3,w.defaults={prerender:C,id:C,overwrite:B,suppress:B,content:{text:B,attr:"title",title:C,button:C},position:{my:"top left",at:"bottom right",target:C,container:C,viewport:C,adjust:{x:0,y:0,mouse:B,scroll:B,resize:B,method:"flipinvert flipinvert"},effect:function(a,b){d(this).animate(b,{duration:200,queue:C})}},show:{target:C,event:"mouseenter",effect:B,delay:90,solo:C,ready:C,autofocus:C},hide:{target:C,event:"mouseleave",effect:B,delay:0,fixed:C,inactive:C,leave:"window",distance:C},style:{classes:"",widget:C,width:C,height:C,def:B},events:{render:D,move:D,show:D,hide:D,toggle:D,visible:D,hidden:D,focus:D,blur:D}};var fb,gb="margin",hb="border",ib="color",jb="background-color",kb="transparent",lb=" !important",mb=!!b.createElement("canvas").getContext,nb=/rgba?\(0, 0, 0(, 0)?\)|transparent|#123456/i,ob={},pb=["Webkit","O","Moz","ms"];if(mb)var qb=a.devicePixelRatio||1,rb=function(){var a=b.createElement("canvas").getContext("2d");return a.backingStorePixelRatio||a.webkitBackingStorePixelRatio||a.mozBackingStorePixelRatio||a.msBackingStorePixelRatio||a.oBackingStorePixelRatio||1}(),sb=qb/rb;else var tb=function(a,b,c){return"'};d.extend(v.prototype,{init:function(a){var b,c;c=this.element=a.elements.tip=d("
",{"class":Q+"-tip"}).prependTo(a.tooltip),mb?(b=d("").appendTo(this.element)[0].getContext("2d"),b.lineJoin="miter",b.miterLimit=1e5,b.save()):(b=tb("shape",'coordorigin="0,0"',"position:absolute;"),this.element.html(b+b),a._bind(d("*",c).add(c),["click","mousedown"],function(a){a.stopPropagation()},this._ns)),a._bind(a.tooltip,"tooltipmove",this.reposition,this._ns,this),this.create()},_swapDimensions:function(){this.size[0]=this.options.height,this.size[1]=this.options.width},_resetDimensions:function(){this.size[0]=this.options.width,this.size[1]=this.options.height},_useTitle:function(a){var b=this.qtip.elements.titlebar;return b&&(a.y===I||a.y===M&&this.element.position().top+this.size[1]/2+this.options.offsetl&&!nb.test(e[1])&&(e[0]=e[1]),this.border=l=p.border!==B?p.border:l):this.border=l=0,k=this.size=this._calculateSize(b),n.css({width:k[0],height:k[1],lineHeight:k[1]+"px"}),j=b.precedance===F?[s(r.x===J?l:r.x===L?k[0]-q[0]-l:(k[0]-q[0])/2),s(r.y===I?k[1]-q[1]:0)]:[s(r.x===J?k[0]-q[0]:0),s(r.y===I?l:r.y===K?k[1]-q[1]-l:(k[1]-q[1])/2)],mb?(g=o[0].getContext("2d"),g.restore(),g.save(),g.clearRect(0,0,6e3,6e3),h=this._calculateTip(r,q,sb),i=this._calculateTip(r,this.size,sb),o.attr(G,k[0]*sb).attr(H,k[1]*sb),o.css(G,k[0]).css(H,k[1]),this._drawCoords(g,i),g.fillStyle=e[1],g.fill(),g.translate(j[0]*sb,j[1]*sb),this._drawCoords(g,h),g.fillStyle=e[0],g.fill()):(h=this._calculateTip(r),h="m"+h[0]+","+h[1]+" l"+h[2]+","+h[3]+" "+h[4]+","+h[5]+" xe",j[2]=l&&/^(r|b)/i.test(b.string())?8===bb.ie?2:1:0,o.css({coordsize:k[0]+l+" "+(k[1]+l),antialias:""+(r.string().indexOf(M)>-1),left:j[0]-j[2]*Number(f===E),top:j[1]-j[2]*Number(f===F),width:k[0]+l,height:k[1]+l}).each(function(a){var b=d(this);b[b.prop?"prop":"attr"]({coordsize:k[0]+l+" "+(k[1]+l),path:h,fillcolor:e[0],filled:!!a,stroked:!a}).toggle(!(!l&&!a)),!a&&b.html(tb("stroke",'weight="'+2*l+'px" color="'+e[1]+'" miterlimit="1000" joinstyle="miter"'))})),a.opera&&setTimeout(function(){m.tip.css({display:"inline-block",visibility:"visible"})},1),c!==C&&this.calculate(b,k)},calculate:function(a,b){if(!this.enabled)return C;var c,e,f=this,g=this.qtip.elements,h=this.element,i=this.options.offset,j=(g.tooltip.hasClass("ui-widget"),{});return a=a||this.corner,c=a.precedance,b=b||this._calculateSize(a),e=[a.x,a.y],c===E&&e.reverse(),d.each(e,function(d,e){var h,k,l;e===M?(h=c===F?J:I,j[h]="50%",j[gb+"-"+h]=-Math.round(b[c===F?0:1]/2)+i):(h=f._parseWidth(a,e,g.tooltip),k=f._parseWidth(a,e,g.content),l=f._parseRadius(a),j[e]=Math.max(-f.border,d?k:i+(l>h?l:-h))) +}),j[a[c]]-=b[c===E?0:1],h.css({margin:"",top:"",bottom:"",left:"",right:""}).css(j),j},reposition:function(a,b,d){function e(a,b,c,d,e){a===O&&j.precedance===b&&k[d]&&j[c]!==M?j.precedance=j.precedance===E?F:E:a!==O&&k[d]&&(j[b]=j[b]===M?k[d]>0?d:e:j[b]===d?e:d)}function f(a,b,e){j[a]===M?p[gb+"-"+b]=o[a]=g[gb+"-"+b]-k[b]:(h=g[e]!==c?[k[b],-g[b]]:[-k[b],g[b]],(o[a]=Math.max(h[0],h[1]))>h[0]&&(d[b]-=k[b],o[b]=C),p[g[e]!==c?e:b]=o[a])}if(this.enabled){var g,h,i=b.cache,j=this.corner.clone(),k=d.adjusted,l=b.options.position.adjust.method.split(" "),m=l[0],n=l[1]||l[0],o={left:C,top:C,x:0,y:0},p={};this.corner.fixed!==B&&(e(m,E,F,J,L),e(n,F,E,I,K),(j.string()!==i.corner.string()||i.cornerTop!==k.top||i.cornerLeft!==k.left)&&this.update(j,C)),g=this.calculate(j),g.right!==c&&(g.left=-g.right),g.bottom!==c&&(g.top=-g.bottom),g.user=this.offset,(o.left=m===O&&!!k.left)&&f(E,J,L),(o.top=n===O&&!!k.top)&&f(F,I,K),this.element.css(p).toggle(!(o.x&&o.y||j.x===M&&o.y||j.y===M&&o.x)),d.left-=g.left.charAt?g.user:m!==O||o.top||!o.left&&!o.top?g.left+this.border:0,d.top-=g.top.charAt?g.user:n!==O||o.left||!o.left&&!o.top?g.top+this.border:0,i.cornerLeft=k.left,i.cornerTop=k.top,i.corner=j.clone()}},destroy:function(){this.qtip._unbind(this.qtip.tooltip,this._ns),this.qtip.elements.tip&&this.qtip.elements.tip.find("*").remove().end().remove()}}),fb=P.tip=function(a){return new v(a,a.options.style.tip)},fb.initialize="render",fb.sanitize=function(a){if(a.style&&"tip"in a.style){var b=a.style.tip;"object"!=typeof b&&(b=a.style.tip={corner:b}),/string|boolean/i.test(typeof b.corner)||(b.corner=B)}},z.tip={"^position.my|style.tip.(corner|mimic|border)$":function(){this.create(),this.qtip.reposition()},"^style.tip.(height|width)$":function(a){this.size=[a.width,a.height],this.update(),this.qtip.reposition()},"^content.title|style.(classes|widget)$":function(){this.update()}},d.extend(B,w.defaults,{style:{tip:{corner:B,mimic:C,width:6,height:6,border:B,offset:0}}}),P.viewport=function(c,d,e,f,g,h,i){function j(a,b,c,e,f,g,h,i,j){var k=d[f],s=u[a],t=v[a],w=c===O,x=s===f?j:s===g?-j:-j/2,y=t===f?i:t===g?-i:-i/2,z=q[f]+r[f]-(n?0:m[f]),A=z-k,B=k+j-(h===G?o:p)-z,C=x-(u.precedance===a||s===u[b]?y:0)-(t===M?i/2:0);return w?(C=(s===f?1:-1)*x,d[f]+=A>0?A:B>0?-B:0,d[f]=Math.max(-m[f]+r[f],k-C,Math.min(Math.max(-m[f]+r[f]+(h===G?o:p),k+C),d[f],"center"===s?k-x:1e9))):(e*=c===N?2:0,A>0&&(s!==f||B>0)?(d[f]-=C+e,l.invert(a,f)):B>0&&(s!==g||A>0)&&(d[f]-=(s===M?-C:C)+e,l.invert(a,g)),d[f]B&&(d[f]=k,l=u.clone())),d[f]-k}var k,l,m,n,o,p,q,r,s=e.target,t=c.elements.tooltip,u=e.my,v=e.at,w=e.adjust,x=w.method.split(" "),y=x[0],z=x[1]||x[0],A=e.viewport,B=e.container,D=(c.cache,{left:0,top:0});return A.jquery&&s[0]!==a&&s[0]!==b.body&&"none"!==w.method?(m=B.offset()||D,n="static"===B.css("position"),k="fixed"===t.css("position"),o=A[0]===a?A.width():A.outerWidth(C),p=A[0]===a?A.height():A.outerHeight(C),q={left:k?0:A.scrollLeft(),top:k?0:A.scrollTop()},r=A.offset()||D,("shift"!==y||"shift"!==z)&&(l=u.clone()),D={left:"none"!==y?j(E,F,y,w.x,J,L,G,f,h):0,top:"none"!==z?j(F,E,z,w.y,I,K,H,g,i):0,my:l}):D}})}(window,document); +//# sourceMappingURL=jquery.qtip.min.js.map \ No newline at end of file diff --git a/sql/4_1_2-to-4_1_3_upgrade.sql b/sql/4_1_2-to-4_1_3_upgrade.sql index b860d3a8b..3621d1a31 100644 --- a/sql/4_1_2-to-4_1_3_upgrade.sql +++ b/sql/4_1_2-to-4_1_3_upgrade.sql @@ -2932,3 +2932,11 @@ UPDATE `clinical_rules` SET `amc_2014_flag` = 1 , `amc_code_2014` = '170.314(g)( ) ENGINE=InnoDB; #EndIf +#IfMissingColumn documents encounter_id + ALTER TABLE `documents` ADD `encounter_id` bigint(20) NULL DEFAULT '0'; +#EndIf + +#IfMissingColumn documents encounter_check + ALTER TABLE `documents` ADD `encounter_check` TINYINT(1) NULL DEFAULT 0; +#EndIf + diff --git a/sql/database.sql b/sql/database.sql index 7bc1ddba8..1dd3c8f1b 100644 --- a/sql/database.sql +++ b/sql/database.sql @@ -718,6 +718,8 @@ CREATE TABLE `documents` ( `storagemethod` TINYINT(4) NOT NULL DEFAULT '0' COMMENT '0->Harddisk,1->CouchDB', `path_depth` TINYINT DEFAULT '1' COMMENT 'Depth of path to use in url to find document. Not applicable for CouchDB.', `imported` TINYINT DEFAULT 0 NULL COMMENT 'Parsing status for CCR/CCD/CCDA importing', + `encounter_id` bigint(20) NULL DEFAULT '0' COMMENT 'Encounter id if tagged', + `encounter_check` TINYINT(1) NULL DEFAULT 0 COMMENT 'If encounter is created while tagging', PRIMARY KEY (`id`), KEY `revision` (`revision`), KEY `foreign_id` (`foreign_id`), diff --git a/templates/documents/general_view.html b/templates/documents/general_view.html index c7a7897fa..55f25e267 100644 --- a/templates/documents/general_view.html +++ b/templates/documents/general_view.html @@ -40,6 +40,35 @@ {literal}}{/literal} {literal}}{/literal} +// For tagging it encounter +function tagUpdate() {literal}{{/literal} + var f = document.forms['document_tag']; + if (f.encounter_check.checked) {literal}{{/literal} + if(f.visit_category_id.value==0) {literal}{{/literal} + alert(" {xl t='Please select visit category'}" ); + return false; + {literal}}{/literal} + {literal}}{/literal} else if (f.encounter_id.value == 0 ) {literal}{{/literal} + alert(" {xl t='Please select encounter'}"); + return false; + {literal}}{/literal} + //top.restoreSession(); + document.forms['document_tag'].submit(); +{literal}}{/literal} + +// For new or existing encounter +function set_checkbox() {literal}{{/literal} + var f = document.forms['document_tag']; + if (f.encounter_check.checked) {literal}{{/literal} + f.encounter_id.disabled = true; + f.visit_category_id.disabled = false; + {literal}}{/literal} else {literal}{{/literal} + f.encounter_id.disabled = false; + f.visit_category_id.disabled = true; + f.visit_category_id.value = 0; + {literal}}{/literal} +{literal}}{/literal} + // Process click on Import link. function import_ccr(docid) {literal}{ top.restoreSession(); @@ -167,6 +196,30 @@
+
+ +
+
+ + + +
+   +    + {xl t='Visit Category'} :    + +
+
+
+
-- 2.11.4.GIT