diff --git a/opac/webapp/static/js/scielo-article-min.js b/opac/webapp/static/js/scielo-article-min.js index ac35c506..5bd1fb36 100644 --- a/opac/webapp/static/js/scielo-article-min.js +++ b/opac/webapp/static/js/scielo-article-min.js @@ -1,2 +1 @@ -var Article={TopBinder:[],Init:function(){Article.SetScreen();var e=$("#articleText"),t=e.offset(),i=$(".articleMenu").width();$(".articleSection",e);$(".ModalTables").on("shown.bs.modal",function(){var e=$(".modal-body",this),t=$("table",e),i=e.outerWidth(),o=t.outerWidth();e.is("cached")||(t.addClass("table"),it.top?($(".articleMenu").addClass("fixed").width(i),e>r+t.top-c-46?$(".articleMenu").addClass("fixedBottom"):$(".articleMenu").removeClass("fixedBottom")):$(".articleMenu").removeClass("fixed"),Article.ArticleStructureSelect(e),$(".alternativeHeader").stop(!1,!1)}),""!=window.location.hash&&(e=window.location.hash,a=window.scrollY,$(e).modal("toggle").on("hidden.bs.modal",function(){window.location.hash="",$("body,html").scrollTop(a)})),$("[data-toggle='modal']").on("click",function(){var e=$(this).data("target"),t=window.scrollY;"undefined"==e&&""==e||(window.location.hash=e),$(e).on("hidden.bs.modal",function(){window.location.hash="",$("body,html").scrollTop(t)})}),$(".downloadOptions li.group")),d=100/e.length,u=(e.css("width",d+"%"),Article.fechaAutores(),!1),e=($(".short-link").mouseenter(function(e){var t;u||(-1!==(t=window.location.href).indexOf("localhost")&&(t="http://www.scielo.br"),$.ajax({type:"GET",async:!1,url:"http://ref.scielo.org/api/v1/shorten",data:"url="+encodeURI(t),dataType:"jsonp",success:function(e){result=e,u=!0}}))}),new Clipboard(".short-link",{text:function(e){return result}})),p=(e.on("success",function(e){var t=$(e.trigger);t.addClass("copyFeedback"),setTimeout(function(){t.removeClass("copyFeedback")},2e3)}),e.on("error",function(e){var t=$(e.trigger);t.addClass("copyFeedbackError"),setTimeout(function(){t.removeClass("copyFeedbackError")},2e3)}),$("ul.floatingMenuMobile").on("click",function(){$(this).find(".fm-button-child").each(function(){$(this).addClass("tooltip-mobile-on")})}),!0);$("ul.floatingMenuMobile").on("focusout click",function(e){p?"focusout"!==e.type&&(p=!1,$(this).find(".fm-list").children("li").removeAttr("style"),$(this).find(".fm-button-main").addClass("fm-button-main-mobile-open")):(p=!0,$(this).find(".fm-list").children("li").css({opacity:0}),$(this).find(".fm-button-main").removeClass("fm-button-main-mobile-open"))})},isScrolledIntoView:function(e){var t=$(window).scrollTop(),i=t+$(window).height(),o=$(e).offset().top;return o+$(e).height()<=i&&t<=o},ArticleStructureBuilder:function(){var e=$(".articleMenu"),t=$("#articleText .articleSection"),n=0,a="";Article.TopBinder=[],t.each(function(){var t,e=$(this).data("anchor"),i=$(this).find(".articleSectionTitle"),o=$(this).offset();if(0==$(this).find("a[name='articleSection"+n+"']").length&&$(this).prepend(""),0==n?Article.TopBinder.push(0):Article.TopBinder.push(o.top),void 0===e)return!0;a=a+"
  • \t'+e+"",1",i.each(function(){var e=$(this).offset();Article.TopBinder.push(e.top),0==$(this).prev("a[name='as"+n+"-heading"+t+"']").length&&$(this).before(""),a=(a+="
  • ")+'\t'+$(this).text()+"
  • ",t++}),a+=""),a+="",n++}),e.html(a),$("a",e).on("click",function(e){e.preventDefault();e=(e=$(this).attr("href")).replace("#",""),e=$("a[name="+e+"]").offset();$("html,body").animate({scrollTop:e.top-60},500)})},ArticleStructureSelect:function(e){for(var t=$(".articleMenu"),i=0,o=Article.TopBinder.length;i=Article.TopBinder[i]-100){t.find("li").removeClass("selected"),t.find("li:eq("+i+")").addClass("selected");break}if(e<=Article.TopBinder[i]-100){t.find("li").removeClass("selected"),t.find("li:eq("+(i-1)+")").addClass("selected");break}}},Bindings:function(e){},fechaAutores:function(){var t,i,e,o,n,a,l,s,r=$(".contribGroup"),c=$(".contribGroup .dropdown"),d=c.length;10<=d&&(t=null,i=$(".outlineFadeLink"),e=c[0],o=c[d-1],(n=$('')).text("[...]"),n.css({padding:"10px",cursor:"pointer"}),a=$("
    "),(l=$("")).addClass("btn-fechar"),(s=$("")).addClass("sci-ico-floatingMenuClose"),l.append(s),a.append(l),(s=$("
    ")).append(e),s.append(n),s.append(o),s.append(i),r.text(""),r.append(s),n.on("click",function(){t.tooltip("disable"),r.textContent="";for(var e=0;ei?t.addClass("autoWidth"):t.removeClass("autoWidth")),e.addClass("cached")});var a={open:function(e){var t=$(".xref",e);t.next("span:eq(0)"),o=e.position(),supHeight=t.outerHeight(),supPositionLeft=o.left,li=e.closest("li"),refTxt=t.parent().find("a").data("ref"),t.parent().append(""+refTxt+""),console.log("cliquei"),li.length>0&&li.addClass("zindexFix"),t.parent().find(".refCtt").removeClass("closed").addClass("opened").css({left:supPositionLeft>300?-supPositionLeft/3:0}).fadeIn("fast")},close:function(e){var t=$(".xref",e),i=(t.next("span:eq(0)"),e.closest("li"));i.length>0&&i.removeClass("zindexFix"),t.parent().find(".refCtt").removeClass("opened").addClass("closed"),t.parent().find(".refCtt").remove()}};if(Article.IsTablet||Article.IsMobile){var n=!1,l=null;$("html").on("touchstart",function(e){$(".ref").each(function(){var e=$(this);a.close(e),n=!1})}),$(".ref").on("touchstart",function(e){e.stopPropagation();var t=$(this);null!==l&&t.get(0)===l.get(0)?n||(l=t,a.open(t),n=!0):(null!==l&&a.close(l),l=t,a.open(t),n=!0)}),$("ul.floatingMenuMobile").on("click",function(){$(this).find(".fm-button-child").each(function(){$(this).addClass("tooltip-mobile-on")})})}else $(".ref").on("mouseenter mouseleave",function(e){e.preventDefault();var t=$(this);"mouseenter"===e.type?a.open(t):a.close(t)});$(".thumb").on("mouseenter mouseleave",function(e){var t=$(this).parent().parent().find(".preview");"mouseenter"==e.type?t.fadeIn("fast"):"mouseleave"==e.type&&t.fadeOut("fast")}),$(".ModalTables").on("shown.bs.modal",function(){0==$("table td[colspan], table td[rowspan]",this).length&&$("table",this).addClass("table-hover")}),$(".collapseTitle").on("click",function(){var e=$(this).next(),t=$(this).find(".collapseIcon");e.is(":visible")?(e.slideUp("fast"),t.removeClass("opened")):(e.slideDown("fast"),t.addClass("opened"))}),$(".expandReduceText").on("click",function(e){e.preventDefault();var t=$("#articleText .ref"),i=$("#articleText .text"),o=$(this).data("expandreducetext");void 0===$(this).data("defaultwidth")&&$(this).data("defaultwidth",i.outerWidth()),!0==o?(t.hide(),i.outerWidth("100%"),$(this).data("expandreducetext",!1)):(i.width(""),t.show(),$(this).data("expandreducetext",!0));var a=$(window).scrollTop();setTimeout(function(){Article.ArticleStructureBuilder(),Article.ArticleStructureSelect(a)},100)}),$(".articleTxt .xref:not(.big)").on("click",function(){var e=$(this).text();$(".ref-list"),-1==e.indexOf(",")?(parseInt(e),e--):(e=(e=e.split(","))[0],parseInt(e),e--)}),Article.ArticleStructureBuilder(),t.top=t.top-25;var r=e.outerHeight(),s=$(".articleMenu").height();if(vbodyText=(hbodyText=$(".articleTxt").height())+100+"px",vbodyTextMobile=hbodyText+150+"px",window.setTimeout(function(){s=$(".articleMenu").height()},200),hbodyText<750&&$(".scielo__floatingMenu, .scielo__floatingMenuItem, .scielo__floatingMenuMobile").css({bottom:"auto",top:Article.IsTablet?vbodyTextMobile:vbodyText}),window.setTimeout(function(){$(".scielo__floatingMenu, .scielo__floatingMenuItem, .scielo__floatingMenuMobile").css({opacity:"1"})},200),$(window).scroll(function(){var e=$(window).scrollTop(),o=".scielo__floatingMenuCtt";Article.isScrolledIntoView(o)?$(o).hide():$(o).show(),e>t.top?($(".articleMenu").addClass("fixed").width(i),e>r+t.top-s-46?$(".articleMenu").addClass("fixedBottom"):$(".articleMenu").removeClass("fixedBottom")):$(".articleMenu").removeClass("fixed"),Article.ArticleStructureSelect(e),$(".alternativeHeader").stop(!1,!1)}),""!=window.location.hash){var c=window.location.hash,d=window.scrollY;$(c).modal("toggle").on("hidden.bs.modal",function(){window.location.hash="",$("body,html").scrollTop(d)})}$("[data-toggle='modal']").on("click",function(){var e=$(this).data("target"),t=window.scrollY;("undefined"!=e||""!=e)&&(window.location.hash=e),$(e).on("hidden.bs.modal",function(){window.location.hash="",$("body,html").scrollTop(t)})});var p=$(".downloadOptions li.group"),u=100/p.length;p.css("width",u+"%"),Article.fechaAutores();var f=!1;$(".short-link").mouseenter(function(e){if(!f){var t=window.location.href;if(-1!==t.indexOf("localhost"))var t="http://www.scielo.br";$.ajax({type:"GET",async:!1,url:"http://ref.scielo.org/api/v1/shorten",data:"url="+encodeURI(t),dataType:"jsonp",success:function(e){result=e,f=!0}})}});var h=new Clipboard(".short-link",{text:function(e){return result}});h.on("success",function(e){console.log("Sucess: "+e);var t=$(e.trigger);t.addClass("copyFeedback"),setTimeout(function(){t.removeClass("copyFeedback")},2e3)}),h.on("error",function(e){console.log("Error: "+e);var t=$(e.trigger);t.addClass("copyFeedbackError"),setTimeout(function(){t.removeClass("copyFeedbackError")},2e3)}),$("ul.floatingMenuMobile").on("click",function(){$(this).find(".fm-button-child").each(function(){$(this).addClass("tooltip-mobile-on")})});var m=!0;$("ul.floatingMenuMobile").on("focusout click",function(e){m?"focusout"!==e.type&&(m=!1,$(this).find(".fm-list").children("li").removeAttr("style"),$(this).find(".fm-button-main").addClass("fm-button-main-mobile-open")):(m=!0,$(this).find(".fm-list").children("li").css({opacity:0}),$(this).find(".fm-button-main").removeClass("fm-button-main-mobile-open"))})},isScrolledIntoView:function(e){var t=$(window).scrollTop()+$(window).height();return $("#standalonearticle").offset().top+$("#standalonearticle").height()<=t},ArticleStructureBuilder:function(){var e=$(".articleMenu"),t=$("#articleText .articleSection"),i=0,o="";Article.TopBinder=[],t.each(function(){var e=$(this).data("anchor"),t=$(this).find(".articleSectionTitle"),a=$(this).offset();if(0==$(this).find("a[name='articleSection"+i+"']").length&&$(this).prepend(""),0==i?Article.TopBinder.push(0):Article.TopBinder.push(a.top),void 0===e)return!0;if(o+="
  • ",o+=' '+e+"",t.length>1){var n=0;o+="
      ",t.each(function(){var e=$(this).offset();Article.TopBinder.push(e.top),0==$(this).prev("a[name='as"+i+"-heading"+n+"']").length&&$(this).before(""),o+="
    • ",o+=' '+$(this).text()+"",o+="
    • ",n++}),o+="
    "}o+="
  • ",i++}),e.html(o),$("a",e).on("click",function(e){e.preventDefault();var t=$(this).attr("href"),i=$("a[name="+(t=t.replace("#",""))+"]").offset();$("html,body").animate({scrollTop:i.top-60},500)})},ArticleStructureSelect:function(e){for(var t=$(".articleMenu"),i=0,o=Article.TopBinder.length;i=Article.TopBinder[i]-100){t.find("li").removeClass("selected"),t.find("li:eq("+i+")").addClass("selected");break}if(e<=Article.TopBinder[i]-100){t.find("li").removeClass("selected"),t.find("li:eq("+(i-1)+")").addClass("selected");break}}},Bindings:function(e){void 0===e&&(e=".article")},fechaAutores:function(){var e=$(".contribGroup"),t=$(".contribGroup .dropdown"),i=t.length;if(i>=10){var o=null,a=$(".outlineFadeLink"),n=t[0],l=t[i-1],r=$('');r.text("[...]"),r.css({padding:"10px",cursor:"pointer"});var s=$("
    "),c=$("");c.addClass("btn-fechar");var d=$("");d.addClass("sci-ico-floatingMenuClose"),c.append(d),s.append(c);var p=$("
    ");p.append(n),p.append(r),p.append(l),p.append(a),e.text(""),e.append(p),r.on("click",function(){o.tooltip("disable"),e.textContent="";for(var n=0;n990&&(Article.IsDesktop=!0),e>1206&&(Article.IsHD=!0),Article.DetectMobile(navigator.userAgent)&&(Article.IsMobile=!0),Article.DetectTablet(navigator.userAgent)&&(Article.IsTablet=!0,t?Article.IsTabletPortrait=!0:Article.IsTabletPortrait=!1,window.addEventListener("orientationchange",function(){0==screen.orientation.angle?Article.IsTabletPortrait=!0:Article.IsTabletPortrait=!1})),navigator.appVersion.indexOf("MSIE 8")>-1&&(Article.IsMobile=!1,Article.IsTablet=!1,Article.IsDesktop=!0,Article.IsOldIE=!0,Article.IsHD=!1)}};$(function(){$("body.article").length&&Article.Init()}); \ No newline at end of file diff --git a/opac/webapp/static/js/scielo-article.js b/opac/webapp/static/js/scielo-article.js index 960702b9..98668c3f 100644 --- a/opac/webapp/static/js/scielo-article.js +++ b/opac/webapp/static/js/scielo-article.js @@ -32,32 +32,35 @@ var Article = { var RefToolTip = { open: function(t) { - + var s = $(".xref",t), - d = s.next("span:eq(0)"), + d = s.next("span:eq(0)") p = t.position(), supHeight = s.outerHeight(), supPositionLeft = p.left, - li = t.closest("li"); - + li = t.closest("li"), + refTxt = s.parent().find("a").data("ref"); + s.parent().append("" + refTxt + ""); + + console.log('cliquei'); + if(li.length > 0) li.addClass("zindexFix"); - - d.removeClass("closed").addClass("opened").css({ + s.parent().find(".refCtt").removeClass("closed").addClass("opened").css({ "left": (supPositionLeft > 300) ? (-supPositionLeft/3) : 0 }).fadeIn("fast"); - + }, close: function(t) { - + var s = $(".xref",t), d = s.next("span:eq(0)"), li = t.closest("li"); - + if(li.length > 0) li.removeClass("zindexFix"); - - d.removeClass("opened").addClass("closed"); + s.parent().find(".refCtt").removeClass("opened").addClass("closed"); + s.parent().find(".refCtt").remove(); } }; @@ -234,30 +237,30 @@ var Article = { },200); if(hbodyText < 750){ - $(".floatingMenu, .floatingMenuItem, .floatingMenuMobile").css({ + $(".scielo__floatingMenu, .scielo__floatingMenuItem, .scielo__floatingMenuMobile").css({ "bottom": "auto", "top": Article.IsTablet ? vbodyTextMobile : vbodyText }); } window.setTimeout(function() { - $(".floatingMenu, .floatingMenuItem, .floatingMenuMobile").css({ + $(".scielo__floatingMenu, .scielo__floatingMenuItem, .scielo__floatingMenuMobile").css({ "opacity": "1" }); },200); $(window).scroll(function() { - var t = $(window).scrollTop(); - - if(Article.isScrolledIntoView('.floatingMenuCtt')){ - - $('.floatingMenuItem').css({position: 'absolute'}); - $('.floatingMenu').css({position: 'absolute'}); + var t = $(window).scrollTop(), + $floatingMenuCtt = '.scielo__floatingMenuCtt'; + + if(Article.isScrolledIntoView($floatingMenuCtt)){ + $($floatingMenuCtt).hide(); + }else{ - $('.floatingMenuItem').css({position: 'fixed'}); - $('.floatingMenu').css({position: 'fixed'}); + $($floatingMenuCtt).show(); } + if(t > articleTextP.top) { @@ -406,13 +409,15 @@ var Article = { }, isScrolledIntoView: function(elem){ - var docViewTop = $(window).scrollTop(); - var docViewBottom = docViewTop + $(window).height(); - var elemTop = $(elem).offset().top; - var elemBottom = elemTop + $(elem).height(); - return ((elemBottom <= docViewBottom) && (elemTop >= docViewTop)); + var docViewTop = $(window).scrollTop(); + var docViewBottom = docViewTop + $(window).height(); + var articleTop = $("#standalonearticle").offset().top; + var articleBottom = articleTop + $("#standalonearticle").height(); + + return articleBottom <= docViewBottom; }, + ArticleStructureBuilder: function() { var structure = $(".articleMenu"), content = $("#articleText .articleSection"), diff --git a/opac/webapp/templates/article/includes/levelMenu.html b/opac/webapp/templates/article/includes/levelMenu.html index 719f7b96..0b0b4f1e 100644 --- a/opac/webapp/templates/article/includes/levelMenu.html +++ b/opac/webapp/templates/article/includes/levelMenu.html @@ -7,7 +7,7 @@
    - home + home {# Sumário #} @@ -266,7 +266,7 @@
    - home + home {% trans %}Sumário{% endtrans %} diff --git a/opac/webapp/templates/base.html b/opac/webapp/templates/base.html index 790cee37..f1aff2d5 100644 --- a/opac/webapp/templates/base.html +++ b/opac/webapp/templates/base.html @@ -17,7 +17,7 @@ - +