0

有一个社交登录 wordpress 插件,在验证来自社交网站(facebook、google 等)的登录时会产生一个大的弹出窗口

我想让弹出窗口更小,但无法弄清楚。产生弹出窗口的代码是:

if( get_option( 'wsl_settings_use_popup' ) == 1 || ! get_option( 'wsl_settings_use_popup' ) ){
    ?>
        <html><head><script>
        function init() {
            window.opener.wsl_wordpress_social_login({
                'action'   : 'wordpress_social_login',
                'provider' : '<?php echo $provider ?>'
            });

            window.close()
        }

如何设置此弹出窗口的宽度和高度?

提前致谢!

4

1 回答 1

2

居中窗口的更新

在下面添加这 2 个计算provider = $(this).attr("data-provider");

datop = (($(document).height()-400)/2);
daleft = (($(document).width()-225)/2);

将这 2 个参数添加到属性中:

top="+datop+",left="+daleft+""

像这样:

"location=1,status=0,scrollbars=0,width=225,height=400,top="+datop+",left="+daleft+""

结尾

编辑

您可以在此处找到该文件:wp-content/plugins/wordpress-social-login/assets/js/connect.js

结束编辑
该文件是“wordpress-social-login\assets\js\connect.js”我不知道该文件将安装在哪里,但可能您可以在包含登录名的每个页面中找到其中的函数(如果您可以找到它,您可以卸载、编辑文件并重新安装修改过的文件)。这应该是您正在搜索的功能:

(function($){ 
    $(function(){
        $(".wsl_connect_with_provider").click(function(){//selector.event
            popupurl = $("#wsl_popup_base_url").val();//assign text of the element with id #wls_popup_base..
            provider = $(this).attr("data-provider");//assign the attribute data-provider of the element with class .wls_connect.. 

            window.open(
                popupurl+"provider="+provider,//url
                "hybridauth_social_sing_on", //window name
                "location=1,status=0,scrollbars=0,width=1000,height=600"//attributes of the window
            ); 
        });
    });
})(jQuery);

这应该是弹出窗口的代码

window.open(
    popupurl+"provider="+provider,
    "hybridauth_social_sing_on",
    "location=1,status=0,scrollbars=0,width=1000,height=600"
);

要更改宽度和高度,请编辑这 2 个参数:..width=1000,height=600"

请注意,我添加注释是为了让您了解该功能的作用以及您在做什么

于 2013-06-25T16:37:23.653 回答