style(legacy): format (#2039)

This commit is contained in:
Jonas L 2022-08-10 13:38:19 +02:00 committed by GitHub
parent 7082c9693d
commit 1550d44ac5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
122 changed files with 18369 additions and 15819 deletions

View file

@ -1,17 +1,16 @@
$(document).ready(function() {
$(document).ready(function () {
var dialog = $("#lang-timezone-popup");
var dialog = $("#lang-timezone-popup");
dialog.dialog({
autoOpen: false,
width: 500,
resizable: false,
modal: true,
closeOnEscape: false,
position:['center','center'],
dialogClass: 'no-close',
buttons: [
/* Testing removing the Not Now button for higher engagement
dialog.dialog({
autoOpen: false,
width: 500,
resizable: false,
modal: true,
closeOnEscape: false,
position: ["center", "center"],
dialogClass: "no-close",
buttons: [
/* Testing removing the Not Now button for higher engagement
{
id: "setup-later",
text: $.i18n._("Not Now"),
@ -20,32 +19,32 @@ $(document).ready(function() {
$(this).dialog("close");
}
},*/
{
id: "help_airtime",
text: $.i18n._("OK"),
"class": "btn",
click: function() {
$("#lang-timezone-form").submit();
}
}
]
});
{
id: "help_airtime",
text: $.i18n._("OK"),
class: "btn",
click: function () {
$("#lang-timezone-form").submit();
},
},
],
});
var language = window.navigator.userLanguage || window.navigator.language;
if (language === undefined) {
language = "en_CA";
}
language = language.replace("-", "_");
$("#setup_language").val(language);
var language = window.navigator.userLanguage || window.navigator.language;
if (language === undefined) {
language = "en_CA";
}
language = language.replace("-", "_");
$("#setup_language").val(language);
dayjs.extend(utc)
dayjs.extend(timezone)
dayjs.extend(utc);
dayjs.extend(timezone);
var timezone_name = dayjs.tz.guess();
if (timezone_name === undefined) {
timezone_name = "America/Toronto";
}
$("#setup_timezone").val(timezone_name);
var timezone_name = dayjs.tz.guess();
if (timezone_name === undefined) {
timezone_name = "America/Toronto";
}
$("#setup_timezone").val(timezone_name);
dialog.dialog('open');
dialog.dialog("open");
});

View file

@ -1,175 +1,177 @@
$(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();
}
}
]
$(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($("#link_to_terms_and_condition").length > 0 ){
button.removeAttr('disabled').removeClass('ui-state-disabled');
}else{
button.attr('disabled', 'disabled' ).addClass('ui-state-disabled');
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");
}
}
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();
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');
$("#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");
}
});
$('.toggle legend').live('click',function() {
$('.toggle').toggleClass('closed');
return false;
});
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");
}
$("#Logo").live('change', function(ev){
var content, res, logoEl;
$(".toggle legend").live("click", function () {
$(".toggle").toggleClass("closed");
return false;
});
content = $(this).val();
res = content.match(/(jpg|jpeg|png|gif)$/gi);
logoEl = $("#Logo-element");
$("#Logo").live("change", function (ev) {
var content, res, logoEl;
//not an accepted image extension.
if (!res) {
var ul, li;
content = $(this).val();
res = content.match(/(jpg|jpeg|png|gif)$/gi);
logoEl = $("#Logo-element");
ul = logoEl.find('.errors');
li = $("<li/>").append($.i18n._("Image must be one of jpg, jpeg, png, or gif"));
//not an accepted image extension.
if (!res) {
var ul, li;
//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);
}
ul = logoEl.find(".errors");
li = $("<li/>").append(
$.i18n._("Image must be one of jpg, jpeg, png, or gif")
);
$(this).val("");
}
else {
logoEl.find(".errors").remove();
}
});
//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);
function resizeImg(ele, targetWidth, targetHeight) {
var img = $(ele);
var width = ele.width;
var height = ele.height;
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" );
}
// 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");
}
}