ml-tools icon indicating copy to clipboard operation
ml-tools copied to clipboard

Select option rather than delete

Open CJP123 opened this issue 5 years ago • 0 comments

Found your code really helpful but made a modification for "sparse" images that required a lot of de-selection. Thought I would thank you and share this code.

javascript:(function(e, s) {
    e.src = s;
    e.onload = function() {
        jQuery.noConflict();
        jQuery('<style type="text/css"> .add { opacity:0.3;}\n .urlmodal {padding: 10px; background-color: #eee; position: fixed; bottom: 0; right: 0; height: 100px; width: 300px; z-index: 1000;} .urlmodal textarea {width: 100%; height: 250px;}</style>').appendTo('head');
        jQuery('<div class="urlmodal"><h3>Create a dataset</h3><textarea></textarea></div>').appendTo('body');
        jQuery('#rg').on('click', '.rg_di', function() {
            jQuery(this).toggleClass('add');
            var urls = Array.from(document.querySelectorAll('.rg_di.add .rg_meta')).map(el=>JSON.parse(el.textContent).ou);
            jQuery('.urlmodal textarea').val(urls.join("\n"));
            jQuery('.urlmodal h3').html('Total Images:'+urls.length);
            return false;
        });
    };
    document.head.appendChild(e);
})(document.createElement('script'), '//code.jquery.com/jquery-latest.min.js');

CJP123 avatar May 15 '19 21:05 CJP123