{"size": 2939, "ext": "js", "max_stars_repo_path": "templates/qor/media/views/assets/javascripts/qor_redactor_media_display_mode.js", "max_stars_repo_name": "x0rzkov/proxi", "max_stars_repo_stars_event_min_datetime": "2017-02-24T17:44:11.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-25T22:13:37.000Z", "max_issues_repo_path": "templates/qor/media/views/assets/javascripts/qor_redactor_media_display_mode.js", "max_issues_repo_name": "x0rzkov/proxi", "max_issues_repo_issues_event_min_datetime": "2020-03-02T06:25:31.000Z", "max_issues_repo_issues_event_max_datetime": "2021-05-11T05:58:06.000Z", "max_forks_repo_path": "templates/qor/media/views/assets/javascripts/qor_redactor_media_display_mode.js", "max_forks_repo_name": "x0rzkov/proxi", "max_forks_repo_forks_event_min_datetime": "2017-02-24T17:44:24.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-05T23:51:51.000Z"}
{"max_stars_count": 61, "max_issues_count": 14, "max_forks_count": 27, "avg_line_length": 2939.0, "max_line_length": 2939, "alphanum_fraction": 0.7124872406}
"use strict";$R.add("plugin","mediadisplaymode",{langs:{en:{mediaDisplayMode:"Media Display Mode",mediaDisplayModeButton:"Display mode"}},getEditterButton:function(){return'<a href="#"><span id="redactor-image-displaymode" data-redactor="verified" contenteditable="false">mediaDisplayModeButton</span></a>'},init:function(e){this.app=e,this.opts=e.opts,this.lang=e.lang,this.block=e.block,this.toolbar=e.toolbar,this.mediadisplaymode={}},start:function(){var e=$(this.app.editor.$editor.nodes[0]),a=this.opts.mediaDisplayModeOptions||"",i="",d=e.find("img");"pre"!==this.opts.type&&"inline"!==this.opts.type&&""!==a&&(a.split(/\||,/).forEach(function(e){var a=e.toLowerCase().replace(/\s/g,"");i=i+'<option value="'+a+'">'+e+"</option>"}),this.mediadisplaymode.$modes=i,e.on("click.redactor-mediadisplaymode touchstart.redactor-mediadisplaymode",d,this.setImageEditter.bind(this)))},insertButton:function(e){var a=this;if(e.is("img")){var i=$(a.getEditterButton()).prependTo($(".redactor-context-toolbar.open"));i.on("click.redactor-mediadisplaymode",function(){a.show.bind(a)(i)})}},removeButton:function(e){$(e.target).closest("#redactor-image-box").length||($("#redactor-image-displaymode").remove(),$(document).off("click.redactor-mediadisplaymode"),$("#modal-media-display-mode").closest("#redactor-modal").remove())},setImageEditter:function(e){var a=this,i=$(e.target),d=i.closest("figure");this.mediadisplaymode.$imageTag=d,this.mediadisplaymode.$image=i,this.mediadisplaymode.currentDisplaymode=this.getDisplayMode(d.attr("class")),$(document).on("click.redactor-mediadisplaymode",this.removeButton),setTimeout(function(){a.insertButton(i)},10)},getDisplayMode:function(e){var a=e?e.match(/rd-display-\w+/):null;return a&&(a=a[0].replace("rd-display-","")),a},modals:{mediaModal:'<div class="redactor-modal-tab redactor-group">\n    <div id="redactor-image-preview" class="redactor-modal-tab-side"></div>\n    <div class="redactor-modal-tab-area" id="redactor-modal-displaymode">\n        <section>\n            <select id="modal-media-display-mode">\n                <option value="0">Please select display mode</option>\n            </select>\n        </section>\n    </div></div>'},show:function(e){this.app.api("module.modal.build",{name:"mediaModal",title:"Media Display Mode",handle:"save",commands:{save:{title:"Save"},cancel:{title:"Cancel"}}})},onmodal:{mediaModal:{open:function(e,a){var i=this.mediadisplaymode.currentDisplaymode;$("#modal-media-display-mode").append(this.mediadisplaymode.$modes),$("#modal-media-display-mode").val(i||0),$("#redactor-image-preview").html('<img src="'+this.mediadisplaymode.$image.prop("src")+'" style="max-width: 100%; opacity: 1">')},save:function(e,a){var i=$("#modal-media-display-mode").val(),d=this.mediadisplaymode.$imageTag;d.removeClass(function(e,a){return(a.match(/rd-display-\w+/g)||[]).join(" ")}),0!=i&&d.addClass("rd-display-"+i),this.app.api("module.modal.close")}}}});