TheFabulousPika / steam-chatlog-to-text

A chrome extension that converts Steam webchat log to text format
2 stars 0 forks source link

ChatSettingsIssue: Image #31

Closed TheFabulousPika closed 3 years ago

TheFabulousPika commented 3 years ago

Don't embed images and other media in-line: ON


<div class="msgText " data-copytext="">
  <div class="NonInlinedEmbed" data-copystyle="merge-adjacent" data-copytext="https://images.brickset.com/sets/large/6811-1.jpg"><a title="https://images.brickset.com/sets/large/6811-1.jpg" href="https://images.brickset.com/sets/large/6811-1.jpg"><svg xmlns="http://www.w3.org/2000/svg" version="1.1" class="SVGIcon_Button SVGIcon_Image" x="0px" y="0px" viewBox="0 0 100 100" enable-background="new 0 0 100 100">
        <path stroke="#ffffff" fill="#ffffff" d="M83.086,12.091H16.913C10.344,12.091,5,17.435,5,24.004v51.992l0.005,0.102c0.056,6.514,5.396,11.813,11.908,11.813h66.173  c6.531,0,11.874-5.314,11.906-11.764L95,24.004C95,17.435,89.654,12.091,83.086,12.091z M83.086,82.989H16.913  c-3.516,0-6.488-2.653-6.93-6.106l18.899-20.615c1.226-1.34,2.85-2.076,4.574-2.076c1.723,0,3.347,0.736,4.574,2.078l19.611,21.393  c0.885,0.961,2.508,1.029,3.473,0.148c1-0.916,1.068-2.476,0.152-3.478l-4.113-4.485l8.406-8.918  c1.258-1.332,2.926-2.064,4.696-2.064c1.772,0,3.44,0.732,4.696,2.064l15.061,15.973C89.564,80.346,86.594,82.989,83.086,82.989z   M90.08,69.801L78.532,57.555c-2.194-2.328-5.132-3.609-8.275-3.609c-3.142,0-6.08,1.281-8.272,3.609l-8.164,8.656l-12.162-13.27  c-2.171-2.366-5.084-3.67-8.201-3.67c-3.119,0-6.031,1.304-8.202,3.67L9.92,69.673V24.004c0-3.856,3.137-6.994,6.993-6.994h66.173  c3.857,0,6.994,3.137,6.994,6.994V69.801z"></path>
        <path stroke="#ffffff" fill="#ffffff" d="M68.907,22.489c-6.569,0-11.914,5.344-11.914,11.914c0,6.569,5.345,11.913,11.914,11.913  c6.567,0,11.913-5.344,11.913-11.913C80.82,27.833,75.477,22.489,68.907,22.489z M68.907,41.396c-3.856,0-6.993-3.137-6.993-6.993  s3.137-6.994,6.993-6.994c3.854,0,6.991,3.138,6.991,6.994S72.764,41.396,68.907,41.396z"></path>
      </svg>https://images.brickset.com/sets/large/6811-1.jpg</a></div>
</div>
TheFabulousPika commented 3 years ago

function checkFormatting(a,b){
    var thisMsgNode = a;
    var checkClassName = "'[class*=" + b + "]'";
    var testResult = thisMsgNode.querySelectorAll(eval(checkClassName)).length;
  alert(testResult);
    if (testResult == 0){
    return false;
    }
    else {
    return true;
    }
}
TheFabulousPika commented 3 years ago

    else if (checkFormatting(thisMsgNode,"NonInlined")){
    var dataCopyText = thisMsgNode.getElementsByClassName("NonInlined")[0].getAttributeNode("data-copytext").value;
    cleanedMsgText = dataCopyText;
    }
TheFabulousPika commented 3 years ago

Giphy


<div class="NonInlinedEmbed" data-copystyle="merge-adjacent" data-copytext="/giphy more
https://giphy.com/gifs/more-kylo-ren-1jXGsHY2EKdL27mEMd"><a title="https://giphy.com/gifs/more-kylo-ren-1jXGsHY2EKdL27mEMd" href="https://giphy.com/gifs/more-kylo-ren-1jXGsHY2EKdL27mEMd">
    <div class="NonInlinedEmbedLogo NonInlinedEmbedLogo_Giphy"></div><span style="font-weight: bold;"> /GIPHY <span class="giphySearch">more</span></span>
  </a></div>