Posted By


codesnipper2017 on 05/22/17

Tagged


Statistics


Viewed 665 times
Favorited by 1 user(s)

Hide Yahoo Mail Ads


/ Published in: jQuery
Save to your folder(s)

Hi, this snippet is used to hide ads within the new version of Yahoo Mail (2017)


Copy this code and paste it in your HTML
  1. $(function(){function e(){$("*").filter(function(){"pencil-ad"==$(this).data("test-id")&&!0===$(this).is(":visible")&&($(this).parent("li").hide(),console.log("Pencil Ad Hidden")),"infinite-scroll-content"==$(this).data("test-id")&&"0px"==$(this).css("margin-top")&&($(this).css("margin-top","-72px"),$(this).css("padding-bottom","72px"),console.log("Infinite Scroll Content Adjusted"))})}function a(){var e=new Array("right-rail-ad","efv-subheader","efv-video-container","toggle-folder-tree");$("*").filter(function(){$.inArray($(this).data("test-id"),e)>-1?!0===$(this).is(":visible")&&($(this).hide(),console.log($(this).attr("data-test-id")+" Hidden")):("mail-right-rail"==$(this).data("test-id")&&!1===$(this).hasClass("r_collapsed")&&($(this).replaceWith('<div data-test-id="mail-right-rail" class="D_F ek_BB iz_A iy_h r_collapsed"><div></div><div data-test-id="comms-properties-bar" aria-label="Keyboard navigation group. Use arrow keys to navigate, or tab to the next group." class="D_F en_0 gl_CI Y_6Fd5 U_6Fd5 N_6Fd5 X_6Fd5 ek_BB H_CS"><div><a href="https://canary-mg.mail.yahoo.com/d/settings/0?.partner=ycorp" class="D_F U_6EGz E_0 cdPFi_ZpQYvz cdPFi4_52qC ir3_Z1a7UWG" aria-label="Settings Menu" title="Settings Menu" target="SETTINGS" data-iskeynav="true" tabindex="90"><svg viewBox="0 0 20 20" class="D_X W_6LEV H_6LEV cdPFi_q cZW7ROP_n en_0"><path d="M10.025 13.157c-1.747 0-3.167-1.416-3.167-3.157s1.42-3.157 3.167-3.157c1.746 0 3.167 1.416 3.168 3.157 0 1.74-1.422 3.157-3.168 3.157m8.66-4.62c-.023-.005-.084-.02-1.344-.22l-1.018-.17c-.03-.004-.056-.026-.065-.056l-.005-.018-.008-.018-.038-.093c-.09-.215-.302-.732-.405-.973l-.006-.016-.01-.015c-.013-.027-.012-.06.007-.086l1.374-1.91c.132-.182.12-.43-.032-.603-.027-.028-.505-.505-1.43-1.425-.09-.09-.21-.14-.34-.14-.1 0-.196.03-.278.09l-1.92 1.37c-.012.01-.03.015-.048.015-.023-.003-.03-.005-.037-.01l-.02-.008-.018-.01-1.065-.44c-.088-.036-.092-.057-.095-.078l-.384-2.32c-.036-.234-.28-.402-.476-.402H9.027c-.24 0-.44.172-.477.408l-.38 2.307c-.004.01-.015.036-.045.063-.14.065-.794.33-1.08.447l-.036.015-.022.008-.02.01c-.01.006-.023.01-.036.01-.01 0-.03-.003-.046-.016l-.1-.072C4.98 2.888 4.957 2.874 4.935 2.862c-.07-.042-.154-.064-.24-.064-.06 0-.215.012-.335.123l.002.002c-.046.043-.17.166-.58.573l-.846.844-.01.01-.012.012c-.136.16-.158.372-.055.557v-.003c.082.14.354.515 1.4 1.955.017.023.02.057.005.084l-.01.016-.006.017-.043.097c-.134.317-.254.6-.404.974l-.006.016-.005.015c-.01.03-.035.054-.066.06L1.4 8.53c-.232.036-.403.237-.403.476v1.988c0 .237.177.44.412.476l2.316.38c.03.006.057.03.066.058l.004.014.005.014c.17.43.293.74.453 1.086l.005.01.005.01c.015.028.012.063-.007.09l-1.373 1.907-.077.167c-.038.16.007.335.13.456l.09.087 1.32 1.316c.09.09.21.14.34.14.103 0 .202-.03.285-.092l1.89-1.35c.03-.015.052-.023.066-.023.01 0 .036.003.086.02l.05.022c.373.16.642.276 1.02.42l.013.006.013.004c.03.01.052.035.058.065l.384 2.318c.028.21.252.405.478.405h1.994c.24 0 .44-.172.477-.408l.378-2.286c.02-.06.047-.094.214-.153.353-.14.62-.246.962-.4.03-.01.056-.015.07-.015.007 0 .022 0 .053.018l1.902 1.358.015.012.02.01c.076.047.162.07.25.07.114 0 .223-.04.314-.117l.012-.012.012-.012.705-.703c.56-.563.703-.708.753-.77.055-.074.13-.22.07-.413-.004-.017-.01-.034-.02-.055l-.01-.025H17.2c-.057-.108-.198-.3-.547-.773l-.86-1.197c-.018-.026-.02-.06-.006-.087l.01-.017.006-.018.434-1.047c.047-.085.066-.1.108-.113 2.255-.362 2.333-.387 2.367-.397l.012-.004.012-.005c.208-.078.317-.285.317-.448V9.006c.002-.22-.146-.41-.37-.468"></path></svg></a><div class="D_F cdPFi_52qC"></div></div><div data-test-id="comms-properties" role="navigation" aria-label="Navigate to other Yahoo properties like Messenger, Calendar, Contacts and Notepad" class="D_F ek_BB Y_6EGz"><a href="https://messenger.yahoo.com/" class="D_F U_6EGz E_0 cdPFi_ZpQYvz cdPFi4_52qC ir3_Z1a7UWG" aria-label="Messenger" title="Messenger" target="MESSENGER" data-iskeynav="true" tabindex="90"><svg viewBox="0 0 20 20" class="D_X W_6LEV H_6LEV cdPFi_q cZW7ROP_n en_0"><path d="M10 2c-4.42 0-8 3.58-8 8 0 4.417 3.58 8 8 8 4.417 0 7.998-3.583 7.998-8 0-4.42-3.58-8-7.998-8zm2.264 4.563c.51 0 .922.413.922.922 0 .51-.413.922-.922.922-.51 0-.922-.413-.922-.922 0-.51.413-.922.922-.922zm-4.553 0c.51 0 .923.424.923.948s-.413.948-.922.948c-.508 0-.92-.424-.92-.948s.412-.947.92-.947zm5.954 7.386c-.816.715-2.664 1.064-3.653 1.05-1.01.014-2.836-.335-3.652-1.05-1.24-1.09-1.376-2.95-1.376-3.363H15.04c0 .413-.135 2.273-1.376 3.362z"></path></svg></a><a href="https://address.yahoo.com/" class="D_F U_6EGz E_0 cdPFi_ZpQYvz cdPFi4_52qC ir3_Z1a7UWG" aria-label="Contacts" title="Contacts" target="CONTACTS" data-iskeynav="true" tabindex="-1"><svg viewBox="0 0 20 20" class="D_X W_6LEV H_6LEV cdPFi_q cZW7ROP_n en_0"><path d="M16.5 2H14v4.5h3.5V3c-.007-.667-.34-1-1-1zM14 12h3.5V8h-3.49zM2.5 3v14c0 .667.333 1 1 1h9V2h-9c-.667 0-1 .333-1 1zM14 18h2.5c.66 0 .993-.333 1-1v-3.5H14V18z"></path></svg></a><a href="https://calendar.google.com/a/yahoo-inc.com" class="D_F U_6EGz E_0 cdPFi_ZpQYvz cdPFi4_52qC ir3_Z1a7UWG" aria-label="Calendar" title="Calendar" target="CALENDAR" data-iskeynav="true" tabindex="-1"><svg viewBox="0 0 20 20" class="D_X W_6LEV H_6LEV cdPFi_q cZW7ROP_n en_0"><path d="M18 3.496h-3v-.46c0-.552-.448-1-1-1-.553 0-1 .448-1 1v.46H6.998v-.46c0-.552-.448-1-1-1s-1 .448-1 1v.46H2c-.633 0-1 .36-1 1v11.5c0 .64.367 1 1 1h16c.633 0 1-.36 1-1v-11.5c0-.64-.367-1-1-1zm-7.95 8.276v.002c0 1.296-.944 2.247-2.475 2.247-.982 0-1.717-.304-2.277-.784-.137-.12-.254-.325-.254-.54 0-.393.332-.727.725-.727.216 0 .36.088.48.186.393.334.806.51 1.344.51.57 0 .972-.324.972-.834v-.02c0-.56-.5-.873-1.344-.873h-.236c-.353 0-.647-.295-.647-.647 0-.208.087-.384.323-.62L7.998 8.33h-2.11c-.353 0-.65-.295-.65-.65 0-.35.297-.647.65-.647h3.346c.44 0 .765.255.765.668 0 .374-.176.58-.453.845L8.203 9.83c.932.157 1.846.647 1.846 1.923v.02zm4.205 2.19c-.412 0-.746-.334-.746-.746v-4.75l-.532.137c-.078.02-.186.04-.265.04-.352 0-.656-.294-.656-.647 0-.305.195-.56.498-.648l.973-.284c.284-.08.5-.128.707-.128h.02c.41 0 .745.333.745.745v5.536c0 .412-.333.746-.745.746z"></path></svg></a><a href="https://calendar.yahoo.com/?view=notepad" class="D_F U_6EGz E_0 cdPFi_ZpQYvz cdPFi4_52qC ir3_Z1a7UWG" aria-label="Notepad" title="Notepad" target="NOTEPAD" data-iskeynav="true" tabindex="-1"><svg viewBox="0 0 20 20" class="D_X W_6LEV H_6LEV cdPFi_q cZW7ROP_n en_0"><path d="M13 14.73V18l4-4h-3.11c-.66 0-.89.063-.89.73zM16 2H4c-.667 0-1 .333-1 1v14c0 .626.305.946.892.985.053.01.096.015.108.015h7.51v-4.23c.018-.832.438-1.25 1.266-1.256H17V3c-.007-.667-.34-1-1-1zM9 14H6.89c-.43 0-.78-.335-.78-.75s.35-.75.78-.75H9c.43 0 .778.335.778.75S9.428 14 9 14zm4.11-3.5H6.89c-.43 0-.78-.335-.78-.75S6.46 9 6.89 9h6.22c.43-.01.78.335.78.75s-.35.75-.78.75zm0-3.5H6.89c-.43 0-.78-.335-.78-.75s.35-.75.78-.75h6.22c.43 0 .78.335.78.75s-.35.75-.78.75z"></path></svg></a></div></div></div>'),console.log("Mail Right Rail Modified")),"keyboard-toggle-smartview-list"==$(this).data("test-id")&&!0===$(this).is(":visible")&&($(this).parent().parent().hide(),console.log("Smart View Hidden")),"feedback-panel"==$(this).data("test-id")&&!0===$(this).is(":visible")&&("feedback-panel"==$(this).data("test-id")&&$(this).parent().parent().prev().hide(),console.log("Left Rail Ads Hidden"),"feedback-panel"==$(this).data("test-id")&&$(this).parent().parent().hide(),console.log("FeedBack Panel Hidden")))})}function t(){var e={compose_button:{level:"self",class:"sty-compose-button"},tab_list:{level:"parent",class:"sty-mail-app-divider"},mail_left_rail:{level:"self",class:"sty-mail-side-rails"},mail_right_rail:{level:"self",class:"sty-mail-side-rails"},message_toolbar:{level:"self",class:"sty-message-toolbar"},message_group_list_container:{level:"grandparent",class:"sty-message-container"},resizer:{level:"self",class:"sty-resizer"},selection_count:{level:"self",class:"sty-selection-count"},message_group_view:{level:"grandparent",class:"sty-message-group-view"},search_basic_btn:{level:"self",class:"sty-search-button"},folder_item_container:{level:"self",class:"sty-folder-item"},efv_toolbar:{level:"self",class:"sty-efv-toolbar"},efv_container_visible:{level:"self",class:"sty-efv-container-visible"},efv_header:{level:"self",class:"sty-efv-header"}};$("*").filter(function(){if(void 0!==$(this).data("test-id")){var a=$(this).data("test-id");if((a=a.replaceAll("-","_"))in e){switch(e[a].level){case"self":t=$(this);break;case"child":t=$(this).children("span");break;case"parent":t=$(this).parent();break;case"grandparent":var t=$(this).parent().parent()}!1===t.hasClass(e[a].class)&&(t.addClass(e[a].class),console.log('class "'+e[a].class+'" Added'))}}})}String.prototype.replaceAll=function(e,a){return this.replace(new RegExp(e,"g"),a)},a(),t(),setInterval(function(){e()},1e3),setInterval(function(){a()},4e3),setInterval(function(){t()},8e3)});

URL: mail.yahoo.com

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.