]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
clean up avatar code a little
authorAnthony Minessale <anthm@freeswitch.org>
Wed, 22 Jul 2015 16:44:20 +0000 (11:44 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Wed, 22 Jul 2015 16:44:29 +0000 (11:44 -0500)
html5/verto/video_demo/index.html
html5/verto/video_demo/verto.js

index d65d89117335cb3f99f513c3ee9d7f89ed2471c5..bd3d98fe4a751897afbf7d3998551ebc92f391b2 100644 (file)
@@ -537,6 +537,8 @@ if ($('#devices').is(':visible')) {
          <input type="text" id="ext""/>
       </div>
 
+      <img width="200" id="avatar_img"/><br>
+
        <!--Comment out to "EOC" comment to disable Googleb Login -->
        <button data-inline="true" id="signinButton">Import Google Credentials</button>
        <!--<button data-inline="true" id="signoutButton">Sign out with Google</button>-->
index 95a79c5902c53ddf54898970315422042f928ab0..f20f38596275b9c3516f4f4e2a5d288b17b883c4 100644 (file)
@@ -869,7 +869,7 @@ $("#nosharebtn").click(function() {
 
 $("#nosharebtn").hide();
 
-function pop(id, cname, dft) {
+function pop(id, cname, dft, onchange) {
     var tmp = $.cookie(cname) || dft;
     $.cookie(cname, tmp, {
         expires: 365
@@ -881,20 +881,30 @@ function pop(id, cname, dft) {
         $.cookie(cname, $(id).val(), {
             expires: 365
         });
+
+       if (onchange) {
+           onchange($(id));
+       }
     });
 }
 
-function pop_select(id, cname, dft) {
+function pop_select(id, cname, dft, onchange) {
     var tmp = $.cookie(cname) || dft;
     $.cookie(cname, tmp, {
        expires: 365
     });
         // $("#usecamera").find(":selected").val()
     $(id).change(function() {
+       if (!save_settings) return;
+
        tmp =  $(id).find(":selected").val();
        $.cookie(cname, tmp, {
            expires: 365
        });
+
+       if (onchange) {
+           onchange($(id));
+       }
     });
 }
 
@@ -1011,10 +1021,16 @@ function init() {
        pop("#ext", "verto_demo_ext", "3500");
     }
 
-    pop("#avatar", "verto_demo_avatar", "");
+    pop("#avatar", "verto_demo_avatar", "", function(jq) { 
+       $("#avatar_img").attr("src", jq.val());
+    });
     pop("#cidname", "verto_demo_name", "FreeSWITCH User");
     pop("#cid", "verto_demo_cid", "1008");
-    pop("#email", "verto_demo_emailaddr", "");
+    pop("#email", "verto_demo_emailaddr", "", function(jq) {
+       $("#avatar").val("http://gravatar.com/avatar/" + md5($("#email").val()) + ".png?s=600");
+       $("#avatar_img").attr("src", $("#avatar").val());
+       $("#avatar").change();
+    });
     pop("#textto", "verto_demo_textto", "1000");
 
     pop("#login", "verto_demo_login", "1008");
@@ -1023,6 +1039,9 @@ function init() {
     pop("#hostName", "verto_demo_hostname", window.location.hostname);
     pop("#wsURL", "verto_demo_wsurl", "wss://" + window.location.hostname + ":8082");
 
+
+    $("#avatar_img").attr("src", $("#avatar").val());
+
     var tmp = $.cookie("verto_demo_vid_checked") || "true";
     $.cookie("verto_demo_vid_checked", tmp, {
         expires: 365
@@ -1427,14 +1446,6 @@ function init() {
        }});
     });
 
-    $("#email").change(function(e) {
-        $("#avatar").val("http://gravatar.com/avatar/" + md5($("#emailaddr").val()) + ".png?s=600");
-        $.cookie("verto_demo_email", e.currentTarget.value, {
-            expires: 365
-        });
-       
-    });
-
     $("#login").change(function(e) {
         $("#cid").val(e.currentTarget.value);
         $.cookie("verto_demo_cid", e.currentTarget.value, {