diff --git a/.hgtags b/.hgtags new file mode 100644 index 00000000..eacf916f --- /dev/null +++ b/.hgtags @@ -0,0 +1 @@ +ce16cd955ae5e34bb81d5f19a2c3a76063bb6ed9 v.1.3.6 diff --git a/css/bible.css b/css/bible.css index 0e31a10c..9c8f7c0d 100644 --- a/css/bible.css +++ b/css/bible.css @@ -156,7 +156,8 @@ h3 { background-color: #fff; } -.removeresult + +.removeresult { float: left; display: block; @@ -184,3 +185,73 @@ h3 { padding: 0px 12px; margin: 0px; } + + + +.input-addtag {width: 200px; height: 36px;} +.btn-addtag {width: 80px; height: 44px; margin-left: 3px;} + + + + +a.trigger{ + position: absolute; + background: url(images/open.png) 6% 55% no-repeat; + text-decoration: none; + font-size: 16px; + letter-spacing:-1px; + font-family: verdana, helvetica, arial, sans-serif; + color:#fff; + font-weight: bold; + border-bottom: none; + margin-left: 2px; + + z-index:2; +} +a.trigger.left { + left: 12px; +} +a.trigger.right { + right: 12px; +} +a.trigger:hover { + text-decoration: none; + border-bottom: none; +} +a.active.trigger { + background: url(images/close.png) 6% 55% no-repeat; +} +.panel { + color:#000; + position: absolute; + display: none; + background: #eee; + width: 300px; + height: auto; + + z-index:1; +} +.panel.left { + left: 10px; + padding: 10px 20px 10px 60px; + border-top-right-radius: 15px; + -moz-border-radius-topright: 15px; + -webkit-border-top-right-radius: 15px; + -moz-border-radius-bottomright: 15px; + -webkit-border-bottom-right-radius: 15px; + border-bottom-right-radius: 15px; +} +.panel.right { + right: 10px; + padding: 10px 60px 10px 20px; + border-bottom-left-radius: 15px; + border-top-left-radius: 15px; + -moz-border-radius-bottomleft: 15px; + -moz-border-radius-topleft: 15px; + -webkit-border-bottom-left-radius: 15px; + -webkit-border-top-left-radius: 15px; +} +.panel p { + font-size:11px; +} +a:focus { outline: none;} \ No newline at end of file diff --git a/css/images/close.png b/css/images/close.png new file mode 100644 index 00000000..c11bd7f6 Binary files /dev/null and b/css/images/close.png differ diff --git a/css/images/minus.png b/css/images/minus.png new file mode 100644 index 00000000..d0b7e92e Binary files /dev/null and b/css/images/minus.png differ diff --git a/css/images/open.png b/css/images/open.png new file mode 100644 index 00000000..999aae06 Binary files /dev/null and b/css/images/open.png differ diff --git a/css/images/plus.png b/css/images/plus.png new file mode 100644 index 00000000..a822b266 Binary files /dev/null and b/css/images/plus.png differ diff --git a/js/common.js b/js/common.js index c7425d0f..87830d0b 100644 --- a/js/common.js +++ b/js/common.js @@ -307,9 +307,18 @@ define(['jquery', 'reference', 'tagging', 'jquery.ui'], r += "
"; } } - // TODO(jwall): hover should show tags for the verse. - var t = $("
" + "

" + ref.toString() + "

" + r + "

"); + var t = $("
 
" + "

" + ref.toString() + "

" + r + "

"); + var tagsform = $("

Tags:

"); + tagging.GetTags( + ref.toString(), { + success: function(data) { + var ts = data ? + (data.data ? + data.data.tagList : []) : []; + tagsform.find('.input-addtag').val(ts.join(', ')); + }}); + t.find(".panel").append(tagsform); Bible.AttachEvents(t, ref); $("#result").prepend(t); CurrentReferences[ref.toString()] = true; @@ -389,30 +398,30 @@ define(['jquery', 'reference', 'tagging', 'jquery.ui'], return null; }, AttachEvents: function(t, ref){ - t.find(".hiddenlink").click(function(e) { - Util.HandleHiddenLink(e); - }); - t.find(".removeresult").click(function(e) { - Util.RemoveResult(e, ref); - }); - // TODO(jwall): support longtouch events on mobile? - t.find(".resultbody h2").tooltip({ - items: ".resultbody h2", - content: function(tt) { - tagging.GetTags( - ref.toString(), { - success: function(data) { - var tags = data ? - (data.data ? - data.data.tagList : null) : null; - var hoverContent = - $("
Tags:
"); - hoverContent.append( - tags ? tags.join(", ") : "N/A"); - tt(hoverContent); - }}); - } - }); + t.find(".hiddenlink").click(function(e) { + Util.HandleHiddenLink(e); + }); + t.find(".removeresult").click(function(e) { + Util.RemoveResult(e, ref); + }); + // TODO(jwall): support longtouch events on mobile? + t.find(".resultbody h2").tooltip({ + items: ".resultbody h2", + content: function(tt) { + }}); + t.find('.btn-addtag').click(function(e) { + var tags = $(e.target).parent().find(".input-addtag").val().split(', '); + // TODO(jwall): add tags. + tagging.UpdateTags( + ref, tags, {success: function(req) { + console.log("Updated Reference"); + } + }); + }); + t.find('.trigger').slidePanel({ + triggerCss: 'margin-top: 60px; display: block; width: 48px; height: 48px;', + panelCss: 'margin-top: 55px; border: 2px solid #666;' + }); } }; var Strongs = { diff --git a/js/db.js b/js/db.js index 234f03e5..a4ded69e 100644 --- a/js/db.js +++ b/js/db.js @@ -27,6 +27,9 @@ define( Capable: function() { return typeof indexedDB != "undefined"; }, + Delete: function() { + // TODO(jwall): Delete databases. + }, // Turn on/off debug logging. ToggleDebug: function() { this.debug = !this.debug; diff --git a/js/jquery.slidePanel.js b/js/jquery.slidePanel.js new file mode 100644 index 00000000..d3f96df1 --- /dev/null +++ b/js/jquery.slidePanel.js @@ -0,0 +1,58 @@ +/* jQuery slidePanel plugin + * Examples and documentation at: http://www.jqeasy.com/ + * Version: 1.0 (22/03/2010) + * No license. Use it however you want. Just keep this notice included. + * Requires: jQuery v1.3+ + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ +(function($){ + $.fn.slidePanel = function(opts) { + opts = $.extend({ + triggerName: '#trigger', + triggerCss: '', + panelCss:'', + speed: 'fast', + clickOutsideToClose: true + }, opts || {}); + + + var trigger = this; + var panel = $(this).parent().find(".panel"); + + // set css properties for trigger and panel + trigger.attr('style',opts.triggerCss); + panel.attr('style',opts.panelCss); + panel.css('filter', 'alpha(opacity='+(opts.panelOpacity*100)+')'); + panel.css('opacity', opts.panelOpacity); + + // triggerName mousedown event + trigger.attr( "href", "javascript:void(0)" ).mousedown(function(e) { + + panel.toggle(opts.speed); + trigger.toggleClass("active"); + + return false; + }); + + if (opts.clickOutsideToClose) { + // bind the 'mousedown' event to the document so we can close panel without having to click triggerName + $(document).bind('mousedown',function(){ + panel.hide(opts.speed); + trigger.removeClass('active'); + }); + + // don't close panel when clicking inside it + panel.bind('mousedown',function(e){ + e.stopPropagation(); + }); + }; + }; +})(jQuery); \ No newline at end of file diff --git a/js/main.js b/js/main.js index 1489fea8..b8f174e7 100644 --- a/js/main.js +++ b/js/main.js @@ -1,4 +1,4 @@ -require(["jquery", "db", "common", "jquery.cookie", "jquery.ui"], +require(["jquery", "db", "common", "reference", "jquery.cookie", "jquery.ui", "jquery.slidePanel"], function($, db, common) { $(document).ready(function() {