var ctrlPressed = 0; var publicInputBox; var cookieHostname = location.hostname; var cookieValidTime = 365 * 24 * 60 * 60 * 1000; var lan1="DE"; var lan2="PE"; var lan1ID="3"; var lan2ID="2"; var lan1Dir="ltr"; var lan2Dir="rtl"; var wid; var imgPathURL="/images"; var autoCompleteItemPos = -1; var autoCompleteItemsCount = 0; var autoCompleteUserEntry = ""; var autoCompleteCursorTimeout; //auto suggestion cursor timeout (buffer) var autoCompleteItemsDirection = "rtl"; var autoCompleteTimeout; var hideCo = 'Co'; var specialVal = ''+val['by']+''; }); temphtml = '' + temphtml + '
'; if(objlength>1) { $('#myPopTemp').html(temphtml); $('#myPop').css('width','auto'); var offset = $(obj).position(); $('#myPop').css({ top: offset.top-20, left: offset.left+20 }) $('#myPop').show(); } playAudioFile(firstfile); } } }); }); $(".img-play-button").live('click',function(){ var firstfile = ''; var temphtml = ''; var obj = this; iid = $(obj).attr("encid"); $.ajax({ type : 'GET', url : '/contribution/images/imgvote.php',dataType: 'json',data: {iid: iid, rt: 9}, success : function(data){ if(data.visualNotificationFlag==1) { showNotificationMessage(data.visualMessage); } else if(data.actionDone==9) { var objlength = 0; var temphtml = ''; $.each(data.iFiles, function(key, val) { if(firstfile=='') firstfile = val['filename']; objlength++; temphtml += ''+val['by']+''; }); temphtml = '' + temphtml + '
'; if(objlength>1) { $('#myPopTemp').html(temphtml); $('#myPop').css('width','auto'); var offset = $(obj).position(); $('#myPop').css({ top: offset.top-10, left: offset.left+20 }) $('#myPop').show(); } else { showImage(firstfile); } } } }); }); $(".pronon-status-unverified,.pronon-status-verified,.pronon-status-del").click(function(){ pid = $(this).attr('pid'); var offset = $(this).position(); var rt = 5; $.ajax({ type : 'GET', url : 'pronunvote.php',dataType: 'json',data: {pid: pid, rt: rt}, success : function(data){ if(data.visualNotificationFlag==1) { showNotificationMessage(data.visualMessage); } if(data.actionDone==2) { $('#myPopTemp').html(data.html); $('#myPop').css('width','auto'); $('#myPop').css({ top: offset.top+20, left: offset.left }) $('#myPop').show(); } } }); }); $(".pronon-ok-off,.pronon-del-off,.pronon-comment-off,.pronon-ok-on,.pronon-del-on,.pronon-comment-on,.prononciationContribution,.pronon-record-button,.pronon-check-button").click(function(){ var obj = this; var rt = $(obj).attr("requestType"); if(rt!=4) { pid = $(obj).closest("div").attr("pid"); } if($('#commentVal').length) { txt = $('#commentVal').val(); } else { txt = ''; } if(rt==3) { var offset = $(this).closest("div").position(); $('#prononciationCommentBox').css({ top: offset.top+25, left: offset.left-125 }) $('#prononciationCommentBox').show(); $('#commentVal').focus(); } else if(rt==4) { $('#prononciationCommentBox').hide(); } else if(rt==7) { $(".pronon-ok-off,.pronon-del-off,.pronon-comment-off,.pronon-ok-on,.pronon-del-on,.pronon-comment-on").attr("disabled", "disabled"); duration = $(this).attr("duration"); if(duration!=0) { enableSendButtonTimeout = setTimeout(function() {$(obj).closest("div").find(".pronon-ok-off,.pronon-del-off,.pronon-comment-off,.pronon-ok-on,.pronon-del-on,.pronon-comment-on").removeAttr("disabled");},duration); } else { $(obj).closest("div").find(".pronon-ok-off,.pronon-del-off,.pronon-comment-off,.pronon-ok-on,.pronon-del-on,.pronon-comment-on,").removeAttr("disabled"); } } if(rt=='1'||rt=='2'||rt=='4'||rt=='6'||rt=='7'||rt=='8') { $.ajax({ type : 'GET', url : '/contribution/pronun/pronunvote.php',dataType: 'json',data: {pid: pid, rt: rt, txt: txt}, success : function(data){ if(data.visualNotificationFlag==1) { showNotificationMessage(data.visualMessage); } if(data.changeObjects==1) { $.each(data.pageObjects, function(key, val) { if(val['valChanged']==1) { $("#"+val['objID']).html(val['objVal']); $("#"+val['objID']).toggleClass($("#"+val['objID']).attr('class')+' '+val['newObjClass']); } else if(val['classChanged']==2) { $("#"+val['objID']).find("."+val['oldObjClass']).toggleClass(val['oldObjClass']+' '+val['newObjClass']); } }); $('#commentVal').val(''); } if(data.actionDone==6) { location.href = "record.php?wid="+data.wid+"&langid="+data.langid; } else if(data.actionDone==7||data.actionDone==8) { playAudioFile(data.fileName); } } }); } }); // $(".searchResult").rightClick( function(e) { $(".searchResult").click(function(){ wid = $(this).closest("tr").attr("wid"); // wid = $(this).attr("wid"); langid = $(this).attr("lanType"); var searchResultClickTemp = '
Contribution
edit this translation
Record your voice here
Upload new image
history of translation
Search in
Google
Wikipedia'; $("#searchResultClickTemp").html(searchResultClickTemp); var offset = $(this).position(); $('#searchResultClick').css({ top: offset.top-20, left: offset.left+20 }) $('#searchResultClick').show(); }); //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// $('.showBox').click(function(){ boxname = $(this).attr('boxname'); $('#'+boxname).show("slow"); }); $(".addComment").click(function () { userText = $(this).closest("div").find("textarea").val(); entryType = $(this).parents("div").parents("div").attr("entryType"); entryID = $(this).parents("div").parents("div").attr("entryID"); requestType = $(this).attr("requestType"); forumUserSelect(entryID,entryType,requestType,userText); userText = $(this).closest("div").find("textarea").val(''); $(this).closest("div").hide("slow"); }); $('.removeComment').live('click',function(){ entryType = $(this).closest("div").attr("entryType"); entryID = $(this).closest("div").attr("entryID"); requestType = $(this).attr("requestType"); forumUserSelect(entryID,entryType,requestType,''); // id = $(this).attr('id'); // boxname = $(this).attr('boxname'); // boxname = $(this).closest("div").find(".qlink"); //forumUserComment(eID,et,rt,txt) boxname = $(this).closest("div").attr("id"); $('#'+boxname).hide("slow"); }); $(".vote-up-off,.vote-up-on,.vote-down-off,.vote-down-on,.star-off,.star-on,.getFeedback,.comment-up-off,.comment-up-on").click(function () { entryType = $(this).closest("div").attr("entryType"); entryID = $(this).closest("div").attr("entryID"); requestType = $(this).attr("requestType"); forumUserSelect(entryID,entryType,requestType,''); }); $(".linkTextbox").focus(function(){ $(this).select(); }); $(".vote-accepted-on,.vote-accepted-off").click(function () { entryType = $(this).closest("div").attr("entryType"); entryID = $(this).closest("div").attr("entryID"); requestType = $(this).attr("requestType"); forumUserSelect(entryID,entryType,requestType,''); }); $(".showSpamReport").click(function () { $('#curtain').show('slow'); $("#spameID").val($(this).closest("div").attr("entryID")); $("#spamet").val($(this).closest("div").attr("entryType")); $("#spamrt").val(12); $('#spamReportBox').show('slow'); }); $("#submitSpamReport").click(function () { entryID = $("#spameID").val(); entryType = $("#spamet").val(); requestType = $("#spamrt").val(); txt = $("#spamType").val(); $('#spamReportBox').hide('slow'); $('#curtain').hide('slow'); forumUserSelect(entryID,entryType,requestType,txt); }); $("#hideSpamReport").mouseover(function () { $('#spamReportBox').hide('slow'); $('#curtain').hide('slow'); }); $(".hidenotificationMessageBox").click(function () { $('#notificationMessageBox').hide('slow'); $('#curtain').hide('slow'); }); $(".showMyedit").click(function () { $(this).closest("div").find(".myEdit").show('slow'); }); $("#showMyAnswerNotification").click(function () { if(confirm("Are you sure you want to answer your own question?\n\nIf you're responding to answers left on your question, enter comments under each answer.\n\nIf you need to add details to your question, use the edit link under your question.")) { $('#answerOwnQuestionNotification').hide(); $('#answerForm').show('slow'); $('#eDes').focus(); } /* ');*/ }); $('.deleteLink').click(function() { return confirm("Are you sure you wish to delete?"); }); $('.showLocalLoginOption').live("click",function(){ $('#openIDLoginOption').hide(); $('#localLoginOption').show(); $('#email').focus(); }); $('.hideLocalLoginOption').click(function(){ $('#localLoginOption').hide(); $('#openIDLoginOption').show(); }); $('.showLocalForgotPassword').click(function(){ $('#localLogin').hide(); $('#localForgostPassword').show(); document.getElementById('passwordimg').src = '/captcha/securimage_show.php?sid=' + Math.random(); $('#un').focus(); }); $('.showLocalRegister').click(function(){ $('#localLogin').hide(); $('#localRegister').show(); document.getElementById('registerimage').src = '/captcha/securimage_show.php?sid=' + Math.random(); $('#emailreg').focus(); }); $('.hideLocalForgotPassword').click(function(){ $('#localForgostPassword').hide(); $('#localLogin').show(); $('#email').focus(); }); $('.hideLocalRegister').click(function(){ $('#localRegister').hide(); $('#localLogin').show(); $('#email').focus(); }); $(".ckeckRegisterForm").focus(function(){ id = $(this).attr('id'); if(id=="email") { $('#miniHelpInput').html("Help:
- Enter your email address. Your email address is you User ID."); } else if(id=="password") { $('#miniHelpInput').html("Help:
- Specify your password. It must be at least 6 characters."); } else if(id=="captcha") { $('#miniHelpInput').html("Help:
- To show that you are a human please enter captcha code."); } $('#miniHelpInput').show("slow"); $('#aboutYourAnswer').show("slow"); }); $(".showFeedback").hover(function(){ id = $(this).attr('id'); $('#fbd'+id).hide(); $('#fb'+id).show(); },function(){ id = $(this).attr('id'); $('#fb'+id).hide(); $('#fbd'+id).show(); }); $('.showComment').click(function(){ boxname = $(this).attr('boxname'); $('#'+boxname).show("slow"); }); $('.removeComment').click(function(){ // id = $(this).attr('id'); // boxname = $(this).attr('boxname'); boxname = $(this).closest("div").attr("id"); $('#'+boxname).hide("slow"); }); $('.showLink').click(function(){ boxname = $(this).attr('boxname'); var offset = $(this).position(); $('#'+boxname).css({ top: offset.top+20, left: 20 }) $('#'+boxname).show("slow"); }); $(".forumQuestionInput").focus(function(){ id = $(this).attr('id'); if(id=="eTit") { $('#miniHelpInput').html("راهنما: عنوان سوال:
- عنوان سوال خود را وارد کنید.
شما میتوانید یک کلمه و یا جمله مورد نظر خود را در اینجا وارد کنید.(حداکثر ۲۰۰ حرف)
- با انتخاب ف صفحه کلید فارسی میشود.
- با انتخاب ⌨ صفحه کلید فارسی نمایش داده می شود."); } else if(id=="eDes") { $('#miniHelpInput').html("راهنما: توضیح سوال:
- شما میتوانید سوال کامل و یا زمینه ترجمه خود را در اینجا مطرح کنید (حداکثر 1024 حرف).
- نحوه نمایش:
**word** displayed as word
__word__ displayed as word
--word-- displayed as word
- اگر می خواهید به صفحه خاصی لینک دهید آدرس سایت را با http:// وارد کنید.
- با انتخاب ف صفحه کلید فارسی میشود.
- با انتخاب ⌨ صفحه کلید فارسی نمایش داده می شود.

