Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(function () {
- $('#m-subnav li').eq(0).addClass('active'); // set left menu
- $('#spin-btn').click(function (x) {
- x.preventDefault();
- if (!nexon.sso.isLoggedIn) {
- nexon.gnt.popupLogin();
- return;
- }
- window.gachapon.runSpin1();
- });
- // nexon popup class override for having callback functionality
- var popupWrap = $('#gnt_popup'),
- popupCenter = $('#gnt_popup_center'),
- popupScreen = $('#gnt_screen');
- $.extend(nexon.gnt, {
- hideCallback: null,
- popupHide: function () {
- popupWrap.removeClass().hide().css({ 'width': null, 'margin-left': null });
- popupCenter.html('');
- popupScreen.hide();
- //location.hash = '#/';
- if (typeof this.hideCallback == 'function')
- this.hideCallback();
- },
- popupShow: function () {
- popupWrap.show().find('#gnt_popup_close').data('goto', 'popupHide');
- popupScreen.show();
- return {
- wrap: popupWrap,
- center: popupCenter
- };
- }
- });
- $('#gachapon-text a').click(function (e) {
- popupShow('detailedGuide');
- return false;
- });
- $('#tabs li').tabs().filter('[data-tab="coupon-history"]').click(function (e) {
- e.preventDefault();
- window.gachapon.showHistory();
- });
- //// test
- //window.gachapon.updateNXBalance({ credit: '#credit', prepaid: '#prepaid' });
- $('#more-spins-btn').click(function (e) {
- e.preventDefault();
- if (!nexon.sso.isLoggedIn) {
- nexon.gnt.popupLogin();
- return;
- }
- var p = popupShow('getMoreSpins');
- var types = p.center.find('input:radio[name=payment-type]');
- var selector = p.center.find('.currentSpins select');
- function updatePrices() {
- var price = selector.find('option:selected').data('price');
- if (price === undefined) return;
- var paytype = types.filter(':checked').val();
- var prepaid = window.gachapon.nx.prepaid;
- var credit = window.gachapon.nx.credit;
- var remain_prepaid = p.center.find('.remain_prepaid');
- var remain_credit = p.center.find('.remain_credit');
- var spin_prices = p.center.find('.spin_price');
- spin_prices.text('');
- if (paytype == 'prepaid') {
- prepaid -= price;
- spin_prices.eq(0).text(price.digits());
- }
- if (paytype == 'credit') {
- credit -= price;
- spin_prices.eq(1).text(price.digits());
- }
- remain_prepaid.text(prepaid.digits());
- remain_credit.text(credit.digits());
- }
- types.click(function (e) {
- updatePrices();
- });
- selector.change(function (e) {
- var changed = $(e.target);
- updatePrices();
- });
- types.eq(0).click();
- p.center.find('.gnt_bot .gnt_button:eq(0)').click(function (e) {
- var value = selector.val();
- var paytype = types.filter(':checked').val();
- if (value == '') {
- alert('Please select quantity');
- return;
- }
- window.gachapon.purchaseSpin(value, paytype == 'prepaid', function () {
- popupShow('thankYou');
- });
- });
- });
- $('.reel-strip > div, .item-icons > div').balloon({ css: { opacity: 1 },
- minLifetime: 0, showDuration: 0, hideDuration: 0
- });
- $('.item-scroll').itemRotator({
- speed: 400
- });
- /*
- function hashChange() {
- var hashes = (location.hash.length > 1 ? location.hash.substr(1).parseToArray() : {});
- var page = hashes['page'];
- if (page !== undefined) {}
- }
- $(window).unbind('hashchange').bind('hashchange', hashChange);
- hashChange();*/
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement