Skip to content

Instantly share code, notes, and snippets.

@andyw330
Created August 17, 2015 12:39
Show Gist options
  • Save andyw330/cb4db81a3634108bee85 to your computer and use it in GitHub Desktop.
Save andyw330/cb4db81a3634108bee85 to your computer and use it in GitHub Desktop.

Revisions

  1. andyw330 created this gist Aug 17, 2015.
    26 changes: 26 additions & 0 deletions dcard-flip-the-card.user.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    // ==UserScript==
    // @name Dcard 抽卡
    // @version 1.0
    // @description 讓抽卡更有趣
    // @author A person in the world
    // @require https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js
    // @require https://gist.github.com/raw/2625891/waitForKeyElements.js
    // @match https://www.dcard.tw/*
    // @grant GM_addStyle
    // ==/UserScript==

    GM_addStyle(".dcard-photo-placeholder img {display: none;} .dcard-photo-placeholder + div tr:first-child td {color: #f9f9f9;}");

    var card_hidder_html = '<img class="img-responsive img-responsive-center ng-isolate-scope" alt="Dcard logo QAQ" src="/img/logo.png" ng-src="/img/logo.png" style="display: block; padding: 175px 85px; background: rgb(31, 88, 122);">'

    waitForKeyElements ('div.dcard-photo-placeholder', actionFunction);
    function actionFunction(jNode){
    var card = jNode.children().first();
    jNode.prepend(card_hidder_html);
    var card_hidder = card.prev();
    card_hidder.click(function(){
    card_hidder.fadeOut('normal', function() {
    card.fadeIn();
    });
    });
    };