"); } else if(id=="eCat") { $('#miniHelpInput').html("راهنما: دسته بندی:
-دسته بندی مربوط به سوال خود را انتخاب کنید.
- ترجمه فارسی به آلمانی، ترجمه آلمانی به فارسی ، گرامر زبان، درباره امتحانات و با سوالات مربوط به سایت را انتخاب کنید"); } else if(id=="eEma") { $('#miniHelpInput').html("Help: Email Notification:
-Select the checkbox if you want to be notify by Email when somebody answers your question."); } $('#miniHelpInput').show("slow"); $('#aboutYourEntry').show("slow"); }); $(".forumAnswerInput").focus(function(){ id = $(this).attr('id'); if(id=="eDes") { $('#miniHelpInput').html("Help: Your Answer:
- If you can answer this question you can help other users to to improve their english.(max 1024 charachters).
- Formatting:
**word** displayed as word
__word__ displayed as word
--word-- displayed as word
- If you want to link to a specific page, just enter the URL beginning with http://

"); } $('#miniHelpInput').show("slow"); $('#aboutYourEntry').show("slow"); }); $("#eTit,#eDes,#eCat").keyup(function(){showPreview();checkLimitChar($(this).attr('id'));}); $("#eTit,#eDes,#eCat").focus(function(){showPreview();checkLimitChar($(this).attr('id'));}); $(".checkLimit").keyup(function(){checkLimitChar($(this).attr('id'));}); // $("#eDes").keyup(function(){showPreview();checkLimitChar("#eDes")}); /* $("#boxLang").click(function(){ persianBox = $(this).attr('persianBox'); myField = document.getElementById(persianBox); boxLangVal = $("#boxLang").val(); if(boxLangVal=="ف") { boxLangVal = $("#boxLang").val("E"); $("#persianKeysComments").show(); myField.lang = "DE"; } else { boxLangVal = $("#boxLang").val("ف"); $("#persianKeysComments").hide("slow"); myField.lang = "PE"; } $("#"+persianBox).focus(); }); */ $(".boxLang").click(function(){ publicInputBox = $(this).attr('persianBox'); keyboardSign = $(this).attr('keyboardSign'); myField = document.getElementById(publicInputBox); boxLangVal = $(this).val(); if(boxLangVal=="ف") { boxLangVal = $(this).val("E"); $("#"+keyboardSign).show(); myField.lang = "PE"; // $('#'+publicInputBox).css({direction: lan1Dir}); } else { boxLangVal = $(this).val("ف"); $("#"+keyboardSign).hide("slow"); myField.lang = "DE"; $('#keyBoard').hide(); // $('#'+publicInputBox).css({direction: lan2Dir}); } $("#"+publicInputBox).focus(); }); $(".showPersianKeys").click(function(){ if($('#keyBoard').is(":hidden")) { publicInputBox = $(this).attr('persianBox'); boxDirection = $(this).attr('boxDirection'); var offset = $('#'+publicInputBox).position(); if(publicInputBox=="w") { $('#keyBoard').css({ top: offset.top-$('#keyBoard').height()-5, left: offset.left+(($('#'+publicInputBox).width()-$('#keyBoard').width())/2)}); $('#'+publicInputBox).css({direction: 'rtl'}); document.getElementById('k').name='k'; document.getElementById('k').value=1; } else if(publicInputBox=="chatText") { $('#keyBoard').css({ top: offset.top-$('#keyBoard').height()+10, left: offset.left+14+(($('#'+publicInputBox).width()-$('#keyBoard').width())/2)}); $('#'+publicInputBox).css({direction: 'rtl'}); } else { $('#keyBoard').css({ top: offset.top+$('#'+publicInputBox).height()+8, left: offset.left+(($('#'+publicInputBox).width()-$('#keyBoard').width())/2)}); $('#'+publicInputBox).css({direction: boxDirection}); } $('#keyBoard').show(); } else { $('#keyBoard').hide(); document.getElementById('k').name='k'; document.getElementById('k').value=0; } }); $(".showOrginal").click(function(){ $("#orginalAnswer").show('slow'); }); $('.mytooltip').hover(function(){ // Hover over code var wComments = $(this).attr('wComments'); $("#myPopTemp").html(wComments); var offset = $(this).position(); $('#myPop').css({ top: offset.top, left: offset.left+($(".mytooltip").width()-10) }) $('#myPop').show(); }); var selectedRow = 0; $('.voteRow').mouseover(function(){ if(selectedRow!=$(this).attr('id')) { $(this).css("backgroundColor","#baf46e"); } }).mouseout(function(){ if(selectedRow!=$(this).attr('id')) { $(this).css("backgroundColor",""); } }); $('.searchResultRows').mouseover(function(){ $(this).css("backgroundColor","#baf46e"); }).mouseout(function(){ $(this).css("backgroundColor",""); }); $('.voteRow').click(function(){ if(selectedRow!=$(this).attr('id')) { if(selectedRow!=0) { $("#"+selectedRow).css("backgroundColor",""); } selectedRow = $(this).attr('id'); } $("#word1").val($(this).attr('word1')); $("#word2").val($(this).attr('word2')); $("#wordC").val($(this).attr('wordC')); $(this).css("backgroundColor","#9FCB85"); $("#word1").focus(); }); $(".hideBox").mouseover(function () { var boxname = $(this).attr('boxname'); boxnameArray = boxname.split(","); if(boxnameArray.length>1) { for(i=0; i- اطمینان از دیکته معنی داشته باشید.
- از علامت گذاری درست استفاده کنید (.، !، ؟) .
- جنسیت واژه را در {} و در انتها معنی قرار دهید.
-معنی دقیق/توضیح اضافی را در [ ] و در انتها معنی قرار دهید.
- برای گزینه های بیشتر (+) را انتخاب کنید.
- در صورت نیاز زیر شاخه زبانی درست را انتخاب کنید."); } else if(id=="word2") { $('#miniHelpInput').html("راهنما، معنی فارسی :
- اطمینان از دیکته معنی داشته باشید.
- از علامت گذاری درست استفاده کنید (.، !، ؟) .
- در صورت وجود چند معنی برای یک واژه، هر معنی را جداگانه وارد کنید و نیازی به جداکردن با کما (، و یا , ) - [ ] نیست.
- برای گزینه های بیشتر (+) را انتخاب کنید.
- معنی دقیق/توضیح اضافی را در [ ] و در انتها معنی قرار دهید.
- با انتخاب ⌨ صفحه کلید فارسی نمایش داده می شود."); } else if(id=="wordC") { $('#miniHelpInput').html("راهنما، دسته بندی :
- برای معنی خود دسته بندی مناسب انتخاب کنید.
- برای گزینه های بیشتر (+) را انتخاب کنید.
- بعضی معنی ها می توانند بیش از یک دسته بندی داشته باشند.
- اگر از دسته بندی معنی اطمینان ندارید، آن را خالی بگذارید."); } else if(id=="wordD") { $('#miniHelpInput').html("راهنما: توضیحات:
- توضیح و یا مرجع خود را برای این معنی وارد کنید.
- با انتخاب ف صفحه کلید فارسی میشود.
- با انتخاب ⌨ صفحه کلید فارسی نمایش داده می شود."); } else if(id=="word3") { $('#miniHelpInput').html("راهنما، Englisch (اختیاری):
- در صورت تمایل با وارد کردن معنی انگلیسی مشابه، این معنی به سایت Perdic.com نیز افزوده می شود.
- امکان ویرایش معانی انگلیسی و فارسی در سایت Perdic.com امکان پذیر می باشد.
- اطمینان از دیکته معنی داشته باشید.
- از علامت گذاری درست استفاده کنید (.، !، ؟) .
-معنی دقیق/توضیح اضافی را در [ ] و در انتها معنی قرار دهید."); } $('#miniHelpInput').show("slow"); $('#miniHelpPublic').show("slow"); }); $(".addExtra").live("click",function(){ title = $(this).attr('title'); boxName = $(this).attr('boxName'); $("#"+boxName).val($("#"+boxName).val()+" "+title); }); }); function showPersianKeysAfterSearch() { publicInputBox = 'w'; document.getElementById('k').name='k'; document.getElementById('k').value=1; offset = $('#w').position(); $('#keyBoard').css({ top: offset.top-$('#keyBoard').height()-5, left: offset.left+(($('#'+publicInputBox).width()-$('#keyBoard').width())/2)}); $('#keyBoard').show(); } function checkLimitChar(id) { // title = $(this).attr('title'); stringVal = $('#'+id).val(); var limit = parseInt($('#'+id).attr('maxlength')); if(stringVal.length > limit) { $('#'+id).val(stringVal.substr(0, limit)); $("#errorMessage").html("You've reached to "+limit+" Characters."); $("#errorMessage").css("color","red"); } else { $("#errorMessage").css("color",""); $("#errorMessage").html(limit-$('#'+id).val().length + " character(s) left"); } var offset = $('#'+id).position(); $('#errorMessage').css({ top: offset.top-$('#errorMessage').height()-11, left: offset.left+370});//, left: offset.left+(($('#errorMessage').width()-$('#'+id).width())/2) } function storeCaretPos(el) { el.caretPos = document.selection.createRange().duplicate(); } function deleteAtCaret(el) { var caretPos = 0; if(el.createTextRange && el.caretPos) { if(el.caretPos.text.length==0) { el.caretPos.moveStart('character', -el.value.length); caretPos = el.caretPos.text.length; //var bookmark = el.caretPos.getBookmark(); //caretPos = bookmark.charCodeAt(2) - 2; if(caretPos) { el.value = el.value.substring(0, caretPos-1) + el.value.substring(caretPos, el.value.length); el.caretPos.collapse(true); el.caretPos.moveStart('character', caretPos-1); // el.caretPos.moveEnd('character', 0); // el.caretPos.select(); } } else { el.caretPos.text = ''; } } } function insertAtCursor(myField, myValue) { if (document.selection) { if(myField.createTextRange && myField.caretPos) { myField.caretPos.text = myValue; } else { myField.value = myField.value + myValue; } } else if (myField.selectionStart || myField.selectionStart == '0') { var startPos = myField.selectionStart; var endPos = myField.selectionEnd; myField.value = myField.value.substring(0, startPos)+ myValue + myField.value.substring(endPos, myField.value.length); myField.selectionStart=startPos+myValue.length; myField.selectionEnd=startPos+myValue.length; } else { myField.value += myValue; } } function addTwoStrings(myField,leftStr,rightStr) { if (document.selection) { //IE support if(myField.createTextRange && myField.caretPos) { myField.caretPos.text = leftStr + myField.caretPos.text + rightStr; } else { myField.value = leftStr + rightStr; } } else if (myField.selectionStart || myField.selectionStart == '0') { //MOZILLA/NETSCAPE support var startPos = myField.selectionStart; var endPos = myField.selectionEnd; selectedTextSize = endPos-startPos; if(selectedTextSize) { selectedText = myField.value.substring(startPos, startPos+selectedTextSize); } else { selectedText = ''; } myField.value = myField.value.substring(0, startPos)+ leftStr + selectedText + rightStr + myField.value.substring(endPos, myField.value.length); myField.selectionStart=startPos; myField.selectionEnd=startPos+selectedTextSize+leftStr.length+rightStr.length; } else { myField.value = myField.value + leftStr + rightStr; } //myField.focus(); } function backAtCursor(myField) { if (document.selection) { //IE support deleteAtCaret(myField); } else if (myField.selectionStart || myField.selectionStart == '0') { //MOZILLA/NETSCAPE support var startPos = myField.selectionStart; var endPos = myField.selectionEnd; myField.value = myField.value.substring(0, startPos-1) + myField.value.substring(endPos, myField.value.length); myField.selectionStart = startPos-1; myField.selectionEnd = startPos-1; } else { myField.value=myField.value.substr(0,(myField.value.length-1)); } myField.focus(); } function showPreview() { //replace(/[^ \- ]/g, '??') //replace(/\[tag:([^\[tag:]+)]/ig, ' $1 ') var eDes = $("#eDes").val(); eDes = eDes.replace(/\n/g,'
').replace(/---/g,'
').replace(/\*\*\*([^\*\*\*]+)\*\*\*/ig, '$1') .replace(/___([^___]+)___/ig, '$1') .replace(/\+\+([^\+\+]+)\+\+/ig, '$1').replace(/__([^__]+)__/ig, '$1').replace(/\*\*([^\*\*]+)\*\*/ig, '$1').replace(/\-\-([^\-\-]+)\-\-/ig, '$1'); eDes = eDes.replace('[/P]', '[/p]').replace('[P]', '[p]').replace(/\[p]([^\[p\]]+)\[\/p]/ig, '
$1
'); eDes = eDes.replace(/`([^`]+)`/ig, '$1').replace(/\[c]([^\[c\]]+)\[\/c]/ig, '
$1
'); eDes = eDes.replace(/([^\w\/])(www\.[a-z0-9\-]+\.[a-z0-9\-]+)/ig, "$1http://$2"); eDes = eDes.replace(/([\w]+:\/\/[\w-?&;#~=\.\/\@]+[\w\/])/ig,"$1"); //eDes = eDes.replace(/(https?:\/\/\S+\.(?:jpg|png|gif))\s+/,"$1"); $("#eDesPreview").html(eDes); } function showNotificationMessage(msg) { $("#notificationMessage").html(msg); $('#curtain').show('slow'); // $('#notificationMessageBox').css({ top: '200'}) $("#notificationMessageBox").show("slow"); } function showNotificationMessageParent(msg) { window.parent.$("#notificationMessage").html(msg); window.parent.$('#curtain').show('slow'); // $('#notificationMessageBox').css({ top: '200'}) window.parent.$("#notificationMessageBox").show("slow"); } function forumUserSelect(eID,et,rt,txt) { //alert(eID+'-'+et+'-'+rt+'-'+txt); $.ajax({ type : 'POST', url : '/forum/getactionj.php',dataType: 'json',data: {eID: eID, et: et, rt: rt, txt: txt}, success : function(data){ if(data.visualNotificationFlag==1) { showNotificationMessage(data.visualMessage); } if(data.changeObjects==1) { $.each(data.pageObjects, function(key, val) { if(val['valChanged']==1) { $("#"+val['objID']).html(val['objVal']); } else if(val['valChanged']==2) { $("#"+val['objID']).find("."+val['oldObjClass']).html(val['objVal']); } else if(val['valChanged']==5) { $("#"+val['objID']).append(val['objVal']); } if(val['classChanged']==1) { $("#"+val['objID']).toggleClass(val['oldObjClass']+' '+val['newObjClass']); } else if(val['classChanged']==2) { $("#"+val['objID']).find("."+val['oldObjClass']).toggleClass(val['oldObjClass']+' '+val['newObjClass']); } else if(val['classChanged']==4) { $("#"+val['objID']).removeClass(val['oldObjClass']); } }); } } }); } function changeDirection(obj) { publicInputBox = $(obj).attr('persianBox'); myField = document.getElementById(publicInputBox); boxLangVal = $(obj).val(); if(boxLangVal=="ف") { myField.dir = lan2Dir; autoCompleteItemsDirection = lan2Dir; } else { myField.dir = lan1Dir; autoCompleteItemsDirection = lan1Dir; } $("#autoCompleteBox").hide(); $('#w').val(''); } function deleteWord() { document.getElementById('word1').value = '[delete]'; document.getElementById('word2').value = '[delete]'; } function spamWord() { document.getElementById('word1').value = '[spam]'; document.getElementById('word2').value = '[spam]'; } keyboardString = "
ض
ص
ث
ق
ف
غ
ع
ه
خ
ح
ج
چ
◀—
ش
س
ئ
ی
ب
ل
أ
آ
ا
ت
ن
م
ک
گ
[]
ظ
ط
ژ
ز
ر
ذ
د
پ
ؤ
و
ء
.
!
؟
()
نیم فاصله
Space
نیم فاصله
"; function autoCompleteBuffer() { if ($("#w").val().length < 30) { throttle("showSuggestions()", 240); } } function throttle(callback, ms) { if (autoCompleteTimeout) { clearTimeout(autoCompleteTimeout); } autoCompleteTimeout = setTimeout(callback, ms) } function showSuggestions() { textEnteredValue = $("#w").val();//textEnteredValue; if(document.getElementById('w').lang==lan1) { moreString = "more ..."; langid = lan1ID ; } else { moreString = "بیشتر..."; langid = lan2ID ; } // moreString = (autoCompleteItemsDirection=="ltr") ? "بیشتر..." : "بیشتر..." ; // langid = (document.getElementById('w').lang==lan1) ? lan1ID : lan2ID ; // moreString = (autoCompleteItemsDirection=="ltr") ? "بیشتر..." : "بیشتر..." ; $.ajax({ type : 'POST', url : '/wordsuggestion.php', data: { q : textEnteredValue,langid:langid }, success : function(data){ autoCompleteItemPos = -1; var autoCompleteItemText = ""; var autoCompleteItemsArray = data.split("\n"); autoCompleteItemsCount = autoCompleteItemsArray.length-1; for(i=0; i " + autoCompleteLangID + "   " + autoCompleteItemsArray[i].substr(0, autoCompleteItemsArray[i].indexOf("\t")) + ""; */ autoCompleteItemText += "
" + autoCompleteItemsArray[i].substr(0, autoCompleteItemsArray[i].indexOf("\t")) + "
"; } autoCompleteItemText += "
"+moreString+"
"; $("#autoCompleteBox").html( autoCompleteItemText + ""); document.getElementById("autoCompleteBox").style.display=(data)?"block":"none"; } }); } $(".autoCompleteRows").live("mousedown",function() {$('#w').val(this.title);$("#formSearchWord").submit();}); $(".autoCompleteRows").live("mouseover",function() {$(this).css('backgroundColor','eee')}); $(".autoCompleteRows").live("mouseout",function() {$(this).css('backgroundColor','fff')}); function autoCompleteonkeyup(event) { //only for letters clearTimeout(autoCompleteCursorTimeout); textEnteredValue = $("#w").val(); event = (event) ? event : ((window.event) ? window.event : ""); //tab-9,enter-13,shift-16,alt-17,alt-18,esc-27,left-37,up-38,right-39,down-40,windows-91,cmd-224 if (event.keyCode==9 || event.keyCode==13 || event.keyCode==16 || event.keyCode==17 || event.keyCode==18 || event.keyCode==27 || event.keyCode==37 || event.keyCode==38 || event.keyCode==39 || event.keyCode==40 || event.keyCode==91 || event.keyCode==224) { if (event.keyCode==38) { //cursor nach hinten beim hochblaettern if (document.getElementById("w").setSelectionRange) document.getElementById("w").setSelectionRange(textEnteredValue.length, textEnteredValue.length); } return; } autoCompleteBuffer(); } function autoCompleteonkeydown(event) { if (document.getElementById("autoCompleteBox").style.display=="none") return; event = (event) ? event : ((window.event) ? window.event : ""); if (event.keyCode==38 || event.keyCode==40) { //up||down autoCompleteMovePointer(event.keyCode, true); $("#autoCompleteBox").show('slow'); } else if (event.keyCode==27) { //esc if (textEnteredValue) $("#w").val(textEnteredValue); $("#autoCompleteBox").hide('slow'); return; } return; } function autoCompleteMovePointer(eventKeyCode, isFirstChar) { clearTimeout(autoCompleteCursorTimeout); if (eventKeyCode==38) autoCompleteItemPos--; else autoCompleteItemPos++; if (autoCompleteItemPos>autoCompleteItemsCount) autoCompleteItemPos=-1; if (autoCompleteItemPos<-1) autoCompleteItemPos=autoCompleteItemsCount; if (autoCompleteItemPos==-1) $("#w").val(autoCompleteUserEntry); else $("#w").val($("#autoCompleteItem"+autoCompleteItemPos).attr('title')); for(i=0;i<=autoCompleteItemsCount;i++) $("#autoCompleteItem"+i).css('backgroundColor', '#fff'); if (autoCompleteItemPos!=-1) $("#autoCompleteItem"+autoCompleteItemPos).css('backgroundColor', '#F2F2F2'); autoCompleteMovePointerDelay = (isFirstChar)?400:70; autoCompleteCursorTimeout = setTimeout("autoCompleteMovePointer("+eventKeyCode+", false)", autoCompleteMovePointerDelay); } function focusOnSearchBox() { word = document.getElementById("w"); if($("#w").val()!='') { word.selectionStart=-1; word.selectionEnd=word.value.length; } $("#w").focus(); return; } function checkPressKeys() { var event = document.all ? window.event : e; var key = event.keyCode ? event.keyCode : event.which; //!wHasfocus && if (key>40 && !ctrlPressed) { $('#w').focus(); // document.getElementById("w").focus(); // document.getElementById("w").select(); } } /* * jQuery EasIng v1.1.2 - http://gsgd.co.uk/sandbox/jquery.easIng.php * * Uses the built In easIng capabilities added In jQuery 1.1 * to offer multiple easIng options * * Copyright (c) 2007 George Smith * Licensed under the MIT License: * http://www.opensource.org/licenses/mit-license.php */ // t: current time, b: begInnIng value, c: change In value, d: duration jQuery.extend( jQuery.easing, { easeInQuad: function (x, t, b, c, d) { return c*(t/=d)*t + b; }, easeOutQuad: function (x, t, b, c, d) { return -c *(t/=d)*(t-2) + b; }, easeInOutQuad: function (x, t, b, c, d) { if ((t/=d/2) < 1) return c/2*t*t + b; return -c/2 * ((--t)*(t-2) - 1) + b; }, easeInCubic: function (x, t, b, c, d) { return c*(t/=d)*t*t + b; }, easeOutCubic: function (x, t, b, c, d) { return c*((t=t/d-1)*t*t + 1) + b; }, easeInOutCubic: function (x, t, b, c, d) { if ((t/=d/2) < 1) return c/2*t*t*t + b; return c/2*((t-=2)*t*t + 2) + b; }, easeInQuart: function (x, t, b, c, d) { return c*(t/=d)*t*t*t + b; }, easeOutQuart: function (x, t, b, c, d) { return -c * ((t=t/d-1)*t*t*t - 1) + b; }, easeInOutQuart: function (x, t, b, c, d) { if ((t/=d/2) < 1) return c/2*t*t*t*t + b; return -c/2 * ((t-=2)*t*t*t - 2) + b; }, easeInQuint: function (x, t, b, c, d) { return c*(t/=d)*t*t*t*t + b; }, easeOutQuint: function (x, t, b, c, d) { return c*((t=t/d-1)*t*t*t*t + 1) + b; }, easeInOutQuint: function (x, t, b, c, d) { if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b; return c/2*((t-=2)*t*t*t*t + 2) + b; }, easeInSine: function (x, t, b, c, d) { return -c * Math.cos(t/d * (Math.PI/2)) + c + b; }, easeOutSine: function (x, t, b, c, d) { return c * Math.sin(t/d * (Math.PI/2)) + b; }, easeInOutSine: function (x, t, b, c, d) { return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b; }, easeInExpo: function (x, t, b, c, d) { return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b; }, easeOutExpo: function (x, t, b, c, d) { return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b; }, easeInOutExpo: function (x, t, b, c, d) { if (t==0) return b; if (t==d) return b+c; if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b; return c/2 * (-Math.pow(2, -10 * --t) + 2) + b; }, easeInCirc: function (x, t, b, c, d) { return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b; }, easeOutCirc: function (x, t, b, c, d) { return c * Math.sqrt(1 - (t=t/d-1)*t) + b; }, easeInOutCirc: function (x, t, b, c, d) { if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b; return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b; }, easeInElastic: function (x, t, b, c, d) { var s=1.70158;var p=0;var a=c; if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; if (a < Math.abs(c)) { a=c; var s=p/4; } else var s = p/(2*Math.PI) * Math.asin (c/a); return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; }, easeOutElastic: function (x, t, b, c, d) { var s=1.70158;var p=0;var a=c; if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; if (a < Math.abs(c)) { a=c; var s=p/4; } else var s = p/(2*Math.PI) * Math.asin (c/a); return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b; }, easeInOutElastic: function (x, t, b, c, d) { var s=1.70158;var p=0;var a=c; if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5); if (a < Math.abs(c)) { a=c; var s=p/4; } else var s = p/(2*Math.PI) * Math.asin (c/a); if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b; }, easeInBack: function (x, t, b, c, d, s) { if (s == undefined) s = 1.70158; return c*(t/=d)*t*((s+1)*t - s) + b; }, easeOutBack: function (x, t, b, c, d, s) { if (s == undefined) s = 1.70158; return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; }, easeInOutBack: function (x, t, b, c, d, s) { if (s == undefined) s = 1.70158; if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; }, easeInBounce: function (x, t, b, c, d) { return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b; }, easeOutBounce: function (x, t, b, c, d) { if ((t/=d) < (1/2.75)) { return c*(7.5625*t*t) + b; } else if (t < (2/2.75)) { return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; } else if (t < (2.5/2.75)) { return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; } else { return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; } }, easeInOutBounce: function (x, t, b, c, d) { if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b; return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b; } }); /* *End of easing.js */ /* |-------------------------------------------------------------------------- | UItoTop jQuery Plugin 1.1 | http://www.mattvarone.com/web-design/uitotop-jquery-plugin/ |-------------------------------------------------------------------------- */ $.fn.UItoTop = function(options) { var defaults = { text: 'To Top', min: 200, inDelay:600, outDelay:400, containerID: 'toTop', containerHoverID: 'toTopHover', scrollSpeed: 1200, easingType: 'linear' }; var settings = $.extend(defaults, options); var containerIDhash = '#' + settings.containerID; var containerHoverIDHash = '#'+settings.containerHoverID; $('body').append(''+settings.text+''); $(containerIDhash).hide().click(function(){ $('html, body').animate({scrollTop:0}, settings.scrollSpeed, settings.easingType); $('#'+settings.containerHoverID, this).stop().animate({'opacity': 0 }, settings.inDelay, settings.easingType); return false; }) .prepend('') .hover(function() { $(containerHoverIDHash, this).stop().animate({ 'opacity': 1 }, 600, 'linear'); }, function() { $(containerHoverIDHash, this).stop().animate({ 'opacity': 0 }, 700, 'linear'); }); $(window).scroll(function() { var sd = $(window).scrollTop(); if(typeof document.body.style.maxHeight === "undefined") { $(containerIDhash).css({ 'position': 'absolute', 'top': $(window).scrollTop() + $(window).height() - 50 }); } if ( sd > settings.min ) $(containerIDhash).fadeIn(settings.inDelay); else $(containerIDhash).fadeOut(settings.Outdelay); }); }; /* *End of jquery.ui.totop.js */ function setCookieVal(cookiekey, cookieVal) { var cookieExpDate = new Date(); var cookieExpTime = cookieExpDate.getTime() + cookieValidTime; cookieExpDate.setTime(cookieExpTime); document.cookie = cookiekey+'='+escape(cookieVal)+';path=/;domain='+cookieHostname+';expires='+cookieExpDate.toGMTString(); } function getCookieVal(cookiekey) { if (!document.cookie) return ""; currentCookie = document.cookie; startpos = currentCookie.indexOf(cookiekey); if (startpos==-1) return ""; currentCookie = currentCookie.substr(startpos + cookiekey.length + 1, 9999); if (currentCookie.indexOf(";")!=-1) currentCookie = currentCookie.substr(0, currentCookie.indexOf(";")); return currentCookie; } function removeCookie(cookiekey) { document.cookie = cookiekey+'=nothing;path=/;domain='+cookieHostname+';expires=Fri, 08 Aug 2008 08:08:08 UTC'; } function showSearchHistory(w,lang) { var searchHistory; searchHistory = getCookieVal("searchHistory"); searchHistory = unescape(searchHistory); var searchHistoryOutput = ''; var bgcolor = '#F2F2F2'; if (!searchHistory) { searchHistoryOutputString = 'Search history is off. Activate'; } else { if (searchHistory.indexOf("_")!=-1) searchHistoryArray = searchHistory.split("_"); else if (searchHistory) searchHistoryArray = new Array(searchHistory); for (i=0; i30) searchHistoryArray.pop(); setCookieVal("searchHistory", searchHistoryArray.join("_")); for (i=0; i'+searchHistoryArray[i]+''; } searchHistoryOutputString = searchHistoryArray.join(""); searchHistoryOutputString = 'Search history is on.' + searchHistoryOutputString;; bgcolor = (bgcolor=='#F2F2F2' ? '#D9EACE' : '#F2F2F2'); searchHistoryOutputString += 'Remove and turn off search history'; } $("#searchHistory").html(''+searchHistoryOutputString+'
'); } function activateSearchHistory(w) { setCookieVal('searchHistory',w); $("#searchHistory").html('
Search history is on.
'+w+'
Remove and turn off search history
'); } function deactivateSearchHistory(w) { removeCookie('searchHistory'); $("#searchHistory").html('
Search history is off. Activate
'); } function superboxClose() { $.superbox.close(); } function parentSuperboxClose() { window.parent.$.superbox.close(); } function showAddPrononciation(langid) { $.ajax({ type : 'POST', url : '/contribution/pronun/addprononj.php', dataType : 'json', data: { langid: langid }, success : function(data){ if(data.actionDone==2) { $("#errormsg").css("color","red"); $("#errormsg").html(data.visualMessage); $("#addPrononciation").html(''); } else { $("#addPrononciation").html(data.html); } } }); } function showQuickVerification() { $.ajax({ type : 'POST', url : '/contribution/quickj.php', dataType : 'json', success : function(data){ if(data.actionDone==2) { $("#errormsg").css("color","red"); $("#errormsg").html(data.visualMessage); $("#quickVerification").html(''); } else { $("#quickVerification").html(data.html); } } }); } $('.getVerification').live("click",function(){ var wid = $("#wid").val(); var SubmitButton = $(this).val(); if(SubmitButton=='نیاز به بررسی') { location.href = 'verify.php?wid='+wid; } else { $.ajax({ type : 'POST', url : '/contribution/quickj.php', dataType : 'json', data: { wid: wid, SubmitButton: SubmitButton }, success : function(data){ if(data.actionDone==1) { $("#errormsg").css("color","green"); showQuickVerification(); } else { $("#errormsg").css("color","red"); } $("#errormsg").html(data.visualMessage); } }); } }); function playAudioFile(audioFileName) { if(navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPod/i) || navigator.userAgent.match(/iPad/i)) { $("#hiddenAudioPlayer").html(''); document.getElementById("iOSplayer").play(); } else { // htmlOutput=''; htmlOutput=''; $("#hiddenAudioPlayer").html(htmlOutput); } return true; } function showExtraBox(obj,boxName,arrayName,direction) { var extraValue = ''; for(i=0; i'+arrayName[i]+''; } $("#extraValues").html(extraValue); if(direction==1) { $("#extraValues").css({direction: 'ltr'}); } else { $("#extraValues").css({direction: 'rtl'}); } $("#extraValues").html(extraValue); $('#showExtraValues').hide(); var offset = $(obj).position(); $('#showExtraValues').css({ top: offset.top, left: offset.left+20}); $('#showExtraValues').show("slow"); } function showImage(imageFileName) { imageFileName = ''; showNotificationMessage(imageFileName); } function isIE_Opera() {return /msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent)} /// function superboxOpen(url,w,h,typ) { $.superbox.wait(function() { if(typ=='iframe') { $.superbox.open('',{boxWidth:w,boxHeight:h}); } }); } function makeBox(boxID,boxContent,boxClass) { var boxes = []; var box = document.createElement('div'); if (isIE_Opera()) box.className = boxClass; else box.setAttribute("class", boxClass); box.id = boxID; box.innerHTML = boxContent; boxes.push( box ); return boxes; } function chatStr(str) { str = str.replace(/\+([^\+]+)\+/, '$1').replace(/\*([^\*]+)\*/, '$1').replace(/-([^-]+)-/, '$1').replace('@', '@'); return str; } function hideBox(nameContainer,boxID) { $("#"+boxID).hide("slow"); } function submitChatMessage(){ var value = $("#chatText").val(); value = value.replace(/<\/?[^>]+>/gi, '').replace(/(^\s+|\s+$)/g, ""); clearTimeout(MSGTimeout); if(value.length>0) { $("#addText").attr("disabled", "disabled"); $("#chatText").attr("disabled", "disabled"); var txtDir= ($("#chatText").attr('lang')=='PE' ? 1 : 0); $.ajax({ type : 'POST', url : 'send.php', dataType : 'json', data: { chatText : value, txtDir : txtDir }, success : function(data){ setTimeout(function(){ if(data.actionDone==1) { $("#chatText").val(""); $("#errorMessage").html("There is no text."); $("#errorMessage").css("color",""); } else { showNotificationMessage(data.visualMessage); } $("#addText").removeAttr("disabled"); $("#chatText").removeAttr("disabled"); updateMSG(); },500); } }); } else { showNotificationMessage('There is no text.'); } } function spamReportHistory(hid) { superboxOpen('/users/spam.php?eID='+hid+'&et=8&redirectPage',600,250,'iframe'); } function go2Verify(wid) { location.href = '/contribution/verify.php?wid=' + wid; } function go2History(wid) { location.href = '/contribution/history.php?wid=' + wid; } function goToQuestion() { var qID = $("#qID").val(); if(is_number(qID)==true) { location.href = '/forum/answers.php?eID=' + qID; } else { alert('شماره سوال مورد نظر خود را بطور صحیح وارد کنید.'); $("#qID").focus(); } } function is_number(n) { return !isNaN(parseFloat(n)) && isFinite(n); } function goToQuestionEnter(e) { if(e.keyCode==13) goToQuestion(); } function translateText(response) { if(sourceLan=='DE') { $("#googleTranslation1").html(sourceText); $("#googleTranslation2").html(response.data.translations[0].translatedText); } else { $("#googleTranslation1").html(response.data.translations[0].translatedText); $("#googleTranslation2").html(sourceText); } if(response.data.translations[0].translatedText!='') $("#addToDictionaryLink").html('
ترجمه گوگل را وارد سایت کن
'); //$("#googleTranslation").html('
'+response.data.translations[0].translatedText + addToDictionaryLink+ '
'); }