PluginProbe
Simple Accessibility Button / 2.2.0
Simple Accessibility Button v2.2.0
trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.8 1.0.9 1.1.0 1.1.2 1.1.4 1.1.5 1.1.6 2.0.0 2.0.1 2.0.2 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 All 31 releases
yydevelopment-accessibility / include / scripts.php

scripts.php in Simple Accessibility Button 2.2.0, at include/scripts.php

52 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?>
2 <script>
3
4 jQuery("document").ready(function($) {
5
6 // ==================================================
7 // Dealing with uploading images
8 // ==================================================
9
10 $('.yydev_upload_image, .yydev_light_img_bg').click(function(e) {
11
12 var uploadButtonParent = $(this).parent();
13
14 e.preventDefault();
15 var image = wp.media({
16 title: 'Upload Image'}).open()
17 .on('select', function(e){
18
19 // This will return the selected image from the Media Uploader, the result is an object
20 var images_length = image.state().get("selection").length;
21 var images = image.state().get("selection").models;
22
23 console.log(images);
24
25 var image_url = images[0].toJSON().url;
26 var image_alt = images[0].toJSON().alt;
27 var image_caption = images[0].toJSON().caption;
28 var image_title = images[0].toJSON().title;
29 var image_id = images[0].toJSON().id;
30
31 // Let's assign the url value to the input field
32 uploadButtonParent.find('.yydev_light_img_bg').attr('src', image_url); // changing image icon
33 uploadButtonParent.find('.yydev_image_input').val(image_url); // changing input url
34
35 }); // .on('select', function(e){
36
37 }); // $('.edit-button-image-upload').click(function(e) {
38
39 // ==================================================
40 // Changing the background of icon image on background change
41 // ==================================================
42
43 $('input#background_color').change(function() {
44
45 var backgroundValue = $(this).val();
46 $("img.yydev_light_img_bg").css("background", backgroundValue);
47
48 }); // $('input#background_color').change(function() {
49
50 }); // jQuery("document").ready(function($) {
51
52 </script>