| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176 |
- $(document).ready(function(){
-
- function doNotShowPopup(){
- $.get(baseUrl+"Usersettings/donotshowregistrationpopup", {format:"json"});
- }
- var dialog = $("#register_popup");
-
- dialog.dialog({
- autoOpen: false,
- width: 500,
- resizable: false,
- modal: true,
- position:['center',50],
- close: doNotShowPopup,
- buttons: [
- {
- id: "remind_me",
- text: $.i18n._("Remind me in 1 week"),
- "class": "btn",
- click: function() {
- var url = baseUrl+'Usersettings/remindme';
- $.ajax({
- url: url,
- data: {format:"json"}
- });
- $(this).dialog("close");
- }
- },
- {
- id: "remind_never",
- text: $.i18n._("Remind me never"),
- "class": "btn",
- click: function() {
- var url =baseUrl+'Usersettings/remindme-never';
- $.ajax({
- url: url,
- data: {format:"json"}
- });
- $(this).dialog("close");
- }
- },
- {
- id: "help_airtime",
- text: sprintf($.i18n._("Yes, help %s"), PRODUCT_NAME),
- "class": "btn",
- click: function() {
- $("#register-form").submit();
- }
- }
- ]
- });
-
- var button = $("#help_airtime");
-
- if($("#link_to_terms_and_condition").length > 0 ){
- button.removeAttr('disabled').removeClass('ui-state-disabled');
- }else{
- button.attr('disabled', 'disabled' ).addClass('ui-state-disabled');
- }
- dialog.dialog('open');
-
- $('.collapsible-header').live('click',function() {
- $(this).next().toggle('fast');
- $(this).toggleClass("close");
- return false;
- }).next().hide();
-
- $("#SupportFeedback").live('click', function(){
- var pub = $("#Publicise");
- var privacy = $("#Privacy");
- var button = $("#help_airtime");
- if( !$(this).is(':checked') ){
- pub.removeAttr("checked");
- pub.attr("disabled", true);
- $("#public-info").hide();
- button.attr('disabled', 'disabled' ).addClass('ui-state-disabled');
- }else{
- pub.removeAttr("disabled");
- if(privacy.length == 0 || privacy.is(':checked')){
- button.removeAttr('disabled').removeClass('ui-state-disabled');
- }
- }
- });
- var promote = $("#Publicise");
- promote.live('click', function(){
- if($(this).is(':checked')){
- $("#public-info").show();
- }else{
- $("#public-info").hide();
- }
- });
- if( promote.is(":checked")){
- $("#public-info").show();
- }
-
- $("#Privacy").live('click', function(){
- var support = $("#SupportFeedback");
- var button = $("#help_airtime");
- if($(this).is(':checked') && support.is(':checked')){
- button.removeAttr('disabled').removeClass('ui-state-disabled');
- }else{
- button.attr('disabled', 'disabled' ).addClass('ui-state-disabled');
- }
- });
-
- if($("#SupportFeedback").is(':checked') && ($("#Privacy").length == 0 || $("#Privacy").is(':checked'))){
- button.removeAttr('disabled').removeClass('ui-state-disabled');
- }else{
- button.attr('disabled', 'disabled' ).addClass('ui-state-disabled');
- }
-
- $('.toggle legend').live('click',function() {
- $('.toggle').toggleClass('closed');
- return false;
- });
-
- $("#Logo").live('change', function(ev){
- var content, res, logoEl;
-
- content = $(this).val();
- res = content.match(/(jpg|jpeg|png|gif)$/gi);
- logoEl = $("#Logo-element");
-
- //not an accepted image extension.
- if (!res) {
- var ul, li;
-
- ul = logoEl.find('.errors');
- li = $("<li/>").append($.i18n._("Image must be one of jpg, jpeg, png, or gif"));
-
- //errors ul has already been created.
- if (ul.length > 0) {
- ul.empty()
- .append(li);
- }
- else {
- logoEl
- .append('<ul class="errors"></ul>')
- .find(".errors")
- .append(li);
- }
-
- $(this).val("");
- }
- else {
- logoEl.find(".errors").remove();
- }
- });
- });
-
- function resizeImg(ele, targetWidth, targetHeight){
- var img = $(ele);
- var width = ele.width;
- var height = ele.height;
- // resize img proportionaly
- if( width > height && width > targetWidth){
- var ratio = targetWidth/width;
- img.css("width", targetHeight+"px");
- var newHeight = height * ratio;
- img.css("height", newHeight);
- }else if( width < height && height > targetHeight){
- var ratio = targetHeight/height;
- img.css("height", targetHeight+"px");
- var newWidth = width * ratio;
- img.css("width", newWidth);
- }else if( width == height && width > targetWidth){
- img.css("height", targetHeight+"px");
- img.css("width", targetWidth+"px" );
- }
- }
|