web/ldt/media/js/embed_popup.js
author ymh <ymh.work@gmail.com>
Mon, 18 Apr 2011 16:28:20 +0200
changeset 142 77fdf5d1786c
parent 96 a8eeb7253e58
permissions -rw-r--r--
Added tag V00.32 for changeset ebca39584596
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
96
a8eeb7253e58 Static corrections in ldt/media
wakimd
parents:
diff changeset
     1
var display_state = "player";
a8eeb7253e58 Static corrections in ldt/media
wakimd
parents:
diff changeset
     2
a8eeb7253e58 Static corrections in ldt/media
wakimd
parents:
diff changeset
     3
function toggle_display() {
a8eeb7253e58 Static corrections in ldt/media
wakimd
parents:
diff changeset
     4
	$j.each(["player","seo_body","seo_meta","links"], function(i,display_str) {
a8eeb7253e58 Static corrections in ldt/media
wakimd
parents:
diff changeset
     5
a8eeb7253e58 Static corrections in ldt/media
wakimd
parents:
diff changeset
     6
		var div_selector = "#"+display_str+"_code";
a8eeb7253e58 Static corrections in ldt/media
wakimd
parents:
diff changeset
     7
		if(display_str == display_state) {
a8eeb7253e58 Static corrections in ldt/media
wakimd
parents:
diff changeset
     8
			$j(div_selector).show();
a8eeb7253e58 Static corrections in ldt/media
wakimd
parents:
diff changeset
     9
		}
a8eeb7253e58 Static corrections in ldt/media
wakimd
parents:
diff changeset
    10
		else {
a8eeb7253e58 Static corrections in ldt/media
wakimd
parents:
diff changeset
    11
			$j(div_selector).hide();
a8eeb7253e58 Static corrections in ldt/media
wakimd
parents:
diff changeset
    12
		}
a8eeb7253e58 Static corrections in ldt/media
wakimd
parents:
diff changeset
    13
	});
a8eeb7253e58 Static corrections in ldt/media
wakimd
parents:
diff changeset
    14
}
a8eeb7253e58 Static corrections in ldt/media
wakimd
parents:
diff changeset
    15
a8eeb7253e58 Static corrections in ldt/media
wakimd
parents:
diff changeset
    16
$j(document).ready(function(){
a8eeb7253e58 Static corrections in ldt/media
wakimd
parents:
diff changeset
    17
	
a8eeb7253e58 Static corrections in ldt/media
wakimd
parents:
diff changeset
    18
	toggle_display();
a8eeb7253e58 Static corrections in ldt/media
wakimd
parents:
diff changeset
    19
	
a8eeb7253e58 Static corrections in ldt/media
wakimd
parents:
diff changeset
    20
	$j('.ldt_json_link').click(function(e) {
a8eeb7253e58 Static corrections in ldt/media
wakimd
parents:
diff changeset
    21
    	e.preventDefault();
a8eeb7253e58 Static corrections in ldt/media
wakimd
parents:
diff changeset
    22
 		link = $j(e.target);
a8eeb7253e58 Static corrections in ldt/media
wakimd
parents:
diff changeset
    23
 		$j("#res_link_{{player_id}}").load(link.attr("href"));
a8eeb7253e58 Static corrections in ldt/media
wakimd
parents:
diff changeset
    24
 		$j("#res_link_{{player_id}}").show();
a8eeb7253e58 Static corrections in ldt/media
wakimd
parents:
diff changeset
    25
 		return false;
a8eeb7253e58 Static corrections in ldt/media
wakimd
parents:
diff changeset
    26
    });
a8eeb7253e58 Static corrections in ldt/media
wakimd
parents:
diff changeset
    27
a8eeb7253e58 Static corrections in ldt/media
wakimd
parents:
diff changeset
    28
    $j('#player_button').click(function(e) {
a8eeb7253e58 Static corrections in ldt/media
wakimd
parents:
diff changeset
    29
    	display_state = "player";
a8eeb7253e58 Static corrections in ldt/media
wakimd
parents:
diff changeset
    30
    	toggle_display();
a8eeb7253e58 Static corrections in ldt/media
wakimd
parents:
diff changeset
    31
    });
a8eeb7253e58 Static corrections in ldt/media
wakimd
parents:
diff changeset
    32
    $j('#seo_body_button').click(function(e) {
a8eeb7253e58 Static corrections in ldt/media
wakimd
parents:
diff changeset
    33
    	display_state = "seo_body";
a8eeb7253e58 Static corrections in ldt/media
wakimd
parents:
diff changeset
    34
    	toggle_display();
a8eeb7253e58 Static corrections in ldt/media
wakimd
parents:
diff changeset
    35
    });
a8eeb7253e58 Static corrections in ldt/media
wakimd
parents:
diff changeset
    36
    $j('#seo_meta_button').click(function(e) {
a8eeb7253e58 Static corrections in ldt/media
wakimd
parents:
diff changeset
    37
    	display_state = "seo_meta";
a8eeb7253e58 Static corrections in ldt/media
wakimd
parents:
diff changeset
    38
    	toggle_display();
a8eeb7253e58 Static corrections in ldt/media
wakimd
parents:
diff changeset
    39
    });
a8eeb7253e58 Static corrections in ldt/media
wakimd
parents:
diff changeset
    40
    $j('#links_button').click(function(e) {
a8eeb7253e58 Static corrections in ldt/media
wakimd
parents:
diff changeset
    41
    	display_state = "links";
a8eeb7253e58 Static corrections in ldt/media
wakimd
parents:
diff changeset
    42
    	toggle_display();
a8eeb7253e58 Static corrections in ldt/media
wakimd
parents:
diff changeset
    43
    });
a8eeb7253e58 Static corrections in ldt/media
wakimd
parents:
diff changeset
    44
a8eeb7253e58 Static corrections in ldt/media
wakimd
parents:
diff changeset
    45
   $j("#copy_button").click(function(e) {
a8eeb7253e58 Static corrections in ldt/media
wakimd
parents:
diff changeset
    46
 	   alert($j("#"+display_state+"_code").html());
a8eeb7253e58 Static corrections in ldt/media
wakimd
parents:
diff changeset
    47
   });	 	    
a8eeb7253e58 Static corrections in ldt/media
wakimd
parents:
diff changeset
    48
    
a8eeb7253e58 Static corrections in ldt/media
wakimd
parents:
diff changeset
    49
});